Skip to content

Commit a991b39

Browse files
authored
Fix unsigned comparison IAR compiler warnings (#81)
IAR treats enumerations with only positive values as unsigned types. Checking commandType is positive raises a redundant unsigned compare warning in IAR. Since MQTTAgentCommandType_t is used as an array index, negative values wouldn't be added to the enumeration.
1 parent 3b74317 commit a991b39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/core_mqtt_agent.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ static MQTTStatus_t processCommand( MQTTAgentContext_t * pMqttAgentContext,
562562

563563
if( pCommand != NULL )
564564
{
565-
assert( pCommand->commandType < NUM_COMMANDS );
565+
assert( ( unsigned int ) pCommand->commandType < ( unsigned int ) NUM_COMMANDS );
566566

567-
if( ( pCommand->commandType >= NONE ) && ( pCommand->commandType < NUM_COMMANDS ) )
567+
if( ( unsigned int ) pCommand->commandType < ( unsigned int ) NUM_COMMANDS )
568568
{
569569
commandFunction = pCommandFunctionTable[ pCommand->commandType ];
570570
pCommandArgs = pCommand->pArgs;

0 commit comments

Comments
 (0)