minor fix for sign-compare warnings.

This commit is contained in:
Ozkan Sezer 2021-12-17 01:12:20 +03:00
parent 3a62cabad2
commit 4ca3d3ae42

6
qoi.h
View File

@ -499,7 +499,7 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
px_prev = px; px_prev = px;
} }
for (i = 0; i < sizeof(qoi_padding); i++) { for (i = 0; i < (int)sizeof(qoi_padding); i++) {
bytes[p++] = qoi_padding[i]; bytes[p++] = qoi_padding[i];
} }
@ -519,7 +519,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) {
if ( if (
data == NULL || desc == NULL || data == NULL || desc == NULL ||
(channels != 0 && channels != 3 && channels != 4) || (channels != 0 && channels != 3 && channels != 4) ||
size < QOI_HEADER_SIZE + sizeof(qoi_padding) size < QOI_HEADER_SIZE + (int)sizeof(qoi_padding)
) { ) {
return NULL; return NULL;
} }
@ -558,7 +558,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) {
px.rgba.b = 0; px.rgba.b = 0;
px.rgba.a = 255; px.rgba.a = 255;
chunks_len = size - sizeof(qoi_padding); chunks_len = size - (int)sizeof(qoi_padding);
for (px_pos = 0; px_pos < px_len; px_pos += channels) { for (px_pos = 0; px_pos < px_len; px_pos += channels) {
if (run > 0) { if (run > 0) {
run--; run--;