fix linux compile; log gameID as %X everywhere

This commit is contained in:
Eric House 2022-12-30 16:14:22 -08:00
parent 9e5b074f7e
commit 16ced1dd49
11 changed files with 24 additions and 25 deletions

View file

@ -1849,8 +1849,9 @@ removeFromQueue( CommsCtxt* comms, XWEnv xwe, XP_PlayerAddr channelNo, MsgID msg
CNO_FMT( cbuf, channelNo ); CNO_FMT( cbuf, channelNo );
XP_LOGFF( "(channelNo=%d): remove msgs <= " XP_LD " for %s (queueLen: %d)", XP_LOGFF( "(channelNo=%d): remove msgs <= " XP_LD " for %s (queueLen: %d)",
channelNo, msgID, cbuf, comms->queueLen ); channelNo, msgID, cbuf, comms->queueLen );
#ifdef DEBUG
XP_U16 prevLen = comms->queueLen; XP_U16 prevLen = comms->queueLen;
#endif
if ((channelNo == 0) || !!getRecordFor( comms, xwe, NULL, channelNo)) { if ((channelNo == 0) || !!getRecordFor( comms, xwe, NULL, channelNo)) {

View file

@ -90,7 +90,7 @@ makeGameID( XW_UtilCtxt* XP_UNUSED_DBG(util) )
postgres DB where INTEGER is apparently a signed 32-bit */ postgres DB where INTEGER is apparently a signed 32-bit */
gameID &= 0x7FFFFFFF; gameID &= 0x7FFFFFFF;
} }
LOG_RETURNF( "%x/%d", gameID, gameID ); LOG_RETURNF( "%X/%d", gameID, gameID );
return gameID; return gameID;
} }

View file

