From f3b886751816c79131658b959f1530c6a2e9c39d Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 16 Feb 2008 16:02:49 +0000 Subject: [PATCH] Mark params unused in compiles for standalone; remove unused param. --- xwords4/common/comtypes.h | 6 ++++++ xwords4/common/game.c | 19 ++++++++++++------- xwords4/common/nwgamest.c | 5 ++++- xwords4/wince/cemain.c | 30 +++++++++++++++--------------- xwords4/wince/ceprefs.c | 6 ++++-- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index f49a47d97..171df675e 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -225,4 +225,10 @@ typedef struct CommonPrefs { # define XP_UNUSED_KEYBOARD_NAV(x) UNUSED__ ## x __attribute__((unused)) #endif +#ifndef XWFEATURE_STANDALONE_ONLY +# define XP_UNUSED_STANDALONE(x) x +#else +# define XP_UNUSED_STANDALONE(x) UNUSED__ ## x __attribute__((unused)) +#endif + #endif diff --git a/xwords4/common/game.c b/xwords4/common/game.c index 2d99f6b3d..52d5ea4db 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -73,8 +73,9 @@ void game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util, DrawCtx* draw, XP_U16 gameID, CommonPrefs* cp, - TransportSend sendproc, IF_CH( TransportReset resetproc ) - void* closure ) + TransportSend XP_UNUSED_STANDALONE(sendproc), + IF_CH( TransportReset resetproc ) + void* XP_UNUSED_STANDALONE(closure) ) { XP_U16 nPlayersHere, nPlayersTotal; @@ -111,9 +112,12 @@ game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi, } /* game_makeNewGame */ void -game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util, - XP_U16 gameID, CommonPrefs* cp, TransportSend sendproc, - IF_CH(TransportReset resetproc) void* closure ) +game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, + XW_UtilCtxt* XP_UNUSED_STANDALONE(util), + XP_U16 gameID, CommonPrefs* cp, + TransportSend XP_UNUSED_STANDALONE(sendproc), + IF_CH(TransportReset resetproc) + void* XP_UNUSED_STANDALONE(closure) ) { XP_U16 i; XP_U16 nPlayersHere, nPlayersTotal; @@ -163,8 +167,9 @@ XP_Bool game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game, CurGameInfo* gi, DictionaryCtxt* dict, XW_UtilCtxt* util, DrawCtx* draw, CommonPrefs* cp, - TransportSend sendProc, IF_CH(TransportReset resetProc) - void* closure ) + TransportSend XP_UNUSED_STANDALONE(sendProc), + IF_CH(TransportReset resetProc) + void* XP_UNUSED_STANDALONE(closure) ) { XP_Bool success = XP_FALSE; XP_U8 strVersion; diff --git a/xwords4/common/nwgamest.c b/xwords4/common/nwgamest.c index 7c7640a78..1b3547e3f 100644 --- a/xwords4/common/nwgamest.c +++ b/xwords4/common/nwgamest.c @@ -207,7 +207,8 @@ cpToLP( NGValue value, const void* cbClosure ) } /* cpToLP */ XP_Bool -newg_store( NewGameCtx* ngc, CurGameInfo* gi, XP_Bool warn ) +newg_store( NewGameCtx* ngc, CurGameInfo* gi, + XP_Bool XP_UNUSED_STANDALONE(warn) ) { XP_U16 player; XP_Bool consistent = checkConsistent( ngc, warn ); @@ -467,6 +468,7 @@ adjustOneRow( NewGameCtx* ngc, XP_U16 player, XP_Bool force ) * the most common case, which is playing again with the same players. In * that case changing role then back again should not lose/change data. */ +#ifndef XWFEATURE_STANDALONE_ONLY static void changeRole( NewGameCtx* ngc, DeviceRole newRole ) { @@ -488,6 +490,7 @@ changeRole( NewGameCtx* ngc, DeviceRole newRole ) setRoleStrings( ngc ); } } +#endif static void setRoleStrings( NewGameCtx* ngc ) diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index eb42f5f05..397479571 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -666,8 +666,8 @@ ceSetTitleFromName( CEAppGlobals* globals ) } /* ceSetTitleFromName */ static void -ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp, - const CommsAddrRec* addr ) +ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, + const CommsAddrRec* XP_UNUSED_STANDALONE(addr) ) { DictionaryCtxt* dict; XP_UCHAR* newDictName = globals->gameInfo.dictName; @@ -709,11 +709,6 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp, newGameID, &globals->appPrefs.cp, CE_SEND_PROC, CE_RESET_PROC globals ); - if ( !!gp ) { - globals->gameInfo.hintsNotAllowed = gp->hintsNotAllowed; - globals->gameInfo.robotSmartness = gp->robotSmartness; - } - #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH if ( !!addr ) { XP_ASSERT( globals->game.comms != NULL ); @@ -1074,7 +1069,8 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) hWnd = FindWindow( szWindowClass, szTitle); if ( hWnd ) { SetForegroundWindow( (HWND)((ULONG) hWnd | 0x00000001) ); - return FALSE; + result = FALSE; + goto exit; } (void)CreateDirectory( DEFAULT_DIR_NAME, 0 ); @@ -1110,8 +1106,9 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) CW_USEDEFAULT, NULL, NULL, hInstance, globals); globals->hWnd = hWnd; - if (!hWnd) { - return FALSE; + if (!hWnd) { + result = FALSE; + goto exit; } #ifdef _WIN32_WCE @@ -1148,7 +1145,8 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) "http://xwords.sf.net." ); messageBoxStream( globals, stream, L"Dictionary Not Found" ); stream_destroy( stream ); - return FALSE; + result = FALSE; + goto exit; } #endif @@ -1189,9 +1187,10 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) } #endif if ( result && !newDone ) { - ceInitAndStartBoard( globals, !oldGameLoaded, NULL, NULL ); + ceInitAndStartBoard( globals, !oldGameLoaded, NULL ); } + exit: return result; } /* InitInstance */ @@ -1370,7 +1369,7 @@ ceDoNewGame( CEAppGlobals* globals ) } #endif - ceInitAndStartBoard( globals, XP_TRUE, NULL, addr ); + ceInitAndStartBoard( globals, XP_TRUE, addr ); changed = XP_TRUE; } @@ -1420,7 +1419,7 @@ ceChooseAndOpen( CEAppGlobals* globals ) globals->curGameName = name; if ( ceLoadSavedGame( globals ) ) { - ceInitAndStartBoard( globals, XP_FALSE, NULL, NULL ); + ceInitAndStartBoard( globals, XP_FALSE, NULL ); ceSetTitleFromName( globals ); } else { XP_LOGF( "failed to open chosen game" ); @@ -2779,7 +2778,8 @@ ce_util_engineProgressCallback( XW_UtilCtxt* XP_UNUSED(uc) ) static void ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, - XP_U16 when, XWTimerProc proc, void* closure ) + XP_U16 XP_UNUSED_STANDALONE(when), XWTimerProc proc, + void* closure ) { CEAppGlobals* globals = (CEAppGlobals*)uc->closure; XP_U32 timerID; diff --git a/xwords4/wince/ceprefs.c b/xwords4/wince/ceprefs.c index fc2051733..3d807a42c 100755 --- a/xwords4/wince/ceprefs.c +++ b/xwords4/wince/ceprefs.c @@ -102,7 +102,8 @@ adjustForChoice( HWND hDlg, CePrefsDlgState* state ) * committing should user cancel. */ void -loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs, +loadStateFromCurPrefs( CEAppGlobals* XP_UNUSED_STANDALONE(globals), + const CEAppPrefs* appPrefs, const CurGameInfo* gi, CePrefsPrefs* prefsPrefs ) { prefsPrefs->gp.hintsNotAllowed = gi->hintsNotAllowed; @@ -132,7 +133,8 @@ loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs, } /* loadStateFromCurPrefs */ void -loadCurPrefsFromState( CEAppGlobals* globals, CEAppPrefs* appPrefs, +loadCurPrefsFromState( CEAppGlobals* XP_UNUSED_STANDALONE(globals), + CEAppPrefs* appPrefs, CurGameInfo* gi, const CePrefsPrefs* prefsPrefs ) { gi->hintsNotAllowed = prefsPrefs->gp.hintsNotAllowed;