From f6a845d497ed6883e8318acc8a17d2ed07b85a51 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 23 Nov 2016 23:16:50 +0100 Subject: [PATCH] Fix signedness issues in format strings. Compiling with -Wformat-signedness (not enabled so far) causes many warnings because of format strings which specify an unsigned type but correspond to an argument of signed type, or vice versa. This commit fixes all these mismatches. For "%u", "%d", "%lu", "%ld" we let the format string match the type of the argument, but for "%x" we need to cast the argument to a suitable unsigned type. After this patch the tree compiles cleanly with -Wformat-signedness given. The warning will be enabled in a subsequent commit. --- aac_afh.c | 4 ++-- aacdec_filter.c | 4 ++-- acl.c | 6 +++--- afh_recv.c | 2 +- afs.c | 4 ++-- aft.c | 20 ++++++++++---------- alsa_mix.c | 2 +- alsa_write.c | 2 +- audiod.c | 4 ++-- blob.c | 2 +- check_wav.c | 2 +- command.c | 6 +++--- crypt_common.c | 2 +- fade.c | 4 ++-- fecdec_filter.c | 12 ++++++------ file_write.c | 2 +- filter_common.c | 2 +- flac_afh.c | 2 +- gui.c | 2 +- mood.c | 2 +- mp3_afh.c | 2 +- net.c | 2 +- ogg_afh.c | 2 +- ogg_afh_common.c | 6 +++--- oggdec_filter.c | 2 +- opus_afh.c | 2 +- oss_write.c | 2 +- play.c | 2 +- server.c | 2 +- spx_afh.c | 2 +- string.h | 2 +- vss.c | 4 ++-- wav_filter.c | 2 +- wma_common.c | 6 +++--- wmadec_filter.c | 4 ++-- 35 files changed, 64 insertions(+), 64 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index c49f30de..bcd2a14e 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -33,11 +33,11 @@ static int aac_find_stsz(unsigned char *buf, size_t buflen, off_t *skip) PARA_DEBUG_LOG("found stsz@%d\n", i); i += 8; sample_size = aac_read_int32(buf + i); - PARA_DEBUG_LOG("sample size: %d\n", sample_size); + PARA_DEBUG_LOG("sample size: %u\n", sample_size); i += 4; sample_count = aac_read_int32(buf + i); i += 4; - PARA_DEBUG_LOG("sample count: %d\n", sample_count); + PARA_DEBUG_LOG("sample count: %u\n", sample_count); *skip = i; return sample_count; } diff --git a/aacdec_filter.c b/aacdec_filter.c index ac8148e8..b40022fe 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -127,7 +127,7 @@ next_buffer: } padd->sample_rate = rate; padd->channels = channels; - PARA_INFO_LOG("rate: %u, channels: %d\n", + PARA_INFO_LOG("rate: %u, channels: %u\n", padd->sample_rate, padd->channels); padd->initialized = 1; } @@ -171,7 +171,7 @@ next_buffer: goto success; } PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(err)); - PARA_ERROR_LOG("consumed: %zu + %zd + %lu\n", + PARA_ERROR_LOG("consumed: %zu + %zu + %lu\n", padd->consumed_total, consumed, padd->frame_info.bytesconsumed); if (consumed < len) diff --git a/acl.c b/acl.c index 5ef9a51c..560ff999 100644 --- a/acl.c +++ b/acl.c @@ -87,7 +87,7 @@ static void acl_add_entry(struct list_head *acl, char *addr, int netmask) inet_pton(AF_INET, addr, &ai->addr); ai->netmask = netmask; - PARA_INFO_LOG("adding %s/%i to access list\n", addr, ai->netmask); + PARA_INFO_LOG("adding %s/%u to access list\n", addr, ai->netmask); para_list_add(&ai->node, acl); } @@ -109,7 +109,7 @@ static void acl_del_entry(struct list_head *acl, char *addr, unsigned netmask) if (v4_addr_match(to_delete.s_addr, ai->addr.s_addr, PARA_MIN(netmask, ai->netmask))) { - PARA_NOTICE_LOG("removing %s/%i from access list\n", + PARA_NOTICE_LOG("removing %s/%u from access list\n", addr, ai->netmask); list_del(&ai->node); free(ai); @@ -131,7 +131,7 @@ char *acl_get_contents(struct list_head *acl) char *ret = NULL; list_for_each_entry_safe(ai, tmp_ai, acl, node) { - char *tmp = make_message("%s%s/%d ", ret? ret : "", + char *tmp = make_message("%s%s/%u ", ret? ret : "", inet_ntoa(ai->addr), ai->netmask); free(ret); ret = tmp; diff --git a/afh_recv.c b/afh_recv.c index 16463463..28d8f398 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -205,7 +205,7 @@ static int afh_recv_post_select(__a_unused struct sched *s, void *context) afh_get_chunk(pard->first_chunk, afhi, pard->map, &start, &size); afh_get_chunk(pard->last_chunk, afhi, pard->map, &end, &size); end += size; - PARA_INFO_LOG("adding %zu bytes\n", end - start); + PARA_INFO_LOG("adding %td bytes\n", end - start); btr_add_output_dont_free(start, end - start, btrn); ret = -E_RECV_EOF; goto out; diff --git a/afs.c b/afs.c index 0accc451..5f933c5b 100644 --- a/afs.c +++ b/afs.c @@ -706,7 +706,7 @@ static int open_afs_tables(void) int i, ret; get_database_dir(); - PARA_NOTICE_LOG("opening %u osl tables in %s\n", NUM_AFS_TABLES, + PARA_NOTICE_LOG("opening %d osl tables in %s\n", NUM_AFS_TABLES, database_dir); for (i = 0; i < NUM_AFS_TABLES; i++) { ret = afs_tables[i].open(database_dir); @@ -1195,7 +1195,7 @@ __must_check int afs_event(enum afs_events event, struct para_buffer *pb, continue; ret = t->event_handler(event, pb, data); if (ret < 0) { - PARA_CRIT_LOG("table %s, event %d: %s\n", t->name, + PARA_CRIT_LOG("table %s, event %u: %s\n", t->name, event, para_strerror(-ret)); return ret; } diff --git a/aft.c b/aft.c index f14440e6..e8a18fd1 100644 --- a/aft.c +++ b/aft.c @@ -738,11 +738,11 @@ static void get_duration_buf(int seconds, char *buf, struct ls_options *opts) if (!hours) { /* m:ss or mm:ss */ max_width = opts->mode == LS_MODE_LONG? opts->widths.duration_width : 4; - sprintf(buf, "%*u:%02u", max_width - 3, mins, seconds % 60); + sprintf(buf, "%*u:%02d", max_width - 3, mins, seconds % 60); } else { /* more than one hour => h:mm:ss, hh:mm:ss, hhh:mm:ss, ... */ max_width = opts->mode == LS_MODE_LONG? opts->widths.duration_width : 7; - sprintf(buf, "%*u:%02u:%02u", max_width - 6, hours, mins, + sprintf(buf, "%*u:%02u:%02d", max_width - 6, hours, mins, seconds % 60); } } @@ -876,14 +876,14 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, para_printf(b, "%s " /* attributes */ "%*u " /* amp */ - "%*d " /* image_id */ - "%*d " /* lyrics_id */ - "%*d " /* bitrate */ + "%*u " /* image_id */ + "%*u " /* lyrics_id */ + "%*u " /* bitrate */ "%*s " /* audio format */ - "%*d " /* frequency */ - "%d " /* channels */ + "%*u " /* frequency */ + "%u " /* channels */ "%s " /* duration */ - "%*d " /* num_played */ + "%*u " /* num_played */ "%s " /* last_played */ "%s\n", /* path */ att_buf, @@ -930,7 +930,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, WRITE_STATUS_ITEM(b, SI_SECONDS_TOTAL, "%" PRIu32 "\n", afhi->seconds_total); WRITE_STATUS_ITEM(b, SI_LAST_PLAYED, "%s\n", last_played_time); - WRITE_STATUS_ITEM(b, SI_NUM_PLAYED, "%d\n", afsi->num_played); + WRITE_STATUS_ITEM(b, SI_NUM_PLAYED, "%u\n", afsi->num_played); WRITE_STATUS_ITEM(b, SI_AMPLIFICATION, "%u\n", afsi->amp); WRITE_STATUS_ITEM(b, SI_CHUNK_TIME, "%lu\n", tv2ms(&afhi->chunk_tv)); WRITE_STATUS_ITEM(b, SI_NUM_CHUNKS, "%" PRIu32 "\n", @@ -2621,7 +2621,7 @@ static int aft_open(const char *dir) if (ret >= 0) { unsigned num; osl_get_num_rows(audio_file_table, &num); - PARA_INFO_LOG("audio file table contains %d files\n", num); + PARA_INFO_LOG("audio file table contains %u files\n", num); return ret; } PARA_NOTICE_LOG("failed to open audio file table\n"); diff --git a/alsa_mix.c b/alsa_mix.c index cad58af0..3adee929 100644 --- a/alsa_mix.c +++ b/alsa_mix.c @@ -142,7 +142,7 @@ static int alsa_mix_set_channel(struct mixer_handle *h, snd_mixer_selem_id_set_name(sid, mixer_channel); h->elem = snd_mixer_find_selem(h->mixer, sid); if (!h->elem) { - PARA_NOTICE_LOG("unable to find simple control '%s',%i\n", + PARA_NOTICE_LOG("unable to find simple control '%s',%u\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); ret = -E_BAD_CHANNEL; diff --git a/alsa_write.c b/alsa_write.c index 63a7055b..fd3b404c 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -303,7 +303,7 @@ again: get_btr_sample_format(btrn, &val); pad->sample_format = get_alsa_pcm_format(val); - PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, + PARA_INFO_LOG("%u channel(s), %uHz\n", pad->channels, pad->sample_rate); ret = alsa_init(pad, wn->conf); if (ret < 0) { diff --git a/audiod.c b/audiod.c index 285d2762..bd97f15e 100644 --- a/audiod.c +++ b/audiod.c @@ -764,7 +764,7 @@ static void compute_time_diff(const struct timeval *status_time) if (count > 5) { int s = tv_diff(&diff, &stat_task->sa_time_diff, &tmp); if (tv_diff(&max_deviation, &tmp, NULL) < 0) - PARA_WARNING_LOG("time diff jump: %lims\n", + PARA_WARNING_LOG("time diff jump: %lums\n", s * tv2ms(&tmp)); } count++; @@ -1378,7 +1378,7 @@ static int status_post_select(struct sched *s, void *context) if (st->clock_diff_count) { /* get status only one time */ char *argv[] = {"audiod", "--", "stat", "-p", "-n=1", NULL}; int argc = 5; - PARA_INFO_LOG("clock diff count: %d\n", st->clock_diff_count); + PARA_INFO_LOG("clock diff count: %u\n", st->clock_diff_count); st->clock_diff_count--; client_open(argc, argv, &st->ct, NULL, NULL, st->btrn, s); set_stat_task_restart_barrier(2); diff --git a/blob.c b/blob.c index ca39de0d..7a7ae756 100644 --- a/blob.c +++ b/blob.c @@ -262,7 +262,7 @@ static int com_rmblob_callback(struct osl_table *table, if (pmd.num_matches == 0) ret = -E_NO_MATCH; else { - para_printf(&aca->pbout, "removed %d blob(s)\n", + para_printf(&aca->pbout, "removed %u blob(s)\n", pmd.num_matches); ret = afs_event(BLOB_REMOVE, NULL, table); } diff --git a/check_wav.c b/check_wav.c index d1d27872..1a47f946 100644 --- a/check_wav.c +++ b/check_wav.c @@ -177,7 +177,7 @@ int check_wav_post_select(struct check_wav_context *cwc) else cwc->sample_format = (a[3] == 'F')? SF_S16_LE : SF_S16_BE; - PARA_NOTICE_LOG("%dHz, %s, %s\n", cwc->sample_rate, + PARA_NOTICE_LOG("%uHz, %s, %s\n", cwc->sample_rate, cwc->channels == 1? "mono" : "stereo", sample_formats[cwc->sample_format]); btr_consume(btrn, WAV_HEADER_LEN); diff --git a/command.c b/command.c index 0eb4efc2..fe4b9232 100644 --- a/command.c +++ b/command.c @@ -473,7 +473,7 @@ static unsigned empty_status_items(int parser_friendly, char **result) #define ITEM(x) "0004 %02x:\n" EMPTY_STATUS_ITEMS #undef ITEM - #define ITEM(x) , SI_ ## x + #define ITEM(x) , (unsigned) SI_ ## x EMPTY_STATUS_ITEMS #undef ITEM ); @@ -767,7 +767,7 @@ static int com_jmp(struct command_context *cc) i = 100; PARA_INFO_LOG("jumping to %lu%%\n", i); mmd->repos_request = (mmd->afd.afhi.chunks_total * i + 50) / 100; - PARA_INFO_LOG("sent: %lu, offset before jmp: %lu\n", + PARA_INFO_LOG("sent: %lu, offset before jmp: %li\n", mmd->chunks_sent, mmd->offset); mmd->new_vss_status_flags |= VSS_REPOS; mmd->new_vss_status_flags &= ~VSS_NEXT; @@ -964,7 +964,7 @@ __noreturn void handle_connect(int fd, const char *peername) numbytes = 256; get_random_bytes_or_die((unsigned char *)buf, numbytes); } - PARA_DEBUG_LOG("sending %u byte challenge + session key (%zu bytes)\n", + PARA_DEBUG_LOG("sending %d byte challenge + session key (%zu bytes)\n", CHALLENGE_SIZE, numbytes); ret = send_sb(&cc->scc, buf, numbytes, SBD_CHALLENGE, false); buf = NULL; diff --git a/crypt_common.c b/crypt_common.c index 022692ad..8e52603f 100644 --- a/crypt_common.c +++ b/crypt_common.c @@ -256,7 +256,7 @@ int check_ssh_key_header(const unsigned char *blob, int blen) return -E_SSH_KEY_HEADER; if (rlen < strlen(KEY_TYPE_TXT)) return -E_SSH_KEY_HEADER; - PARA_DEBUG_LOG("type: %s, rlen: %d\n", p, rlen); + PARA_DEBUG_LOG("type: %s, rlen: %u\n", p, rlen); if (strncmp((char *)p, KEY_TYPE_TXT, strlen(KEY_TYPE_TXT))) return -E_SSH_KEY_HEADER; return 4 + rlen; diff --git a/fade.c b/fade.c index e05e3173..2a4eb1e1 100644 --- a/fade.c +++ b/fade.c @@ -67,7 +67,7 @@ static int fade(struct mixer *m, struct mixer_handle *h, int new_vol, int fade_t if (ret < 0) goto out; vol = ret; - PARA_NOTICE_LOG("fading %s from %d to %d in %d seconds\n", + PARA_NOTICE_LOG("fading %s from %d to %d in %u seconds\n", conf.mixer_channel_arg, vol, new_vol, secs); diff = new_vol - vol; if (!diff) { @@ -203,7 +203,7 @@ static int sweet_dreams(struct mixer *m, struct mixer_handle *h) tm = localtime(&t1); } wake_time_epoch = mktime(tm); - PARA_INFO_LOG("waketime: %u:%02u\n", tm->tm_hour, tm->tm_min); + PARA_INFO_LOG("waketime: %d:%02d\n", tm->tm_hour, tm->tm_min); client_cmd("stop"); sleep(1); if (fot) { diff --git a/fecdec_filter.c b/fecdec_filter.c index 26ea24a6..1c3a3784 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -171,7 +171,7 @@ static struct fecdec_group *free_oldest_group(struct private_fecdec_data *pfd) oldest = fg; } if (!group_complete(oldest) && !group_empty(oldest)) - PARA_WARNING_LOG("Clearing incomplete group %d " + PARA_WARNING_LOG("Clearing incomplete group %u " "(contains %d slices)\n", oldest->h.group_num, oldest->num_received_slices); if (oldest == pfd->first_complete_group) @@ -224,7 +224,7 @@ static int add_slice(char *buf, struct fecdec_group *fg) uint8_t slice_num = fg->h.slice_num; if (group_complete(fg)) { - PARA_DEBUG_LOG("group %d complete, ignoring slice %d\n", + PARA_DEBUG_LOG("group %u complete, ignoring slice %d\n", fg->h.group_num, slice_num); return 0; } @@ -236,7 +236,7 @@ static int add_slice(char *buf, struct fecdec_group *fg) r = fg->num_received_slices; /* Check if we already have this slice. */ if (test_and_set_slice_bit(fg, slice_num)) { - PARA_INFO_LOG("ignoring duplicate slice %d:%d\n", fg->h.group_num, + PARA_INFO_LOG("ignoring duplicate slice %u:%d\n", fg->h.group_num, slice_num); return 0; } @@ -293,10 +293,10 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn) char *buf = NULL; if (u == FEC_GROUP_UNUSABLE) { - PARA_INFO_LOG("dropping unusable group %d\n", fg->h.group_num); + PARA_INFO_LOG("dropping unusable group %u\n", fg->h.group_num); return 0; } - PARA_DEBUG_LOG("decoding group %d (%d slices)\n", fg->h.group_num, + PARA_DEBUG_LOG("decoding group %u (%d slices)\n", fg->h.group_num, fg->h.data_slices_per_group); ret = fec_decode(pfd->fec, fg->data, fg->idx, sb); if (ret < 0) @@ -307,7 +307,7 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn) i = DIV_ROUND_UP(fg->h.audio_header_size, fg->h.slice_bytes); PARA_DEBUG_LOG("skipping %d header slices\n", i); } - PARA_DEBUG_LOG("writing group %d (%d/%d decoded data bytes)\n", + PARA_DEBUG_LOG("writing group %u (%u/%d decoded data bytes)\n", fg->h.group_num, fg->h.group_bytes, fg->h.data_slices_per_group * sb); need = (fg->h.data_slices_per_group - i) * sb; diff --git a/file_write.c b/file_write.c index ef25b0f5..5e66607e 100644 --- a/file_write.c +++ b/file_write.c @@ -39,7 +39,7 @@ __must_check __malloc static char *random_filename(void) char *result, *home = para_homedir(); srandom(clock_get_realtime(NULL)->tv_usec); - result = make_message("%s/.paraslash/%08lu", home, + result = make_message("%s/.paraslash/%08ld", home, para_random(99999999)); free(home); return result; diff --git a/filter_common.c b/filter_common.c index 84863b39..e9b97e54 100644 --- a/filter_common.c +++ b/filter_common.c @@ -204,7 +204,7 @@ int decoder_execute(const char *cmd, unsigned sample_rate, unsigned channels, return 1; } if (!strcmp(cmd, "sample_format")) { - *result = make_message("%u", DECODER_SAMPLE_FORMAT); + *result = make_message("%d", DECODER_SAMPLE_FORMAT); return 1; } return -ERRNO_TO_PARA_ERROR(ENOTSUP); diff --git a/flac_afh.c b/flac_afh.c index 2e2842b1..385d4f0c 100644 --- a/flac_afh.c +++ b/flac_afh.c @@ -468,7 +468,7 @@ static int flac_write_chain(FLAC__Metadata_Chain *chain, if (!ok) { FLAC__Metadata_ChainStatus st; st = FLAC__metadata_chain_status(chain); - PARA_ERROR_LOG("chain status: %d\n", st); + PARA_ERROR_LOG("chain status: %u\n", st); if (st == FLAC__METADATA_CHAIN_STATUS_READ_ERROR) PARA_ERROR_LOG("read error\n"); return -E_FLAC_WRITE_CHAIN; diff --git a/gui.c b/gui.c index b0eae64a..3e01340a 100644 --- a/gui.c +++ b/gui.c @@ -1160,7 +1160,7 @@ static void print_scroll_msg(void) unsigned lines_total, filled = ringbuffer_filled(bot_win_rb); int first_rbe = first_visible_rbe(&lines_total); - print_in_bar(COLOR_MSG, "scrolled view: %d-%d/%d\n", filled - first_rbe, + print_in_bar(COLOR_MSG, "scrolled view: %u-%u/%u\n", filled - first_rbe, filled - scroll_position, ringbuffer_filled(bot_win_rb)); } diff --git a/mood.c b/mood.c index 940d72a1..79f47e5a 100644 --- a/mood.c +++ b/mood.c @@ -747,7 +747,7 @@ static int mood_update_audio_file(const struct osl_row *aft_row, percent = 100; else if (percent < 0) percent = 0; - PARA_DEBUG_LOG("moving from rank %u to %lu%%\n", rank, percent); + PARA_DEBUG_LOG("moving from rank %u to %li%%\n", rank, percent); return score_update(aft_row, percent); } diff --git a/mp3_afh.c b/mp3_afh.c index 70f2ec9f..2115f71c 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -238,7 +238,7 @@ static int replace_tag(char const *id, const char *val, struct id3_tag *id3_t, if (!val || !*val) return 0; fr = id3_frame_new(id); - PARA_DEBUG_LOG("frame desc: %s, %d fields\n", fr->description, fr->nfields); + PARA_DEBUG_LOG("frame desc: %s, %u fields\n", fr->description, fr->nfields); /* Frame 0 contains the encoding. We always use UTF-8. */ field = id3_frame_field(fr, 0); diff --git a/net.c b/net.c index 13694989..fa7cd4b8 100644 --- a/net.c +++ b/net.c @@ -376,7 +376,7 @@ int lookup_address(unsigned l4type, bool passive, const char *host, struct addrinfo *addr = NULL, hints; *result = NULL; - sprintf(port, "%u", port_number & 0xffff); + sprintf(port, "%d", port_number & 0xffff); /* Set up address hint structure */ memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; diff --git a/ogg_afh.c b/ogg_afh.c index 29f08965..2ddf0ee3 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -95,7 +95,7 @@ static void add_ogg_page(ogg_page *og, struct vorbis_get_header_data *vghd) memcpy(p + og->header_len, og->body, og->body_len); vghd->buf = buf; vghd->len = new_len; - PARA_DEBUG_LOG("header/body/old/new: %lu/%lu/%zu/%zu\n", + PARA_DEBUG_LOG("header/body/old/new: %li/%li/%zu/%zu\n", og->header_len, og->body_len, old_len, new_len); } diff --git a/ogg_afh_common.c b/ogg_afh_common.c index e49b803b..adab7f48 100644 --- a/ogg_afh_common.c +++ b/ogg_afh_common.c @@ -193,7 +193,7 @@ static int write_ogg_page(int fd, const ogg_page *op) { int ret; - PARA_DEBUG_LOG("header/body: %lu/%lu\n", op->header_len, op->body_len); + PARA_DEBUG_LOG("header/body: %li/%li\n", op->header_len, op->body_len); ret = xwrite(fd, (const char *)op->header, op->header_len); if (ret < 0) return ret; @@ -288,7 +288,7 @@ int ogg_rewrite_tags(const char *map, size_t map_sz, int fd, goto out; continue; } - PARA_DEBUG_LOG("packet: bytes: %d, granule: %d, packetno: %u\n", + PARA_DEBUG_LOG("packet: bytes: %d, granule: %d, packetno: %d\n", (int)packet.bytes, (int)packet.granulepos, (int)packet.packetno); /* ignore meta data packet which we replaced */ @@ -309,7 +309,7 @@ int ogg_rewrite_tags(const char *map, size_t map_sz, int fd, #endif if (ret <= 0) break; - PARA_DEBUG_LOG("writing page (%lu bytes)\n", + PARA_DEBUG_LOG("writing page (%li bytes)\n", op.header_len + op.body_len); ret = write_ogg_page(fd, &op); if (ret < 0) diff --git a/oggdec_filter.c b/oggdec_filter.c index 4b801356..04be7020 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -162,7 +162,7 @@ open: goto out; pod->channels = ov_info(vf, 0)->channels; pod->sample_rate = ov_info(vf, 0)->rate; - PARA_NOTICE_LOG("%d channels, %d Hz\n", pod->channels, + PARA_NOTICE_LOG("%u channels, %u Hz\n", pod->channels, pod->sample_rate); ret = 1; out: diff --git a/opus_afh.c b/opus_afh.c index b1469b47..64eeb03c 100644 --- a/opus_afh.c +++ b/opus_afh.c @@ -55,7 +55,7 @@ static int opus_get_comments(char *comments, int length, p += 4; if (p + ntags * 4 > end) return -E_OPUS_COMMENT; - PARA_INFO_LOG("found %d tag(s)\n", ntags); + PARA_INFO_LOG("found %u tag(s)\n", ntags); for (i = 0; i < ntags; i++, p += val) { char *tag; diff --git a/oss_write.c b/oss_write.c index 12cf8b69..20186667 100644 --- a/oss_write.c +++ b/oss_write.c @@ -165,7 +165,7 @@ static int oss_init(struct writer_node *wn, unsigned sample_rate, ret = -E_BAD_SAMPLERATE; if (100 * max > 110 * min) /* more than 10% deviation */ goto err; - PARA_NOTICE_LOG("using %dHz rather than %dHz\n", rate, + PARA_NOTICE_LOG("using %uHz rather than %uHz\n", rate, sample_rate); } wn->min_iqs = powd->bytes_per_frame; diff --git a/play.c b/play.c index d2539ee1..c35757a9 100644 --- a/play.c +++ b/play.c @@ -784,7 +784,7 @@ static void list_file(struct play_task *pt, int num) char *buf; size_t sz; - sz = xasprintf(&buf, "%s %4u %s\n", num == pt->current_file? + sz = xasprintf(&buf, "%s %4d %s\n", num == pt->current_file? "*" : " ", num, conf.inputs[num]); btr_add_output(buf, sz, pt->btrn); } diff --git a/server.c b/server.c index 088cc8b1..c90045c3 100644 --- a/server.c +++ b/server.c @@ -526,7 +526,7 @@ out: prev_uptime = uptime; prev_events = mmd->events; mmd->vss_status_flags = mmd->new_vss_status_flags; - PARA_DEBUG_LOG("%d events, forcing status update\n", mmd->events); + PARA_DEBUG_LOG("%u events, forcing status update\n", mmd->events); killpg(0, SIGUSR1); } diff --git a/spx_afh.c b/spx_afh.c index b780635b..4e318af1 100644 --- a/spx_afh.c +++ b/spx_afh.c @@ -88,7 +88,7 @@ static int spx_get_comments(unsigned char *comments, int length, if (c + 4 > end) return -E_SPX_COMMENT; nb_fields = read_u32(c); - PARA_DEBUG_LOG("%d comment(s)\n", nb_fields); + PARA_DEBUG_LOG("%u comment(s)\n", nb_fields); c += 4; for (i = 0; i < nb_fields; i++, c += len) { char *tag; diff --git a/string.h b/string.h index aa8292fd..52f98941 100644 --- a/string.h +++ b/string.h @@ -63,7 +63,7 @@ int for_each_line(unsigned flags, char *buf, size_t size, #define WRITE_STATUS_ITEM(b, n, f, ...) (\ { \ if ((b)->flags & PBF_SIZE_PREFIX) { \ - para_printf((b), "%02x:" f, n, ## __VA_ARGS__); \ + para_printf((b), "%02x:" f, (unsigned)n, ## __VA_ARGS__); \ } else { \ para_printf((b), "%s: " f, status_item_list[(n)], \ ## __VA_ARGS__); \ diff --git a/vss.c b/vss.c index 2acff1cb..5484db9d 100644 --- a/vss.c +++ b/vss.c @@ -611,7 +611,7 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst) for (; i < k; i++) fc->src_data[i] = (const unsigned char *)buf; } - PARA_DEBUG_LOG("FEC group %d: %d chunks (%d - %d), %d bytes\n", + PARA_DEBUG_LOG("FEC group %u: %u chunks (%u - %u), %u bytes\n", g->num, g->num_chunks, g->first_chunk, g->first_chunk + g->num_chunks - 1, g->bytes ); @@ -1027,7 +1027,7 @@ static void vss_send(struct vss_task *vsst) } if (compute_next_fec_slice(fc, vsst) <= 0) continue; - PARA_DEBUG_LOG("sending %d:%d (%u bytes)\n", fc->group.num, + PARA_DEBUG_LOG("sending %u:%u (%u bytes)\n", fc->group.num, fc->current_slice_num, fc->group.slice_bytes); fc->fcp->send_fec(fc->sc, (char *)fc->enc_buf, fc->group.slice_bytes + FEC_HEADER_SIZE); diff --git a/wav_filter.c b/wav_filter.c index 07423a14..88047adb 100644 --- a/wav_filter.c +++ b/wav_filter.c @@ -31,7 +31,7 @@ static void make_wav_header(unsigned int channels, unsigned int sample_rate, int bytespersec = channels * sample_rate * BITS / 8; int align = channels * BITS / 8; - PARA_DEBUG_LOG("writing wave header: %d channels, %d KHz\n", channels, sample_rate); + PARA_DEBUG_LOG("writing wave header: %u channels, %u KHz\n", channels, sample_rate); memset(headbuf, 0, WAV_HEADER_LEN); memcpy(headbuf, "RIFF", 4); write_u32(headbuf + 4, size - 8); diff --git a/wma_common.c b/wma_common.c index 8886a061..95bb9ace 100644 --- a/wma_common.c +++ b/wma_common.c @@ -52,7 +52,7 @@ static int find_audio_stream_info(const char *buf, int len) if (!p) return -E_WMA_NO_GUID; - PARA_DEBUG_LOG("found audio stream guid@%0x\n", (int)(p - buf)); + PARA_DEBUG_LOG("found audio stream guid@%0x\n", (unsigned)(p - buf)); return p - buf + 16; } @@ -100,14 +100,14 @@ int read_asf_header(const char *buf, int loaded, struct asf_header_info *ahi) ahi->sample_rate); ahi->bit_rate = 8 * read_u16(start + 46); - PARA_INFO_LOG("bit rate: %d\n", ahi->bit_rate); + PARA_INFO_LOG("bit rate: %u\n", ahi->bit_rate); ahi->block_align = read_u16(start + 50); PARA_INFO_LOG("block_align: %d\n", ahi->block_align); ahi->flags1 = read_u32(start + 56); ahi->flags2 = read_u16(start + 60); - PARA_INFO_LOG("read_asf_header: flags1: %d, flag2: %d\n", + PARA_INFO_LOG("read_asf_header: flags1: %u, flag2: %u\n", ahi->flags1, ahi->flags2); ahi->use_exp_vlc = ahi->flags2 & 0x0001; ahi->use_bit_reservoir = ahi->flags2 & 0x0002; diff --git a/wmadec_filter.c b/wmadec_filter.c index 0dff2b79..7691553e 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -371,8 +371,8 @@ static int wma_init(struct private_wmadec_data *pwd) else high_freq = high_freq * 0.5; } - PARA_INFO_LOG("channels=%d sample_rate=%d " - "bitrate=%d block_align=%d\n", + PARA_INFO_LOG("channels=%u sample_rate=%u " + "bitrate=%u block_align=%d\n", ahi->channels, ahi->sample_rate, ahi->bit_rate, ahi->block_align); PARA_INFO_LOG("frame_len=%d, bps=%f bps1=%f " -- 2.39.5