Skip to content

Commit

Permalink
Fix warning: comparison of integer expressions of different signednes…
Browse files Browse the repository at this point in the history
…s: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]

Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus authored and Dead2 committed Feb 23, 2023
1 parent fa9bfed commit 135641b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/gh1235.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ int main(void) {
unsigned char plain[32];
unsigned char compressed[130];
PREFIX3(stream) strm;
int bound;
z_size_t bound;
z_size_t bytes;

for (int i = 0; i <= 32; i++) {
Expand All @@ -21,7 +21,7 @@ int main(void) {
strm.avail_out = sizeof(compressed);
if (PREFIX(deflate)(&strm, Z_FINISH) != Z_STREAM_END) return -1;
if (strm.avail_in != 0) return -1;
printf("bytes = %2i, deflateBound = %2i, total_out = %2zi\n", i, bound, strm.total_out);
printf("bytes = %2i, deflateBound = %2zi, total_out = %2zi\n", i, (size_t)bound, (size_t)strm.total_out);
if (bound < strm.total_out) return -1;
if (PREFIX(deflateEnd)(&strm) != Z_OK) return -1;
}
Expand All @@ -32,7 +32,7 @@ int main(void) {
}
bound = PREFIX(compressBound)(i);
if (PREFIX(compress2)(compressed, &bytes, plain, i, 1) != Z_OK) return -1;
printf("bytes = %2i, compressBound = %2i, total_out = %2zi\n", i, bound, (size_t)bytes);
printf("bytes = %2i, compressBound = %2zi, total_out = %2zi\n", i, (size_t)bound, (size_t)bytes);
if (bytes > bound) return -1;
}
return 0;
Expand Down

0 comments on commit 135641b

Please sign in to comment.