From d13270a686a9ce21614f103bc134615be75c263a Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sun, 11 Feb 2024 09:46:30 +0100 Subject: The flag MPQ_OPEN_NO_LISTFILE is now propagated by SFileOpenPatchArchive --- src/FileStream.cpp | 14 +++++++------- src/SBaseFileTable.cpp | 8 ++++---- src/SFileAddFile.cpp | 4 ++-- src/SFileOpenFileEx.cpp | 4 ++-- src/SFilePatchArchives.cpp | 12 ++++++------ test/StormTest.cpp | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/FileStream.cpp b/src/FileStream.cpp index c431cb6..bc5618e 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -508,8 +508,8 @@ static bool BaseMap_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStre HANDLE hMap = NULL; bool bResult = false; - // Keep compiler happy - dwStreamFlags = dwStreamFlags; + // Keep compilers happy + STORMLIB_UNUSED(dwStreamFlags); // 1) Try to treat "szFileName" as a section name hMap = OpenFileMapping(SECTION_QUERY | FILE_MAP_READ, FALSE, szFileName); @@ -699,8 +699,8 @@ static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD HINTERNET hRequest; DWORD dwTemp = 0; - // Keep compiler happy - dwStreamFlags = dwStreamFlags; + // Keep compilers happy + STORMLIB_UNUSED(dwStreamFlags); // Don't connect to the internet if(!InternetGetConnectedState(&dwTemp, 0)) @@ -2245,9 +2245,9 @@ static bool Block4Stream_BlockRead( assert(StartOffset < EndOffset); assert(bAvailable == true); - // Keep compiler happy - bAvailable = bAvailable; - EndOffset = EndOffset; + // Keep compilers happy + STORMLIB_UNUSED(bAvailable); + STORMLIB_UNUSED(EndOffset); while(BytesNeeded != 0) { diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index ca14693..fa388fc 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -107,8 +107,8 @@ void TMPQBits::GetBits( unsigned int nBitOffset = (nBitPosition & 0x07); unsigned char BitBuffer; - // Keep compiler happy for platforms where nResultByteSize is not used - nResultByteSize = nResultByteSize; + // Keep compilers happy for platforms where nResultByteSize is not used + STORMLIB_UNUSED(nResultByteSize); #ifdef _DEBUG // Check if the target is properly zeroed @@ -172,8 +172,8 @@ void TMPQBits::SetBits( unsigned short AndMask = 0; unsigned short OneByte = 0; - // Keep compiler happy for platforms where nResultByteSize is not used - nResultByteSize = nResultByteSize; + // Keep compilers happy for platforms where nResultByteSize is not used + STORMLIB_UNUSED(nResultByteSize); #ifndef STORMLIB_LITTLE_ENDIAN // Adjust the buffer pointer for big endian platforms diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp index 1baf1fa..54dcbc5 100644 --- a/src/SFileAddFile.cpp +++ b/src/SFileAddFile.cpp @@ -1107,8 +1107,8 @@ bool WINAPI SFileRemoveFile(HANDLE hMpq, const char * szFileName, DWORD dwSearch TMPQFile * hf = NULL; DWORD dwErrCode = ERROR_SUCCESS; - // Keep compiler happy - dwSearchScope = dwSearchScope; + // Keep compilers happy + STORMLIB_UNUSED(dwSearchScope); // Check the parameters if(ha == NULL) diff --git a/src/SFileOpenFileEx.cpp b/src/SFileOpenFileEx.cpp index 157ad15..90c7fab 100644 --- a/src/SFileOpenFileEx.cpp +++ b/src/SFileOpenFileEx.cpp @@ -204,9 +204,9 @@ DWORD WINAPI SFileEnumLocales( if(IsPseudoFileName(szFileName, &dwFileIndex)) return ERROR_INVALID_PARAMETER; - // Keep compiler happy + // Keep compilers happy dwMaxLocales = PtrMaxLocales[0]; - dwSearchScope = dwSearchScope; + STORMLIB_UNUSED(dwSearchScope); // Parse all files with that name pFirstHash = pHash = GetFirstHashEntry(ha, szFileName); diff --git a/src/SFilePatchArchives.cpp b/src/SFilePatchArchives.cpp index e5fe32b..5d9450d 100644 --- a/src/SFilePatchArchives.cpp +++ b/src/SFilePatchArchives.cpp @@ -1081,7 +1081,6 @@ void Patch_Finalize(TMPQPatcher * pPatcher) } } - //----------------------------------------------------------------------------- // Public functions @@ -1096,9 +1095,6 @@ bool WINAPI SFileOpenPatchArchive( HANDLE hPatchMpq = NULL; DWORD dwErrCode = ERROR_SUCCESS; - // Keep compiler happy - dwFlags = dwFlags; - // Verify input parameters if(!IsValidMpqHandle(hMpq)) dwErrCode = ERROR_INVALID_HANDLE; @@ -1114,7 +1110,7 @@ bool WINAPI SFileOpenPatchArchive( // 2) Modify or replace a file // 3) Add patch archive to the opened MPQ // 4) Read patched file - // 5) Now what ? + // 5) Now what? // if(dwErrCode == ERROR_SUCCESS) @@ -1126,7 +1122,11 @@ bool WINAPI SFileOpenPatchArchive( // Open the archive like it is normal archive if(dwErrCode == ERROR_SUCCESS) { - if(SFileOpenArchive(szPatchMpqName, 0, MPQ_OPEN_READ_ONLY | MPQ_OPEN_PATCH, &hPatchMpq)) + // These flags will be propagated to SFileOpenArchive + dwFlags = (dwFlags & MPQ_OPEN_NO_LISTFILE) | MPQ_OPEN_READ_ONLY | MPQ_OPEN_PATCH; + + // Open the patch as MPQ + if(SFileOpenArchive(szPatchMpqName, 0, dwFlags, &hPatchMpq)) { // Cast the archive handle to structure pointer haPatch = (TMPQArchive *)hPatchMpq; diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 21f395f..596ebae 100755 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -591,7 +591,7 @@ static HANDLE InitDirectorySearch(LPCTSTR szDirectory) #if defined(STORMLIB_LINUX) || defined(STORMLIB_MAC) - // Keep compilers happy + // Open the directory return (HANDLE)opendir(szDirectory); #endif @@ -1296,8 +1296,8 @@ static void WINAPI AddFileCallback(void * pvUserData, DWORD dwBytesWritten, DWOR { TLogHelper * pLogger = (TLogHelper *)pvUserData; - // Keep compiler happy - bFinalCall = bFinalCall; + // Keep compilers happy + STORMLIB_UNUSED(bFinalCall); pLogger->PrintProgress("Adding file (%s) (%u of %u) (%u of %u) ...", pLogger->UserString, pLogger->UserCount, -- cgit v1.2.3