Skip to content
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

Fix #455, Convert suitable 0/1 variables to bool type #456

Merged

Conversation

thnkslprpt
Copy link
Contributor

Checklist

Describe the contribution

  • Fixes Convert internal 0/1 variables to bool type #455
    • Continuation of recent efforts to improve type/return values in the CFDP app
    • This targets obvious candidates of int variables being used to represent boolean truth values (on/off, true/false) to use the actual bool type - improving the clarity of the code.
    • Note: no changes have been made here to the external facing inc folder

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).

Expected behavior changes
Effectively no change to behavior (these int variables were already being used as boolean truth values).

System(s) tested on
Debian GNU/Linux 11 (bullseye)
Current main branch of cFS bundle.

Contributor Info
Avi Weiss   @thnkslprpt

@@ -689,7 +689,7 @@
if (success && txn->state_data.receive.r2.rx_crc_calc_bytes == txn->fsize)
{
/* all bytes calculated, so now check */
if (!CF_CFDP_R_CheckCrc(txn, txn->state_data.receive.r2.eof_crc))
if (CF_CFDP_R_CheckCrc(txn, txn->state_data.receive.r2.eof_crc) == CFE_SUCCESS)

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
fsw/src/cf_cfdp.c Fixed Show fixed Hide fixed
@@ -981,14 +981,14 @@
* See description in cf_cmd.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, uint8 chan_num)
void CF_GetSetParamCmd(bool is_set, CF_GetSet_ValueID_t param_id, uint32 value, uint8 chan_num)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
fsw/src/cf_cfdp.c Fixed Show fixed Hide fixed
@@ -981,14 +981,14 @@
* See description in cf_cmd.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, uint8 chan_num)
void CF_GetSetParamCmd(bool is_set, CF_GetSet_ValueID_t param_id, uint32 value, uint8 chan_num)

Check notice

Code scanning / CodeQL

Function too long Note

CF_GetSetParamCmd has too many lines (148, while 60 are allowed).
@dzbaker
Copy link
Contributor

dzbaker commented Nov 27, 2024

Thanks @thnkslprpt for these contributions! I'd like to get our team to review this one next week; would you be able to resolve the conflicts?

@dzbaker dzbaker added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Nov 27, 2024
@thnkslprpt thnkslprpt force-pushed the fix-455-convert-suitable-variables-to-bool branch from e029f03 to 0b1be18 Compare November 28, 2024 07:38
@thnkslprpt
Copy link
Contributor Author

dzbaker

Updated @dzbaker

@@ -1586,7 +1586,7 @@
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history)
void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, bool keep_history)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -1586,7 +1586,7 @@
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history)
void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, bool keep_history)

Check notice

Code scanning / CodeQL

Function too long Note

CF_CFDP_ResetTransaction has too many lines (63, while 60 are allowed).
@dzbaker dzbaker added CCB:Approved and removed CCB:Ready Ready for discussion at the Configuration Control Board (CCB) labels Dec 5, 2024
@dzbaker dzbaker merged commit e063cea into nasa:main Dec 5, 2024
16 checks passed
@thnkslprpt thnkslprpt deleted the fix-455-convert-suitable-variables-to-bool branch December 5, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert internal 0/1 variables to bool type
2 participants