txCommands.c: warning: variable ... is used uninitialized whenever

Maybe ASSERT are not always active, so defensive coding solution.

txCommands.c:883:6: warning: variable 'but' is used uninitialized whenever switch default is taken
txCommands.c:888:6: warning: variable 'act' is used uninitialized whenever switch default is taken

clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
This commit is contained in:
Darryl L. Miles 2024-10-04 19:45:52 +01:00 committed by Tim Edwards
parent fa3a01c486
commit 817efbbccc
1 changed files with 4 additions and 3 deletions

View File

@ -880,15 +880,16 @@ txLogCommand(cmd)
case TX_LEFT_BUTTON: { but = 0; break; };
case TX_MIDDLE_BUTTON: { but = 1; break; };
case TX_RIGHT_BUTTON: { but = 2; break; };
default: {ASSERT(FALSE, "txLogCommand"); break; };
default: {ASSERT(FALSE, "txLogCommand"); but = -1; break; };
}
switch(cmd->tx_buttonAction) {
case TX_BUTTON_DOWN: { act = 0; break; };
case TX_BUTTON_UP: { act = 1; break; };
default: {ASSERT(FALSE, "txLogCommand"); break; };
default: {ASSERT(FALSE, "txLogCommand"); act = -1; break; };
}
fprintf(txLogFile, "%spushbutton %s %s\n",
if (but >= 0 && act >= 0)
fprintf(txLogFile, "%spushbutton %s %s\n",
pfix, txButTable[but], txActTable[act]);
}
if (txLogFlags & TX_LOG_UPDATE)