From 495b2ab3d42db3f0d484e76eba15c7da9148d53a Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Tue, 25 Nov 2014 09:24:01 +0100 Subject: + Fixed bug in processing HET table --- src/SBaseFileTable.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/SBaseFileTable.cpp') 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; -- cgit v1.2.3