aboutsummaryrefslogtreecommitdiff
path: root/src/SFileOpenFileEx.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2023-12-21 22:37:46 +0100
committerGitHub <noreply@github.com>2023-12-21 22:37:46 +0100
commit61b6665433e8de0e4be68e69ddfb0128421d4057 (patch)
treedba51804af1606b558d4e2eb74b7428f6171e932 /src/SFileOpenFileEx.cpp
parentaaa011852dcbbf92cc2475720291198d6f5597ca (diff)
parent2b50c079cb28d5becb347c54777edca6c9771ea3 (diff)
Merge pull request #313 from ladislav-zezula/LZ_TabsToSpaces
Fixed https://github.com/ladislav-zezula/StormLib/issues/311
Diffstat (limited to 'src/SFileOpenFileEx.cpp')
-rw-r--r--src/SFileOpenFileEx.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/SFileOpenFileEx.cpp b/src/SFileOpenFileEx.cpp
index b5829b4..d26e01e 100644
--- a/src/SFileOpenFileEx.cpp
+++ b/src/SFileOpenFileEx.cpp
@@ -20,7 +20,6 @@ static DWORD FindHashIndex(TMPQArchive * ha, DWORD dwFileIndex)
{
TMPQHash * pHashTableEnd;
TMPQHash * pHash;
- DWORD dwFirstIndex = HASH_ENTRY_FREE;
// Should only be called if the archive has hash table
assert(ha->pHashTable != NULL);
@@ -32,15 +31,15 @@ static DWORD FindHashIndex(TMPQArchive * ha, DWORD dwFileIndex)
{
if(MPQ_BLOCK_INDEX(pHash) == dwFileIndex)
{
- // Duplicate hash entry found
- if(dwFirstIndex != HASH_ENTRY_FREE)
- return HASH_ENTRY_FREE;
- dwFirstIndex = (DWORD)(pHash - ha->pHashTable);
+ // Find the first hash entry that points to it.
+ // If there are multiple hash entries that point
+ // to the same file, only the first one is returned.
+ return (DWORD)(pHash - ha->pHashTable);
}
}
- // Return the hash table entry index
- return dwFirstIndex;
+ // No item was found
+ return HASH_ENTRY_FREE;
}
static const char * GetPatchFileName(TMPQArchive * ha, const char * szFileName, char * szBuffer)