Fix #145, Clean up CF return codes #364
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.
Checklist
Describe the contribution
Fixes #145
int
/int32
return types were converted toCFE_Status_t
(cases of specifically unsigned or intentionally long/short types (e.g.uint64
,uint8
) were not changed)CFE_SUCCESS
rather than 0 (zero)CF_ERROR
macro, or specific error macros where appropriate for repeat casesCF_Timer_Expired()
changed to bool return typeCF_SendRet_t
enum error return values to macros (all negative)CF_SendRet_FAILURE
enum valueCF_RxEofRet_t
enum error return values to macros (all negative)CF_RxEofRet_INVALID
enum valueMinor changes:
(failed)
, not(success)
:CF/unit-test/cf_cmd_tests.c
Line 3569 in 19c18b9
@retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR
(previouslyCF_SendRet_NO_MSG
) forCF_CFDP_SendNak()
(was simply missing)@retval CF_SEND_PDU_ERROR
(previouslyCF_SendRet_ERROR
) was not actually implemented/used and was removed from the prototype descriptions of:CF_CFDP_SendFin()
CF_CFDP_SendAck()
CF_CFDP_SendMd()
CF_CFDP_SendEof()
/* error return path */
comments that are no longer relevant since thegoto
's were removedTesting performed
GitHub CI actions (incl. Build + Run, Unit Tests etc.) all passing successfully.
Expected behavior changes
Behavior essentially unchanged.
Removing positive error return values eases future maintainability.
Using a defined set of error return macros improves code clarity and makes CF more consistent with cFE and the other cFS apps.
Synchronizing the return types to
CFE_Status_t
simplifies the code, and makes it more type-safe.Could consider adding to this PR, or in the future, defining unique error return macros for each unique return type.
Contributor Info
Avi Weiss @thnkslprpt