Fix #1311, CFE_SUCCESS constant type #1374
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the contribution
Ensures that the CFE_SUCCESS constant is the CFE_Status_t type.
Fixes #1311
Testing performed
Build and sanity check CFE, run all unit tests, confirm nothing went wrong.
Expected behavior changes
None
System(s) tested on
Ubuntu 20.04
Additional context
The explicit cast is required on all error codes that are expected to be negative values. The problem that occurs if these are not forced to
int32
type is that the compiler up-converts them tolong
, which on a 64-bit platform can can represent the value as a positive integer. Therefore a test for equality starts to fail.On codes that are positive values, it doesn't matter as much, the compiler will not need to convert these literals to anything other than int, but it shouldn't hurt to add it for consistency, just in case.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.