Changeset 2ffb6ae in tol
- Timestamp:
- Feb 9, 2011, 9:34:10 AM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 8f99127
- Parents:
- db1c18b
- Location:
- tol
- Files:
-
- 7 edited
-
OIS/ois.cpp (modified) (5 diffs)
-
OIS/oiscompress.cpp (modified) (2 diffs)
-
OIS/oiscreator.cpp (modified) (3 diffs)
-
OIS/oisloader.cpp (modified) (3 diffs)
-
OIS/oisxml.cpp (modified) (1 diff)
-
OIS/tol_ois.h (modified) (2 diffs)
-
tol_version_def.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/OIS/ois.cpp
rdb1c18b r2ffb6ae 63 63 BArray<BSystemDat*> BOis::loadModeOptions_; 64 64 65 size_t BOis::_MaxBlockLength_ = 1024*1024; 65 size_t BOis::_MaxBlockLength_ = 1024*1024; 66 int BOis::_NumAuxiliarBuffer_ = 9; 66 67 67 68 #ifdef TRACE_OIS_FILE … … 95 96 source_ (), 96 97 packages_ (), 97 auxilarBuffer(), 98 auxilarBufferSize_(0) 99 { 100 AllocAuxilarBuffer(_MaxBlockLength_); 98 auxilarBuffer (NULL), 99 auxilarBufferSize_(NULL) 100 { 101 auxilarBuffer = new char*[_NumAuxiliarBuffer_]; 102 auxilarBufferSize_ = new int[_NumAuxiliarBuffer_]; 103 for(int i=0; i<_NumAuxiliarBuffer_; i++) 104 { 105 auxilarBufferSize_[i] = 0; 106 auxilarBuffer[i] = NULL; 107 AllocAuxilarBuffer(i,_MaxBlockLength_); 108 } 101 109 InitBuild(); 102 110 } … … 108 116 { 109 117 Close(); 110 if(auxilarBuffer) 111 { 118 if(auxilarBuffer) 119 { 120 for(int i=0; i<_NumAuxiliarBuffer_; i++) 121 { 122 if(auxilarBuffer[i]) 123 { 124 delete [] auxilarBuffer[i]; 125 } 126 } 112 127 delete [] auxilarBuffer; 113 } 114 } 115 116 117 //-------------------------------------------------------------------- 118 char* BOis::AllocAuxilarBuffer(int size) 119 //-------------------------------------------------------------------- 120 { 121 if(size>auxilarBufferSize_) 122 { 123 if(auxilarBuffer) 128 auxilarBuffer = NULL; 129 } 130 if(auxilarBufferSize_) 131 { 132 delete [] auxilarBufferSize_; 133 auxilarBufferSize_ = NULL; 134 } 135 } 136 137 138 //-------------------------------------------------------------------- 139 char* BOis::AllocAuxilarBuffer(int id, int size) 140 //-------------------------------------------------------------------- 141 { 142 if((id<0) || (id>=_NumAuxiliarBuffer_)) 143 { 144 Error(BText("[OIS] FATAL ERROR IN BOis::AllocAuxilarBuffer id=")+id+ 145 " out of range [0,BOis::_NumAuxiliarBuffer_="+BOis::_NumAuxiliarBuffer_+"] "); 146 exit(-1); 147 } 148 if(size>auxilarBufferSize_[id]) 149 { 150 if(auxilarBuffer[id]) 124 151 { 125 delete [] auxilarBuffer ;126 auxilarBuffer = NULL;152 delete [] auxilarBuffer[id]; 153 auxilarBuffer[id] = NULL; 127 154 } 128 auxilarBufferSize_ = int(double(size)*1.2);129 auxilarBuffer = new char[auxilarBufferSize_];130 } 131 return(auxilarBuffer );155 auxilarBufferSize_[id] = int(double(size)*1.2); 156 auxilarBuffer[id] = new char[auxilarBufferSize_[id] ]; 157 } 158 return(auxilarBuffer[id]); 132 159 } 133 160 … … 168 195 //-------------------------------------------------------------------- 169 196 { 170 BText dirOriPath = GetFilePath(tolFile); 197 BText absTolPath = GetStandardAbsolutePath(tolFile); 198 BText absDirPath = GetFilePath(absTolPath); 171 199 BText filPrf = GetFilePrefix(tolFile); 172 BText dirAbsPath = Replace(RemoveLastSlash( 173 GetStandardAbsolutePath(dirOriPath)),"\\","/"); 174 BText oisSubPath = PlainPath(dirAbsPath+ArchiveExtension()); 200 BText oisSubPath = PlainPath(absDirPath+filPrf+ArchiveExtension()); 175 201 connection_ = Replace(oisDefRoot_,"\\","/")+"module/"+oisSubPath; 176 202 address_.concept_ = ""; 177 203 address_.version_ = ""; 178 address_.node_ = dirOriPath+filPrf;204 address_.node_ = ""; 179 205 options_.tolSourceSearchPaths_.AllocBuffer(1); 180 options_.tolSourceSearchPaths_[0].alias_ = ToName( GetFilePrefix(dirAbsPath));181 options_.tolSourceSearchPaths_[0].value_ = dirAbsPath;182 /* 206 options_.tolSourceSearchPaths_[0].alias_ = ToName(absDirPath); 207 options_.tolSourceSearchPaths_[0].value_ = absDirPath; 208 183 209 //Std(BText("\nTRACE BOis::SetModulePath('")+tolFile+"'"); 184 210 //Std(BText("\nTRACE connection_='")+connection_+"'"); … … 186 212 //Std(BText("\nTRACE alias_='")+options_.tolSourceSearchPaths_[0].alias_+"'"); 187 213 //Std(BText("\nTRACE value_='")+options_.tolSourceSearchPaths_[0].value_+"'"); 188 */214 /* */ 189 215 } 190 216 -
tol/OIS/oiscompress.cpp
rdb1c18b r2ffb6ae 49 49 else //BZip2 Compress method 50 50 { 51 char* dest = AllocAuxilarBuffer( destLen);51 char* dest = AllocAuxilarBuffer(5,destLen); 52 52 int cmprs = BZ2_bzBuffToBuffCompress 53 53 ( … … 289 289 else 290 290 { 291 char* source = AllocAuxilarBuffer( sourceLen);291 char* source = AllocAuxilarBuffer(6,sourceLen); 292 292 if(!source) 293 293 { -
tol/OIS/oiscreator.cpp
rdb1c18b r2ffb6ae 309 309 FILE* file=fopen(path.String(),"rb"); 310 310 if(!file) { return(false); } 311 char* contens = AllocAuxilarBuffer( size+1);311 char* contens = AllocAuxilarBuffer(2,size+1); 312 312 int r = fread(contens,1,size,file); 313 313 contens[r]='\0'; … … 413 413 int s = x.Size(); 414 414 EWrite(s, stream); 415 BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer( sizeof(BCoefDeg)*x.Size());415 BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer(3,sizeof(BCoefDeg)*x.Size()); 416 416 for(int i=0; i<x.Size(); i++) 417 417 { … … 1070 1070 else 1071 1071 { 1072 BDat* buf = (BDat*)AllocAuxilarBuffer( sizeof(BDat)*r*c);1072 BDat* buf = (BDat*)AllocAuxilarBuffer(4,sizeof(BDat)*r*c); 1073 1073 int i, j, k; 1074 1074 for(i=k=0; i<r; i++) { for(j=0; j<c; j++) { buf[k++] = x(i,j); } } -
tol/OIS/oisloader.cpp
rdb1c18b r2ffb6ae 397 397 if(control_.typeSizes_.sizeof_BCoefDeg_==sizeof(BCoefDegOld)) 398 398 { 399 BCoefDegOld* buf = (BCoefDegOld*)AllocAuxilarBuffer( sizeof(BCoefDegOld)*s);399 BCoefDegOld* buf = (BCoefDegOld*)AllocAuxilarBuffer(0,sizeof(BCoefDegOld)*s); 400 400 Ensure(Read(buf,sizeof(BCoefDegOld),s,stream)); 401 401 for(i=0; i<x.Size(); i++) … … 407 407 else if(control_.typeSizes_.sizeof_BCoefDeg_==sizeof(BCoefDeg)) 408 408 { 409 BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer( sizeof(BCoefDeg)*s);409 BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer(1,sizeof(BCoefDeg)*s); 410 410 Ensure(Read(buf,sizeof(BCoefDeg),s,stream)); 411 411 for(i=0; i<x.Size(); i++) … … 1513 1513 { 1514 1514 bool isOza = (options_.compressor_.fileManager_.engine_==BAE_ZIPARC_); 1515 if(!isOza) { return(false); } 1515 1516 BDir dir(path); 1516 1517 lostSource_=!dir.Exist(); 1517 bool updated; 1518 if(lostSource_) 1519 { 1520 updated = true; 1521 } 1522 else 1523 { 1524 BText name = BText("._tol_source_/")+PlainPath(path); 1525 BStream* fn = isOza?streamHandler_->Open(name,name):NULL; 1526 source_.Add(fn); 1527 if(isOza && !fn) 1518 if(lostSource_) { return(false); } 1519 bool updated = false; 1520 BText name = BText("._tol_source_/")+PlainPath(path); 1521 BStream* fn = streamHandler_->Open(name,name); 1522 source_.Add(fn); 1523 if(fn) 1524 { 1525 int size = dir.Bytes(); 1526 int oldSize = (int)tolSources_[n].bytes_; 1527 if(oldSize==size) 1528 1528 { 1529 updated = true; 1530 } 1531 else 1532 { 1533 int size = dir.Bytes(); 1534 int oldSize = (int)tolSources_[n].bytes_; 1535 if(oldSize!=size) 1529 time_t time = dir.Time(); 1530 BDate date = BTimer::TimeToDate(time); 1531 BDate oldDate = tolSources_[n].release_; 1532 double diff = DifInSeconds(oldDate,date); 1533 if(fabs(diff)<1.0) 1536 1534 { 1537 updated = false;1535 updated = true; 1538 1536 } 1539 else 1537 else 1540 1538 { 1541 time_t time = dir.Time(); 1542 BDate date = BTimer::TimeToDate(time); 1543 BDate oldDate = tolSources_[n].release_; 1544 double diff = DifInSeconds(oldDate,date); 1545 if(fabs(diff)<1.0) 1539 FILE* file=fopen(path.String(),"rb"); 1540 if(!file) 1546 1541 { 1547 updated = true; 1542 Warning(I2("Cannot check if source file ", 1543 "No se pudo comprobar si el fichero fuente ")+path+ 1544 I2(" is synchronized with this module.", 1545 " está sincronizado con este módulo.")); 1548 1546 } 1549 else if(!isOza) 1550 { 1551 updated = false; 1552 } 1553 else if(fn && fn->Bytes()!=size) 1554 { 1555 updated = false; 1556 } 1557 else 1547 else 1558 1548 { 1559 FILE* file=fopen(path.String(),"rb"); 1560 if(!file) 1561 { 1562 Warning(I2("Cannot check if source file ", 1563 "No se pudo comprobar si el fichero fuente ")+path+ 1564 I2(" is synchronized with this module.", 1565 " está sincronizado con este módulo.")); 1566 updated = true; 1567 } 1568 else 1569 { 1570 char* contens = AllocAuxilarBuffer(2*size+2); 1571 char* oldCont = contens+(size+1); 1572 int r = fread(contens,1,size,file); 1573 contens[r]='\0'; 1574 fclose(file); 1549 char* contens = AllocAuxilarBuffer(7,size+1); 1550 char* oldCont = AllocAuxilarBuffer(8,size+1); 1551 int r = fread(contens,1,size,file); 1552 fclose(file); 1553 if(r==size) 1554 { 1555 contens[size]='\0'; 1575 1556 assert(r==size); 1576 1557 Read(oldCont,1,size,fn); 1577 1558 oldCont[size]='\0'; 1578 int cmp = memcmp(oldCont,contens, r);1559 int cmp = memcmp(oldCont,contens,size); 1579 1560 updated = (cmp==0); 1580 if( updated)1561 if(!updated) 1581 1562 { 1582 1563 //tolSources_[n].release_ = date; 1564 Std(BText("[OIS] File ")+path+" has changed and module should be rebuilt.\n"); 1583 1565 SetFileTime(path, BTimer::DateToTime(tolSources_[n].release_)); 1584 1566 } -
tol/OIS/oisxml.cpp
rdb1c18b r2ffb6ae 535 535 } 536 536 } 537 if(!obsoleteSource_) { obsoleteSource_ = !CheckUpdatedSource(n, path); } 537 if(!obsoleteSource_) { 538 obsoleteSource_ = !CheckUpdatedSource(n, path); } 538 539 } 539 540 } -
tol/OIS/tol_ois.h
rdb1c18b r2ffb6ae 604 604 //auxiliar buffer 605 605 static size_t _MaxBlockLength_; 606 char* auxilarBuffer; 607 int auxilarBufferSize_; 606 static int _NumAuxiliarBuffer_; 607 608 char** auxilarBuffer; 609 int* auxilarBufferSize_; 608 610 609 611 //Functions … … 615 617 bool Warning(const BText& msg) const; 616 618 BSyntaxObject* NullError(const BText& msg) const; 617 char* AllocAuxilarBuffer(int size);619 char* AllocAuxilarBuffer(int id, int size); 618 620 619 621 public: -
tol/tol_version_def.h
rdb1c18b r2ffb6ae 25 25 #define VERSION_MINOR 0 26 26 #define VERSION_RELEASE 1 27 #define VERSION_BUILD "0.5 3.alpha"27 #define VERSION_BUILD "0.54.alpha" 28 28 29 29 #if defined(_MSC_VER)
Note: See TracChangeset
for help on using the changeset viewer.
