Skip to content

Make the VQA seek command's origin explicit - #114

Open
mischa85 wants to merge 3 commits into
OpenTS-Developers:mainfrom
mischa85:seek-origin
Open

Make the VQA seek command's origin explicit#114
mischa85 wants to merge 3 commits into
OpenTS-Developers:mainfrom
mischa85:seek-origin

Conversation

@mischa85

@mischa85 mischa85 commented Sep 2, 2026

Copy link
Copy Markdown

VQACMD_SEEK carries lseek's origin in its buffer argument, but the comment in both stream handlers said "Buffer has no meaning here", and the origin was spelled five ways across 15 call sites: SEEK_CUR, SEEK_SET, NULL, 0 and (void *)1. All of them now name the constant. The origin is also taken back through intptr_t rather than int, which truncated on a 64-bit target.

Behaviour preserved: SEEK_SET is 0 and SEEK_CUR is 1, so every rename keeps the value it had.

mischa85 added a commit to mischa85/OpenTS that referenced this pull request Sep 3, 2026

@Krisztiaan Krisztiaan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just an extra step suggested

Comment thread code/vqalib/dstream.cpp
*/
case VQACMD_SEEK:
error = (lseek(fh, nbytes, (long)buffer) == -1);
error = (lseek(fh, nbytes, (int)(intptr_t)buffer) == -1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply the same pointer-width decode and named origins to VQACCFileHandler, VQAMixFileHandler in vqa.cpp too :)

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

Successfully merging this pull request may close these issues.

2 participants