Match format strings to parameter types
This commit makes a couple of changes in format strings:
unsigned int: %d->%u
int: %u->%d
The change fixes a number of CppCheck warnings.
Change-Id: Ifb46e7898c7a1fd824d597de3bede8ebc4609915
(cherry picked from commit f49873dfc300bcaa5a40233a256a5a518364bf2a)
diff --git a/av1/common/debugmodes.c b/av1/common/debugmodes.c
index c4bfb7e..78bc39a 100644
--- a/av1/common/debugmodes.c
+++ b/av1/common/debugmodes.c
@@ -17,7 +17,7 @@
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
fprintf(f, "%s", str);
- fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_frame.frame_number,
+ fprintf(f, "(Frame %u, Show:%d, Q:%d): \n", cm->current_frame.frame_number,
cm->show_frame, cm->quant_params.base_qindex);
}
/* This function dereferences a pointer to the mbmi structure
diff --git a/common/y4menc.c b/common/y4menc.c
index e3f5d5b..d228eaa 100644
--- a/common/y4menc.c
+++ b/common/y4menc.c
@@ -86,7 +86,7 @@
unsigned int bit_depth) {
const char *color = monochrome ? monochrome_colorspace(bit_depth)
: colorspace(bit_depth, csp, fmt);
- return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s\n", width, height,
+ return snprintf(buf, len, "YUV4MPEG2 W%d H%d F%d:%d I%c %s\n", width, height,
framerate->numerator, framerate->denominator, 'p', color);
}
diff --git a/examples/aom_cx_set_ref.c b/examples/aom_cx_set_ref.c
index 3d71a32..ebe83bf 100644
--- a/examples/aom_cx_set_ref.c
+++ b/examples/aom_cx_set_ref.c
@@ -108,7 +108,7 @@
}
printf(
- "Encode/decode mismatch on frame %d at"
+ "Encode/decode mismatch on frame %u at"
" Y[%d, %d] {%d/%d},"
" U[%d, %d] {%d/%d},"
" V[%d, %d] {%d/%d}",
@@ -351,7 +351,7 @@
printf("\n");
fclose(infile);
- printf("Processed %d frames.\n", frame_out);
+ printf("Processed %u frames.\n", frame_out);
if (test_decode) {
if (!mismatch_seen)
diff --git a/examples/decode_to_md5.c b/examples/decode_to_md5.c
index 515d20a..07f788f 100644
--- a/examples/decode_to_md5.c
+++ b/examples/decode_to_md5.c
@@ -115,7 +115,7 @@
get_image_md5(img, digest);
print_md5(outfile, digest);
- fprintf(outfile, " img-%dx%d-%04d.i420\n", img->d_w, img->d_h,
+ fprintf(outfile, " img-%ux%u-%04d.i420\n", img->d_w, img->d_h,
++frame_cnt);
}
}
diff --git a/examples/lightfield_decoder.c b/examples/lightfield_decoder.c
index 68ddbd9..1a40155 100644
--- a/examples/lightfield_decoder.c
+++ b/examples/lightfield_decoder.c
@@ -240,7 +240,7 @@
while ((img = aom_codec_get_frame(&codec, &iter)) != NULL) {
char name[1024];
snprintf(name, sizeof(name), "ref_%d.yuv", i);
- printf("writing ref image to %s, %d, %d\n", name, img->d_w, img->d_h);
+ printf("writing ref image to %s, %u, %u\n", name, img->d_w, img->d_h);
FILE *ref_file = fopen(name, "wb");
aom_img_write(img, ref_file);
fclose(ref_file);
diff --git a/examples/lightfield_tile_list_decoder.c b/examples/lightfield_tile_list_decoder.c
index 3da02f0..6811972 100644
--- a/examples/lightfield_tile_list_decoder.c
+++ b/examples/lightfield_tile_list_decoder.c
@@ -178,7 +178,7 @@
while ((img = aom_codec_get_frame(&codec, &iter)) != NULL) {
char name[1024];
snprintf(name, sizeof(name), "ref_%d.yuv", i);
- printf("writing ref image to %s, %d, %d\n", name, img->d_w, img->d_h);
+ printf("writing ref image to %s, %u, %u\n", name, img->d_w, img->d_h);
FILE *ref_file = fopen(name, "wb");
aom_img_write(img, ref_file);
fclose(ref_file);
diff --git a/examples/scalable_decoder.c b/examples/scalable_decoder.c
index edbc471..00fe820 100644
--- a/examples/scalable_decoder.c
+++ b/examples/scalable_decoder.c
@@ -142,7 +142,7 @@
// open any enhancement layer output yuv files
for (i = 1; i < si.number_spatial_layers; i++) {
- snprintf(filename, sizeof(filename), "out_lyr%d.yuv", i);
+ snprintf(filename, sizeof(filename), "out_lyr%u.yuv", i);
if (!(outfile[i] = fopen(filename, "wb")))
die("Failed to open output for writing.");
}
diff --git a/examples/svc_encoder_rtc.c b/examples/svc_encoder_rtc.c
index c098464..40500ff 100644
--- a/examples/svc_encoder_rtc.c
+++ b/examples/svc_encoder_rtc.c
@@ -212,7 +212,7 @@
int tot_num_frames = 0;
double perc_fluctuation = 0.0;
printf("Total number of processed frames: %d\n\n", frame_cnt - 1);
- printf("Rate control layer stats for %d layer(s):\n\n", ts_number_layers);
+ printf("Rate control layer stats for %u layer(s):\n\n", ts_number_layers);
for (unsigned int sl = 0; sl < ss_number_layers; ++sl) {
tot_num_frames = 0;
for (unsigned int tl = 0; tl < ts_number_layers; ++tl) {
@@ -228,7 +228,7 @@
rc->layer_avg_frame_size[i] / rc->layer_enc_frames[tl];
rc->layer_avg_rate_mismatch[i] =
100.0 * rc->layer_avg_rate_mismatch[i] / rc->layer_enc_frames[tl];
- printf("For layer#: %d %d \n", sl, tl);
+ printf("For layer#: %u %u \n", sl, tl);
printf("Bitrate (target vs actual): %d %f\n", rc->layer_target_bitrate[i],
rc->layer_encoding_bitrate[i]);
printf("Average frame size (target vs actual): %f %f\n", rc->layer_pfb[i],