Skip to content

Commit 427acea

Browse files
Fix build
1 parent f29959d commit 427acea

File tree

5 files changed

+16
-46
lines changed

5 files changed

+16
-46
lines changed

docs/doxygen/include/size_table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</tr>
2020
<tr>
2121
<td>core_mqtt_serializer.c</td>
22-
<td><center>8.7K</center></td>
22+
<td><center>8.8K</center></td>
2323
<td><center>7.2K</center></td>
2424
</tr>
2525
<tr>
@@ -39,7 +39,7 @@
3939
</tr>
4040
<tr>
4141
<td><b>Total estimates</b></td>
42-
<td><b><center>21.1K</center></b></td>
42+
<td><b><center>21.2K</center></b></td>
4343
<td><b><center>17.8K</center></b></td>
4444
</tr>
4545
</table>

source/core_mqtt.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static size_t addEncodedStringToVector( uint8_t serializedLength[ CORE_MQTT_SERI
185185
const char * const string,
186186
uint16_t length,
187187
TransportOutVector_t * iterator,
188-
size_t * updatedLength );
188+
uint32_t * updatedLength );
189189

190190
/**
191191
* @brief Send Subscribe without copying the users data into any buffer.
@@ -2600,7 +2600,7 @@ static size_t addEncodedStringToVector( uint8_t serializedLength[ CORE_MQTT_SERI
26002600
const char * const string,
26012601
uint16_t length,
26022602
TransportOutVector_t * iterator,
2603-
size_t * updatedLength )
2603+
uint32_t * updatedLength )
26042604
{
26052605
size_t packetLength = 0U;
26062606
TransportOutVector_t * pLocalIterator = iterator;
@@ -2653,7 +2653,7 @@ static MQTTStatus_t sendSubscribeWithoutCopy( MQTTContext_t * pContext,
26532653
TransportOutVector_t * pIterator;
26542654
uint8_t serializedTopicFieldLength[ MQTT_SUB_UNSUB_MAX_VECTORS ][ CORE_MQTT_SERIALIZED_LENGTH_FIELD_BYTES ];
26552655
uint8_t subscriptionOptionsArray[ MQTT_SUB_UNSUB_MAX_VECTORS / CORE_MQTT_SUBSCRIBE_PER_TOPIC_VECTOR_LENGTH ];
2656-
size_t totalPacketLength = 0U;
2656+
uint32_t totalPacketLength = 0U;
26572657
size_t ioVectorLength = 0U;
26582658
size_t subscriptionsSent = 0U;
26592659
size_t vectorsAdded = 0U;
@@ -2794,7 +2794,7 @@ static MQTTStatus_t sendUnsubscribeWithoutCopy( MQTTContext_t * pContext,
27942794
TransportOutVector_t pIoVector[ MQTT_SUB_UNSUB_MAX_VECTORS ];
27952795
TransportOutVector_t * pIterator;
27962796
uint8_t serializedTopicFieldLength[ MQTT_SUB_UNSUB_MAX_VECTORS ][ CORE_MQTT_SERIALIZED_LENGTH_FIELD_BYTES ];
2797-
size_t totalPacketLength = 0U;
2797+
uint32_t totalPacketLength = 0U;
27982798
size_t ioVectorLength = 0U;
27992799
size_t unsubscriptionsSent = 0U;
28002800
size_t vectorsAdded = 0U;
@@ -3648,12 +3648,11 @@ static MQTTStatus_t validateSharedSubscriptions( const MQTTContext_t * pContext,
36483648
bool isSharedSub = ( topicFilterLength > 7U );
36493649
const char * shareNameEnd;
36503650
const char * shareNameStart;
3651-
size_t topicFilterMaxLen;
36523651

36533652
/* Need to check this only if the length is proper. */
36543653
if( pSubscriptionList[ iterator ].topicFilterLength > 7U )
36553654
{
3656-
isSharedSub = ( isSharedSub ) && ( ( strncmp( pSubscriptionList[ iterator ].pTopicFilter, "$share/", topicFilterMaxLen ) ) == 0 );
3655+
isSharedSub = ( isSharedSub ) && ( ( strncmp( pSubscriptionList[ iterator ].pTopicFilter, "$share/", 7U ) ) == 0 );
36573656
}
36583657

36593658
if( isSharedSub )

source/core_mqtt_serializer.c

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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. */

source/include/core_mqtt_serializer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,8 @@ MQTTStatus_t MQTT_GetConnectPacketSize( const MQTTConnectInfo_t * pConnectInfo,
793793
const MQTTPublishInfo_t * pWillInfo,
794794
const MQTTPropBuilder_t * pConnectProperties,
795795
const MQTTPropBuilder_t * pWillProperties,
796-
size_t * pRemainingLength,
797-
size_t * pPacketSize );
796+
uint32_t * pRemainingLength,
797+
uint32_t * pPacketSize );
798798
/* @[declare_mqtt_getconnectpacketsize] */
799799

800800
/**

source/include/private/core_mqtt_serializer_private.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -439,19 +439,6 @@ MQTTStatus_t decodeVariableLength( const uint8_t * pBuffer,
439439
size_t bufferLength,
440440
uint32_t * pLength );
441441

442-
/**
443-
* @brief Encodes the remaining length of the packet using the variable length
444-
* encoding scheme provided in the MQTT v3.1.1 specification.
445-
*
446-
* @param[out] pDestination The destination buffer to store the encoded remaining
447-
* length.
448-
* @param[in] length The remaining length to encode.
449-
*
450-
* @return The location of the byte following the encoded value.
451-
*/
452-
uint8_t * encodeVariableLength( uint8_t * pDestination,
453-
size_t length );
454-
455442
/**
456443
* @brief Serialize the fixed size part of the ack packet header.
457444
*

0 commit comments

Comments
 (0)