aboutsummaryrefslogtreecommitdiff
path: root/src/SFileCompactArchive.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2025-08-06 09:38:55 +0200
committerGitHub <noreply@github.com>2025-08-06 09:38:55 +0200
commit36d76cddbfa02624617bb112da0b72e919f0cf33 (patch)
treecbe34ab3d2d2c7ab784ba890b7d2a3436bb6795b /src/SFileCompactArchive.cpp
parentb41cda40f9c3fbdb802cf63e739425cd805eecaa (diff)
parentdb410fd564af358cb7c1e2e72cdbaeaeef510e09 (diff)
Merge pull request #393 from ladislav-zezula/LZ_BlizzardCompatibleNames
* Replaced GetLastError with SErrGetLastError * Members of TMPQHash have now the same names like in Blizzard sources * Fixed bug in SFileRenameFile that falsely reported an existing file if it had different locale.
Diffstat (limited to 'src/SFileCompactArchive.cpp')
-rw-r--r--src/SFileCompactArchive.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/SFileCompactArchive.cpp b/src/SFileCompactArchive.cpp
index 1077daa..8ad1b4b 100644
--- a/src/SFileCompactArchive.cpp
+++ b/src/SFileCompactArchive.cpp
@@ -116,14 +116,14 @@ static DWORD CopyNonMpqData(
// Read from the source stream
if(!FileStream_Read(pSrcStream, &ByteOffset, DataBuffer, dwToRead))
{
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
break;
}
// Write to the target stream
if(!FileStream_Write(pTrgStream, NULL, DataBuffer, dwToRead))
{
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
break;
}
@@ -175,7 +175,7 @@ static DWORD CopyMpqFileSectors(
{
BSWAP_ARRAY32_UNSIGNED(hf->pPatchInfo, sizeof(DWORD) * 3);
if(!FileStream_Write(pNewStream, NULL, hf->pPatchInfo, hf->pPatchInfo->dwLength))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
// Save the size of the patch info
dwPatchSize = hf->pPatchInfo->dwLength;
@@ -202,7 +202,7 @@ static DWORD CopyMpqFileSectors(
BSWAP_ARRAY32_UNSIGNED(SectorOffsetsCopy, dwSectorOffsLen);
if(!FileStream_Write(pNewStream, NULL, SectorOffsetsCopy, dwSectorOffsLen))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
dwBytesToCopy -= dwSectorOffsLen;
dwCmpSize += dwSectorOffsLen;
@@ -244,7 +244,7 @@ static DWORD CopyMpqFileSectors(
// Read the file sector
if(!FileStream_Read(ha->pStream, &RawFilePos, hf->pbFileSector, dwRawDataInSector))
{
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
break;
}
@@ -262,7 +262,7 @@ static DWORD CopyMpqFileSectors(
// Now write the sector back to the file
if(!FileStream_Write(pNewStream, NULL, hf->pbFileSector, dwRawDataInSector))
{
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
break;
}
@@ -289,10 +289,10 @@ static DWORD CopyMpqFileSectors(
if(dwCrcLength != 0)
{
if(!FileStream_Read(ha->pStream, NULL, hf->SectorChksums, dwCrcLength))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
if(!FileStream_Write(pNewStream, NULL, hf->SectorChksums, dwCrcLength))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
// Update compact progress
if(ha->pfnCompactCB != NULL)
@@ -321,10 +321,10 @@ static DWORD CopyMpqFileSectors(
if(pbExtraData != NULL)
{
if(!FileStream_Read(ha->pStream, NULL, pbExtraData, dwBytesToCopy))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
if(!FileStream_Write(pNewStream, NULL, pbExtraData, dwBytesToCopy))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
// Include these extra data in the compressed size
dwCmpSize += dwBytesToCopy;
@@ -501,7 +501,7 @@ bool WINAPI SFileSetMaxFileCount(HANDLE hMpq, DWORD dwMaxFileCount)
// Return the error
if(dwErrCode != ERROR_SUCCESS)
- SetLastError(dwErrCode);
+ SErrSetLastError(dwErrCode);
return (dwErrCode == ERROR_SUCCESS);
}
@@ -514,7 +514,7 @@ bool WINAPI SFileSetCompactCallback(HANDLE hMpq, SFILE_COMPACT_CALLBACK pfnCompa
if (!IsValidMpqHandle(hMpq))
{
- SetLastError(ERROR_INVALID_HANDLE);
+ SErrSetLastError(ERROR_INVALID_HANDLE);
return false;
}
@@ -574,7 +574,7 @@ bool WINAPI SFileCompactArchive(HANDLE hMpq, const TCHAR * szListFile, bool /* b
// Create temporary file
pTempStream = FileStream_CreateFile(szTempFile, STREAM_PROVIDER_FLAT | BASE_PROVIDER_FILE);
if(pTempStream == NULL)
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
}
// Write the data before MPQ user data (if any)
@@ -615,7 +615,7 @@ bool WINAPI SFileCompactArchive(HANDLE hMpq, const TCHAR * szListFile, bool /* b
BSWAP_TMPQHEADER(&SaveMpqHeader, MPQ_FORMAT_VERSION_3);
BSWAP_TMPQHEADER(&SaveMpqHeader, MPQ_FORMAT_VERSION_4);
if(!FileStream_Write(pTempStream, NULL, &SaveMpqHeader, ha->pHeader->dwHeaderSize))
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
// Update the progress
ha->CompactBytesProcessed += ha->pHeader->dwHeaderSize;
@@ -649,6 +649,6 @@ bool WINAPI SFileCompactArchive(HANDLE hMpq, const TCHAR * szListFile, bool /* b
if(pFileKeys != NULL)
STORM_FREE(pFileKeys);
if(dwErrCode != ERROR_SUCCESS)
- SetLastError(dwErrCode);
+ SErrSetLastError(dwErrCode);
return (dwErrCode == ERROR_SUCCESS);
}