Conversation
| @@ -707,7 +703,9 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) | |||
Check notice
Code scanning
Unchecked function argument
fsw/src/cf_cfdp.c
Outdated
| @@ -654,18 +651,15 @@ int CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) | |||
| { | |||
Check notice
Code scanning
Unchecked function argument
skliper
left a comment
There was a problem hiding this comment.
Preference is for functions to have one exit point if reasonably possible. We don't currently enforce it as a hard rule but should be the goal.
453ae2d to
58e591e
Compare
There was a problem hiding this comment.
Found 17 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Found 17 potential problems in the proposed changes. Check the Files changed tab for more details.
58e591e to
07f9228
Compare
There was a problem hiding this comment.
Found 17 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Found 17 potential problems in the proposed changes. Check the Files changed tab for more details.
07f9228 to
8dac0a2
Compare
There was a problem hiding this comment.
Found 50 potential problems in the proposed changes. Check the Files changed tab for more details.
8dac0a2 to
0012263
Compare
There was a problem hiding this comment.
Found 64 potential problems in the proposed changes. Check the Files changed tab for more details.
0012263 to
88d8764
Compare
There was a problem hiding this comment.
Found 61 potential problems in the proposed changes. Check the Files changed tab for more details.
88d8764 to
d628409
Compare
There was a problem hiding this comment.
Found 61 potential problems in the proposed changes. Check the Files changed tab for more details.
|
I believe I got all functions. The only function I wasn't sure what to do with was |
skliper
left a comment
There was a problem hiding this comment.
Great progress! See suggestions (happy to chat if it helps.)
fsw/src/cf_cfdp_s.c
Outdated
| */ | ||
| fd->data_len = actual_bytes; | ||
| fd->data_ptr = data_ptr; | ||
| int status; |
There was a problem hiding this comment.
Declare at the top of the function... might also need to initialize it just to squash warnings
fsw/src/cf_cfdp_s.c
Outdated
| ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; | ||
| goto err_out; | ||
| t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; | ||
| CF_CFDP_S_Reset(t); |
There was a problem hiding this comment.
Does this work because the rest of the calls fail on a transaction that was reset? Probably more clear if you set a flag again and only did each of the following calls based on success. Could also just do the reset and filestore rejection once at the end if it wasn't success.
fsw/src/cf_cfdp_s.c
Outdated
| /* no reason to reset this timer, as it isn't used again */ | ||
| CF_CFDP_S_Reset(t); | ||
| goto err_out; /* must exit after reset */ | ||
| return; /* must exit after reset */ |
There was a problem hiding this comment.
I need to think more on this one... but I think we can simplify. If the transaction is reset will it skip the if on 792 anyways? Seem like you just need to also skip the finack send if the SendEof return is CF_SendRet_NO_MSG...
fsw/src/cf_clist.c
Outdated
| if (fn(n, context)) | ||
| { | ||
| goto err_out; | ||
| return; |
fsw/src/cf_clist.c
Outdated
| if (fn(n, context)) | ||
| { | ||
| goto err_out; | ||
| return; |
fsw/src/cf_app.c
Outdated
| status = CFE_TBL_Register(&CF_AppData.config_handle, CF_CONFIG_TABLE_NAME, sizeof(CF_ConfigTable_t), | ||
| CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP, CF_ValidateConfigTable); | ||
| if (status != CFE_SUCCESS) | ||
| if ((status = CFE_TBL_Register(&CF_AppData.config_handle, CF_CONFIG_TABLE_NAME, sizeof(CF_ConfigTable_t), |
There was a problem hiding this comment.
Preference is to avoid side affects in conditionals... get the status first, then the decision is just status != CFE_SUCCESS (same for similar patterns below)
fsw/src/cf_app.c
Outdated
| int32 CF_Init(void) | ||
| { | ||
| int32 status = CFE_SUCCESS; | ||
| bool success = true; |
There was a problem hiding this comment.
can you just use status == CFE_SUCCESS for these? Might be able to replace at least the first decision w/ just an else (maybe more?)
fsw/src/cf_cfdp.c
Outdated
| break; /* triggers tick type reset below */ | ||
| else | ||
| goto early_exit; | ||
| return; |
There was a problem hiding this comment.
maybe set an "early exit" then only reset the tick type below if not an early exit?
There was a problem hiding this comment.
When I tried to update this, it seemed to break a unit test and I'm not sure why.
There was a problem hiding this comment.
Did you try on line 1240 just doing a break; (since below it just breaks or returns), and then move the conditional on 1256 (might need to adjust the comment if it makes sense) to wrap the logic on 1266? Basically you just want to reset the tick type if c->tick_type == CF_TickType_TXW_NAK.
fsw/src/cf_cfdp_r.c
Outdated
| if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) | ||
| { | ||
| goto err_out; /* nothing to do here if error cc is set */ | ||
| return; /* nothing to do here if error cc is set */ |
There was a problem hiding this comment.
Could just switch to an == and wrap the entire block blow
fsw/src/cf_cfdp_r.c
Outdated
| ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; | ||
| CF_CFDP_R2_Reset(t); | ||
| goto err_out; /* must return after reset */ | ||
| return; /* must return after reset */ |
There was a problem hiding this comment.
I think you just need to skip the CF_CFDP_ArmAckTimer... and could let it flow to the end
d628409 to
9c47813
Compare
There was a problem hiding this comment.
Found 69 potential problems in the proposed changes. Check the Files changed tab for more details.
9c47813 to
9d965c4
Compare
There was a problem hiding this comment.
Found 69 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Found 68 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Found 68 potential problems in the proposed changes. Check the Files changed tab for more details.
fsw/src/cf_cfdp.c
Outdated
| break; /* triggers tick type reset below */ | ||
| else | ||
| goto early_exit; | ||
| return; |
There was a problem hiding this comment.
Did you try on line 1240 just doing a break; (since below it just breaks or returns), and then move the conditional on 1256 (might need to adjust the comment if it makes sense) to wrap the logic on 1266? Basically you just want to reset the tick type if c->tick_type == CF_TickType_TXW_NAK.
9d965c4 to
5f6a437
Compare
There was a problem hiding this comment.
Found 68 potential problems in the proposed changes. Check the Files changed tab for more details.
5f6a437 to
2c14b77
Compare
There was a problem hiding this comment.
Found 68 potential problems in the proposed changes. Check the Files changed tab for more details.
|
CCB 20 Jul 2022: Approved pending final review by @semaldona. |
Checklist (Please check before submitting)
Describe the contribution
Fix #225, replaced all instances of
gotoTesting performed
Ran unit tests
Expected behavior changes
No impact to behavior
System(s) tested on
Ubuntu 18.04
Contributor Info - All information REQUIRED for consideration of pull request
Haven Carlson - NASA