[x] I signed and emailed the appropriate Contributor License Agreement to GSFC-SoftwareRelease@mail.nasa.gov and copied cfs-program@lists.nasa.gov.
Describe the contribution
Fixes #145
most int/int32 return types were converted to CFE_Status_t (cases of specifically unsigned or intentionally long/short types (e.g. uint64, uint8) were not changed)
successful returns now almost all represented by CFE_SUCCESS rather than 0 (zero)
unsuccessful returns now almost all represented by CF_ERROR macro, or specific error macros where appropriate for repeat cases
new error return macros all negative (unlike previously where some were positive enum values)
CF_Timer_Expired() changed to bool return type
converted CF_SendRet_t enum error return values to macros (all negative)
deleted unused CF_SendRet_FAILURE enum value
converted CF_RxEofRet_t enum error return values to macros (all negative)
deleted unused CF_RxEofRet_INVALID enum value
Minor changes:
updated this test message: should say (failed), not (success):
couple of typos that were noticed along the way (e.g. deode instead of decode)
added documentation for @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR (previously CF_SendRet_NO_MSG) for CF_CFDP_SendNak() (was simply missing)
@retval CF_SEND_PDU_ERROR (previously CF_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()
removed /* error return path */ comments that are no longer relevant since the goto's were removed
Testing 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.
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)
:@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