@@ -388,7 +388,7 @@ static MQTTStatus_t decodeAndDiscard( size_t * pPropertyLength,
388388 *
389389 * @return #MQTTSuccess if variable length and paramters are valid else #MQTTBadParameter.
390390 */
391- static MQTTStatus_t decodeVariableLength ( uint8_t * pBuffer ,
391+ static MQTTStatus_t decodeVariableLength ( const uint8_t * pBuffer ,
392392 size_t * pLength );
393393
394394/**
@@ -1928,7 +1928,7 @@ MQTTStatus_t MQTT_GetDisconnectPacketSize( size_t * pRemainingLength,
19281928 LogError ( ( "Max packet size cannot be zero." ) );
19291929 status = MQTTBadParameter ;
19301930 }
1931- else if (validateDisconnectResponse ( reasonCode , false ) != MQTTSuccess )
1931+ else if (validateDisconnectResponse ( ( uint8_t ) reasonCode , false ) != MQTTSuccess )
19321932 {
19331933 LogError ( ( "Invalid reason code." ) );
19341934 status = MQTTBadParameter ;
@@ -2300,7 +2300,7 @@ static MQTTStatus_t validateConnackParams( const MQTTPacketInfo_t * pIncomingPac
23002300
23012301/*-----------------------------------------------------------*/
23022302
2303- static MQTTStatus_t decodeVariableLength (uint8_t * pBuffer ,
2303+ static MQTTStatus_t decodeVariableLength (const uint8_t * pBuffer ,
23042304 size_t * pLength )
23052305{
23062306 size_t remainingLength = 0 ;
@@ -2676,8 +2676,8 @@ static MQTTStatus_t logAckResponse( uint8_t reasonCode,
26762676 uint16_t packetIdentifier )
26772677{
26782678 MQTTStatus_t status = MQTTServerRefused ;
2679-
2680- switch ( reasonCode )
2679+ /* coverity[misra_c_2012_rule_10_5_violation] */
2680+ switch ( ( MQTTSuccessFailReasonCode_t ) reasonCode )
26812681 {
26822682 case MQTT_REASON_PUBACK_SUCCESS :
26832683 ( void ) packetIdentifier ;
@@ -2739,8 +2739,8 @@ static MQTTStatus_t logSimpleAckResponse( uint8_t reasonCode,
27392739 uint16_t packetIdentifier )
27402740{
27412741 MQTTStatus_t status = MQTTServerRefused ;
2742-
2743- switch ( reasonCode )
2742+ /* coverity[misra_c_2012_rule_10_5_violation] */
2743+ switch ( ( MQTTSuccessFailReasonCode_t ) reasonCode )
27442744 {
27452745 case MQTT_REASON_PUBREL_SUCCESS :
27462746 ( void ) packetIdentifier ;
@@ -2841,7 +2841,8 @@ static MQTTStatus_t validateDisconnectResponse( uint8_t reasonCode,
28412841 MQTTStatus_t status ;
28422842
28432843 /*Validate the reason code.*/
2844- switch ( reasonCode )
2844+ /* coverity[misra_c_2012_rule_10_5_violation] */
2845+ switch ( (MQTTSuccessFailReasonCode_t )reasonCode )
28452846 {
28462847 case MQTT_REASON_DISCONNECT_DISCONNECT_WITH_WILL_MESSAGE :
28472848
0 commit comments