]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/format-signedness'
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 28 Dec 2016 19:38:34 +0000 (20:38 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 28 Dec 2016 19:42:12 +0000 (20:42 +0100)
This series fixes all warnings produced by compiling with
-Wformat-signedness and adds the flag to CFLAGS if the compiler
supports it.

* refs/heads/t/format-signedness (cooking for ~2 weeks):
  gcrypt: Fix a few format-signedness issues.
  Compile with -Wformat-signedness if possible.
  Fix signedness issues in format strings.

39 files changed:
Makefile.real
NEWS.md
aac_afh.c
aac_common.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
gcrypt.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 ce4881d29c90c8626e44d384dab14c81e15b11b8..464cd68ee2a1af044d0b09e36f4681db2a836aae 100644 (file)
@@ -128,6 +128,13 @@ ifeq ($(uname_s),Linux)
        LDFLAGS += -Wl,--gc-sections
 endif
 
+cc-option = $(shell \
+       $(CC) $(1) -Werror -c -x c /dev/null -o /dev/null > /dev/null 2>&1 \
+       && echo "$(1)" \
+)
+
+STRICT_CFLAGS += $(call cc-option, -Wformat-signedness)
+
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
 ifeq ("$(origin V)", "command line")
diff --git a/NEWS.md b/NEWS.md
index 10e78ca542c556ad5406f7920672c6f0dbb66cf0..a7af771744e91e3654bd216b217f40a56eae11ea 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -14,6 +14,7 @@ NEWS
 - The openssl code has been adjusted to work also with openssl-1.1.
 - The wma decoder and audio format handler now correctly decodes
   files with unusual block sizes.
+- We now compile with -Wformat-signedness if possible.
 
 Download: [tarball](./releases/paraslash-git.tar.bz2)
 
index a30be96f4f9da70b841e26fd16a3044ebc1df8ac..1c7fd706f0a7c9fe8c9d4d8db43846be18a9304d 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -34,11 +34,11 @@ static int aac_find_stsz(char *buf, size_t buflen, off_t *skip)
                PARA_DEBUG_LOG("found stsz@%d\n", i);
                i += 8;
                sample_size = read_u32_be(buf + i);
-               PARA_DEBUG_LOG("sample size: %d\n", sample_size);
+               PARA_DEBUG_LOG("sample size: %u\n", sample_size);
                i += 4;
                sample_count = read_u32_be(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 70a9d77d51b320ee8511f394186528164362273a..812c742cf668e7ad67e6f5b502fbe6c93829f0a3 100644 (file)
@@ -73,18 +73,18 @@ int aac_find_esds(char *buf, size_t buflen, size_t *skip,
                        continue;
                i += 8;
                p = buf + i;
-               PARA_INFO_LOG("found esds@%zu, next: %x\n", i, *p);
+               PARA_INFO_LOG("found esds@%zu, next: %x\n", i, (unsigned)*p);
                if (*p == 3)
                        i += 8;
                else
                        i += 6;
                p = buf + i;
-               PARA_INFO_LOG("next: %x\n", *p);
+               PARA_INFO_LOG("next: %x\n", (unsigned)*p);
                if (*p != 4)
                        continue;
                i += 18;
                p = buf + i;
-               PARA_INFO_LOG("next: %x\n", *p);
+               PARA_INFO_LOG("next: %x\n", (unsigned)*p);
                if (*p != 5)
                        continue;
                i++;
index 9791175ecd72d6dcd22ee719f90d1e59481668b3..5725ce043089361092ddb68e05bb3c60fcf66801 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 071f657ce69c79812d29a982f69cc5c0bbf8f8b7..0946b6df3b0766f82f95f0cd100f039753543350 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);
@@ -1202,7 +1202,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 df295246db0cf1d1d6e3d0b202d43c86332db0f6..77891342313e17295d5b60ea836fd9b187705ae9 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",
@@ -2625,7 +2625,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 b39ee5e4cb6fce2b28a3b87034350f321d7cd75d..a05572df85b1de5fb5e1043abfc34c66e26c65e7 100644 (file)
@@ -96,7 +96,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 95bb1d59ffd60f277f4569e44c8909c3fe060c76..2a001ebacde964eb1f710413540cc23f2bc85699 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;
index 289748e84d16dbca133b9280dc2027e5d9c2ec67..7c19aeb0c3edc022c5b0f0425a202e37fd38d906 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -388,7 +388,7 @@ static int read_bignum(unsigned char *start, unsigned char *end, gcry_mpi_t *bn,
                for (i = 0; i < num_bytes; i++, cp++)
                        bn_size = (bn_size << 8) + *cp;
        }
-       PARA_DEBUG_LOG("bn_size %d (0x%x)\n", bn_size, bn_size);
+       PARA_DEBUG_LOG("bn_size %d (0x%x)\n", bn_size, (unsigned)bn_size);
        gret = gcry_mpi_scan(bn, GCRYMPI_FMT_STD, cp, bn_size, NULL);
        if (gret) {
                PARA_ERROR_LOG("%s while scanning n\n",
@@ -586,7 +586,7 @@ static int get_asn_public_key(const char *key_file, struct asymmetric_key **resu
        key->num_bytes = n_size;
        *result = key;
        ret = n_size;
-       PARA_INFO_LOG("successfully read %u bit asn public key\n", n_size * 8);
+       PARA_INFO_LOG("successfully read %d bit asn public key\n", n_size * 8);
 
 release_e:
        gcry_mpi_release(e);
@@ -648,7 +648,7 @@ static int get_ssh_public_key(unsigned char *data, int size, gcry_sexp_t *result
                goto release_n;
        }
        ret = nr_scanned / 32 * 32;
-       PARA_INFO_LOG("successfully read %u bit ssh public key\n", ret * 8);
+       PARA_INFO_LOG("successfully read %d bit ssh public key\n", ret * 8);
 release_n:
        gcry_mpi_release(n);
 release_e:
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 108db598a51ebb28f72cb03a10c31ebfcb44ca6e..46e8ff7d6f099e016cca6338dc399e210b9e5c97 100644 (file)
--- a/play.c
+++ b/play.c
@@ -788,7 +788,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 ca71c4d8860e49224ffd0f2203ed76a7253a1a01..1f93194474374e7450fec6a4895309c4529c5226 100644 (file)
--- a/server.c
+++ b/server.c
@@ -537,7 +537,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 27cb51d0434367e168fa49554e05bf1f13d9f473..6d57c00be2d2627624f5642a74948723bc2726fb 100644 (file)
@@ -49,7 +49,7 @@ static int find_file_properties(const char *buf, int len)
 
        if (!p)
                return -E_WMA_NO_GUID;
-       PARA_DEBUG_LOG("found file property guid@%0x\n", (int)(p - buf));
+       PARA_DEBUG_LOG("found file property guid@%0x\n", (unsigned)(p - buf));
        return p - buf + 16;
 }
 
@@ -63,7 +63,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;
 }
 
@@ -111,14 +111,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, flags2: %d\n",
+       PARA_INFO_LOG("read_asf_header: flags1: %u, flags2: %u\n",
                ahi->flags1, ahi->flags2);
        ahi->use_exp_vlc = ahi->flags2 & 0x0001;
        ahi->use_bit_reservoir = ahi->flags2 & 0x0002;
index 31a13c5094a239fca2ebd519553821933b838ba7..4c7c047a482e2b3f256cfb8c12dcd6b4de3a7500 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 "