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

Fix minor warnings. #6

Closed
wants to merge 1 commit into from
Closed

Fix minor warnings. #6

wants to merge 1 commit into from

Conversation

slembcke
Copy link

Fixes some minor warnings that come up with extra warnings enabled.

P.S. This is great and making it basically a drop in replacement for stb_image made it pretty trivial. qoiconv dropped right into my asset pipeline too. :) This shaved dozens of kilobytes from my game, and several milliseconds at load time. Heh. Thanks!

@nigeltao
Copy link

An alternative fix would be to change the qoi_decode argument from int size to size_t size. Generally, when passing around a pointer-length pair for a block of memory, the length should be size_t.

Similarly, with these lines:

int size = ftell(f);
...
int bytes_read = fread(data, 1, size, f);

Note that ftell and fread return long and size_t, not int, so there's potential overflow here.

@phoboslab
Copy link
Owner

Addressed in 81b438c

@nigeltao
Copy link

Addressed in 81b438c

Well, this addressed endianness, and changed some of the lines that the PR also changed (so that the PR no longer applies). I filed #21 to discuss the points from #6 (comment) above.

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.

None yet

4 participants