@@ -1897,7 +1897,9 @@ static MQTTStatus_t validateSubscriptionSerializeParams( const MQTTSubscribeInfo
18971897
18981898 if ( status == MQTTSuccess )
18991899 {
1900- for ( size_t it = 0 ; it < subscriptionCount ; it ++ )
1900+ size_t it ;
1901+
1902+ for ( it = 0 ; it < subscriptionCount ; it ++ )
19011903 {
19021904 /* Check whether the topic filter and the topic filter length are non-zero. */
19031905 if ( ( pSubscriptionList [ it ].pTopicFilter == NULL ) || ( pSubscriptionList [ it ].topicFilterLength == 0 ) )
@@ -2966,16 +2968,16 @@ MQTTStatus_t MQTT_GetConnectPacketSize( const MQTTConnectInfo_t * pConnectInfo,
29662968 const MQTTPublishInfo_t * pWillInfo ,
29672969 const MQTTPropBuilder_t * pConnectProperties ,
29682970 const MQTTPropBuilder_t * pWillProperties ,
2969- size_t * pRemainingLength ,
2970- size_t * pPacketSize )
2971+ uint32_t * pRemainingLength ,
2972+ uint32_t * pPacketSize )
29712973{
29722974 MQTTStatus_t status = MQTTSuccess ;
2973- size_t remainingLength ;
2975+ uint32_t remainingLength ;
29742976 size_t propertyLength = 0U ;
29752977 size_t willPropertyLength = 0U ;
29762978
29772979 /* The CONNECT packet will always include a 10-byte variable header without connect properties. */
2978- size_t connectPacketSize = MQTT_PACKET_CONNECT_HEADER_SIZE ;
2980+ uint32_t connectPacketSize = MQTT_PACKET_CONNECT_HEADER_SIZE ;
29792981
29802982 /* Validate arguments. */
29812983 if ( ( pConnectInfo == NULL ) || ( pRemainingLength == NULL ) ||
@@ -2994,18 +2996,6 @@ MQTTStatus_t MQTT_GetConnectPacketSize( const MQTTConnectInfo_t * pConnectInfo,
29942996 LogError ( ( "Client ID length and value mismatch." ) );
29952997 status = MQTTBadParameter ;
29962998 }
2997- else if ( ( pConnectInfo -> clientIdentifierLength > UINT16_MAX ) ||
2998- ( pConnectInfo -> userNameLength > UINT16_MAX ) ||
2999- ( pConnectInfo -> passwordLength > UINT16_MAX ) )
3000- {
3001- LogError ( ( "Client ID, userName and password length cannot be greater than %d. "
3002- "Client ID: %lu, User name len: %lu, Password len: %lu"
3003- UINT16_MAX ,
3004- ( unsigned long ) pConnectInfo -> clientIdentifierLength ,
3005- ( unsigned long ) pConnectInfo -> userNameLength ,
3006- ( unsigned long ) pConnectInfo -> passwordLength ) );
3007- status = MQTTBadParameter ;
3008- }
30092999 else if ( ( pWillInfo != NULL ) && ( pWillInfo -> payloadLength > ( size_t ) UINT16_MAX ) )
30103000 {
30113001 /* The MQTTPublishInfo_t is reused for the will message. The payload
@@ -3017,12 +3007,6 @@ MQTTStatus_t MQTT_GetConnectPacketSize( const MQTTConnectInfo_t * pConnectInfo,
30173007 ( unsigned long ) pWillInfo -> payloadLength ) );
30183008 status = MQTTBadParameter ;
30193009 }
3020- else if ( ( pWillInfo != NULL ) && ( pWillInfo -> topicNameLength > ( size_t ) UINT16_MAX ) )
3021- {
3022- LogError ( ( "The Will topic length must not exceed %d." ,
3023- UINT16_MAX ) );
3024- status = MQTTBadParameter ;
3025- }
30263010 else
30273011 {
30283012 /* Do Nothing. */
0 commit comments