Skip to content

Use input argument instead of macro in mqttDownloader_processReceivedDataBlock #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
priyamourya25 opened this issue Jun 13, 2024 · 1 comment

Comments

@priyamourya25
Copy link

The param description for the API shows that dataLength is an input argument dataLength Decoded data block length.

This line should be
( void ) memset( data, ( int32_t ) '\0', mqttFileDownloader_CONFIG_BLOCK_SIZE );
changed to :
( void ) memset( data, ( int32_t ) '\0', *dataLength );

This is to avoid using constants if arguments are available for the same. The API does provide an interface to pass the dataLength and it should be used for manipulating the data buffer.

@priyamourya25
Copy link
Author

Another instance of MACRO seen here:

size_t payloadSize = mqttFileDownloader_CONFIG_BLOCK_SIZE;

Better to use
size_t payloadSize = *decodedDataLength;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant