Skip to content

Commit 2bbf544

Browse files
Fix build
1 parent f29959d commit 2bbf544

File tree

8 files changed

+162
-80
lines changed

8 files changed

+162
-80
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: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static void serializeConnectPacket( const MQTTConnectInfo_t * pConnectInfo,
242242
const MQTTPublishInfo_t * pWillInfo,
243243
const MQTTPropBuilder_t * pConnectProperties,
244244
const MQTTPropBuilder_t * pWillProperties,
245-
size_t remainingLength,
245+
uint32_t remainingLength,
246246
const MQTTFixedBuffer_t * pFixedBuffer );
247247

248248
/**
@@ -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 ) )
@@ -2604,7 +2606,7 @@ static void serializeConnectPacket( const MQTTConnectInfo_t * pConnectInfo,
26042606
const MQTTPublishInfo_t * pWillInfo,
26052607
const MQTTPropBuilder_t * pConnectProperties,
26062608
const MQTTPropBuilder_t * pWillProperties,
2607-
size_t remainingLength,
2609+
uint32_t remainingLength,
26082610
const MQTTFixedBuffer_t * pFixedBuffer )
26092611
{
26102612
uint8_t * pIndex = NULL;
@@ -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. */
@@ -3261,11 +3245,11 @@ MQTTStatus_t MQTT_SerializeConnect( const MQTTConnectInfo_t * pConnectInfo,
32613245
const MQTTPublishInfo_t * pWillInfo,
32623246
const MQTTPropBuilder_t * pConnectProperties,
32633247
const MQTTPropBuilder_t * pWillProperties,
3264-
size_t remainingLength,
3248+
uint32_t remainingLength,
32653249
const MQTTFixedBuffer_t * pFixedBuffer )
32663250
{
32673251
MQTTStatus_t status = MQTTSuccess;
3268-
size_t connectPacketSize = 0;
3252+
uint32_t connectPacketSize = 0;
32693253

32703254
/* Validate arguments. */
32713255
if( ( pConnectInfo == NULL ) || ( pFixedBuffer == NULL ) )

source/core_mqtt_serializer_private.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ uint8_t * serializeAckFixed( uint8_t * pIndex,
459459
uint8_t * serializeConnectFixedHeader( uint8_t * pIndex,
460460
const MQTTConnectInfo_t * pConnectInfo,
461461
const MQTTPublishInfo_t * pWillInfo,
462-
size_t remainingLength )
462+
uint32_t remainingLength )
463463
{
464464
uint8_t * pIndexLocal = pIndex;
465465
uint8_t connectFlags = 0U;

source/include/core_mqtt_serializer.h

Lines changed: 3 additions & 3 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
/**
@@ -864,7 +864,7 @@ MQTTStatus_t MQTT_SerializeConnect( const MQTTConnectInfo_t * pConnectInfo,
864864
const MQTTPublishInfo_t * pWillInfo,
865865
const MQTTPropBuilder_t * pConnectProperties,
866866
const MQTTPropBuilder_t * pWillProperties,
867-
size_t remainingLength,
867+
uint32_t remainingLength,
868868
const MQTTFixedBuffer_t * pFixedBuffer );
869869
/* @[declare_mqtt_serializeconnect] */
870870

0 commit comments

Comments
 (0)