Change util function to use signed type; other cleanup to compile with various features.

This commit is contained in:
ehouse 2007-12-05 06:28:51 +00:00
parent 1926c84825
commit d5d29adc0c
7 changed files with 22 additions and 11 deletions

View file

@ -98,7 +98,7 @@ typedef struct TrayContext TrayContext;
typedef struct PoolContext PoolContext; typedef struct PoolContext PoolContext;
typedef struct XW_UtilCtxt XW_UtilCtxt; typedef struct XW_UtilCtxt XW_UtilCtxt;
typedef XP_U16 XP_PlayerAddr; typedef XP_S16 XP_PlayerAddr;
typedef enum { typedef enum {
TIMER_PENDOWN = 1, /* ARM doesn't like ids of 0... */ TIMER_PENDOWN = 1, /* ARM doesn't like ids of 0... */
@ -213,6 +213,12 @@ typedef struct CommonPrefs {
# define XP_UNUSED_BT(x) UNUSED__ ## x __attribute__((unused)) # define XP_UNUSED_BT(x) UNUSED__ ## x __attribute__((unused))
#endif #endif
#if BT_USE_RFCOMM
# define XP_UNUSED_RFCOMM(x) x
#else
# define XP_UNUSED_RFCOMM(x) UNUSED__ ## x __attribute__((unused))
#endif
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
# define XP_UNUSED_KEYBOARD_NAV(x) x # define XP_UNUSED_KEYBOARD_NAV(x) x
#else #else

View file

@ -99,7 +99,7 @@ typedef struct UtilVtable {
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
XWStreamCtxt* (*m_util_makeStreamFromAddr )(XW_UtilCtxt* uc, XWStreamCtxt* (*m_util_makeStreamFromAddr )(XW_UtilCtxt* uc,
XP_U16 channelNo ); XP_PlayerAddr channelNo );
#endif #endif
XWBonusType (*m_util_getSquareBonus)( XW_UtilCtxt* uc, ModelCtxt* model, XWBonusType (*m_util_getSquareBonus)( XW_UtilCtxt* uc, ModelCtxt* model,

View file

@ -695,7 +695,7 @@ curses_socket_changed( void* closure, int oldSock, int newSock,
static void static void
curses_socket_acceptor( int listener, Acceptor func, CommonGlobals* cGlobals, curses_socket_acceptor( int listener, Acceptor func, CommonGlobals* cGlobals,
void** storage ) void** XP_UNUSED(storage) )
{ {
CursesAppGlobals* globals = (CursesAppGlobals*)cGlobals; CursesAppGlobals* globals = (CursesAppGlobals*)cGlobals;
XP_ASSERT( !cGlobals->acceptor || (func == cGlobals->acceptor) ); XP_ASSERT( !cGlobals->acceptor || (func == cGlobals->acceptor) );
@ -705,10 +705,10 @@ curses_socket_acceptor( int listener, Acceptor func, CommonGlobals* cGlobals,
} }
static int static int
figureTimeout( CursesAppGlobals* XP_UNUSED_RELAY(globals) ) figureTimeout( CursesAppGlobals* globals )
{ {
int result = INFINITE_TIMEOUT; int result = INFINITE_TIMEOUT;
#ifdef XWFEATURE_RELAY #ifdef RELAY_HEARTBEAT
if ( globals->cGlobals.timerProcs[TIMER_HEARTBEAT] != 0 ) { if ( globals->cGlobals.timerProcs[TIMER_HEARTBEAT] != 0 ) {
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util ); XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util );
XP_U32 then = globals->nextTimer; XP_U32 then = globals->nextTimer;
@ -737,7 +737,7 @@ blocking_gotEvent( CursesAppGlobals* globals, int* ch )
numEvents = poll( globals->fdArray, globals->fdCount, timeout ); numEvents = poll( globals->fdArray, globals->fdCount, timeout );
if ( timeout != INFINITE_TIMEOUT && numEvents == 0 ) { if ( timeout != INFINITE_TIMEOUT && numEvents == 0 ) {
#ifdef XWFEATURE_RELAY #ifdef RELAY_HEARTBEAT
if ( !globals->cGlobals.params->noHeartbeat ) { if ( !globals->cGlobals.params->noHeartbeat ) {
linuxFireTimer( &globals->cGlobals, TIMER_HEARTBEAT ); linuxFireTimer( &globals->cGlobals, TIMER_HEARTBEAT );
} }

View file

@ -222,7 +222,8 @@ lbt_accept( int listener, void* ctxt )
} /* lbt_accept */ } /* lbt_accept */
static void static void
lbt_register( LinBtStuff* btStuff, unsigned short l2_psm, uint8_t rc_channel ) lbt_register( LinBtStuff* btStuff, unsigned short l2_psm,
uint8_t XP_UNUSED_RFCOMM(rc_channel) )
{ {
LOG_FUNC(); LOG_FUNC();
if ( NULL == btStuff->u.master.session ) { if ( NULL == btStuff->u.master.session ) {

View file

@ -428,7 +428,9 @@ linux_tcp_send( const XP_U8* buf, XP_U16 buflen,
return result; return result;
} /* linux_tcp_send */ } /* linux_tcp_send */
#endif /* XWFEATURE_RELAY */
#ifdef COMMS_HEARTBEAT
static void static void
linux_tcp_reset( CommonGlobals* globals ) linux_tcp_reset( CommonGlobals* globals )
{ {
@ -438,7 +440,7 @@ linux_tcp_reset( CommonGlobals* globals )
globals->socket = -1; globals->socket = -1;
} }
} }
#endif /* XWFEATURE_RELAY */ #endif
#ifdef COMMS_HEARTBEAT #ifdef COMMS_HEARTBEAT
void void

View file

@ -109,7 +109,7 @@ linux_udp_reset( CommonGlobals* globals )
XP_MEMCPY( &addr, &stuff->addr, sizeof(addr) ); XP_MEMCPY( &addr, &stuff->addr, sizeof(addr) );
linux_udp_close( globals ); linux_udp_close( globals );
} }
sleep( 3 ); sleep( 1 );
linux_udp_open( globals, &addr ); linux_udp_open( globals, &addr );
LOG_RETURN_VOID(); LOG_RETURN_VOID();
} }

View file

@ -128,7 +128,7 @@ static DictionaryCtxt* palm_util_makeEmptyDict( XW_UtilCtxt* uc );
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
static XWStreamCtxt* palm_util_makeStreamFromAddr( XW_UtilCtxt* uc, static XWStreamCtxt* palm_util_makeStreamFromAddr( XW_UtilCtxt* uc,
XP_U16 channelNo ); XP_PlayerAddr channelNo );
#endif #endif
static const XP_UCHAR* palm_util_getUserString( XW_UtilCtxt* uc, static const XP_UCHAR* palm_util_getUserString( XW_UtilCtxt* uc,
XP_U16 stringCode ); XP_U16 stringCode );
@ -2748,7 +2748,9 @@ mainViewHandleEvent( EventPtr event )
/* Would be better to beep when no remote players.... */ /* Would be better to beep when no remote players.... */
case XW_RESENDIR_PULLDOWN_ID: case XW_RESENDIR_PULLDOWN_ID:
if ( !!globals->game.comms ) { if ( !!globals->game.comms ) {
#ifdef XWFEATURE_BLUETOOTH
globals->suspendBT = XP_FALSE; globals->suspendBT = XP_FALSE;
#endif
(void)comms_resendAll( globals->game.comms ); (void)comms_resendAll( globals->game.comms );
} }
break; break;
@ -3871,7 +3873,7 @@ palm_util_makeEmptyDict( XW_UtilCtxt* uc )
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
static XWStreamCtxt* static XWStreamCtxt*
palm_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_U16 channelNo ) palm_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
{ {
XWStreamCtxt* stream; XWStreamCtxt* stream;
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure; PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;