From a3bc875191d8132ed9aec9015c775b2e74f8dba8 Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 11 Mar 2008 12:24:23 +0000 Subject: [PATCH] Fix errors, all in debug-only code, flagged by __attribute__ format addition. --- xwords4/common/comms.c | 6 +++--- xwords4/common/mempool.c | 6 +++--- xwords4/linux/gtkmain.c | 2 +- xwords4/linux/linuxmain.c | 2 +- xwords4/linux/linuxudp.c | 1 - xwords4/linux/xptypes.h | 1 + xwords4/palm/xptypes.h | 1 + xwords4/wince/xptypes.h | 1 + 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 4f87aee55..3da1ac828 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -1131,7 +1131,7 @@ validateInitialMessage( CommsCtxt* comms, XP_Bool hasPayload, rec = NULL; } } - LOG_RETURNF( "%lx", rec ); + LOG_RETURNF( XP_P, rec ); return rec; #else AddressRecord* rec = getRecordFor( comms, addr, *channelNo ); @@ -1171,7 +1171,7 @@ validateChannelMessage( CommsCtxt* comms, const CommsAddrRec* addr, rec->lastACK = (XP_U16)lastMsgRcd; #endif } else { - XP_LOGF( "%s: expected %d, got %d", __func__, + XP_LOGF( "%s: expected %ld, got %ld", __func__, rec->lastMsgRcd + 1, msgID ); rec = NULL; } @@ -1179,7 +1179,7 @@ validateChannelMessage( CommsCtxt* comms, const CommsAddrRec* addr, XP_LOGF( "%s: no rec for addr", __func__ ); } - LOG_RETURNF( "%lx", rec ); + LOG_RETURNF( XP_P, rec ); return rec; } /* validateChannelMessage */ diff --git a/xwords4/common/mempool.c b/xwords4/common/mempool.c index ddc7e8af2..f8f5f86f0 100644 --- a/xwords4/common/mempool.c +++ b/xwords4/common/mempool.c @@ -96,7 +96,7 @@ mpool_destroy( MemPoolCtx* mpool ) MemPoolEntry* entry; for ( entry = mpool->usedList; !!entry; entry = entry->next ) { #ifndef FOR_GREMLINS /* I don't want to hear about this right now */ - XP_WARNF( "0x%lx from ln %ld of %s\n", + XP_WARNF( "0x" XP_P " from ln %ld of %s\n", entry->ptr, entry->lineNo, entry->fileName ); #ifdef DEBUG { @@ -174,7 +174,7 @@ mpool_realloc( MemPoolCtx* mpool, void* ptr, XP_U32 newsize, const char* file, X MemPoolEntry* entry = findEntryFor( mpool, ptr, (MemPoolEntry**)NULL ); if ( !entry ) { - XP_LOGF( "findEntryFor failed; called from %s, line %d", + XP_LOGF( "findEntryFor failed; called from %s, line %ld", file, lineNo ); } else { entry->ptr = XP_PLATREALLOC( entry->ptr, newsize ); @@ -194,7 +194,7 @@ mpool_free( MemPoolCtx* mpool, void* ptr, const char* file, XP_U32 lineNo ) entry = findEntryFor( mpool, ptr, &prev ); if ( !entry ) { - XP_LOGF( "findEntryFor failed; called from %s, line %d", + XP_LOGF( "findEntryFor failed; called from %s, line %ld", file, lineNo ); } else { diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index 84d0c6f09..5e38701a0 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -336,7 +336,7 @@ createOrLoadObjects( GtkAppGlobals* globals ) #endif params->gi.gameID = util_getCurSeconds(globals->cGlobals.params->util); - XP_STATUSF( "grabbed gameID: %ld\n", params->gi.gameID ); + XP_STATUSF( "grabbed gameID: %d\n", params->gi.gameID ); game_makeNewGame( MEMPOOL &globals->cGlobals.game, ¶ms->gi, params->util, (DrawCtx*)globals->draw, diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 7035df94c..30033b3cc 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -63,7 +63,7 @@ #ifdef DEBUG void -linux_debugf( char* format, ... ) +linux_debugf( const char* format, ... ) { char buf[1000]; va_list ap; diff --git a/xwords4/linux/linuxudp.c b/xwords4/linux/linuxudp.c index 399b6ec06..c40117f5a 100644 --- a/xwords4/linux/linuxudp.c +++ b/xwords4/linux/linuxudp.c @@ -25,7 +25,6 @@ #include #include #include -#include #ifdef XWFEATURE_BLUETOOTH # include # if defined BT_USE_L2CAP diff --git a/xwords4/linux/xptypes.h b/xwords4/linux/xptypes.h index 33aa4602c..4b8cfc4ae 100644 --- a/xwords4/linux/xptypes.h +++ b/xwords4/linux/xptypes.h @@ -114,6 +114,7 @@ extern void linux_debugf(const char*, ...) #define XP_HTONS(s) htons(s) #define XP_LD "%ld" +#define XP_P "%p" #endif diff --git a/xwords4/palm/xptypes.h b/xwords4/palm/xptypes.h index 0d33616d0..f6808675b 100644 --- a/xwords4/palm/xptypes.h +++ b/xwords4/palm/xptypes.h @@ -120,6 +120,7 @@ XP_U8* palm_realloc(XP_U8* in, XP_U16 size); #endif #define XP_LD "%ld" +#define XP_P "%lx" #ifdef FEATURE_SILK # define XP_UNUSED_SILK(x) x diff --git a/xwords4/wince/xptypes.h b/xwords4/wince/xptypes.h index 6215ec7c9..2b12d5eef 100755 --- a/xwords4/wince/xptypes.h +++ b/xwords4/wince/xptypes.h @@ -118,6 +118,7 @@ XP_U16 wince_snprintf( XP_UCHAR* buf, XP_U16 len, #define XP_HTONS(s) htons(s) #define XP_LD "%ld" +#define XP_P "%p" /* The pocketpc sdk on linux renames certain functions to avoid conflicts with same-named posix symbols. */