-
Notifications
You must be signed in to change notification settings - Fork 208
IPv4/single: some minor comments after the MISRA changes #531
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
IPv4/single: some minor comments after the MISRA changes #531
Conversation
AniruddhaKanhere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR @htibosch. I have a couple of comments/suggestions. Can you please take a look at that?
source/include/FreeRTOS_IP.h
Outdated
| #define __VERSION( v1, v2, v3 ) "V" # v1 "." # v2 "." # v3 | ||
| #define _VERSION( v1, v2, v3 ) __VERSION( v1, v2, v3 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MISRA doesn't like the use of # operator. Ref: Misra c-2012 rule 20.10 (advisory).
Also, these version numbers are updated together - and only when a release happens. Not completely sold on the value added by using the above expression to generate the ipFR_TCP_VERSION_NUMBER string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have cancelled the change to the macro ipFR_TCP_VERSION_NUMBER.
Aniruddha suggestion to clear uxPayloadXXX when recv() failed Co-authored-by: Aniruddha Kanhere <[email protected]>
|
The logic added in DNS_ReadReply is not needed. Removed that part and update the branch. |
Description
Use
xReturnand notuxReturnwhen the variable is signed.Call
memset()to clear the contents of a struct.I have seen applications crash on such a statement:
because the compile can be mistaken about the alignment.
Check the return value of
FreeRTOS_recvfrom()before assigning it to an unsigned variable:The result of
FreeRTOS_recvfrom()must be tested because a negative value indicates an error.As I commented here, cast a
BaseType_tvariable tointwhen usingsnprintf():Let
ipFR_TCP_VERSION_NUMBERdepend on the other 3 version macros:but I think that Aniruddha has a more elegant solution.
I compare today's mainline with the release on 7th of June. Beside a few minor things I think it is all good. Thanks.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.