Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS_Seek return value #690

Open
smallmodel opened this issue Sep 24, 2024 · 2 comments
Open

FS_Seek return value #690

smallmodel opened this issue Sep 24, 2024 · 2 comments

Comments

@smallmodel
Copy link

Hello,

https://github.com/ioquake/ioq3/blob/main/code/qcommon/files.c#L1694

When the file is inside a zip file, FS_Seek returns the requested offset. But when it's on the file system, FS_Seek returns the result of fseek, which is 0 on success.
Is this correct? This looks like a mistake to me, it should always return 0 on success, and nonzero on failure.

@zturtleman
Copy link

Yeah, it seems incorrect. Though it's the original Quake 3 behavior and changing it could potentially affect mod compatibility. Code can reliably check if FS_Seek() return value is more or equal to 0 for success and less than 0 for failure.

@smallmodel
Copy link
Author

Code similar to #691 was the reason why I was asking (from another engine based on quake3), but now it's clear that result < 0 = error.
I think a small note above the FS_Seek function telling On success, it returns 0 or a positive value indicating the offset. On failure it returns a negative value indicating the error code could help, up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants