diff options
author | Ladislav Zezula <ladislav.zezula@avg.com> | 2014-11-25 09:24:01 +0100 |
---|---|---|
committer | Ladislav Zezula <ladislav.zezula@avg.com> | 2014-11-25 09:24:01 +0100 |
commit | 495b2ab3d42db3f0d484e76eba15c7da9148d53a (patch) | |
tree | 0b479f6faf26ae3846328a25beabfff5dae6718f /src | |
parent | eec75473b71cba0363dcb4c6985e92b266144ce5 (diff) |
+ Fixed bug in processing HET table
Diffstat (limited to 'src')
-rw-r--r-- | src/SBaseFileTable.cpp | 10 | ||||
-rw-r--r-- | src/StormLib.h | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index 906edce..2d6249f 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -1115,7 +1115,7 @@ static int InsertHetEntry(TMPQHetTable * pHetTable, ULONGLONG FileNameHash, DWOR BYTE NameHash1; // Get the start index and the high 8 bits of the name hash - StartIndex = Index = (DWORD)(FileNameHash % pHetTable->dwEntryCount); + StartIndex = Index = (DWORD)(FileNameHash % pHetTable->dwTotalCount); NameHash1 = (BYTE)(FileNameHash >> (pHetTable->dwNameHashBitSize - 8)); // Find a place where to put it @@ -1137,7 +1137,7 @@ static int InsertHetEntry(TMPQHetTable * pHetTable, ULONGLONG FileNameHash, DWOR // Move to the next entry in the HET table // If we came to the start index again, we are done - Index = (Index + 1) % pHetTable->dwEntryCount; + Index = (Index + 1) % pHetTable->dwTotalCount; if(Index == StartIndex) break; } @@ -1257,7 +1257,7 @@ DWORD GetFileIndex_Het(TMPQArchive * ha, const char * szFileName) NameHash1 = (BYTE)(FileNameHash >> (pHetTable->dwNameHashBitSize - 8)); // Calculate the starting index to the hash table - StartIndex = Index = (DWORD)(FileNameHash % pHetTable->dwEntryCount); + StartIndex = Index = (DWORD)(FileNameHash % pHetTable->dwTotalCount); // Go through HET table until we find a terminator while(pHetTable->pNameHashes[Index] != HET_ENTRY_FREE) @@ -1286,7 +1286,7 @@ DWORD GetFileIndex_Het(TMPQArchive * ha, const char * szFileName) // Move to the next entry in the HET table // If we came to the start index again, we are done - Index = (Index + 1) % pHetTable->dwEntryCount; + Index = (Index + 1) % pHetTable->dwTotalCount; if(Index == StartIndex) break; } @@ -2438,7 +2438,7 @@ int BuildFileTable_HetBet( return ERROR_FILE_CORRUPT; // Step one: Fill the name indexes - for(i = 0; i < pHetTable->dwEntryCount; i++) + for(i = 0; i < pHetTable->dwTotalCount; i++) { DWORD dwFileIndex = 0; diff --git a/src/StormLib.h b/src/StormLib.h index 3ea3e19..c543563 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -69,6 +69,7 @@ /* 14.01.13 8.21 Lad ADPCM and Huffmann (de)compression refactored */ /* 04.12.13 9.00 Lad Unit tests, bug fixes */ /* 27.08.14 9.10 Lad Signing archives with weak digital signature */ +/* 25.11.14 9.11 Lad Fixed bug reading & creating HET table */ /*****************************************************************************/ #ifndef __STORMLIB_H__ @@ -133,8 +134,8 @@ extern "C" { //----------------------------------------------------------------------------- // Defines -#define STORMLIB_VERSION 0x090A // Current version of StormLib (9.1) -#define STORMLIB_VERSION_STRING "9.10" // String version of StormLib version +#define STORMLIB_VERSION 0x090B // Current version of StormLib (9.11) +#define STORMLIB_VERSION_STRING "9.11" // String version of StormLib version #define ID_MPQ 0x1A51504D // MPQ archive header ID ('MPQ\x1A') #define ID_MPQ_USERDATA 0x1B51504D // MPQ userdata entry ('MPQ\x1B') |