]> git.tue.mpg.de Git - paraslash.git/commitdiff
Fix signedness issues in format strings.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 23 Nov 2016 22:16:50 +0000 (23:16 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 4 Dec 2016 10:14:27 +0000 (11:14 +0100)
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.

35 files changed:
aac_afh.c
aacdec_filter.c
acl.c
afh_recv.c
afs.c
aft.c
alsa_mix.c
alsa_write.c
audiod.c
blob.c
check_wav.c
command.c
crypt_common.c
fade.c
fecdec_filter.c
file_write.c
filter_common.c
flac_afh.c
gui.c
mood.c
mp3_afh.c
net.c
ogg_afh.c
ogg_afh_common.c
oggdec_filter.c
opus_afh.c
oss_write.c
play.c
server.c
spx_afh.c
string.h
vss.c
wav_filter.c
wma_common.c
wmadec_filter.c

index c49f30dea858f05c627a820685fd6538b55eb07d..bcd2a14edfd8de64baaca165f17ae855490e8cc9 100644 (file)
--- 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;
        }
index ac8148e863d8568082dca4cb3aac68843e5893a6..b40022fe160e21d254eff7ab7672826258b68a0b 100644 (file)
@@ -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 5ef9a51ca381e3f6aa3a21de21eb0e0d3b37114f..560ff9999d191f418c35695f4a6629b45436f49f 100644 (file)
--- 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;
index 164634634fedbaaf5441ebdec79dcff51e24d641..28d8f3980f814763cfe249e5762203ff5038a9a5 100644 (file)
@@ -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 0accc45108f7c6ba0c2a3a89595d957d8a566920..5f933c5b31e440438acce2e9179121db66c0600e 100644 (file)
--- 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 f14440e6fb903548e25ccfdf611f4c2f2881aa49..e8a18fd13cdca7e957dffa34c59b6e7c736fbd22 100644 (file)
--- 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");
index cad58af0a9481bd8cb7985cf87b431685f537c01..3adee929a804434fcea1999a439819dc85c66936 100644 (file)
@@ -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;
index 63a7055be35fab00847379be8ce3785a48312818..fd3b404c0359c1a571255b1ac7265b0ee0faef41 100644 (file)
@@ -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) {
index 285d2762fa1093baf3e49211eab73ca631f605db..bd97f15e22e1629e8b9b0895420438dd5fb46194 100644 (file)
--- 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 ca39de0db5fc8fdb15009d0ed1c46ec14ca15087..7a7ae756cb834ef998f37b8b88a781537392e4d3 100644 (file)
--- 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);
        }
index d1d278724f123100a96358779c1cff4520db177d..1a47f946f3fb01829ae0d84caacb7461d0d22580 100644 (file)
@@ -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);
index 0eb4efc22fa564fd2c055aa0753392696ad49a2f..fe4b92329b417009613e0f1034f747783699c2e0 100644 (file)
--- 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;
index 022692adc52ce1cb8fe4ec925e93362e89b4b754..8e52603fffc12ba701ec5a8456634cd751ea4d41 100644 (file)
@@ -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 e05e31733623dacae4beddad69580d077ad23a0d..2a4eb1e1829168f0b94ebc24bc8138be5e9f226c 100644 (file)
--- 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) {
index 26ea24a6375db1749f7f9e7b2cd3ebe05196aca8..1c3a37849d1309fbf3b676bf04c513628dc1c657 100644 (file)
@@ -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;
index ef25b0f5695d09c539635cdffe32a3b4cc6dbe53..5e66607e4dba4a0595da7f8fcfeae0dba0bf3bad 100644 (file)
@@ -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;
index 84863b39fb489cb9b4ac546b6fe4f557b1d647bf..e9b97e54633a8770009c0f746b7daa712d4135fb 100644 (file)
@@ -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);
index 2e2842b183c91bfbe06ec2de0616fb52872ba4f4..385d4f0c3a0235b9be24cdc83666308c30b959b8 100644 (file)
@@ -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 b0eae64ae129999083263846d60a9bfd939aae2e..3e01340a4b1b910245f22be77e75945ae25bc1ca 100644 (file)
--- 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 940d72a17f9cbeb1d8dec42ea26cd9a821f9cbb3..79f47e5a3d20801832d5ad396bbd5b3b98aeed08 100644 (file)
--- 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);
 }
 
index 70f2ec9f6b3817887799edab3292f7136aec0a84..2115f71c77ce745b356b917058792d0c64db42ef 100644 (file)
--- 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 1369498905faa4ab729bac8209a6a03e8b920063..fa7cd4b80a7d96b26e35add01ad97d9a123f138d 100644 (file)
--- 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;
index 29f08965077be97b6015208bb16cd8e8ef2d270c..2ddf0ee35818fc7fe7aa59ccaf04ad75e7a07502 100644 (file)
--- 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);
 }
 
index e49b803b4e7a0e6492161d7be5c2b2fa21a16a09..adab7f481fbb0e7873c1d1e1ac4968834bd81fe3 100644 (file)
@@ -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)
index 4b801356075ba8b7f1ebb4280708aac94194912a..04be7020e57f29351b73501203db6b1bfa1dbb39 100644 (file)
@@ -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:
index b1469b474d504e69bfe62ad95f6d1ee9043b65a5..64eeb03c1a4bd89bb64488495ed5d76c3ca322e9 100644 (file)
@@ -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;
 
index 12cf8b69bef2a7a189425df8ed15604f5cf10220..20186667e2f383880538275d61d1607203ed2b8a 100644 (file)
@@ -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 d2539ee134773614a40bca9941f35dd161007946..c35757a9ae4aec542da3ce94267305aff705b37d 100644 (file)
--- 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);
 }
index 088cc8b124448123ed6f4cb73f0226f584dffc25..c90045c30d81ece771a679f648b203c3aa000910 100644 (file)
--- 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);
 }
 
index b780635b383e8f95dd6f6df9f69cc09ce2c34d16..4e318af19af8940570887ac3ebf8edb7a4c25b85 100644 (file)
--- 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;
index aa8292fdf4ec1f076294842e1b6cb02dbc4f23a6..52f989417d8071a1f2ed33d99ce7fd8ba18d66c1 100644 (file)
--- 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 2acff1cb95b8e0b54a37eeb96aa653fd16443e4c..5484db9d9479401fe90e481f842c37a9afed8e4f 100644 (file)
--- 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);
index 07423a14b6f41973e1fb391b0733837b5751d1ce..88047adbb71c2becef6afe13f45ab96ddd3b1774 100644 (file)
@@ -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);
index 8886a061751caaa6c16375e244ea92a8f18a212d..95bb9ace57665ba0b9050f9fa512a750a913d52a 100644 (file)
@@ -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;
index 0dff2b7914a0e1f1e18afc412bbd331bfe32f648..7691553e4723ebaac01294ca40290be9b3eb2899 100644 (file)
@@ -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 "