- aFile.seekg(0, ios::end);
- aFileSize[i] = aFile.tellg();
- aBufferSize += aFileSize[i]; //Add a space to store the file
- }
- aFileNameSize[i] = strlen(theFiles[i])+1;
- aBufferSize += aFileNameSize[i]; //Add a space to store the file name
- aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
- // 8 bytes: length of the file itself
- aNbFiles++;
- }
-
- aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream;
- unsigned char* aBuffer = new unsigned char[aBufferSize];
- if(aBuffer == NULL)
-// return NULL;
- return (new SALOMEDS::TMPFile);
-
- //Initialize 4 bytes of the buffer by 0
- memset(aBuffer, 0, 4);
- //Copy the number of files that will be written to the stream
- memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int)));
-
-
- aCurrentPos = 4;
-
- for(i=0; i<aLength; i++) {
- ifstream *aFile;
- if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
- TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
- OSD_Path anOSDPath(aFullPath);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-#ifdef WNT
- aFile = new ifstream(aFullPath.ToCString(), ios::binary);
-#else
- aFile = new ifstream(aFullPath.ToCString());
-#endif
- }
+ aFile.seekg(0, std::ios::end);
+ aFileSize[i] = aFile.tellg();
+ aBufferSize += aFileSize[i]; //Add a space to store the file
+ }
+ aFileNameSize[i] = strlen(theFileNames[i])+1;
+ aBufferSize += aFileNameSize[i]; //Add a space to store the file name
+ aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
+ // 8 bytes: length of the file itself
+ aNbFiles++;
+ }
+
+ if ( aNbFiles == 0 ) return (new SALOMEDS::TMPFile);
+ aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream;
+ unsigned char* aBuffer = new unsigned char[aBufferSize];
+ if(aBuffer == NULL)
+ return (new SALOMEDS::TMPFile);
+