]> granicus.if.org Git - strace/commitdiff
Stop using %h[h]u format specifiers
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 16 Apr 2012 16:12:27 +0000 (18:12 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 16 Apr 2012 16:16:13 +0000 (18:16 +0200)
This is needed for simplified printf, and reduces code size a bit.

* block.c (block_ioctl): Cast the value to unsinged and use %u
instead of using %hu.
* desc.c (sys_io_cancel): Likewise.
* resource.c (sys_sysinfo): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
block.c
desc.c
resource.c

diff --git a/block.c b/block.c
index 1dee8bf3965a197491ccb1e513484b9687ea3428..ea571b6df245f68312ec288ee0500ddc514d14c5 100644 (file)
--- a/block.c
+++ b/block.c
@@ -136,7 +136,7 @@ block_ioctl(struct tcb *tcp, long code, long arg)
                        if (syserror(tcp) || umove(tcp, arg, &val) < 0)
                                tprintf(", %#lx", arg);
                        else
-                               tprintf(", %hu", val);
+                               tprintf(", %u", (unsigned)val);
                }
                break;
 
@@ -223,10 +223,12 @@ block_ioctl(struct tcb *tcp, long code, long arg)
                        if (syserror(tcp) || umove(tcp, arg, &geo) < 0)
                                tprintf(", %#lx", arg);
                        else
-                               tprintf(", {heads=%hhu, sectors=%hhu, "
-                                       "cylinders=%hu, start=%lu}",
-                                       geo.heads, geo.sectors,
-                                       geo.cylinders, geo.start);
+                               tprintf(", {heads=%u, sectors=%u, "
+                                       "cylinders=%u, start=%lu}",
+                                       (unsigned)geo.heads,
+                                       (unsigned)geo.sectors,
+                                       (unsigned)geo.cylinders,
+                                       geo.start);
                }
                break;
 
@@ -248,10 +250,10 @@ block_ioctl(struct tcb *tcp, long code, long arg)
                        if (umove(tcp, arg, &buts) < 0)
                                tprintf(", %#lx", arg);
                        else
-                               tprintf(", {act_mask=%hu, buf_size=%u, "
+                               tprintf(", {act_mask=%u, buf_size=%u, "
                                        "buf_nr=%u, start_lba=%" PRIu64 ", "
                                        "end_lba=%" PRIu64 ", pid=%u}",
-                                       buts.act_mask, buts.buf_size,
+                                       (unsigned)buts.act_mask, buts.buf_size,
                                        buts.buf_nr, buts.start_lba,
                                        buts.end_lba, buts.pid);
                }
diff --git a/desc.c b/desc.c
index 884f143ce04e45298f1d246327af4506a0ff8376..f0c18903438f94a4624f5f54301763d797571cc8 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -950,10 +950,10 @@ sys_io_cancel(struct tcb *tcp)
                tprintf("%lu, ", tcp->u_arg[0]);
 #ifdef HAVE_LIBAIO_H
                if (umove(tcp, tcp->u_arg[1], &iocb) == 0) {
-                       tprintf("{%p, %u, %hu, %hu, %d}, ",
+                       tprintf("{%p, %u, %u, %u, %d}, ",
                                iocb.data, iocb.key,
-                               iocb.aio_lio_opcode,
-                               iocb.aio_reqprio, iocb.aio_fildes);
+                               (unsigned)iocb.aio_lio_opcode,
+                               (unsigned)iocb.aio_reqprio, iocb.aio_fildes);
                } else
 #endif
                        tprints("{...}, ");
index d7a34ef3a368b2b1c57847315c719195a147bb52..1b8f1a48dcd2ab6b765cd4467be8c77f5741dff6 100644 (file)
@@ -379,9 +379,9 @@ sys_sysinfo(struct tcb *tcp)
                                (long) si.totalram, (long) si.freeram);
                        tprintf("sharedram=%lu, bufferram=%lu} ",
                                (long) si.sharedram, (long) si.bufferram);
-                       tprintf("totalswap=%lu, freeswap=%lu, procs=%hu}",
+                       tprintf("totalswap=%lu, freeswap=%lu, procs=%u}",
                                (long) si.totalswap, (long) si.freeswap,
-                               si.procs);
+                               (unsigned)si.procs);
                }
        }
        return 0;