From: Denys Vlasenko Date: Wed, 16 May 2012 10:20:17 +0000 (+0200) Subject: Stop using non-standard %Zu and %Zd formats for size_t printing X-Git-Tag: v4.8~227 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=048cc42f08ac64a04d14e6de17611a5e7ec3b400;p=strace Stop using non-standard %Zu and %Zd formats for size_t printing The documented formats are %zu and %zd, but since our (normally disabled) "fast" printf code doesn't support those too, I convert them to %lu and %ld. * bjm.c (sys_query_module): Convert %Zd usages to %lu. * system.c (sys_sysctl): Likewise. Signed-off-by: Denys Vlasenko --- diff --git a/bjm.c b/bjm.c index 6ae37587..364dca71 100644 --- a/bjm.c +++ b/bjm.c @@ -115,7 +115,7 @@ sys_query_module(struct tcb *tcp) printflags(modflags, mi.flags, "MOD_???"); tprintf(", usecount=%lu}, ", mi.usecount); } - tprintf("%Zu", ret); + tprintf("%lu", (unsigned long)ret); } else if ((tcp->u_arg[1]==QM_MODULES) || (tcp->u_arg[1]==QM_DEPS) || (tcp->u_arg[1]==QM_REFS)) { @@ -127,11 +127,11 @@ sys_query_module(struct tcb *tcp) if (!data) { fprintf(stderr, "out of memory\n"); - tprintf(" /* %Zu entries */ ", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); } else { if (umoven(tcp, tcp->u_arg[2], tcp->u_arg[3], data) < 0) { - tprintf(" /* %Zu entries */ ", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); } else { for (idx = 0; idx < ret; idx++) { tprintf("%s%s", @@ -143,8 +143,8 @@ sys_query_module(struct tcb *tcp) free(data); } } else - tprintf(" /* %Zu entries */ ", ret); - tprintf("}, %Zu", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); + tprintf("}, %lu", (unsigned long)ret); } else if (tcp->u_arg[1]==QM_SYMBOLS) { tprints("{"); if (!abbrev(tcp)) { @@ -154,11 +154,11 @@ sys_query_module(struct tcb *tcp) if (!data) { fprintf(stderr, "out of memory\n"); - tprintf(" /* %Zu entries */ ", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); } else { if (umoven(tcp, tcp->u_arg[2], tcp->u_arg[3], data) < 0) { - tprintf(" /* %Zu entries */ ", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); } else { for (idx = 0; idx < ret; idx++) { tprintf("%s{name=%s, value=%lu}", @@ -171,8 +171,8 @@ sys_query_module(struct tcb *tcp) free(data); } } else - tprintf(" /* %Zu entries */ ", ret); - tprintf("}, %Zd", ret); + tprintf(" /* %lu entries */ ", (unsigned long)ret); + tprintf("}, %ld", (unsigned long)ret); } else { printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]); tprintf(", %#lx", tcp->u_arg[4]); diff --git a/system.c b/system.c index a7764927..8efe90ef 100644 --- a/system.c +++ b/system.c @@ -845,9 +845,9 @@ sys_sysctl(struct tcb *tcp) umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) { free(name); if (entering(tcp)) - tprintf("{%p, %d, %p, %p, %p, %Zu}", + tprintf("{%p, %d, %p, %p, %p, %lu}", info.name, info.nlen, info.oldval, - info.oldlenp, info.newval, info.newlen); + info.oldlenp, info.newval, (unsigned long)info.newlen); return 0; } @@ -965,17 +965,18 @@ sys_sysctl(struct tcb *tcp) #endif )))) { printpath(tcp, (size_t)info.oldval); - tprintf(", %Zu, ", oldlen); + tprintf(", %lu, ", (unsigned long)oldlen); if (info.newval == 0) tprints("NULL"); else if (syserror(tcp)) tprintf("%p", info.newval); else printpath(tcp, (size_t)info.newval); - tprintf(", %Zd", info.newlen); + tprintf(", %ld}", (unsigned long)info.newlen); } else { - tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen, - info.newval, info.newlen); + tprintf("%p, %ld, %p, %ld}", + info.oldval, (unsigned long)oldlen, + info.newval, (unsigned long)info.newlen); } tprints("}"); }