[core] leave file open when calling hash with file argument 45/21745/2
mottelet [Tue, 27 Apr 2021 13:18:02 +0000 (15:18 +0200)]
Change-Id: I482dafe7e076a1a33c457b04e6146cc4b758f61f

scilab/modules/core/sci_gateway/cpp/sci_hash.cpp
scilab/modules/fileio/help/en_US/hash.xml
scilab/modules/fileio/help/ru_RU/hash.xml

index c42ac61..6053af1 100644 (file)
@@ -167,9 +167,9 @@ types::Function::ReturnValue sci_hash(types::typed_list &in, int _iRetCount, typ
                     iLen = fread(pStData, 1, sizeof(pStData), fp);
                     digest->add(pStData, iLen);
                 }
-                fclose(fp);
+                //fclose(fp);
                 // after closing, don't forget to remove file from the list of opened files
-                FileManager::deleteFile(iFile);
+                //FileManager::deleteFile(iFile);
             }
         }
 
index 4958c11..ed84277 100644 (file)
@@ -91,7 +91,9 @@ hash('hello world', 'md5')
 hash('hello world', 'sha256')
 hash(['hello';'world'], 'sha3-256')
 
-hash( mopen(SCI+'/modules/core/etc/core.start') ,'sha256')
+fp = mopen(SCI+'/modules/core/etc/core.start')
+hash(fp ,'sha256')
+mclose(fp)
  ]]></programlisting>
     </refsection>
       <refsection>
index fd9441d..3be1f46 100644 (file)
@@ -102,7 +102,9 @@ hash('hello world', 'md5')
 hash('hello world', 'sha256')
 hash(['hello';'world'], 'sha3-256')
 
-hash( mopen(SCI+'/modules/core/etc/core.start') ,'sha256')
+fp = mopen(SCI+'/modules/core/etc/core.start')
+hash(fp ,'sha256')
+mclose(fp)
  ]]></programlisting>
     </refsection>
       <refsection>