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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.
@@ -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.
@@ -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.
@@ -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 (86, while 60 are allowed).
@@ -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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert internal 0/1 variables to bool type
1 participant