Skip to content

Commit 8036db0

Browse files
Merge pull request #16 from bradleysmith23/main
Fix MISRA violations introduced by parameter checking
2 parents 336b339 + 558c2a5 commit 8036db0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

source/MQTTFileDownloader.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ MQTTFileDownloaderStatus_t mqttDownloader_init( MqttFileDownloaderContext_t * co
170170
const char * getStreamApiSuffix = NULL;
171171
MQTTFileDownloaderStatus_t initStatus = MQTTFileDownloaderSuccess;
172172

173-
if( ( streamName == NULL ) || ( streamNameLength == 0 ) ||
174-
( thingName == NULL ) || ( thingNameLength == 0 ) || ( context == NULL ) )
173+
if( ( streamName == NULL ) || ( streamNameLength == 0U ) ||
174+
( thingName == NULL ) || ( thingNameLength == 0U ) || ( context == NULL ) )
175175
{
176176
initStatus = MQTTFileDownloaderBadParameter;
177177
}
@@ -183,9 +183,9 @@ MQTTFileDownloaderStatus_t mqttDownloader_init( MqttFileDownloaderContext_t * co
183183
( void ) memset( context->topicGetStream, ( int32_t ) '\0', TOPIC_GET_STREAM_BUFFER_SIZE );
184184
context->topicStreamDataLength = 0U;
185185
context->topicGetStreamLength = 0U;
186-
context->dataType = dataType;
186+
context->dataType = ( uint8_t ) dataType;
187187

188-
if( dataType == DATA_TYPE_JSON )
188+
if( context->dataType == ( uint8_t ) DATA_TYPE_JSON )
189189
{
190190
streamDataApiSuffix = MQTT_API_DATA_JSON;
191191
}
@@ -379,7 +379,7 @@ MQTTFileDownloaderStatus_t mqttDownloader_isDataBlockReceived( const MqttFileDow
379379
{
380380
MQTTFileDownloaderStatus_t status = MQTTFileDownloaderFailure;
381381

382-
if( ( topic == NULL ) || ( topicLength == 0 ) )
382+
if( ( topic == NULL ) || ( topicLength == 0U ) )
383383
{
384384
status = MQTTFileDownloaderBadParameter;
385385
}
@@ -404,11 +404,11 @@ MQTTFileDownloaderStatus_t mqttDownloader_processReceivedDataBlock( const MqttFi
404404
{
405405
MQTTFileDownloaderStatus_t decodingStatus = MQTTFileDownloaderFailure;
406406

407-
if( ( message != NULL ) && ( messageLength != 0 ) && ( data != NULL ) && ( dataLength != NULL ) )
407+
if( ( message != NULL ) && ( messageLength != 0U ) && ( data != NULL ) && ( dataLength != NULL ) )
408408
{
409409
( void ) memset( data, ( int32_t ) '\0', mqttFileDownloader_CONFIG_BLOCK_SIZE );
410410

411-
if( context->dataType == DATA_TYPE_JSON )
411+
if( context->dataType == ( uint8_t ) DATA_TYPE_JSON )
412412
{
413413
decodingStatus = handleJsonMessage( data,
414414
dataLength,

0 commit comments

Comments
 (0)