From 2cf12c43c6a5822212f1d4e42dca7c059a1a9000 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 14 Jul 2009 00:01:09 +0100 Subject: [PATCH] Use AFS_PTR_FMT to format pointers Replace "0x%x" with "%"AFS_FMT_PTR for pointer printing in all locations where gcc flags a warning. This change is warnings reduction driven - there are many more occurences of this in the code which don't currently result in compiler warnings, because the va_args functions they're used in aren't defined as printflike. Reviewed-on: http://gerrit.openafs.org/75 Verified-by: Russ Allbery Reviewed-by: Russ Allbery Reviewed-by: Derrick Brashear Verified-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/config/stds.h | 2 +- src/ptserver/ptserver.c | 2 +- src/rx/rx_event.c | 7 +++++-- src/rx/rx_user.c | 4 ++-- src/xstat/xstat_cm.c | 10 +++++----- src/xstat/xstat_cm_test.c | 6 +++--- src/xstat/xstat_fs.c | 10 +++++----- src/xstat/xstat_fs_test.c | 4 ++-- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/config/stds.h b/src/config/stds.h index f451b16..69ef40a 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -287,7 +287,7 @@ typedef struct afsUUID afsUUID; #define AFS_SIZET_FMT "Iu" #else #define AFS_INT64_FMT "lld" -#define AFS_PTR_FMT "x" +#define AFS_PTR_FMT "p" #define AFS_SIZET_FMT "u" #endif diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index 6758b08..745e5e0 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -342,7 +342,7 @@ main(int argc, char **argv) rxMaxMTU = atoi(argv[++a]); if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) { - printf("rxMaxMTU %lu invalid; must be between %d-%d\n", + printf("rxMaxMTU %d invalid; must be between %d-%lu\n", rxMaxMTU, RX_MIN_PACKET_SIZE, RX_MAX_PACKET_DATA_SIZE); PT_EXIT(1); diff --git a/src/rx/rx_event.c b/src/rx/rx_event.c index 4cf847a..b0a06d4 100644 --- a/src/rx/rx_event.c +++ b/src/rx/rx_event.c @@ -225,7 +225,9 @@ _rxevent_Post(struct clock *when, struct clock *now, if (rx_Log_event) { struct clock now1; clock_GetTime(&now1); - fprintf(rx_Log_event, "%ld.%ld: rxevent_Post(%ld.%ld, %lp, %lp, %lp, %d)\n", + fprintf(rx_Log_event, "%ld.%ld: rxevent_Post(%ld.%ld, " + "%"AFS_PTR_FMT", %"AFS_PTR_FMT", " + "%"AFS_PTR_FMT", %d)\n", afs_printable_int32_ld(now1.sec), afs_printable_int32_ld(now1.usec), afs_printable_int32_ld(when->sec), @@ -401,7 +403,8 @@ rxevent_Cancel_1(struct rxevent *ev, struct rx_call *call, if (rx_Log_event) { struct clock now; clock_GetTime(&now); - fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %lp, %lp)\n", + fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %" + AFS_PTR_FMT ", %p" AFS_PTR_FMT ")\n", (int)now.sec, (int)now.usec, (int)ev->eventTime.sec, (int)ev->eventTime.usec, ev->func.newfunc, ev->arg); diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index 8049bb6..36d3b1f 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -464,9 +464,9 @@ rxi_syscall(a3, a4, a5) void *a5; { afs_uint32 rcode; - void (*old) (); + void (*old) (int); - old = (void (*)())signal(SIGSYS, SIG_IGN); + old = signal(SIGSYS, SIG_IGN); #if defined(AFS_SGI_ENV) rcode = afs_syscall(a3, a4, a5); diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c index 88c9e11..2aadde3 100644 --- a/src/xstat/xstat_cm.c +++ b/src/xstat/xstat_cm.c @@ -257,12 +257,12 @@ xstat_cm_LWP(void *unused) if (xstat_cm_debug) { printf - ("%s: Calling RXAFSCB_GetXStats, conn=0x%" AFS_PTR_FMT ", clientVersionNumber=%d, collectionNumber=%d, srvVersionNumberP=0x%" AFS_PTR_FMT ", timeP=0x%" AFS_PTR_FMT ", dataP=0x%" AFS_PTR_FMT "\n", + ("%s: Calling RXAFSCB_GetXStats, conn=%" AFS_PTR_FMT ", clientVersionNumber=%d, collectionNumber=%d, srvVersionNumberP=%" AFS_PTR_FMT ", timeP=%" AFS_PTR_FMT ", dataP=%" AFS_PTR_FMT "\n", rn, curr_conn->rxconn, clientVersionNumber, *currCollIDP, &srvVersionNumber, &(xstat_cm_Results.probeTime), &(xstat_cm_Results.data)); - printf("%s: [bufflen=%d, buffer at 0x%" AFS_PTR_FMT "]\n", rn, + printf("%s: [bufflen=%d, buffer at %" AFS_PTR_FMT "]\n", rn, xstat_cm_Results.data.AFSCB_CollData_len, xstat_cm_Results.data.AFSCB_CollData_val); } @@ -314,7 +314,7 @@ xstat_cm_LWP(void *unused) * that we've finished our collection round. */ if (xstat_cm_debug) - printf("[%s] Signalling main process at 0x%" AFS_PTR_FMT "\n", rn, + printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn, &terminationEvent); oneShotCode = LWP_SignalProcess(&terminationEvent); if (oneShotCode) @@ -559,7 +559,7 @@ xstat_cm_Init(int a_numServers, struct sockaddr_in *a_socketArray, conn_err = 1; } if (xstat_cm_debug) - printf("[%s] New connection at 0x%" AFS_PTR_FMT "\n", rn, curr_conn->rxconn); + printf("[%s] New connection at %" AFS_PTR_FMT "\n", rn, curr_conn->rxconn); /* * Bump the current xstat_cm connection to set up. @@ -586,7 +586,7 @@ xstat_cm_Init(int a_numServers, struct sockaddr_in *a_socketArray, return (code); } if (xstat_cm_debug) - printf("[%s] Probe LWP process structure located at 0x%" AFS_PTR_FMT "\n", rn, + printf("[%s] Probe LWP process structure located at %" AFS_PTR_FMT "\n", rn, probeLWP_ID); /* diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index 3c2f346..de9a285 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -134,7 +134,7 @@ PrintCallInfo(void) xstat_cm_Results.probeNum, printableTime); if (debugging_on) - printf("\n[%d entries returned at 0x%x]\n\n", numInt32s, currInt32); + printf("\n[%d entries returned at %" AFS_PTR_FMT "]\n\n", numInt32s, currInt32); for (i = 0; i < numInt32s; i++) printf("%d ", *currInt32++); @@ -1349,8 +1349,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock) * One-shot operation; just wait for the collection to be done. */ if (debugging_on) - printf("[%s] Calling LWP_WaitProcess() on event 0x%x\n", rn, - &terminationEvent); + printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT + "\n", rn, &terminationEvent); waitCode = LWP_WaitProcess(&terminationEvent); if (debugging_on) printf("[%s] Returned from LWP_WaitProcess()\n", rn); diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c index c149562..9f03030 100644 --- a/src/xstat/xstat_fs.c +++ b/src/xstat/xstat_fs.c @@ -286,12 +286,12 @@ xstat_fs_LWP(void *unused) if (xstat_fs_debug) { printf - ("%s: Calling RXAFS_GetXStats, conn=0x%" AFS_PTR_FMT ", clientVersionNumber=%d, collectionNumber=%d, srvVersionNumberP=0x%" AFS_PTR_FMT ", timeP=0x%" AFS_PTR_FMT ", dataP=0x%" AFS_PTR_FMT "\n", + ("%s: Calling RXAFS_GetXStats, conn=%" AFS_PTR_FMT ", clientVersionNumber=%d, collectionNumber=%d, srvVersionNumberP=%" AFS_PTR_FMT ", timeP=%" AFS_PTR_FMT ", dataP=%" AFS_PTR_FMT "\n", rn, curr_conn->rxconn, clientVersionNumber, *currCollIDP, &srvVersionNumber, &(xstat_fs_Results.probeTime), &(xstat_fs_Results.data)); - printf("%s: [bufflen=%d, buffer at 0x%" AFS_PTR_FMT "]\n", rn, + printf("%s: [bufflen=%d, buffer at %" AFS_PTR_FMT "]\n", rn, xstat_fs_Results.data.AFS_CollData_len, xstat_fs_Results.data.AFS_CollData_val); } @@ -343,7 +343,7 @@ xstat_fs_LWP(void *unused) * that we've finished our collection round. */ if (xstat_fs_debug) - printf("[%s] Signalling main process at 0x%" AFS_PTR_FMT "\n", rn, + printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn, &terminationEvent); oneShotCode = LWP_SignalProcess(&terminationEvent); if (oneShotCode) @@ -619,7 +619,7 @@ xstat_fs_Init(int a_numServers, struct sockaddr_in *a_socketArray, conn_err = 1; } if (xstat_fs_debug) - printf("[%s] New connection at 0x%" AFS_PTR_FMT "\n", rn, curr_conn->rxconn); + printf("[%s] New connection at %" AFS_PTR_FMT "\n", rn, curr_conn->rxconn); /* * Bump the current xstat_fs connection to set up. @@ -673,7 +673,7 @@ xstat_fs_Init(int a_numServers, struct sockaddr_in *a_socketArray, return (code); } if (xstat_fs_debug) - printf("[%s] Probe LWP process structure located at 0x%" AFS_PTR_FMT "\n", rn, + printf("[%s] Probe LWP process structure located at %" AFS_PTR_FMT "\n", rn, probeLWP_ID); /* diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index 75af1a4..7c949ab 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -123,7 +123,7 @@ PrintCallInfo(void) printableTime); if (debugging_on) - printf("\n[%d entries returned at 0x%" AFS_PTR_FMT "]\n\n", numInt32s, currInt32); + printf("\n[%d entries returned at %" AFS_PTR_FMT "]\n\n", numInt32s, currInt32); for (i = 0; i < numInt32s; i++) printf("%d ", *currInt32++); @@ -779,7 +779,7 @@ RunTheTest(struct cmd_syndesc *a_s, void *dummy) * One-shot operation; just wait for the collection to be done. */ if (debugging_on) - printf("[%s] Calling LWP_WaitProcess() on event 0x%" AFS_PTR_FMT "\n", rn, + printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT "\n", rn, &terminationEvent); waitCode = LWP_WaitProcess(&terminationEvent); if (debugging_on) -- 1.9.4