Merge pull request #157 from contriteobserver/gccwarnings

fixed gcc warnings in qoibench.c
This commit is contained in:
Dominic Szablewski 2022-01-03 11:51:29 +01:00 committed by GitHub
commit 943d2b637b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,7 +189,7 @@ typedef struct {
void png_decode_callback(png_structp png, png_bytep data, png_size_t length) { void png_decode_callback(png_structp png, png_bytep data, png_size_t length) {
libpng_read_t *read_data = (libpng_read_t*)png_get_io_ptr(png); libpng_read_t *read_data = (libpng_read_t*)png_get_io_ptr(png);
if (read_data->pos + length > read_data->size) { if (read_data->pos + length > read_data->size) {
ERROR("PNG read %d bytes at pos %d (size: %d)", length, read_data->pos, read_data->size); ERROR("PNG read %ld bytes at pos %d (size: %d)", length, read_data->pos, read_data->size);
} }
memcpy(data, read_data->data + read_data->pos, length); memcpy(data, read_data->data + read_data->pos, length);
read_data->pos += length; read_data->pos += length;
@ -358,7 +358,7 @@ void benchmark_print_result(benchmark_result_t res) {
printf(" decode ms encode ms decode mpps encode mpps size kb rate\n"); printf(" decode ms encode ms decode mpps encode mpps size kb rate\n");
if (!opt_nopng) { if (!opt_nopng) {
printf( printf(
"libpng: %8.1f %8.1f %8.2f %8.2f %8d %4.1f%%\n", "libpng: %8.1f %8.1f %8.2f %8.2f %8ld %4.1f%%\n",
(double)res.libpng.decode_time/1000000.0, (double)res.libpng.decode_time/1000000.0,
(double)res.libpng.encode_time/1000000.0, (double)res.libpng.encode_time/1000000.0,
(res.libpng.decode_time > 0 ? px / ((double)res.libpng.decode_time/1000.0) : 0), (res.libpng.decode_time > 0 ? px / ((double)res.libpng.decode_time/1000.0) : 0),
@ -367,7 +367,7 @@ void benchmark_print_result(benchmark_result_t res) {
((double)res.libpng.size/(double)res.raw_size) * 100.0 ((double)res.libpng.size/(double)res.raw_size) * 100.0
); );
printf( printf(
"stbi: %8.1f %8.1f %8.2f %8.2f %8d %4.1f%%\n", "stbi: %8.1f %8.1f %8.2f %8.2f %8ld %4.1f%%\n",
(double)res.stbi.decode_time/1000000.0, (double)res.stbi.decode_time/1000000.0,
(double)res.stbi.encode_time/1000000.0, (double)res.stbi.encode_time/1000000.0,
(res.stbi.decode_time > 0 ? px / ((double)res.stbi.decode_time/1000.0) : 0), (res.stbi.decode_time > 0 ? px / ((double)res.stbi.decode_time/1000.0) : 0),
@ -377,7 +377,7 @@ void benchmark_print_result(benchmark_result_t res) {
); );
} }
printf( printf(
"qoi: %8.1f %8.1f %8.2f %8.2f %8d %4.1f%%\n", "qoi: %8.1f %8.1f %8.2f %8.2f %8ld %4.1f%%\n",
(double)res.qoi.decode_time/1000000.0, (double)res.qoi.decode_time/1000000.0,
(double)res.qoi.encode_time/1000000.0, (double)res.qoi.encode_time/1000000.0,
(res.qoi.decode_time > 0 ? px / ((double)res.qoi.decode_time/1000.0) : 0), (res.qoi.decode_time > 0 ? px / ((double)res.qoi.decode_time/1000.0) : 0),