fix hashing of bitarray (uninitialized value in HashArchive & random

values at end)
This commit is contained in:
Christopher Lackner 2020-11-25 22:07:07 +01:00
parent d0776bd726
commit cb0d8295bf
2 changed files with 15 additions and 2 deletions

View File

@ -916,7 +916,7 @@ namespace ngcore
class NGCORE_API HashArchive : public Archive
{
size_t hash_value;
size_t hash_value = 0;
char* h;
int offset = 0;
public:

View File

@ -141,7 +141,20 @@ namespace ngcore
archive & size;
if(archive.Input())
SetSize(size);
archive.Do(data, size/CHAR_BIT+1);
if(archive.GetVersion("netgen") < "v6.2.2009-20")
archive.Do(data, size/CHAR_BIT+1);
else
{
archive.NeedsVersion("netgen", "v6.2.2009-20");
archive.Do(data, size/CHAR_BIT);
for(size_t i = 0; i < size%CHAR_BIT; i++)
{
size_t index = CHAR_BIT * (size/CHAR_BIT) + i;
bool b = Test(index);
archive & b;
b ? SetBit(index) : Clear(index);
}
}
}
else
{