mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-23 07:55:27 +01:00
Set SFileSetFilePointer error when new pointer < 0
This addresses an apparent oversight in the following commit:
- 951f416398
An error is not actually set, even though the return value now correctly
indicates failure. Per the documentation for [`SetFilerPointer ()`][1],
this should be set to `ERROR_NEGATIVE_SEEK` on Windows. On Mac/Linux,
this would be `EINVAL` as per the documentation for [`fseek ()`][2].
[1]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365541(v=vs.85).aspx
[2]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
This commit is contained in:
@@ -868,6 +868,7 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi
|
||||
if((LONGLONG)DeltaPos < 0)
|
||||
{
|
||||
if(NewPosition > FileSize) // Position is negative
|
||||
SetLastError(ERROR_NEGATIVE_SEEK);
|
||||
return SFILE_INVALID_POS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user