From d5d2413e951165aa19e926d9f6ad63a818bbce78 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sun, 12 Jun 2022 20:51:09 +0200 Subject: Fixed --- src/SBaseCommon.cpp | 1 - src/SBaseFileTable.cpp | 7 +------ src/SFileAddFile.cpp | 6 +++--- src/SFileOpenFileEx.cpp | 4 ++-- src/StormCommon.h | 3 +-- 5 files changed, 7 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp index f90c009..4b2bd6d 100644 --- a/src/SBaseCommon.cpp +++ b/src/SBaseCommon.cpp @@ -1833,7 +1833,6 @@ void CalculateDataBlockHash(void * pvDataBlock, DWORD cbDataBlock, LPBYTE md5_ha md5_done(&md5_state, md5_hash); } - //----------------------------------------------------------------------------- // Swapping functions diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index 7d7a401..58e259f 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -1967,7 +1967,7 @@ void FreeBetTable(TMPQBetTable * pBetTable) //----------------------------------------------------------------------------- // Support for file table -TFileEntry * GetFileEntryLocale2(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex) +TFileEntry * GetFileEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex) { TMPQHash * pHash; DWORD dwFileIndex; @@ -1998,11 +1998,6 @@ TFileEntry * GetFileEntryLocale2(TMPQArchive * ha, const char * szFileName, LCID return NULL; } -TFileEntry * GetFileEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale) -{ - return GetFileEntryLocale2(ha, szFileName, lcLocale, NULL); -} - TFileEntry * GetFileEntryExact(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex) { TMPQHash * pHash; diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp index f71434e..a65244e 100644 --- a/src/SFileAddFile.cpp +++ b/src/SFileAddFile.cpp @@ -423,7 +423,7 @@ DWORD SFileAddFile_Init( if(!(dwFlags & MPQ_FILE_COMPRESS_MASK)) dwFlags &= ~MPQ_FILE_SECTOR_CRC; - // Fix Key is not allowed if the file is not enrypted + // Fix Key is not allowed if the file is not encrypted if(!(dwFlags & MPQ_FILE_ENCRYPTED)) dwFlags &= ~MPQ_FILE_FIX_KEY; @@ -441,7 +441,7 @@ DWORD SFileAddFile_Init( if(dwErrCode == ERROR_SUCCESS) { // Check if the file already exists in the archive - pFileEntry = GetFileEntryExact(ha, szFileName, lcLocale, &dwHashIndex); + pFileEntry = GetFileEntryLocale(ha, szFileName, lcLocale, &dwHashIndex); if(pFileEntry != NULL) { if(dwFlags & MPQ_FILE_REPLACEEXISTING) @@ -1285,7 +1285,7 @@ bool WINAPI SFileSetFileLocale(HANDLE hFile, LCID lcNewLocale) } // We have to check if the file+locale is not already there - pFileEntry = GetFileEntryExact(ha, hf->pFileEntry->szFileName, lcNewLocale, NULL); + pFileEntry = GetFileEntryLocale(ha, hf->pFileEntry->szFileName, lcNewLocale, NULL); if(pFileEntry != NULL) { SetLastError(ERROR_ALREADY_EXISTS); diff --git a/src/SFileOpenFileEx.cpp b/src/SFileOpenFileEx.cpp index d77f25e..96d8cfc 100644 --- a/src/SFileOpenFileEx.cpp +++ b/src/SFileOpenFileEx.cpp @@ -263,7 +263,7 @@ bool WINAPI SFileOpenFileEx(HANDLE hMpq, const char * szFileName, DWORD dwSearch // If this MPQ has no patches, open the file from this MPQ directly if(ha->haPatch == NULL || dwSearchScope == SFILE_OPEN_BASE_FILE) { - pFileEntry = GetFileEntryLocale2(ha, szFileName, g_lcFileLocale, &dwHashIndex); + pFileEntry = GetFileEntryLocale(ha, szFileName, g_lcFileLocale, &dwHashIndex); } // If this MPQ is a patched archive, open the file as patched @@ -278,7 +278,7 @@ bool WINAPI SFileOpenFileEx(HANDLE hMpq, const char * szFileName, DWORD dwSearch // This open option is reserved for opening MPQ internal listfile. // No argument validation. Tries to open file with neutral locale first, // then any other available. - pFileEntry = GetFileEntryLocale2(ha, szFileName, 0, &dwHashIndex); + pFileEntry = GetFileEntryLocale(ha, szFileName, 0, &dwHashIndex); break; case SFILE_OPEN_LOCAL_FILE: diff --git a/src/StormCommon.h b/src/StormCommon.h index 865d975..7ff55e8 100644 --- a/src/StormCommon.h +++ b/src/StormCommon.h @@ -282,8 +282,7 @@ TMPQBetTable * CreateBetTable(DWORD dwMaxFileCount); void FreeBetTable(TMPQBetTable * pBetTable); // Functions for finding files in the file table -TFileEntry * GetFileEntryLocale2(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex); -TFileEntry * GetFileEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale); +TFileEntry * GetFileEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex = NULL); TFileEntry * GetFileEntryExact(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex); // Allocates file name in the file entry -- cgit v1.2.3