use %zd instead of %d for size_t
authorAndre <maan@p133.(none)>
Sun, 5 Mar 2006 12:14:09 +0000 (13:14 +0100)
committerAndre <maan@p133.(none)>
Sun, 5 Mar 2006 12:14:09 +0000 (13:14 +0100)
As of version 2.1 of glibc there is the %z modifier, so use it.
This avoids many warnings of the type

warning: int format, different type arg

on x86_64.

audiod.c
compress.c
filter.c
filter_chain.c
http_recv.c
recv.c
wav.c

index 552577d..eab44b4 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -987,16 +987,16 @@ static int write_audio_data(int slot_num)
                buf = &rn->buf;
                len = &rn->loaded;
        }
-       PARA_DEBUG_LOG("writing %p (%d bytes)\n", *buf, *len);
+       PARA_DEBUG_LOG("writing %p (%zd bytes)\n", *buf, *len);
        rv = write(s->write_fd, *buf, *len);
-       PARA_DEBUG_LOG("wrote %d/%d\n", rv, *len);
+       PARA_DEBUG_LOG("wrote %d/%zd\n", rv, *len);
        if (rv < 0) {
                PARA_WARNING_LOG("write error in slot %d (fd %d): %s\n",
                        slot_num, s->write_fd, strerror(errno));
                *len = 0;
                s->fci->error = E_WRITE_AUDIO_DATA;
        } else if (rv != *len) {
-               PARA_DEBUG_LOG("partial %s write (%i/%i) for slot %d\n",
+               PARA_DEBUG_LOG("partial %s write (%i/%zd) for slot %d\n",
                        audio_formats[s->format], rv, *len, slot_num);
                *len -= rv;
                memmove(*buf, *buf + rv, *len);
index a4d881f..bad4ada 100644 (file)
@@ -124,7 +124,7 @@ static ssize_t compress(char *inbuf, size_t inbuf_len, struct filter_node *fn)
                *op++ = sample;
        }
        pcd->pn = (pcd->pn + 1) % pcd->conf->buckets_arg;
-       PARA_DEBUG_LOG("bucket: %03i, input len: %i, length: %i, peak: %05i, "
+       PARA_DEBUG_LOG("bucket: %03i, input len: %zd, length: %zd, peak: %05i, "
                "current gain: %03i, clipped: %d\n", pcd->pn, inbuf_len,
                length, peak, pcd->current_gain, pcd->clip);
        fn->loaded = length;
index 04997cf..37c1c43 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
 again:
        if (*il < INBUF_SIZE && !eof) {
                ret  = read(STDIN_FILENO, ib + *il, INBUF_SIZE - *il);
-               PARA_DEBUG_LOG("read %d/%d\n", ret, INBUF_SIZE - *il);
+               PARA_DEBUG_LOG("read %d/%zd\n", ret, INBUF_SIZE - *il);
                if (ret < 0)
                        goto out;
                if (!ret)
@@ -154,12 +154,12 @@ again:
        converted = ret;
        if (*ol) {
                ret = write(STDOUT_FILENO, ob, *ol);
-               PARA_DEBUG_LOG("wrote %d/%d\n", ret, *ol);
+               PARA_DEBUG_LOG("wrote %d/%zd\n", ret, *ol);
                if (ret <= 0)
                        goto out;
                *ol -= ret;
                if (*ol) {
-                       PARA_NOTICE_LOG("short write: %d bytes left\n", *ol);
+                       PARA_NOTICE_LOG("short write: %zd bytes left\n", *ol);
                        memmove(ob, ob + ret, *ol);
                }
        }
index d11f169..6265f19 100644 (file)
@@ -123,7 +123,7 @@ again:
                int ret;
                if (*loaded && fn->loaded < fn->bufsize) {
                        size_t old_fn_loaded = fn->loaded;
-                       PARA_DEBUG_LOG("fc %p loaded: %d, calling %s convert\n", fci, *loaded, fn->filter->name);
+                       PARA_DEBUG_LOG("fc %p loaded: %zd, calling %s convert\n", fci, *loaded, fn->filter->name);
                        ret = fn->filter->convert(ib, *loaded, fn);
                        if (ret < 0) {
                                if (!fci->error)
@@ -134,7 +134,7 @@ again:
                        *loaded -= ret;
                        conv += ret;
                        if (*loaded && ret) {
-                               PARA_DEBUG_LOG("moving %d bytes in input buffer for %s filter\n",
+                               PARA_DEBUG_LOG("moving %zd bytes in input buffer for %s filter\n",
                                        *loaded,  fn->filter->name);
                                memmove(ib, ib + ret, *loaded);
                        }
index 2e3a11b..04f8721 100644 (file)
@@ -139,7 +139,7 @@ static int http_post_select(struct receiver_node *rn, int select_ret,
        }
        ret = recv_bin_buffer(phd->fd, rn->buf + rn->loaded, BUFSIZE - rn->loaded);
        if (ret <= 0) {
-               PARA_NOTICE_LOG("recv returned %d/%d\n", ret, BUFSIZE - rn->loaded);
+               PARA_NOTICE_LOG("recv returned %d/%zd\n", ret, BUFSIZE - rn->loaded);
                return ret < 0? -E_HTTP_RECV_BUF : 0;
        }
        rn->loaded += ret;
diff --git a/recv.c b/recv.c
index abd0419..31c18a3 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -104,13 +104,13 @@ recv:
                goto recv;
        }
        ret = write(STDOUT_FILENO, rn.buf, rn.loaded);
-       PARA_DEBUG_LOG("wrote %d/%d\n", ret, rn.loaded);
+       PARA_DEBUG_LOG("wrote %d/%zd\n", ret, rn.loaded);
        if (ret < 0) {
                ret = -E_WRITE_STDOUT;
                goto out;
        }
        if (ret != rn.loaded) {
-               PARA_INFO_LOG("short write %d/%d\n", ret, rn.loaded);
+               PARA_INFO_LOG("short write %d/%zd\n", ret, rn.loaded);
                memmove(rn.buf, rn.buf + ret, rn.loaded - ret);
        }
        rn.loaded -= ret;
diff --git a/wav.c b/wav.c
index 01ac440..879b188 100644 (file)
--- a/wav.c
+++ b/wav.c
@@ -95,7 +95,7 @@ static void wav_open(struct filter_node *fn)
        fn->private_data = para_malloc(sizeof(int));
        bof = fn->private_data;
        *bof = 1;
-       PARA_DEBUG_LOG("wav filter node: %p, output buffer: %p, loaded: %d\n",
+       PARA_DEBUG_LOG("wav filter node: %p, output buffer: %p, loaded: %zd\n",
                fn, fn->buf, fn->loaded);
 }