From c09ac287596acd771c6c83d3ee7cb4517b91c2e2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 7 Aug 2024 22:29:46 -0700 Subject: [PATCH] fix warnings about zeroing static structs (no behavior change) --- xwords4/android/jni/andutils.c | 2 +- xwords4/android/jni/xwjni.c | 12 +++++------ xwords4/common/board.c | 4 ++-- xwords4/common/boarddrw.c | 2 +- xwords4/common/comms.c | 20 +++++++++--------- xwords4/common/device.c | 4 ++-- xwords4/common/dictiter.c | 30 +++++++++++++-------------- xwords4/common/engine.c | 2 +- xwords4/common/knownplyr.c | 2 +- xwords4/common/model.c | 6 +++--- xwords4/common/nli.c | 6 +++--- xwords4/common/pool.c | 2 +- xwords4/common/server.c | 38 +++++++++++++++++----------------- xwords4/common/strutils.c | 4 ++-- xwords4/linux/cursesboard.c | 4 ++-- xwords4/linux/cursesdraw.c | 10 ++++----- xwords4/linux/cursesmain.c | 2 +- xwords4/linux/extcmds.c | 4 ++-- xwords4/linux/gamesdb.c | 10 ++++----- xwords4/linux/gsrcwrap.c | 2 +- xwords4/linux/gtkaskm.c | 2 +- xwords4/linux/gtkboard.c | 8 +++---- xwords4/linux/gtkinvit.c | 2 +- xwords4/linux/gtkmain.c | 18 ++++++++-------- xwords4/linux/gtknewgame.c | 2 +- xwords4/linux/lindutil.c | 2 +- xwords4/linux/linuxmain.c | 18 ++++++++-------- xwords4/linux/linuxsms.c | 6 +++--- xwords4/linux/linuxutl.c | 2 +- xwords4/linux/relaycon.c | 4 ++-- 30 files changed, 115 insertions(+), 115 deletions(-) diff --git a/xwords4/android/jni/andutils.c b/xwords4/android/jni/andutils.c index f51c3e0bb..e2af51cc0 100644 --- a/xwords4/android/jni/andutils.c +++ b/xwords4/android/jni/andutils.c @@ -496,7 +496,7 @@ getMethodID( JNIEnv* env, jobject obj, const char* proc, const char* sig ) jclass cls = (*env)->GetObjectClass( env, obj ); XP_ASSERT( !!cls ); #ifdef DEBUG - char buf[128] = {0}; + char buf[128] = {}; /* int len = sizeof(buf); */ /* getClassName( env, obj, buf, &len ); */ #endif diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 71810c3b1..3c2ad37f8 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -948,7 +948,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_gi_1from_1stream XWStreamCtxt* stream = streamFromJStream( MPPARM(mpool) env, globalState->vtMgr, jstream ); - CurGameInfo gi = {0}; + CurGameInfo gi = {}; // XP_MEMSET( &gi, 0, sizeof(gi) ); if ( game_makeFromStream( MPPARM(mpool) env, stream, NULL, &gi, NULL, NULL, NULL, NULL ) ) { @@ -1000,7 +1000,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_nli_1from_1stream XWStreamCtxt* stream = streamFromJStream( MPPARM(mpool) env, globalState->vtMgr, jstream ); - NetLaunchInfo nli = {0}; + NetLaunchInfo nli = {}; if ( nli_makeFromStream( &nli, stream ) ) { jnli = makeObjectEmptyConstr( env, PKG_PATH("NetLaunchInfo") ); setNLI( env, jnli, &nli ); @@ -1455,7 +1455,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame TI_IF(&state->globalJNI->ti) j_procs ); } - CommonPrefs cp = {0}; + CommonPrefs cp = {}; loadCommonPrefs( env, &cp, j_cp ); CommsAddrRec selfAddr; @@ -2388,7 +2388,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage XWStreamCtxt* stream = streamFromJStream( MPPARM(mpool) env, globals->vtMgr, jstream ); CommsAddrRec* addrp = NULL; - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; XP_ASSERT( !!jaddr ); if ( NULL != jaddr ) { getJAddrRec( env, &addr, jaddr ); @@ -2408,7 +2408,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jsummary ) { XWJNI_START_GLOBALS(gamePtr); - GameSummary summary = {0}; + GameSummary summary = {}; game_summarize( &state->game, globals->gi, &summary ); setInt( env, jsummary, "nMoves", summary.nMoves ); @@ -2842,7 +2842,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1inviteeName jstring result = NULL; XWJNI_START(gamePtr); XP_ASSERT( !!state->game.server ); - XP_UCHAR buf[32] = {0}; + XP_UCHAR buf[32] = {}; XP_U16 len = VSIZE(buf); server_inviteeName( state->game.server, env, channel, buf, &len ); if ( !!buf[0] ) { diff --git a/xwords4/common/board.c b/xwords4/common/board.c index bc0fd6bac..6118b93e5 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -471,7 +471,7 @@ board_figureLayout( BoardCtxt* board, XWEnv xwe, const CurGameInfo* gi, XP_U16 scoreWidth, XP_U16 fontWidth, XP_U16 fontHt, XP_Bool squareTiles, BoardDims* dimsp ) { - BoardDims ldims = {0}; + BoardDims ldims = {}; XP_U16 nCells = gi->boardSize; XP_U16 maxCellSize = 8 * fontHt; @@ -3750,7 +3750,7 @@ keyToIndex( BoardCtxt* board, XP_Key key, Tile* blankFace ) XP_UCHAR buf[2] = { key, '\0' }; /* Figure out if we have the tile in the tray */ - FTData ftd = {0}; + FTData ftd = {}; dict_tilesForString( dict, buf, 0, foundTiles, &ftd ); if ( ftd.found ) { XP_S16 turn = board->selPlayer; diff --git a/xwords4/common/boarddrw.c b/xwords4/common/boarddrw.c index 1aa903b2b..582eacfcb 100644 --- a/xwords4/common/boarddrw.c +++ b/xwords4/common/boarddrw.c @@ -372,7 +372,7 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col, const XP_U16 row, XP_Bool skipBlanks ) { XP_Bool success = XP_TRUE; - XP_Rect cellRect = {0}; + XP_Rect cellRect = {}; Tile tile; XP_Bool isBlank, isEmpty, pending = XP_FALSE; XWBonusType bonus; diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 65b9196a6..b822d845a 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -628,7 +628,7 @@ addrFromStreamOne( CommsAddrRec* addrP, XWStreamCtxt* stream, CommsConnType typ addrP->u.ip.port_ip = stream_getU16( stream ); break; case COMMS_CONN_RELAY: { - IpRelay ip_relay = {{0}}; + IpRelay ip_relay = {}; if ( version < STREAM_VERS_NORELAY ) { stringFromStreamHere( stream, ip_relay.invite, sizeof(ip_relay.invite) ); @@ -760,7 +760,7 @@ comms_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream, flags = 0; } - CommsAddrRec selfAddr = {0}; + CommsAddrRec selfAddr = {}; addrFromStream( &selfAddr, stream ); if ( addr_hasType( &selfAddr, COMMS_CONN_MQTT ) && 0 == selfAddr.u.mqtt.devID ) { @@ -1020,7 +1020,7 @@ addrToStreamOne( XWStreamCtxt* stream, CommsConnType typ, break; case COMMS_CONN_RELAY: if ( stream_getVersion( stream ) < STREAM_VERS_NORELAY ) { - IpRelay ip_relay = {{0}}; + IpRelay ip_relay = {}; #ifdef XWFEATURE_RELAY ip_relay = addrP->u.ip_relay; #endif @@ -1265,7 +1265,7 @@ comms_addMQTTDevID( CommsCtxt* comms, XP_PlayerAddr channelNo, } else if ( addr_hasType( &rec->addr, COMMS_CONN_MQTT ) ) { XP_ASSERT( *devID == rec->addr.u.mqtt.devID ); } else { - CommsAddrRec tmp = {0}; + CommsAddrRec tmp = {}; addr_setType( &tmp, COMMS_CONN_MQTT ); tmp.u.mqtt.devID = *devID; ASSERT_ADDR_OK( &tmp ); @@ -1373,7 +1373,7 @@ countNonAcks( MsgQueueElem* elem, void* closure ) XP_U16 comms_countPendingPackets( RELCONST CommsCtxt* comms, XP_Bool* quashed ) { - NonAcks na = {0}; + NonAcks na = {}; WITH_MUTEX(&comms->mutex); if ( !!quashed ) { *quashed = QUASHED(comms); @@ -1696,7 +1696,7 @@ pickChannel( const CommsCtxt* comms, const NetLaunchInfo* nli, if ( 0 == result ) { /* Data useful for next two steps: unused channel, then invites-only channel */ - GetInviteChannelsData gicd = {0}; + GetInviteChannelsData gicd = {}; forEachElem( (CommsCtxt*)comms, getInviteChannels, &gicd ); /* Now find the first channelNo that doesn't have an invitation on it @@ -1800,7 +1800,7 @@ void comms_getInvited( RELCONST CommsCtxt* comms, XP_U16* nInvites ) { WITH_MUTEX(&comms->mutex); - GetInvitedData gid = {0}; + GetInvitedData gid = {}; forEachElem( (CommsCtxt*)comms, getInvitedProc, &gid ); *nInvites = gid.count; // LOG_RETURNF( "%d", *nInvites ); @@ -2526,7 +2526,7 @@ got_connect_cmd( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream, #ifdef XWFEATURE_DEVID DevIDType typ = stream_getU8( stream ); - XP_UCHAR devID[MAX_DEVID_LEN + 1] = {0}; + XP_UCHAR devID[MAX_DEVID_LEN + 1] = {}; if ( ID_TYPE_NONE != typ ) { stringFromStreamHere( stream, devID, sizeof(devID) ); } @@ -3165,7 +3165,7 @@ comms_checkIncomingStream( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream, COMMS_LOGFF( TAGFMT() "got message of len %d with sum %s", TAGPRMS, state->len, state->sum ); - HeaderStuff stuff = {0}; + HeaderStuff stuff = {}; messageValid = stream_gotU16( stream, &stuff.flags ); if ( messageValid ) { @@ -3667,7 +3667,7 @@ augmentAddrIntrnl( CommsCtxt* comms, CommsAddrRec* destAddr, { XP_Bool changed = XP_FALSE; ASSERT_ADDR_OK( srcAddr ); - const CommsAddrRec empty = {0}; + const CommsAddrRec empty = {}; if ( !!srcAddr ) { CommsConnType typ; for ( XP_U32 st = 0; addr_iter( srcAddr, &typ, &st ); ) { diff --git a/xwords4/common/device.c b/xwords4/common/device.c index 194cd1601..c9f79e218 100644 --- a/xwords4/common/device.c +++ b/xwords4/common/device.c @@ -614,7 +614,7 @@ dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic, switch ( cmd ) { case CMD_INVITE: { - NetLaunchInfo nli = {0}; + NetLaunchInfo nli = {}; if ( nli_makeFromStream( &nli, stream ) ) { dutil_onInviteReceived( dutil, xwe, &nli ); } @@ -622,7 +622,7 @@ dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic, break; case CMD_DEVGONE: case CMD_MSG: { - CommsAddrRec from = {0}; + CommsAddrRec from = {}; addr_addType( &from, COMMS_CONN_MQTT ); from.u.mqtt.devID = senderID; if ( CMD_MSG == cmd ) { diff --git a/xwords4/common/dictiter.c b/xwords4/common/dictiter.c index 813dae0c0..d464c71dd 100644 --- a/xwords4/common/dictiter.c +++ b/xwords4/common/dictiter.c @@ -560,9 +560,9 @@ printCount( PrintState* prs, const PatElem* elem ) /* const PatElem* elem = &prs->iter->patElems[prs->curElem]; */ /* switch ( elem->typ ) { */ /* case CHILD: { */ -/* XP_UCHAR flags[8] = {0}; */ +/* XP_UCHAR flags[8] = {}; */ /* formatFlags( flags, elem->u.child.flags ); */ -/* XP_UCHAR tiles[128] = {0}; */ +/* XP_UCHAR tiles[128] = {}; */ /* formatTiles( tiles, elem->u.child.tiles, prs->iter->dict ); */ /* prs->strEnd += XP_SNPRINTF( &prs->buf[prs->strEnd], prs->bufLen - prs->strEnd, */ /* "[%s%s]", flags, tiles ); */ @@ -772,7 +772,7 @@ getMatchInfo( const Params* params, const TileSet* prevs, const FaceTile* ft, #ifdef MULTI_SET const TileSet* elemTileSet = &elem->u.child.tiles; #else - TileSet curMask = {0}; + TileSet curMask = {}; #endif if ( !!ft ) { Tile tile = ft->tile; @@ -862,9 +862,9 @@ formatElem( PrintState* prs, const PatElem* elem ) { switch ( elem->typ ) { case CHILD: { - XP_UCHAR flags[8] = {0}; + XP_UCHAR flags[8] = {}; formatFlags( flags, elem->u.child.flags ); - XP_UCHAR tiles[128] = {0}; + XP_UCHAR tiles[128] = {}; formatTiles( tiles, &elem->u.child.tiles, prs->iter->dict ); prs->curPos += XP_SNPRINTF( &prs->buf[prs->curPos], prs->bufLen - prs->curPos, @@ -912,11 +912,11 @@ static XP_Bool patHasMatch( DictIter* iter, array_edge* edge, PatMatch* matchP, XP_Bool log ) { XP_Bool success = XP_TRUE; - FaceTile _tile = {0}; + FaceTile _tile = {}; mkFaceTile( iter->dict, edge, &_tile ); const FaceTile* ft = &_tile; - PatMatch resultMatch = {0}; + PatMatch resultMatch = {}; for ( int patIndx = 0; success && patIndx < iter->nPats; ++patIndx ) { ElemSet oldElems; if ( 0 == iter->nEdges ) { @@ -1131,7 +1131,7 @@ nextWord( DictIter* iter, XP_Bool log ) if ( iter->nEdges < iter->max ) { array_edge* next = dict_follow( dict, iter->stack[iter->nEdges-1].edge ); if ( !!next ) { - PatMatch match = {0}; + PatMatch match = {}; if ( nextPeerMatch( iter, &next, &match, log ) ) { pushEdge( iter, next, &match ); success = iter->min <= iter->nEdges && ACCEPT_NODE( iter, next, log ); @@ -1152,7 +1152,7 @@ nextWord( DictIter* iter, XP_Bool log ) array_edge* edge = popEdge( iter ); if ( !IS_LAST_EDGE( dict, edge ) ) { edge += dict->nodeSize; - PatMatch match = {0}; + PatMatch match = {}; if ( nextPeerMatch( iter, &edge, &match, log ) ) { pushEdge( iter, edge, &match ); /* let the top of the loop examine this one */ success = iter->min <= iter->nEdges && ACCEPT_NODE( iter, edge, log ); @@ -1201,7 +1201,7 @@ pushLastEdges( DictIter* iter, array_edge* edge, XP_Bool log ) edge += dict->nodeSize; } /* ... so we can then move back, testing */ - PatMatch match = {0}; + PatMatch match = {}; if ( ! prevPeerMatch( iter, &edge, &match, log ) ) { break; } @@ -1232,7 +1232,7 @@ prevWord( DictIter* iter, XP_Bool log ) XP_ASSERT( !isFirstEdge( dict, edge ) ); edge -= dict->nodeSize; - PatMatch match = {0}; + PatMatch match = {}; if ( prevPeerMatch( iter, &edge, &match, log ) ) { pushEdge( iter, edge, &match ); if ( iter->nEdges < iter->max ) { @@ -1278,7 +1278,7 @@ findStartsWithTiles( DictIter* iter, const Tile* tiles, XP_U16 nTiles ) break; } - PatMatch match = {0}; + PatMatch match = {}; if ( ! HAS_MATCH( iter, edge, &match, XP_FALSE ) ) { break; } @@ -1440,7 +1440,7 @@ di_makeIter( const DictionaryCtxt* dict, XWEnv xwe, const DIMinMax* minmax, DictIter* iter = NULL; XP_U16 nUsed = 0; - Pat pats[MAX_PATS] = {{0}}; + Pat pats[MAX_PATS] = {}; ParseState ps; @@ -1537,7 +1537,7 @@ XP_Bool di_stringMatches( DictIter* iter, const XP_UCHAR* str ) { LOG_FUNC(); - FindState fs = {0}; + FindState fs = {}; dict_tilesForString( iter->dict, str, 0, onFoundTilesSM, &fs ); XP_ASSERT( 1 == fs.timesCalled ); @@ -1548,7 +1548,7 @@ di_stringMatches( DictIter* iter, const XP_UCHAR* str ) XP_Bool matched = XP_TRUE; for ( int ii = 0; matched && ii < fs.nTiles; ++ii ) { - PatMatch match = {0}; + PatMatch match = {}; array_edge_old* tmp = &tmps[ii]; tmp->bits = fs.tiles[ii]; array_edge* fakeEdge = (array_edge*)tmp; diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index e6b1024f3..dcc24fe83 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -278,7 +278,7 @@ print_savedMoves( const EngineCtxt* engine, const char* label ) { int ii; int pos = 0; - char buf[(NUM_SAVED_ENGINE_MOVES*10) + 3] = {0}; + char buf[(NUM_SAVED_ENGINE_MOVES*10) + 3] = {}; for ( ii = 0; ii < engine->nMovesToSave; ++ii ) { if ( 0 < engine->miData.savedMoves[ii].score ) { pos += XP_SNPRINTF( &buf[pos], VSIZE(buf)-pos, "[%d]: %d; ", diff --git a/xwords4/common/knownplyr.c b/xwords4/common/knownplyr.c index c8a1025cc..4da36f752 100644 --- a/xwords4/common/knownplyr.c +++ b/xwords4/common/knownplyr.c @@ -53,7 +53,7 @@ loadFromStream( XW_DUtilCtxt* dutil, KPState* state, XWStreamCtxt* stream ) XP_UCHAR buf[64]; stringFromStreamHere( stream, buf, VSIZE(buf) ); - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; addrFromStream( &addr, stream ); addPlayer( dutil, state, buf, &addr, newestMod ); diff --git a/xwords4/common/model.c b/xwords4/common/model.c index cb77d62b0..b3d46df60 100644 --- a/xwords4/common/model.c +++ b/xwords4/common/model.c @@ -215,7 +215,7 @@ model_writeToTextStream( const ModelCtxt* model, XWStreamCtxt* stream ) { const DictionaryCtxt* dict = model_getDictionary( model ); int width = dict_getMaxWidth( dict ); - XP_UCHAR empty[4] = {0}; + XP_UCHAR empty[4] = {}; XP_U16 ii; XP_U16 col, row; @@ -1914,7 +1914,7 @@ commitTurn( ModelCtxt* model, XWEnv xwe, XP_S16 turn, const TrayTileSet* newTile #endif tilesInLine( model, turn, &isHorizontal ); XP_ASSERT( inLine ); - MoveInfo moveInfo = {0}; + MoveInfo moveInfo = {}; normalizeMoves( model, turn, isHorizontal, &moveInfo ); stack_addMove( model->vol.stack, turn, &moveInfo, newTiles ); @@ -2679,7 +2679,7 @@ model_listWordsThrough( ModelCtxt* model, XWEnv xwe, XP_U16 col, XP_U16 row, XP_Bool isHorizontal; if ( tilesInLine( model, turn, &isHorizontal ) ) { - MoveInfo moveInfo = {0}; + MoveInfo moveInfo = {}; normalizeMoves( model, turn, isHorizontal, &moveInfo ); model_makeTurnFromMoveInfo( tmpModel, xwe, turn, &moveInfo ); diff --git a/xwords4/common/nli.c b/xwords4/common/nli.c index ee0dce46e..6985f4e13 100644 --- a/xwords4/common/nli.c +++ b/xwords4/common/nli.c @@ -314,8 +314,8 @@ XP_Bool nli_fromArgv( MPFORMAL NetLaunchInfo* nlip, int argc, const char** argv ) { XP_LOGFF( "(argc=%d)", argc ); - CurGameInfo gi = {0}; - CommsAddrRec addr = {0}; + CurGameInfo gi = {}; + CommsAddrRec addr = {}; MQTTDevID mqttDevID = 0; XP_U16 nPlayersH = 0; XP_U16 forceChannel = 0; @@ -388,7 +388,7 @@ logNLI( const NetLaunchInfo* nli, const char* callerFunc, const int callerLine ) { XP_LOGFF( "called by %s(), line %d", callerFunc, callerLine ); - XP_UCHAR conTypes[128] = {0}; + XP_UCHAR conTypes[128] = {}; int offset = 0; CommsConnType typ; for ( XP_U32 state = 0; types_iter( nli->_conTypes, &typ, &state ); ) { diff --git a/xwords4/common/pool.c b/xwords4/common/pool.c index f77cea87d..8d2df996a 100644 --- a/xwords4/common/pool.c +++ b/xwords4/common/pool.c @@ -285,7 +285,7 @@ checkTilesLeft( const PoolContext* pool ) void pool_dumpSelf( const PoolContext* pool ) { - XP_UCHAR buf[256] = {0}; + XP_UCHAR buf[256] = {}; XP_U16 offset = 0; for ( Tile tile = 0; tile < pool->numFaces; ++tile ) { XP_U16 count = pool->lettersLeft[tile]; diff --git a/xwords4/common/server.c b/xwords4/common/server.c index daa18a018..2377bfb1a 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -851,7 +851,7 @@ server_countTilesInPool( ServerCtxt* server ) static void addMQTTDevIDIf( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream ) { - CommsAddrRec selfAddr = {0}; + CommsAddrRec selfAddr = {}; comms_getSelfAddr( server->vol.comms, &selfAddr ); if ( addr_hasType( &selfAddr, COMMS_CONN_MQTT ) ) { MQTTDevID devID; @@ -895,7 +895,7 @@ buildGuestRI( const ServerCtxt* server, XP_U16 guestIndex, RematchInfo* rip ) for ( int ii = 0; ii < gi->nPlayers; ++ii ) { const LocalPlayer* lp = &gi->players[ii]; if ( lp->isLocal ) { /* that's me, the host */ - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; ri_addAddrAt( rip, server, &addr, ii ); } else { XP_S8 deviceIndex = server->srvPlyrs[ii].deviceIndex; @@ -999,7 +999,7 @@ readGuestAddrs( ServerCtxt* server, XWStreamCtxt* stream, XP_U8 streamVersion ) } } else { while ( 0 < stream_getSize(tmpStream) ) { - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; addrFromStream( &addr, tmpStream ); SRVR_LOGFFV( "got an address" ); logAddr( server->vol.dutil, &addr, __func__ ); @@ -1699,7 +1699,7 @@ makeRobotMove( ServerCtxt* server, XWEnv xwe ) XP_Bool result = XP_FALSE; XP_Bool searchComplete = XP_FALSE; XP_S16 turn; - MoveInfo newMove = {0}; + MoveInfo newMove = {}; ModelCtxt* model = server->vol.model; CurGameInfo* gi = server->vol.gi; XP_Bool timerEnabled = gi->timerEnabled; @@ -2260,7 +2260,7 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream ) gameID = streamVersion < STREAM_VERS_REMATCHORDER ? stream_getU32( stream ) : 0; - CurGameInfo localGI = {0}; + CurGameInfo localGI = {}; gi_readFromStream( MPPARM(server->mpool) stream, &localGI ); XP_ASSERT( gameID == 0 || gameID == localGI.gameID ); gameID = localGI.gameID; @@ -2739,7 +2739,7 @@ trayAllowsMoves( ServerCtxt* server, XWEnv xwe, XP_U16 turn, tmpEngine = engine = engine_make( MPPARM(server->mpool) server->vol.util ); } XP_Bool canMove; - MoveInfo newMove = {0}; + MoveInfo newMove = {}; XP_U16 score = 0; XP_Bool result = engine_findMove( engine, xwe, server->vol.model, turn, XP_TRUE, XP_TRUE, @@ -3472,7 +3472,7 @@ dupe_makeAndReportTrade( ServerCtxt* server, XWEnv xwe ) model_removePlayerTiles( model, DUP_PLAYER, &oldTiles ); pool_replaceTiles( pool, &oldTiles ); - TrayTileSet newTiles = {0}; + TrayTileSet newTiles = {}; fetchTiles( server, xwe, DUP_PLAYER, oldTiles.nTiles, &newTiles, XP_FALSE ); model_commitDupeTrade( model, &oldTiles, &newTiles ); @@ -3623,10 +3623,10 @@ dupe_commitAndReportMove( ServerCtxt* server, XWEnv xwe, XP_U16 winner, /* The winning move is the one we'll commit everywhere. Get it. Reset everybody else then commit it there. */ - MoveInfo moveInfo = {0}; + MoveInfo moveInfo = {}; model_currentMoveToMoveInfo( model, winner, &moveInfo ); - TrayTileSet newTiles = {0}; + TrayTileSet newTiles = {}; fetchTiles( server, xwe, winner, nTiles, &newTiles, XP_FALSE ); for ( XP_U16 player = 0; player < nPlayers; ++player ) { @@ -3782,7 +3782,7 @@ dupe_postStatus( const ServerCtxt* server, XWEnv xwe, XP_Bool allDone ) * yet been received. If all have been, say nothing. */ - XP_UCHAR buf[256] = {0}; + XP_UCHAR buf[256] = {}; XP_Bool amHost = XP_FALSE; switch ( server->vol.gi->serverRole ) { case SERVER_STANDALONE: @@ -3894,7 +3894,7 @@ commitMoveImpl( ServerCtxt* server, XWEnv xwe, XP_U16 player, XP_Bool inDupeMode = inDuplicateMode(server); XP_ASSERT( server->nv.currentTurn == player || inDupeMode ); XP_S16 turn = player; - TrayTileSet newTiles = {0}; + TrayTileSet newTiles = {}; if ( !!newTilesP ) { newTiles = *newTilesP; @@ -3978,7 +3978,7 @@ XP_Bool server_commitTrade( ServerCtxt* server, XWEnv xwe, const TrayTileSet* oldTiles, TrayTileSet* newTilesP ) { - TrayTileSet newTiles = {0}; + TrayTileSet newTiles = {}; if ( !!newTilesP ) { newTiles = *newTilesP; } @@ -4162,7 +4162,7 @@ sortByScoreLow( const ServerCtxt* server, NewOrder* nop ) { const CurGameInfo* gi = server->vol.gi; - ScoresArray scores = {0}; + ScoresArray scores = {}; model_getCurScores( server->vol.model, &scores, server_getGameIsOver(server) ); int mask = 0; /* mark values already consumed */ @@ -4297,7 +4297,7 @@ getRematchInfoImpl( const ServerCtxt* server, CurGameInfo* newGI, const NewOrder* nop, RematchInfo** ripp ) { XP_Bool success = XP_TRUE; - RematchInfo ri = {0}; + RematchInfo ri = {}; const CommsCtxt* comms = server->vol.comms; /* Now build the address list. Simple cases are STANDALONE, when I'm the host, or when there are only two devices/players. If I'm guest @@ -4527,7 +4527,7 @@ log_ri( const ServerCtxt* server, const RematchInfo* rip, XP_USE(line); SRVR_LOGFFV( "called from line %d of %s() with ptr %p", line, caller, rip ); if ( !!rip ) { - char buf[64] = {0}; + char buf[64] = {}; int offset = 0; int maxIndx = -1; for ( int ii = 0; ii < rip->nPlayers; ++ii ) { @@ -4754,7 +4754,7 @@ server_inviteeName( const ServerCtxt* server, if ( playerPosn == ii ) { CommsCtxt* comms = server->vol.comms; - InviteeNames names = {0}; + InviteeNames names = {}; comms_inviteeNames( comms, xwe, &names ); if ( nameIndx < names.count ) { @@ -4839,7 +4839,7 @@ tellMoveWasLegal( ServerCtxt* server, XWEnv xwe ) static XP_Bool handleIllegalWord( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* incoming ) { - BadWordsState bws = {{0}}; + BadWordsState bws = {{}}; (void)stream_getBits( incoming, PLAYERNUM_NBITS ); bwsFromStream( MPPARM(server->mpool) incoming, &bws ); @@ -5170,7 +5170,7 @@ server_formatDictCounts( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream, if ( count > 0 ) { const XP_UCHAR* face = NULL; - XP_UCHAR faces[48] = {0}; + XP_UCHAR faces[48] = {}; XP_U16 len = 0; do { face = dict_getNextTileString( dict, tile, face ); @@ -5409,7 +5409,7 @@ server_writeFinalScores( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream ) } } - XP_UCHAR tmpbuf[48] = {0}; + XP_UCHAR tmpbuf[48] = {}; if ( !inDuplicateMode( server ) ) { firstDone = model_getNumTilesTotal( model, thisIndex) == 0; XP_SNPRINTF( tmpbuf, sizeof(tmpbuf), diff --git a/xwords4/common/strutils.c b/xwords4/common/strutils.c index 533092163..a298f9e7b 100644 --- a/xwords4/common/strutils.c +++ b/xwords4/common/strutils.c @@ -118,7 +118,7 @@ void moveInfoToStream( XWStreamCtxt* stream, const MoveInfo* mi, XP_U16 bitsPerTile ) { #ifdef DEBUG - /* XP_UCHAR buf[64] = {0}; */ + /* XP_UCHAR buf[64] = {}; */ /* XP_U16 offset = 0; */ #endif assertSorted( mi ); @@ -145,7 +145,7 @@ void moveInfoFromStream( XWStreamCtxt* stream, MoveInfo* mi, XP_U16 bitsPerTile ) { #ifdef DEBUG - /* XP_UCHAR buf[64] = {0}; */ + /* XP_UCHAR buf[64] = {}; */ /* XP_U16 offset = 0; */ #endif mi->nTiles = stream_getBits( stream, tilesNBits( stream ) ); diff --git a/xwords4/linux/cursesboard.c b/xwords4/linux/cursesboard.c index 5d7f2b6b9..3a22f93e2 100644 --- a/xwords4/linux/cursesboard.c +++ b/xwords4/linux/cursesboard.c @@ -485,7 +485,7 @@ utf8_len( const char* face ) { const int max = strlen(face); int count = 0; - mbstate_t ps = {0}; + mbstate_t ps = {}; for ( int offset = 0; offset < max; ) { size_t nBytes = mbrlen( &face[offset], max - offset, &ps ); if ( 0 < nBytes ) { @@ -1342,7 +1342,7 @@ inviteList( CommonGlobals* cGlobals, CommsAddrRec* myAddr, GSList* invitees, if ( haveAddressees ) { LaunchParams* params = cGlobals->params; #ifdef XWFEATURE_COMMS_INVITE - CommsAddrRec destAddr = {0}; + CommsAddrRec destAddr = {}; #endif for ( int ii = 0; ii < g_slist_length(invitees); ++ii ) { const XP_U16 nPlayersH = params->connInfo.inviteeCounts[ii]; diff --git a/xwords4/linux/cursesdraw.c b/xwords4/linux/cursesdraw.c index 224671204..b0a02bd6e 100644 --- a/xwords4/linux/cursesdraw.c +++ b/xwords4/linux/cursesdraw.c @@ -166,7 +166,7 @@ curses_draw_measureRemText( DrawCtx* XP_UNUSED(dctx), XWEnv XP_UNUSED(xwe), *width = *height = 0; } else { char buf[64]; - char* lines[2] = {0}; + char* lines[2] = {}; formatRemText( nTilesLeft, rect, buf, lines ); *width = 0; @@ -187,7 +187,7 @@ curses_draw_drawRemText( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* r CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; char buf[32]; - char* lines[2] = {0}; + char* lines[2] = {}; formatRemText( nTilesLeft, rInner, buf, lines ); int ii; for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) { @@ -291,7 +291,7 @@ curses_draw_measureScoreText( DrawCtx* XP_UNUSED(p_dctx), XWEnv XP_UNUSED(xwe), XP_U16* width, XP_U16* height ) { XP_UCHAR buf[100]; - char* lines[3] = {0}; + char* lines[3] = {}; formatScoreText( buf, dsi, rect, lines ); int ii; @@ -316,7 +316,7 @@ curses_draw_score_drawPlayer( DrawCtx* p_dctx, XWEnv xwe, curses_draw_clearRect( p_dctx, xwe, rOuter ); /* print the name and turn/remoteness indicator */ - char* lines[3] = {0}; + char* lines[3] = {}; formatScoreText( buf, dsi, rInner, lines ); int ii; for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) { @@ -430,7 +430,7 @@ curses_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect } else { /* To deal with multibyte (basically just L·L at this point), draw one char at a time, wrapping to the next line if we need to. */ - mbstate_t ps = {0}; + mbstate_t ps = {}; const char* end = letter + strlen( letter ); for ( int line = 0; line < rect->height; ++line ) { for ( int col = 0; letter < end && col < rect->width; ++col ) { diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index 5b0c0e2e4..cad1fc712 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1295,7 +1295,7 @@ static gint curses_requestMsgs( gpointer data ) { CursesAppGlobals* aGlobals = (CursesAppGlobals*)data; - XP_UCHAR devIDBuf[64] = {0}; + XP_UCHAR devIDBuf[64] = {}; gdb_fetch_safe( aGlobals->cag.params->pDb, KEY_RDEVID, NULL, devIDBuf, sizeof(devIDBuf) ); if ( '\0' != devIDBuf[0] ) { diff --git a/xwords4/linux/extcmds.c b/xwords4/linux/extcmds.c index 4411fbbec..6ae4dfca6 100644 --- a/xwords4/linux/extcmds.c +++ b/xwords4/linux/extcmds.c @@ -298,7 +298,7 @@ static XP_U32 makeGameFromArgs( CmdWrapper* wr, cJSON* args ) { LaunchParams* params = wr->params; - CurGameInfo gi = {0}; + CurGameInfo gi = {}; gi_copy( MPPARM(params->mpool) &gi, ¶ms->pgi ); gi.boardSize = 15; gi.traySize = 7; @@ -512,7 +512,7 @@ cmds_addCmdListener( const CmdWrapper* wr ) if ( !!cmdsSocket ) { service = g_socket_service_new(); - struct sockaddr_un addr = {0}; + struct sockaddr_un addr = {}; addr.sun_family = AF_UNIX; strncpy( addr.sun_path, cmdsSocket, sizeof(addr.sun_path) - 1); GSocketAddress* gsaddr diff --git a/xwords4/linux/gamesdb.c b/xwords4/linux/gamesdb.c index 774d0102a..afc99d9cd 100644 --- a/xwords4/linux/gamesdb.c +++ b/xwords4/linux/gamesdb.c @@ -349,9 +349,9 @@ gdb_summarize( CommonGlobals* cGlobals ) XP_U32 gameID = gi->gameID; XP_ASSERT( 0 != gameID ); - gchar connvia[128] = {0}; + gchar connvia[128] = {}; - ScoresArray scores = {0}; + ScoresArray scores = {}; if ( gameOver ) { model_figureFinalScores( game->model, &scores, NULL ); } else { @@ -359,8 +359,8 @@ gdb_summarize( CommonGlobals* cGlobals ) scores.arr[ii] = model_getPlayerScore( game->model, ii ); } } - gchar scoreBufs[MAX_NUM_PLAYERS][64] = {0}; - gchar* arr[MAX_NUM_PLAYERS+1] = {0}; + gchar scoreBufs[MAX_NUM_PLAYERS][64] = {}; + gchar* arr[MAX_NUM_PLAYERS+1] = {}; for ( int ii = 0; ii < nTotal; ++ii ) { XP_SNPRINTF( scoreBufs[ii], VSIZE(scoreBufs[ii]), "%s: %d", gi->players[ii].name, scores.arr[ii] ); @@ -404,7 +404,7 @@ gdb_summarize( CommonGlobals* cGlobals ) } seed = comms_getChannelSeed( game->comms ); #ifdef XWFEATURE_RELAY - XP_UCHAR relayID[32] = {0}; + XP_UCHAR relayID[32] = {}; XP_U16 len = VSIZE(relayID); (void)comms_getRelayID( game->comms, relayID, &len ); #endif diff --git a/xwords4/linux/gsrcwrap.c b/xwords4/linux/gsrcwrap.c index 21e90b672..0130f8218 100644 --- a/xwords4/linux/gsrcwrap.c +++ b/xwords4/linux/gsrcwrap.c @@ -135,7 +135,7 @@ watch_wrapper( GIOChannel* source, GIOCondition condition, gpointer data ) { WrapperState* state = (WrapperState*)data; - char buf[128] = {0}; + char buf[128] = {}; formatFlags( buf, VSIZE(buf), condition ); /* XP_LOGF( TAG "%s(%s): CALLED; flags: %s", __func__, state->procName, buf ); */ diff --git a/xwords4/linux/gtkaskm.c b/xwords4/linux/gtkaskm.c index 8b048fb83..db32557a4 100644 --- a/xwords4/linux/gtkaskm.c +++ b/xwords4/linux/gtkaskm.c @@ -42,7 +42,7 @@ button_clicked( GtkWidget* widget, gpointer closure ) XP_Bool gtkaskm( const gchar* message, AskMInfo* infos, int nInfos ) { - AskMState state = {0}; + AskMState state = {}; GtkWidget* dialog = gtk_dialog_new(); GtkWidget* fields[nInfos]; gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE ); diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index 40af34ae6..ffb164fd8 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -1368,7 +1368,7 @@ handle_invite_button( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals ) CommonGlobals* cGlobals = &globals->cGlobals; XP_U16 nMissing = server_getPendingRegs( globals->cGlobals.game.server ); - CommsAddrRec inviteAddr = {0}; + CommsAddrRec inviteAddr = {}; gint nPlayers = nMissing; XP_Bool confirmed = gtkInviteDlg( globals, &inviteAddr, &nPlayers ); XP_LOGFF( "gtkInviteDlg() => %s", boolToStr(confirmed) ); @@ -1383,7 +1383,7 @@ send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers, const CommsAddrRec* destAddr ) { CommsCtxt* comms = cGlobals->game.comms; - CommsAddrRec myAddr = {0}; + CommsAddrRec myAddr = {}; XP_ASSERT( comms ); comms_getSelfAddr( comms, &myAddr ); @@ -1391,7 +1391,7 @@ send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers, if ( server_getOpenChannel( cGlobals->game.server, &channel ) ) { gint forceChannel = channel; - NetLaunchInfo nli = {0}; /* include everything!!! */ + NetLaunchInfo nli = {}; /* include everything!!! */ nli_init( &nli, cGlobals->gi, &myAddr, nPlayers, forceChannel ); #ifdef XWFEATURE_RELAY if ( addr_hasType( &myAddr, COMMS_CONN_RELAY ) ) { @@ -1540,7 +1540,7 @@ ask_tiles( gpointer data ) GtkGameGlobals* globals = (GtkGameGlobals*)data; CommonGlobals* cGlobals = &globals->cGlobals; - TrayTileSet newTiles = {0}; + TrayTileSet newTiles = {}; XP_UCHAR* name = cGlobals->gi->players[cGlobals->selPlayer].name; for ( XP_Bool done = XP_FALSE; !done; ) { XP_S16 picked = gtkletterask( &newTiles, XP_TRUE, name, diff --git a/xwords4/linux/gtkinvit.c b/xwords4/linux/gtkinvit.c index e38142d40..6f7fcd0fa 100644 --- a/xwords4/linux/gtkinvit.c +++ b/xwords4/linux/gtkinvit.c @@ -36,7 +36,7 @@ typedef struct _PageData { } PageData; #ifdef XWFEATURE_RELAY -static XP_UCHAR s_devIDBuf[32] = {0}; +static XP_UCHAR s_devIDBuf[32] = {}; #endif typedef struct _GtkInviteState { diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index b2b045965..bc4a0cc14 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -271,13 +271,13 @@ add_to_list( GtkWidget* list, sqlite3_int64 rowid, XP_Bool isNew, gchar* localString = 0 <= gib->turn ? gib->turnLocal ? "YES" : "NO" : ""; - gchar createdStr[64] = {0}; + gchar createdStr[64] = {}; if ( 0 != gib->created ) { formatSeconds( gib->created, createdStr, VSIZE(createdStr) ); } gchar timeStr[64]; formatSeconds( gib->lastMoveTime, timeStr, VSIZE(timeStr) ); - gchar timerStr[64] = {0}; + gchar timerStr[64] = {}; if ( gib->dupTimerExpires ) { formatSeconds( gib->dupTimerExpires, timerStr, VSIZE(timeStr) ); } @@ -435,7 +435,7 @@ delete_game( GtkAppGlobals* apg, sqlite3_int64 rowid ) gdb_deleteGame( params->pDb, rowid ); #ifdef XWFEATURE_RELAY - XP_UCHAR devIDBuf[64] = {0}; + XP_UCHAR devIDBuf[64] = {}; gdb_fetch_safe( params->pDb, KEY_RDEVID, NULL, devIDBuf, sizeof(devIDBuf) ); if ( '\0' != devIDBuf[0] ) { relaycon_deleted( params, devIDBuf, clientToken ); @@ -522,7 +522,7 @@ setWindowTitle( GtkAppGlobals* apg ) GtkWidget* window = apg->window; LaunchParams* params = apg->cag.params; - gchar title[128] = {0}; + gchar title[128] = {}; if ( !!params->dbName ) { strcat( title, params->dbName ); } @@ -840,7 +840,7 @@ static gint requestMsgs( gpointer data ) { GtkAppGlobals* apg = (GtkAppGlobals*)data; - XP_UCHAR devIDBuf[64] = {0}; + XP_UCHAR devIDBuf[64] = {}; gdb_fetch_safe( apg->cag.params->pDb, KEY_RDEVID, NULL, devIDBuf, sizeof(devIDBuf) ); if ( '\0' != devIDBuf[0] ) { relaycon_requestMsgs( apg->cag.params, devIDBuf ); @@ -1010,7 +1010,7 @@ makeMoveIfWrapper( void* closure, XP_U32 gameID, XP_Bool tryTrade ) if ( !!globals ) { success = linux_makeMoveIf( &globals->cGlobals, tryTrade ); } else { - GtkGameGlobals tmpGlobals = {0}; + GtkGameGlobals tmpGlobals = {}; int nRowIDs = 1; gdb_getRowsForGameID( apg->cag.params->pDb, gameID, &rowid, &nRowIDs ); @@ -1034,7 +1034,7 @@ sendChatWrapper( void* closure, XP_U32 gameID, const char* msg ) board_sendChat( globals->cGlobals.game.board, NULL_XWE, msg ); success = XP_TRUE; } else { - GtkGameGlobals tmpGlobals = {0}; + GtkGameGlobals tmpGlobals = {}; int nRowIDs = 1; gdb_getRowsForGameID( apg->cag.params->pDb, gameID, &rowid, &nRowIDs ); @@ -1061,7 +1061,7 @@ addInvitesWrapper( void* closure, XP_U32 gameID, XP_U16 nRemotes, int nRowIDs = 1; gdb_getRowsForGameID( apg->cag.params->pDb, gameID, &rowid, &nRowIDs ); - GtkGameGlobals tmpGlobals = {0}; + GtkGameGlobals tmpGlobals = {}; if ( 1 == nRowIDs && loadGameNoDraw( &tmpGlobals, apg->cag.params, rowid ) ) { linux_addInvites( &tmpGlobals.cGlobals, nRemotes, destAddrs ); @@ -1096,7 +1096,7 @@ getForGameIDWrapper( void* closure, XP_U32 gameID ) int gtkmain( LaunchParams* params ) { - GtkAppGlobals apg = {0}; + GtkAppGlobals apg = {}; params->appGlobals = &apg; g_globals_for_signal = &apg; diff --git a/xwords4/linux/gtknewgame.c b/xwords4/linux/gtknewgame.c index 3d626d979..ba10f2c4c 100644 --- a/xwords4/linux/gtknewgame.c +++ b/xwords4/linux/gtknewgame.c @@ -746,7 +746,7 @@ gboolean gtkNewGameDialog( GtkGameGlobals* globals, CurGameInfo* gi, CommsAddrRec* addr, XP_Bool isNewGame, XP_Bool fireConnDlg ) { - GtkNewGameState state = {0}; + GtkNewGameState state = {}; state.globals = globals; state.gi = gi; diff --git a/xwords4/linux/lindutil.c b/xwords4/linux/lindutil.c index a466b1ebc..21454c490 100644 --- a/xwords4/linux/lindutil.c +++ b/xwords4/linux/lindutil.c @@ -252,7 +252,7 @@ sendViaThreadProc( void* arg ) headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - FetchData fd = {0}; + FetchData fd = {}; curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, curl_callback ); curl_easy_setopt( curl, CURLOPT_WRITEDATA, (void *) &fd ); diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 3f49b43ed..0a8dd7c69 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -375,7 +375,7 @@ gint requestMsgsIdle( gpointer data ) { CommonGlobals* cGlobals = (CommonGlobals*)data; - XP_UCHAR devIDBuf[64] = {0}; + XP_UCHAR devIDBuf[64] = {}; gdb_fetch_safe( cGlobals->params->pDb, KEY_RDEVID, NULL, devIDBuf, sizeof(devIDBuf) ); if ( '\0' != devIDBuf[0] ) { @@ -1225,7 +1225,7 @@ linux_init_relay_socket( CommonGlobals* cGlobals, const CommsAddrRec* addrRec ) cGlobals->relaySocket = sock; XP_LOGF( "%s: connected new socket %d to relay", __func__, sock ); - struct timeval tv = {0}; + struct timeval tv = {}; tv.tv_sec = 15; setsockopt( sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv) ); } else { @@ -1361,7 +1361,7 @@ linux_relay_ioproc( GIOChannel* source, GIOCondition condition, gpointer data ) inboundS = stream_from_msgbuf( cGlobals, buf, nBytes ); if ( !!inboundS ) { - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; addr_addType( &addr, COMMS_CONN_RELAY ); redraw = game_receiveMessage( &cGlobals->game, NULL_XWE, inboundS, &addr ); @@ -1792,7 +1792,7 @@ patsParamsToIter( const LaunchParams* params, const DictionaryCtxt* dict ) const XP_UCHAR** strPats = NULL; const XP_UCHAR* _strPats[4]; XP_U16 nStrPats = 0; - PatDesc descs[3] = {0}; + PatDesc descs[3] = {}; XP_U16 nPatDescs = 0; if ( !!params->iterTestPats ) { @@ -1886,7 +1886,7 @@ onFoundTiles( void* XP_UNUSED(closure), const Tile* XP_UNUSED(tiles), /* XP_S16 lenMatched = di_findStartsWith( ftp->iter, tiles, nTiles ); */ /* if ( 0 <= lenMatched ) { */ /* XP_UCHAR buf[32]; */ - /* XP_UCHAR bufPrev[32] = {0}; */ + /* XP_UCHAR bufPrev[32] = {}; */ /* di_wordToString( ftp->iter, buf, VSIZE(buf), "." ); */ /* /\* This doesn't work with synonyms like "L-L" for "L·L" *\/ */ @@ -2005,7 +2005,7 @@ walk_dict_test( MPFORMAL const LaunchParams* params, const DictionaryCtxt* dict, XP_ASSERT( word.index == indices[ii] ); XP_UCHAR buf1[64]; dict_wordToString( dict, &word, buf1, VSIZE(buf1), delim ); - XP_UCHAR buf2[64] = {0}; + XP_UCHAR buf2[64] = {}; if ( ii > 0 && dict_getNthWord( dict, &word, indices[ii]-1 ) ) { dict_wordToString( dict, &word, buf2, VSIZE(buf2), delim ); } @@ -2599,12 +2599,12 @@ writeStatus( const char* statusSocket, const char* dbName ) { int sock = socket( AF_UNIX, SOCK_DGRAM, 0 ); - DevSummary ds = {0}; + DevSummary ds = {}; sqlite3* pDb = gdb_open( dbName ); gdb_getSummary( pDb, &ds ); gdb_close( pDb ); - struct sockaddr_un addr = {0}; + struct sockaddr_un addr = {}; addr.sun_family = AF_UNIX; strncpy( addr.sun_path, statusSocket, sizeof(addr.sun_path) - 1); int err = connect( sock, (const struct sockaddr *) &addr, sizeof(addr)); @@ -2694,7 +2694,7 @@ main( int argc, char** argv ) // char* portNum = NULL; // char* hostName = "localhost"; unsigned int seed = makeRandomInt(); - LaunchParams mainParams = {0}; + LaunchParams mainParams = {}; XP_U16 nPlayerDicts = 0; XP_U16 robotCount = 0; /* XP_U16 ii; */ diff --git a/xwords4/linux/linuxsms.c b/xwords4/linux/linuxsms.c index 449865480..c66debc9e 100644 --- a/xwords4/linux/linuxsms.c +++ b/xwords4/linux/linuxsms.c @@ -258,7 +258,7 @@ parseAndDispatch( LaunchParams* params, uint8_t* buf, int len, msg->data, msg->len ); break; case INVITE: { - NetLaunchInfo nli = {0}; + NetLaunchInfo nli = {}; nliFromData( params, msg, &nli ); (*storage->procs->inviteReceived)( storage->procClosure, &nli ); @@ -446,7 +446,7 @@ pickFile( LinSMSData* storage, XP_Bool pickAtRandom, g_dir_rewind( dir ); int targetIndx = XP_RANDOM() % count; - XP_UCHAR oldestFile[512] = {0}; + XP_UCHAR oldestFile[512] = {}; int cur = 0; for ( ; ; ) { const gchar* name = g_dir_read_name( dir ); @@ -516,7 +516,7 @@ check_for_files_once( gpointer data ) uint8_t buf[256]; - CommsAddrRec fromAddr = {0}; + CommsAddrRec fromAddr = {}; XP_S16 nRead = -1; XP_UCHAR path[1024]; if ( pickFile( storage, XP_TRUE, path, VSIZE(path) ) ) { diff --git a/xwords4/linux/linuxutl.c b/xwords4/linux/linuxutl.c index ec862dfe0..bc7bb98e5 100644 --- a/xwords4/linux/linuxutl.c +++ b/xwords4/linux/linuxutl.c @@ -45,7 +45,7 @@ static void debugf( const char* format, va_list ap ) { pthread_mutex_lock( &sLogMutex ); - struct timespec tp = {0}; + struct timespec tp = {}; int res = clock_gettime( CLOCK_REALTIME, &tp ); if ( 0 == res ) { struct tm* timp = localtime( &tp.tv_sec ); diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index edbb9c071..35d9311a5 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -633,7 +633,7 @@ process( RelayConStorage* storage, XP_U8* buf, ssize_t nRead ) } break; case XWPDEV_MSG: { - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; addr_addType( &addr, COMMS_CONN_RELAY ); (*storage->procs.msgReceived)( storage->procsClosure, &addr, ptr, end - ptr ); @@ -915,7 +915,7 @@ onGotQueryData( RelayTask* task ) if ( !!task->ws.ptr ) { json_object* reply = json_tokener_parse( task->ws.ptr ); if ( !!reply ) { - CommsAddrRec addr = {0}; + CommsAddrRec addr = {}; addr_addType( &addr, COMMS_CONN_RELAY ); #ifdef DEBUG GList* ids = g_hash_table_get_keys( task->u.query.map );