mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-21 15:14:28 +01:00
+ More paratemer checking to make nitpickers happy
This commit is contained in:
@@ -34,26 +34,23 @@ bool WINAPI SFileExtractFile(HANDLE hMpq, const char * szToExtract, const TCHAR
|
||||
}
|
||||
|
||||
// Copy the file's content
|
||||
if(nError == ERROR_SUCCESS)
|
||||
while(nError == ERROR_SUCCESS)
|
||||
{
|
||||
char szBuffer[0x1000];
|
||||
DWORD dwTransferred;
|
||||
DWORD dwTransferred = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
// dwTransferred is only set to nonzero if something has been read.
|
||||
// nError can be ERROR_SUCCESS or ERROR_HANDLE_EOF
|
||||
if(!SFileReadFile(hMpqFile, szBuffer, sizeof(szBuffer), &dwTransferred, NULL))
|
||||
nError = GetLastError();
|
||||
if(nError == ERROR_HANDLE_EOF)
|
||||
nError = ERROR_SUCCESS;
|
||||
if(dwTransferred == 0)
|
||||
break;
|
||||
// dwTransferred is only set to nonzero if something has been read.
|
||||
// nError can be ERROR_SUCCESS or ERROR_HANDLE_EOF
|
||||
if(!SFileReadFile(hMpqFile, szBuffer, sizeof(szBuffer), &dwTransferred, NULL))
|
||||
nError = GetLastError();
|
||||
if(nError == ERROR_HANDLE_EOF)
|
||||
nError = ERROR_SUCCESS;
|
||||
if(dwTransferred == 0)
|
||||
break;
|
||||
|
||||
// If something has been actually read, write it
|
||||
if(!FileStream_Write(pLocalFile, NULL, szBuffer, dwTransferred))
|
||||
nError = GetLastError();
|
||||
}
|
||||
// If something has been actually read, write it
|
||||
if(!FileStream_Write(pLocalFile, NULL, szBuffer, dwTransferred))
|
||||
nError = GetLastError();
|
||||
}
|
||||
|
||||
// Close the files
|
||||
|
||||
Reference in New Issue
Block a user