Skip to content

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.

4 participants