@ -302,7 +302,7 @@ logNLI( const NetLaunchInfo* nli, const char* callerFunc, const int callerLine )
XP_UCHAR buf[1024]; XP_UCHAR buf[1024];
XP_SNPRINTF( buf, VSIZE(buf), "{ctyps: [%s], nPlayersT: %d, nPlayersH: %d, " XP_SNPRINTF( buf, VSIZE(buf), "{ctyps: [%s], nPlayersT: %d, nPlayersH: %d, "
"channel: %d, isoCode: '%s', gameID: %d, gameName: %s", "channel: %d, isoCode: '%s', gameID: %X, gameName: %s",
conTypes, nli->nPlayersT, nli->nPlayersH, nli->forceChannel, conTypes, nli->nPlayersT, nli->nPlayersH, nli->forceChannel,
nli->isoCodeStr, nli->gameID, nli->gameName ); nli->isoCodeStr, nli->gameID, nli->gameName );
if ( types_hasType( nli->_conTypes, COMMS_CONN_MQTT ) ) { if ( types_hasType( nli->_conTypes, COMMS_CONN_MQTT ) ) {

View file

@ -237,7 +237,7 @@ static void writeProto( const ServerCtxt* server, XWStreamCtxt* stream,
#define PICK_NEXT -1 #define PICK_NEXT -1
#define PICK_CUR -2 #define PICK_CUR -2
#define LOG_GAMEID() XP_LOGFF("gameID: %d", server->vol.gi->gameID ) #define LOG_GAMEID() XP_LOGFF("gameID: %X", server->vol.gi->gameID )
#if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY #if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY
static char* static char*
@ -778,7 +778,7 @@ XP_Bool
server_initClientConnection( ServerCtxt* server, XWEnv xwe ) server_initClientConnection( ServerCtxt* server, XWEnv xwe )
{ {
XP_Bool result; XP_Bool result;
XP_LOGFF( "gameState: %s; gameID: %d", getStateStr(server->nv.gameState), XP_LOGFF( "gameState: %s; gameID: %X", getStateStr(server->nv.gameState),
server->vol.gi->gameID ); server->vol.gi->gameID );
CurGameInfo* gi = server->vol.gi; CurGameInfo* gi = server->vol.gi;
XP_U16 nPlayers; XP_U16 nPlayers;
@ -1702,7 +1702,7 @@ server_do( ServerCtxt* server, XWEnv xwe )
} else { } else {
XP_Bool moreToDo = XP_FALSE; XP_Bool moreToDo = XP_FALSE;
server->serverDoing = XP_TRUE; server->serverDoing = XP_TRUE;
XP_LOGFF( "gameState: %s; gameID: %d", getStateStr(server->nv.gameState), XP_LOGFF( "gameState: %s; gameID: %X", getStateStr(server->nv.gameState),
server->vol.gi->gameID ); server->vol.gi->gameID );
switch( server->nv.gameState ) { switch( server->nv.gameState ) {
case XWSTATE_BEGIN: case XWSTATE_BEGIN:

View file

@ -643,7 +643,7 @@ cb_feedGame( CursesBoardState* cbState, XP_U32 gameID,
int nRows = VSIZE( rowids ); int nRows = VSIZE( rowids );
LaunchParams* params = cbState->params; LaunchParams* params = cbState->params;
gdb_getRowsForGameID( params->pDb, gameID, rowids, &nRows ); gdb_getRowsForGameID( params->pDb, gameID, rowids, &nRows );
XP_LOGFF( "found %d rows for gameID %d", nRows, gameID ); XP_LOGFF( "found %d rows for gameID %X", nRows, gameID );
for ( int ii = 0; ii < nRows; ++ii ) { for ( int ii = 0; ii < nRows; ++ii ) {
#ifdef DEBUG #ifdef DEBUG
bool success = bool success =
@ -1308,7 +1308,7 @@ sendInvite( void* closure, int XP_UNUSED(key) )
} else if ( addr_hasType( &selfAddr, COMMS_CONN_SMS ) ) { } else if ( addr_hasType( &selfAddr, COMMS_CONN_SMS ) ) {
linux_sms_invite( params, &nli, selfAddr.u.sms.phone, selfAddr.u.sms.port ); linux_sms_invite( params, &nli, selfAddr.u.sms.phone, selfAddr.u.sms.port );
} else if ( addr_hasType( &selfAddr, COMMS_CONN_MQTT ) ) { } else if ( addr_hasType( &selfAddr, COMMS_CONN_MQTT ) ) {
mqttc_invite( params, 0, &nli, mqttc_getDevID( params ) ); mqttc_invite( params, &nli, mqttc_getDevID( params ) );
#ifdef XWFEATURE_RELAY #ifdef XWFEATURE_RELAY
} else if ( addr_hasType( &selfAddr, COMMS_CONN_RELAY ) ) { } else if ( addr_hasType( &selfAddr, COMMS_CONN_RELAY ) ) {
/* ======= */ /* ======= */

View file

@ -1194,7 +1194,7 @@ inviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
figureDims( aGlobals, &dims ); figureDims( aGlobals, &dims );
cb_newFor( aGlobals->cbState, invite, &dims ); cb_newFor( aGlobals->cbState, invite, &dims );
} else { } else {
XP_LOGFF( "Not accepting duplicate invitation (nRowIDs(gameID=%d) was %d", XP_LOGFF( "Not accepting duplicate invitation (nRowIDs(gameID=%X) was %d",
invite->gameID, nRowIDs ); invite->gameID, nRowIDs );
} }
} }

View file

@ -285,7 +285,7 @@ gdb_write( XWStreamCtxt* stream, XWEnv XP_UNUSED(xwe), void* closure )
if ( newGame ) { /* new row; need to insert blob first */ if ( newGame ) { /* new row; need to insert blob first */
cGlobals->rowid = selRow; cGlobals->rowid = selRow;
XP_LOGFF( "new game for id %d at row %lld", cGlobals->gi->gameID, selRow ); XP_LOGFF( "new game for id %X at row %lld", cGlobals->gi->gameID, selRow );
} else { } else {
assert( selRow == cGlobals->rowid ); assert( selRow == cGlobals->rowid );
} }

View file

@ -126,7 +126,7 @@ linux_dutil_onMessageReceived( XW_DUtilCtxt* duc, XWEnv XP_UNUSED(xwe),
XP_U32 gameID, const CommsAddrRec* from, XP_U32 gameID, const CommsAddrRec* from,
const XP_U8* buf, XP_U16 len ) const XP_U8* buf, XP_U16 len )
{ {
XP_LOGFF( "(gameID=%d)", gameID ); XP_LOGFF( "(gameID=%X)", gameID );
LaunchParams* params = (LaunchParams*)duc->closure; LaunchParams* params = (LaunchParams*)duc->closure;
if ( params->useCurses ) { if ( params->useCurses ) {

View file

@ -1436,7 +1436,7 @@ linux_reset( XWEnv xwe, void* closure )
XP_S16 XP_S16
linux_send( XWEnv XP_UNUSED(xwe), const XP_U8* buf, XP_U16 buflen, linux_send( XWEnv XP_UNUSED(xwe), const XP_U8* buf, XP_U16 buflen,
const XP_UCHAR* msgNo, XP_U32 createdStamp, const XP_UCHAR* msgNo, XP_U32 XP_UNUSED(createdStamp),
const CommsAddrRec* addrRec, CommsConnType conType, const CommsAddrRec* addrRec, CommsConnType conType,
XP_U32 gameID, void* closure ) XP_U32 gameID, void* closure )
{ {
@ -1499,7 +1499,7 @@ linux_send( XWEnv XP_UNUSED(xwe), const XP_U8* buf, XP_U16 buflen,
#endif #endif
case COMMS_CONN_MQTT: case COMMS_CONN_MQTT:
nSent = mqttc_send( cGlobals->params, gameID, createdStamp, buf, buflen, nSent = mqttc_send( cGlobals->params, gameID, buf, buflen,
&addrRec->u.mqtt.devID ); &addrRec->u.mqtt.devID );
break; break;
@ -1516,7 +1516,7 @@ linux_send( XWEnv XP_UNUSED(xwe), const XP_U8* buf, XP_U16 buflen,
#ifdef XWFEATURE_COMMS_INVITE #ifdef XWFEATURE_COMMS_INVITE
XP_S16 XP_S16
linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli, linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli,
XP_U32 createdStamp, XP_U32 XP_UNUSED(createdStamp),
const CommsAddrRec* destAddr, void* closure ) const CommsAddrRec* destAddr, void* closure )
{ {
XP_S16 nSent = -1; XP_S16 nSent = -1;
@ -1526,8 +1526,7 @@ linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli,
for ( XP_U32 st = 0; addr_iter( destAddr, &typ, &st ); ) { for ( XP_U32 st = 0; addr_iter( destAddr, &typ, &st ); ) {
switch ( typ ) { switch ( typ ) {
case COMMS_CONN_MQTT: case COMMS_CONN_MQTT:
mqttc_invite( cGlobals->params, createdStamp, nli, mqttc_invite( cGlobals->params, nli, &destAddr->u.mqtt.devID );
&destAddr->u.mqtt.devID );
break; break;
case COMMS_CONN_SMS: case COMMS_CONN_SMS:
linux_sms_invite( cGlobals->params, nli, linux_sms_invite( cGlobals->params, nli,

View file

@ -315,7 +315,7 @@ msgAndTopicProc( void* closure, const XP_UCHAR* topic, const XP_U8* buf, XP_U16
} }
void void
mqttc_invite( LaunchParams* params, XP_U32 timestamp, const NetLaunchInfo* nli, mqttc_invite( LaunchParams* params, const NetLaunchInfo* nli,
const MQTTDevID* invitee ) const MQTTDevID* invitee )
{ {
MQTTConStorage* storage = getStorage( params ); MQTTConStorage* storage = getStorage( params );
@ -324,21 +324,20 @@ mqttc_invite( LaunchParams* params, XP_U32 timestamp, const NetLaunchInfo* nli,
XP_LOGFF( "need to send to %s", formatMQTTDevID(invitee, buf, sizeof(buf) ) ); XP_LOGFF( "need to send to %s", formatMQTTDevID(invitee, buf, sizeof(buf) ) );
XP_ASSERT( 16 == strlen(buf) ); XP_ASSERT( 16 == strlen(buf) );
#endif #endif
XP_USE( timestamp );
dvc_makeMQTTInvites( params->dutil, NULL_XWE, msgAndTopicProc, storage, dvc_makeMQTTInvites( params->dutil, NULL_XWE, msgAndTopicProc, storage,
invitee, nli, 0 ); invitee, nli );
} }
XP_S16 XP_S16
mqttc_send( LaunchParams* params, XP_U32 gameID, XP_U32 timestamp, mqttc_send( LaunchParams* params, XP_U32 gameID,
const XP_U8* buf, XP_U16 len, const MQTTDevID* addressee ) const XP_U8* buf, XP_U16 len, const MQTTDevID* addressee )
{ {
MQTTConStorage* storage = getStorage( params ); MQTTConStorage* storage = getStorage( params );
dvc_makeMQTTMessages( params->dutil, NULL_XWE, dvc_makeMQTTMessages( params->dutil, NULL_XWE,
msgAndTopicProc, storage, msgAndTopicProc, storage,
addressee, gameID, timestamp, buf, len ); addressee, gameID, buf, len );
return len; return len;
} }
@ -348,5 +347,5 @@ mqttc_notifyGameGone( LaunchParams* params, const MQTTDevID* addressee, XP_U32 g
MQTTConStorage* storage = getStorage( params ); MQTTConStorage* storage = getStorage( params );
dvc_makeMQTTNoSuchGames( params->dutil, NULL_XWE, dvc_makeMQTTNoSuchGames( params->dutil, NULL_XWE,
msgAndTopicProc, storage, msgAndTopicProc, storage,
addressee, gameID, 0 ); addressee, gameID );
} }

View file

@ -28,9 +28,9 @@ void mqttc_cleanup( LaunchParams* params );
const MQTTDevID* mqttc_getDevID( LaunchParams* params ); const MQTTDevID* mqttc_getDevID( LaunchParams* params );
const gchar* mqttc_getDevIDStr( LaunchParams* params ); const gchar* mqttc_getDevIDStr( LaunchParams* params );
void mqttc_invite( LaunchParams* params, XP_U32 timestamp, void mqttc_invite( LaunchParams* params, const NetLaunchInfo* nli,
const NetLaunchInfo* nli, const MQTTDevID* mqttInvitee ); const MQTTDevID* mqttInvitee );
XP_S16 mqttc_send( LaunchParams* params, XP_U32 gameID, XP_U32 timestamp, XP_S16 mqttc_send( LaunchParams* params, XP_U32 gameID,
const XP_U8* buf, XP_U16 len, const MQTTDevID* addressee ); const XP_U8* buf, XP_U16 len, const MQTTDevID* addressee );
void mqttc_notifyGameGone( LaunchParams* params, const MQTTDevID* addressee, XP_U32 gameID ); void mqttc_notifyGameGone( LaunchParams* params, const MQTTDevID* addressee, XP_U32 gameID );