From 09b8224804545338b66aa985c0f9eba949e0ede5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 18 Jan 2017 18:45:28 -0800 Subject: [PATCH] Fix cppcheck warnings Signed-off-by: Erik de Castro Lopo --- src/libFLAC/bitreader.c | 4 ++-- src/libFLAC/bitwriter.c | 4 ++-- src/plugin_xmms/plugin.c | 2 +- src/test_libFLAC++/encoders.cpp | 8 ++++---- src/test_libFLAC/decoders.c | 4 ++-- src/test_libFLAC/encoders.c | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c index 386f4200..75543854 100644 --- a/src/libFLAC/bitreader.c +++ b/src/libFLAC/bitreader.c @@ -306,7 +306,7 @@ void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out) if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) fprintf(out, "."); else - fprintf(out, "%01u", br->buffer[i] & ((brword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); + fprintf(out, "%01d", br->buffer[i] & ((brword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); fprintf(out, "\n"); } if(br->bytes > 0) { @@ -315,7 +315,7 @@ void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out) if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) fprintf(out, "."); else - fprintf(out, "%01u", br->buffer[i] & ((brword)1 << (br->bytes*8-j-1)) ? 1:0); + fprintf(out, "%01d", br->buffer[i] & ((brword)1 << (br->bytes*8-j-1)) ? 1:0); fprintf(out, "\n"); } } diff --git a/src/libFLAC/bitwriter.c b/src/libFLAC/bitwriter.c index 8f475d59..bfe79b02 100644 --- a/src/libFLAC/bitwriter.c +++ b/src/libFLAC/bitwriter.c @@ -201,13 +201,13 @@ void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out) for(i = 0; i < bw->words; i++) { fprintf(out, "%08X: ", i); for(j = 0; j < FLAC__BITS_PER_WORD; j++) - fprintf(out, "%01u", bw->buffer[i] & ((bwword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); + fprintf(out, "%01d", bw->buffer[i] & ((bwword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); fprintf(out, "\n"); } if(bw->bits > 0) { fprintf(out, "%08X: ", i); for(j = 0; j < bw->bits; j++) - fprintf(out, "%01u", bw->accum & ((bwword)1 << (bw->bits-j-1)) ? 1:0); + fprintf(out, "%01d", bw->accum & ((bwword)1 << (bw->bits-j-1)) ? 1:0); fprintf(out, "\n"); } } diff --git a/src/plugin_xmms/plugin.c b/src/plugin_xmms/plugin.c index d84d53cb..94fbae50 100644 --- a/src/plugin_xmms/plugin.c +++ b/src/plugin_xmms/plugin.c @@ -324,7 +324,7 @@ void FLAC_XMMS__play_file(char *filename) } else { /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */ - fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", stream_data_.bits_per_sample); + fprintf(stderr, "libxmms-flac: can't handle %u bit output\n", stream_data_.bits_per_sample); safe_decoder_finish_(decoder_); return; } diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp index 277e1293..e328a534 100644 --- a/src/test_libFLAC++/encoders.cpp +++ b/src/test_libFLAC++/encoders.cpp @@ -438,7 +438,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_max_lpc_order()... "); if(encoder->get_max_lpc_order() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_max_lpc_order()); + printf("FAILED, expected %d, got %u\n", 0, encoder->get_max_lpc_order()); return false; } printf("OK\n"); @@ -471,21 +471,21 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_min_residual_partition_order()... "); if(encoder->get_min_residual_partition_order() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_min_residual_partition_order()); + printf("FAILED, expected %d, got %u\n", 0, encoder->get_min_residual_partition_order()); return false; } printf("OK\n"); printf("testing get_max_residual_partition_order()... "); if(encoder->get_max_residual_partition_order() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_max_residual_partition_order()); + printf("FAILED, expected %d, got %u\n", 0, encoder->get_max_residual_partition_order()); return false; } printf("OK\n"); printf("testing get_rice_parameter_search_dist()... "); if(encoder->get_rice_parameter_search_dist() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_rice_parameter_search_dist()); + printf("FAILED, expected %d, got %u\n", 0, encoder->get_rice_parameter_search_dist()); return false; } printf("OK\n"); diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c index 46114f1e..e9d52e95 100644 --- a/src/test_libFLAC/decoders.c +++ b/src/test_libFLAC/decoders.c @@ -282,10 +282,10 @@ static void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder return; if (metadata->type == FLAC__METADATA_TYPE_APPLICATION) { - printf ("%d ('%c%c%c%c')... ", dcd->current_metadata_number, metadata->data.application.id [0], metadata->data.application.id [1], metadata->data.application.id [2], metadata->data.application.id [3]); + printf ("%u ('%c%c%c%c')... ", dcd->current_metadata_number, metadata->data.application.id [0], metadata->data.application.id [1], metadata->data.application.id [2], metadata->data.application.id [3]); } else { - printf("%d... ", dcd->current_metadata_number); + printf("%u... ", dcd->current_metadata_number); } fflush(stdout); diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index 510a9c2a..7aefe79b 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -397,7 +397,7 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_encoder_get_max_lpc_order()... "); if(FLAC__stream_encoder_get_max_lpc_order(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_max_lpc_order(encoder)); + printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_max_lpc_order(encoder)); return false; } printf("OK\n"); @@ -430,21 +430,21 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_encoder_get_min_residual_partition_order()... "); if(FLAC__stream_encoder_get_min_residual_partition_order(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_min_residual_partition_order(encoder)); + printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_min_residual_partition_order(encoder)); return false; } printf("OK\n"); printf("testing FLAC__stream_encoder_get_max_residual_partition_order()... "); if(FLAC__stream_encoder_get_max_residual_partition_order(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_max_residual_partition_order(encoder)); + printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_max_residual_partition_order(encoder)); return false; } printf("OK\n"); printf("testing FLAC__stream_encoder_get_rice_parameter_search_dist()... "); if(FLAC__stream_encoder_get_rice_parameter_search_dist(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_rice_parameter_search_dist(encoder)); + printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_rice_parameter_search_dist(encoder)); return false; } printf("OK\n"); -- 2.11.4.GIT