Fix the return value of FS_Seek

It returns a negative value on failure, so handle that properly
This commit is contained in:
smallmodel 2024-09-25 21:04:55 +02:00
parent c76dda1523
commit 5403577642
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
7 changed files with 9 additions and 9 deletions

View file

@ -1710,7 +1710,7 @@ FS_Seek
=================
*/
int FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ) {
int FS_Seek( fileHandle_t f, long offset, int origin ) {
int _origin;
if ( !fs_searchpaths ) {
@ -1758,7 +1758,7 @@ int FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ) {
switch( origin ) {
case FS_SEEK_SET:
if ( remainder == currentPosition ) {
return 0;
return offset;
}
unzSetOffset(fsh[f].handleFiles.file.z, fsh[f].zipFilePos);
unzOpenCurrentFile(fsh[f].handleFiles.file.z);
@ -1771,7 +1771,7 @@ int FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ) {
remainder -= PK3_SEEK_BUFFER_SIZE;
}
FS_Read( buffer, remainder, f );
return 0;
return offset;
default:
Com_Error( ERR_FATAL, "Bad origin in FS_Seek" );