From af1ca9af8464dafb0b53af088e7c37bb677a0445 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 6 Dec 2008 15:59:30 +0000 Subject: [PATCH] Quash some compile-time warnings. snprintf instead of sprintf. --- xwords4/common/dragdrpp.c | 2 +- xwords4/common/game.c | 4 ++++ xwords4/wince/cedebug.c | 3 ++- xwords4/wince/cesvdgms.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xwords4/common/dragdrpp.c b/xwords4/common/dragdrpp.c index 862ea58b1..9995b3ce3 100644 --- a/xwords4/common/dragdrpp.c +++ b/xwords4/common/dragdrpp.c @@ -526,7 +526,7 @@ setLimitsFrom( const BoardCtxt* board, BdHintLimits* limits ) #endif static XP_Bool -scrollTimerProc( void* closure, XWTimerReason why ) +scrollTimerProc( void* closure, XWTimerReason XP_UNUSED_DBG(why) ) { XP_Bool draw = XP_FALSE; BoardCtxt* board = (BoardCtxt*)closure; diff --git a/xwords4/common/game.c b/xwords4/common/game.c index d82b78406..e7d11429b 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -143,6 +143,10 @@ game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, nPlayersHere, nPlayersTotal, sendproc, IF_CH(resetproc) closure ); } +#else +# ifdef DEBUG + mpool = mpool; /* quash unused formal warning */ +# endif #endif model_init( game->model, gi->boardSize, gi->boardSize ); diff --git a/xwords4/wince/cedebug.c b/xwords4/wince/cedebug.c index d4e054172..e455fda4c 100644 --- a/xwords4/wince/cedebug.c +++ b/xwords4/wince/cedebug.c @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include "cedebug.h" #ifdef DEBUG @@ -120,7 +121,7 @@ logLastError( const char* comment ) XP_U16 len; XP_U16 lenSoFar; - sprintf( msg, "%s (err: %ld): ", comment, lastErr ); + snprintf( msg, sizeof(msg), "%s (err: %ld): ", comment, lastErr ); lenSoFar = strlen( msg ); FormatMessage( diff --git a/xwords4/wince/cesvdgms.c b/xwords4/wince/cesvdgms.c index 450e0c7e7..d8d12387b 100644 --- a/xwords4/wince/cesvdgms.c +++ b/xwords4/wince/cesvdgms.c @@ -21,6 +21,7 @@ #include #include "stdafx.h" #include +#include #ifdef _win32_wce #include #endif