]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
size_t replaced witf t_size (unsigned int) to adopt persistence of 32 and 64 bit...
authorsln <sln@opencascade.com>
Tue, 10 Apr 2012 09:19:55 +0000 (09:19 +0000)
committersln <sln@opencascade.com>
Tue, 10 Apr 2012 09:19:55 +0000 (09:19 +0000)
src/LightApp/LightApp_Driver.cxx
src/LightApp/LightApp_Driver.h

index eb42e2d33b5b512f51a809dbfd3a585e2c1cacad..15bf1452162f93f43283f23fcf7c49a8d69d15a5 100644 (file)
@@ -509,8 +509,8 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
   TCollection_AsciiString aTmpDir(const_cast<char*>(aFiles[0].c_str()));
 
   int aNbFiles = 0;
-  myFileNameSizes = new size_t[aLength];
-  myFileSizes = new size_t[aLength];
+  myFileNameSizes = new t_size[aLength];
+  myFileSizes = new t_size[aLength];
 
   //Determine the required size of the buffer
   TCollection_AsciiString aFileName;
@@ -544,7 +544,7 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
 
   mySizeToBeWritten += 4;      //4 bytes for a number of the files that will be written to the stream;
 
-  size_t aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
+  t_size aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
   theBuffer = new unsigned char[ aCurrSize ];
   myCurrBuff = theBuffer;
 
@@ -609,7 +609,7 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
       {
         myCurrIFile->seekg(0, ios::beg);
         int aPos = myCurrIFile->tellg();
-        size_t aSizeToRead = GetMaxBuffSize() - myCurrPos;
+        t_size aSizeToRead = GetMaxBuffSize() - myCurrPos;
         if ( aSizeToRead > myFileSizes[myCurrFileIndex] - myCurrIFile->tellg() )
           aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
         myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
@@ -666,7 +666,7 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
 
   TCollection_AsciiString aTmpDir(const_cast<char*>(aFiles[0].c_str()));
 
-  size_t aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
+  t_size aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
 
   for ( ; myCurrFileIndex < aLength; myCurrFileIndex++ ) 
   {
@@ -713,7 +713,7 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
     if ( aCurrSize < GetMaxBuffSize() )
     {
       //myCurrIFile->seekg(0, ios::beg);
-      size_t aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
+      t_size aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
       myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
       myCurrIFile->close();
       delete(myCurrIFile);
@@ -724,8 +724,8 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
     else // new code for big files
     {
       int aPos = myCurrIFile->tellg();
-      size_t aFileSize = myFileSizes[myCurrFileIndex];
-      size_t aSizeToRead = GetMaxBuffSize() - myCurrPos;
+      t_size aFileSize = myFileSizes[myCurrFileIndex];
+      t_size aSizeToRead = GetMaxBuffSize() - myCurrPos;
       if ( aSizeToRead > myFileSizes[myCurrFileIndex] - myCurrIFile->tellg() )
         aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
       myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
@@ -792,8 +792,8 @@ void LightApp_Driver::PutFirstStreamToFiles( ListOfFiles& theListOfFiles,
 
   const int n = myNbFilles + 1;
   theListOfFiles.resize( n );
-  myFileSizes = new size_t[ n ];
-  myFileNameSizes = new size_t[ n ];
+  myFileSizes = new t_size[ n ];
+  myFileNameSizes = new t_size[ n ];
   theListOfFiles[ 0 ] = aDir;
   myFileSizes[ 0 ] = 0;
   myFileNameSizes[ 0 ] = 0;
@@ -840,7 +840,7 @@ void LightApp_Driver::PutFirstStreamToFiles( ListOfFiles& theListOfFiles,
       else 
       {
         // old code for big files
-        size_t aSize = theBufferSize - myCurrPos;
+        t_size aSize = theBufferSize - myCurrPos;
         myCurrOFile->write((char *)( theBuffer + myCurrPos ), aSize );
         myFileSizes[ myCurrFileIndex ] -= aSize;
         myCurrPos = 0;
@@ -922,8 +922,8 @@ void LightApp_Driver::PutNextStreamToFiles( ListOfFiles& theListOfFiles,
     else 
     {
       // old code for big files
-      size_t aFileSize = myFileSizes[ myCurrFileIndex ];
-      size_t aSize = theBufferSize - myCurrPos;
+      t_size aFileSize = myFileSizes[ myCurrFileIndex ];
+      t_size aSize = theBufferSize - myCurrPos;
       myCurrOFile->write((char *)( theBuffer + myCurrPos ), aSize );
       myFileSizes[ myCurrFileIndex ] -= aSize;
       myCurrPos = 0;
index 25d4842bed7ea983a1f6d099cd751f057b59a285..1ef96c4e82097d349418bdec1a1ef07178bbef47 100644 (file)
@@ -31,6 +31,8 @@
 #pragma warning( disable:4251 )
 #endif
 
+typedef unsigned int t_size;
+
 class QString;
 
 /*!Description : Driver can save to file and read from file list of files for light modules*/
@@ -76,7 +78,7 @@ protected:
   void                PutNextStreamToFiles( ListOfFiles& theListOfFiles, const unsigned char* theBuffer,
                                             const long theBufferSize, bool theNamesOnly = false);
 
-  inline static size_t GetMaxBuffSize();
+  inline static t_size GetMaxBuffSize();
 
   std::string GetTmpDir();
   std::string GetDirFromPath(const std::string& thePath);
@@ -103,26 +105,26 @@ private:
   int                                        myCurrFileIndex;
   
   // writing
-  size_t                                     myCurrPos;
+  t_size                                     myCurrPos;
   unsigned char*                             myCurrBuff;
   ifstream*                                  myCurrIFile;
-  size_t                                     mySizeToBeWritten;
-  size_t*                                    myFileSizes;
-  size_t*                                    myFileNameSizes;
+  t_size                                     mySizeToBeWritten;
+  t_size*                                    myFileSizes;
+  t_size*                                    myFileNameSizes;
 
   // reading
   ofstream*                                  myCurrOFile;
   long                                       myNbFilles;
 };
 
-inline size_t LightApp_Driver::GetMaxBuffSize()
+inline t_size LightApp_Driver::GetMaxBuffSize()
 {
-  static size_t aValue = 0;
+  static t_size aValue = 0;
   if ( !aValue )
   {
     char* aVar = getenv( "HDF_BUFFER_SIZE" );
     if ( aVar )
-      aValue = (size_t)atol( aVar );
+      aValue = (t_size)atol( aVar );
     else
       aValue = 50000000;
   }