]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Win 5.1.4: Problems with ASCII studys
authordmv <dmv@opencascade.com>
Tue, 26 Oct 2010 12:06:34 +0000 (12:06 +0000)
committerdmv <dmv@opencascade.com>
Tue, 26 Oct 2010 12:06:34 +0000 (12:06 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx

index 6070173cc9512da12b4fe6e4a38909c94d693a51..a634e8402addb61bac5271cfd3c11b38953735b4 100644 (file)
@@ -133,13 +133,15 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl)
   if (HDFascii::isASCII(aUrl.c_str())) {
     isASCII = true;
     char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str());
-    aC_HDFUrl = new char[strlen(aResultPath) + 19];
-    sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
-    delete [] (aResultPath);
-    aHDFUrl = aC_HDFUrl;
-    delete [] aC_HDFUrl;
+       if ( !aResultPath )
+               return NULL;
+       aC_HDFUrl = new char[strlen(aResultPath) + 19];
+       sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
+       delete [] (aResultPath);
+       aHDFUrl = aC_HDFUrl;
+       delete [] aC_HDFUrl;
   } else {
-    aHDFUrl = aUrl;
+       aHDFUrl = aUrl;
   }
 
   
@@ -763,7 +765,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl,
   system(aCmd.c_str());
 
   //       Iterate and move files in the temporary directory
-  FILE* fp = fopen(aTmpFile.c_str(), "r");
+  FILE* fp = fopen(aTmpFile.c_str(), "rb");
   if(!fp) return false;
   char* buffer = new char[2047];
   while(!feof(fp)) {