aboutsummaryrefslogtreecommitdiff
path: root/src/SFileReadFile.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/SFileReadFile.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/SFileReadFile.cpp')
-rw-r--r--src/SFileReadFile.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/SFileReadFile.cpp b/src/SFileReadFile.cpp
index f2c17ba..ee91cac 100644
--- a/src/SFileReadFile.cpp
+++ b/src/SFileReadFile.cpp
@@ -224,7 +224,7 @@ static DWORD ReadMpqSectors(TMPQFile * hf, LPBYTE pbBuffer, DWORD dwByteOffset,
}
else
{
- dwErrCode = GetLastError();
+ dwErrCode = SErrGetLastError();
}
// Free all used buffers
@@ -280,7 +280,7 @@ static DWORD ReadMpqFileSingleUnit(TMPQFile * hf, void * pvBuffer, DWORD dwFileP
if(!FileStream_Read(ha->pStream, &RawFilePos, pbRawData, cbRawData))
{
STORM_FREE(pbCompressed);
- return GetLastError();
+ return SErrGetLastError();
}
// If the file is encrypted, we have to decrypt the data first
@@ -411,7 +411,7 @@ static DWORD ReadMpkFileSingleUnit(TMPQFile * hf, void * pvBuffer, DWORD dwFileP
if(!FileStream_Read(ha->pStream, &RawFilePos, pbRawData, pFileEntry->dwCmpSize))
{
STORM_FREE(pbCompressed);
- return GetLastError();
+ return SErrGetLastError();
}
// If the file is encrypted, we have to decrypt the data first
@@ -666,7 +666,7 @@ static DWORD ReadMpqFileLocalFile(TMPQFile * hf, void * pvBuffer, DWORD dwFilePo
if(!FileStream_Read(hf->pStream, &FilePosition1, pvBuffer, dwToRead))
{
// If not all bytes have been read, then return the number of bytes read
- if((dwErrCode = GetLastError()) == ERROR_HANDLE_EOF)
+ if((dwErrCode = SErrGetLastError()) == ERROR_HANDLE_EOF)
{
FileStream_GetPos(hf->pStream, &FilePosition2);
dwBytesRead = (DWORD)(FilePosition2 - FilePosition1);
@@ -699,13 +699,13 @@ bool WINAPI SFileReadFile(HANDLE hFile, void * pvBuffer, DWORD dwToRead, LPDWORD
// Check valid parameters
if((hf = IsValidFileHandle(hFile)) == NULL)
{
- SetLastError(ERROR_INVALID_HANDLE);
+ SErrSetLastError(ERROR_INVALID_HANDLE);
return false;
}
if(pvBuffer == NULL)
{
- SetLastError(ERROR_INVALID_PARAMETER);
+ SErrSetLastError(ERROR_INVALID_PARAMETER);
return false;
}
@@ -715,7 +715,7 @@ bool WINAPI SFileReadFile(HANDLE hFile, void * pvBuffer, DWORD dwToRead, LPDWORD
dwErrCode = AllocatePatchInfo(hf, true);
if(dwErrCode != ERROR_SUCCESS || hf->pPatchInfo == NULL)
{
- SetLastError(dwErrCode);
+ SErrSetLastError(dwErrCode);
return false;
}
}
@@ -768,7 +768,7 @@ bool WINAPI SFileReadFile(HANDLE hFile, void * pvBuffer, DWORD dwToRead, LPDWORD
// If something failed, set the last error value
if(dwErrCode != ERROR_SUCCESS)
- SetLastError(dwErrCode);
+ SErrSetLastError(dwErrCode);
return (dwErrCode == ERROR_SUCCESS);
}
@@ -818,7 +818,7 @@ DWORD WINAPI SFileGetFileSize(HANDLE hFile, LPDWORD pdwFileSizeHigh)
return (DWORD)FileSize;
}
- SetLastError(ERROR_INVALID_HANDLE);
+ SErrSetLastError(ERROR_INVALID_HANDLE);
return SFILE_INVALID_SIZE;
}
@@ -833,7 +833,7 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi
// If the hFile is not a valid file handle, return an error.
if(!IsValidFileHandle(hFile))
{
- SetLastError(ERROR_INVALID_HANDLE);
+ SErrSetLastError(ERROR_INVALID_HANDLE);
return SFILE_INVALID_POS;
}
@@ -881,7 +881,7 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi
break;
default:
- SetLastError(ERROR_INVALID_PARAMETER);
+ SErrSetLastError(ERROR_INVALID_PARAMETER);
return SFILE_INVALID_POS;
}
@@ -893,7 +893,7 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi
{
if(NewPosition > FileSize) // Position is negative
{
- SetLastError(ERROR_NEGATIVE_SEEK);
+ SErrSetLastError(ERROR_NEGATIVE_SEEK);
return SFILE_INVALID_POS;
}
}