Fix cppcheck warnings
authorRosen Penev <rosenp@gmail.com>
Thu, 19 Jan 2017 02:45:28 +0000 (18:45 -0800)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Thu, 19 Jan 2017 09:45:13 +0000 (20:45 +1100)
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
src/libFLAC/bitreader.c
src/libFLAC/bitwriter.c
src/plugin_xmms/plugin.c
src/test_libFLAC++/encoders.cpp
src/test_libFLAC/decoders.c
src/test_libFLAC/encoders.c

index 386f420..7554385 100644 (file)
@@ -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");
                }
        }
index 8f475d5..bfe79b0 100644 (file)
@@ -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");
                }
        }
index d84d53c..94fbae5 100644 (file)
@@ -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;
                }
index 277e129..e328a53 100644 (file)
@@ -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");
index 46114f1..e9d52e9 100644 (file)
@@ -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);
 
index 510a9c2..7aefe79 100644 (file)
@@ -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");