From 9d3cdd0ebfcd827881e3e3f723c7405701679a21 Mon Sep 17 00:00:00 2001 From: Svyatoslav Mishyn Date: Sun, 24 Jan 2016 20:06:48 +0200 Subject: fix format specifier for unsigned int --- tinycap.c | 6 +++--- tinymix.c | 12 ++++++------ tinypcminfo.c | 2 +- tinywavinfo.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tinycap.c b/tinycap.c index 180a2dd..ffccb18 100644 --- a/tinycap.c +++ b/tinycap.c @@ -159,7 +159,7 @@ int main(int argc, char **argv) format = PCM_FORMAT_S16_LE; break; default: - fprintf(stderr, "%d bits is not supported.\n", bits); + fprintf(stderr, "%u bits is not supported.\n", bits); return 1; } @@ -179,7 +179,7 @@ int main(int argc, char **argv) header.sample_rate, format, period_size, period_count); if (prinfo) { - printf("Captured %d frames\n", frames); + printf("Captured %u frames\n", frames); } /* write header now all information is known */ @@ -226,7 +226,7 @@ unsigned int capture_sample(FILE *file, unsigned int card, unsigned int device, size = pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm)); buffer = malloc(size); if (!buffer) { - fprintf(stderr, "Unable to allocate %d bytes\n", size); + fprintf(stderr, "Unable to allocate %u bytes\n", size); free(buffer); pcm_close(pcm); return 0; diff --git a/tinymix.c b/tinymix.c index 6e4b9a0..5966df9 100644 --- a/tinymix.c +++ b/tinymix.c @@ -90,7 +90,7 @@ static void tinymix_list_controls(struct mixer *mixer) num_ctls = mixer_get_num_ctls(mixer); - printf("Number of controls: %d\n", num_ctls); + printf("Number of controls: %u\n", num_ctls); printf("ctl\ttype\tnum\t%-40s value\n", "name"); for (i = 0; i < num_ctls; i++) { @@ -99,7 +99,7 @@ static void tinymix_list_controls(struct mixer *mixer) name = mixer_ctl_get_name(ctl); type = mixer_ctl_get_type_string(ctl); num_values = mixer_ctl_get_num_values(ctl); - printf("%d\t%s\t%d\t%-40s", i, type, num_values, name); + printf("%u\t%s\t%u\t%-40s", i, type, num_values, name); tinymix_detail_control(mixer, name, 0); } } @@ -149,7 +149,7 @@ static void tinymix_detail_control(struct mixer *mixer, const char *control, if ((type == MIXER_CTL_TYPE_BYTE) && (num_values > 0)) { buf = calloc(1, num_values); if (buf == NULL) { - fprintf(stderr, "Failed to alloc mem for bytes %d\n", num_values); + fprintf(stderr, "Failed to alloc mem for bytes %u\n", num_values); return; } @@ -209,7 +209,7 @@ static void tinymix_set_byte_ctl(struct mixer_ctl *ctl, buf = calloc(1, num_values); if (buf == NULL) { - fprintf(stderr, "set_byte_ctl: Failed to alloc mem for bytes %d\n", num_values); + fprintf(stderr, "set_byte_ctl: Failed to alloc mem for bytes %u\n", num_values); exit(EXIT_FAILURE); } @@ -302,13 +302,13 @@ static void tinymix_set_value(struct mixer *mixer, const char *control, /* Set multiple values */ if (num_values > num_ctl_values) { fprintf(stderr, - "Error: %d values given, but control only takes %d\n", + "Error: %u values given, but control only takes %u\n", num_values, num_ctl_values); return; } for (i = 0; i < num_values; i++) { if (mixer_ctl_set_value(ctl, i, atoi(values[i]))) { - fprintf(stderr, "Error: invalid value for index %d\n", i); + fprintf(stderr, "Error: invalid value for index %u\n", i); return; } } diff --git a/tinypcminfo.c b/tinypcminfo.c index 99eec34..4eb0afa 100644 --- a/tinypcminfo.c +++ b/tinypcminfo.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) argv++; } - printf("Info for card %d, device %d:\n", card, device); + printf("Info for card %u, device %u:\n", card, device); for (i = 0; i < 2; i++) { struct pcm_params *params; diff --git a/tinywavinfo.c b/tinywavinfo.c index 9d15668..99ee5da 100644 --- a/tinywavinfo.c +++ b/tinywavinfo.c @@ -201,9 +201,9 @@ void analyse_sample(FILE *file, unsigned int channels, unsigned int bits, for (ch = 0; ch < channels; ch++) { float average_power = 10 * log10((*(power + ch)) / total_sample_per_channel); if(isinf (average_power)) { - printf("Channel [%2d] Average Power : NO signal or ZERO signal\n", ch); + printf("Channel [%2u] Average Power : NO signal or ZERO signal\n", ch); } else { - printf("Channel [%2d] Average Power : %.2f dB\n", ch, average_power); + printf("Channel [%2u] Average Power : %.2f dB\n", ch, average_power); } } -- cgit v1.2.3