From 9a68476bd224575ca0f452b261f5736edf077b39 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Thu, 11 Jul 2024 20:19:00 +0200 Subject: [PATCH] early_exit --- fsw/src/cf_cfdp.c | 28 ++++++++-------- fsw/src/cf_cfdp.h | 4 +-- fsw/src/cf_cfdp_r.c | 50 ++++++++++++++--------------- fsw/src/cf_cfdp_r.h | 2 +- fsw/src/cf_cfdp_s.c | 14 ++++---- fsw/src/cf_clist.c | 8 ++--- fsw/src/cf_cmd.c | 38 +++++++++++----------- fsw/src/cf_cmd.h | 4 +-- fsw/src/cf_utils.c | 6 ++-- unit-test/cf_cfdp_r_tests.c | 6 ++-- unit-test/cf_cfdp_sbintf_tests.c | 2 +- unit-test/cf_cfdp_tests.c | 46 +++++++++++++------------- unit-test/cf_cmd_tests.c | 16 ++++----- unit-test/stubs/cf_cfdp_handlers.c | 2 +- unit-test/stubs/cf_cfdp_stubs.c | 4 +-- unit-test/stubs/cf_cmd_stubs.c | 4 +-- unit-test/utilities/cf_test_utils.h | 2 +- 17 files changed, 118 insertions(+), 118 deletions(-) diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index c96a9167..55767104 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -123,7 +123,7 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical void CF_CFDP_ArmAckTimer(CF_Transaction_t *txn) { CF_Timer_InitRelSec(&txn->ack_timer, CF_AppData.config_table->chan[txn->chan_num].ack_timer_s); - txn->flags.com.ack_timer_armed = 1; + txn->flags.com.ack_timer_armed = true; } /*---------------------------------------------------------------- @@ -252,7 +252,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *txn, hdr->version = 1; hdr->pdu_type = (directive_code == 0); /* set to '1' for file data PDU, '0' for a directive PDU */ - hdr->direction = (towards_sender != 0); /* set to '1' for toward sender, '0' for toward receiver */ + hdr->direction = (towards_sender != false); /* set to '1' for toward sender, '0' for toward receiver */ hdr->txm_mode = (CF_CFDP_GetClass(txn) == CF_CFDP_CLASS_1); /* set to '1' for class 1 data, '0' for class 2 */ /* choose the larger of the two EIDs to determine size */ @@ -896,7 +896,7 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { /* NOTE: whether or not class 1 or 2, get a free chunks. It's cheap, and simplifies cleanup path */ txn->state = ph->pdu_header.txm_mode ? CF_TxnState_R1 : CF_TxnState_R2; - txn->flags.rx.md_recv = 1; + txn->flags.rx.md_recv = true; CF_CFDP_R_Init(txn); /* initialize R */ } else @@ -918,7 +918,7 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) if (txn->state == CF_TxnState_IDLE) { /* state was not changed, so free the transaction */ - CF_CFDP_ResetTransaction(txn, 0); + CF_CFDP_ResetTransaction(txn, false); } } @@ -1137,7 +1137,7 @@ CF_CListTraverse_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) if (args->chan->cur) { ret = CF_CLIST_EXIT; - args->early_exit = 1; + args->early_exit = true; } } @@ -1289,7 +1289,7 @@ CFE_Status_t CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP_TxFile_Initiate(txn, cfdp_class, keep, chan_num, priority, dest_id); ++chan->num_cmd_tx; - txn->flags.tx.cmd_tx = 1; + txn->flags.tx.cmd_tx = true; } return ret; @@ -1316,8 +1316,8 @@ static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *pb, const char * } else { - pb->diropen = 1; - pb->busy = 1; + pb->diropen = true; + pb->busy = true; pb->keep = keep; pb->priority = priority; pb->dest_id = dest_id; @@ -1417,7 +1417,7 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb) { /* PFTO: can we figure out the difference between "end of dir" and an error? */ OS_DirectoryClose(pb->dir_id); - pb->diropen = 0; + pb->diropen = false; } } @@ -1425,7 +1425,7 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb) { /* the directory has been exhausted, and there are no more active transactions * for this playback -- so mark it as not busy */ - pb->busy = 0; + pb->busy = false; } } @@ -1503,7 +1503,7 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan) { /* timer was not set, so set it now */ CF_Timer_InitRelSec(&poll->interval_timer, pd->interval_sec); - poll->timer_set = 1; + poll->timer_set = true; } else if (CF_Timer_Expired(&poll->interval_timer)) { @@ -1512,7 +1512,7 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan) chan_index, pd->priority, pd->dest_eid); if (!ret) { - poll->timer_set = 0; + poll->timer_set = false; } else { @@ -1586,7 +1586,7 @@ void CF_CFDP_CycleEngine(void) * 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) { char * filename; char destination[OS_MAX_PATH_LEN]; @@ -1759,7 +1759,7 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) void (*fns[2])(CF_Transaction_t * txn) = {CF_CFDP_R_Cancel, CF_CFDP_S_Cancel}; if (!txn->flags.com.canceled) { - txn->flags.com.canceled = 1; + txn->flags.com.canceled = true; CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_CANCEL_REQUEST_RECEIVED); fns[!!CF_CFDP_IsSender(txn)](txn); } diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index 1fa54db0..e61aa249 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -44,7 +44,7 @@ typedef struct CF_CFDP_Tick_args { CF_Channel_t *chan; /**< \brief channel structure */ void (*fn)(CF_Transaction_t *, int *); /**< \brief function pointer */ - int early_exit; /**< \brief early exit result */ + bool early_exit; /**< \brief early exit result */ int cont; /**< \brief if 1, then re-traverse the list */ } CF_CFDP_Tick_args_t; @@ -91,7 +91,7 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical * @param txn Pointer to the transaction object * @param keep_history Whether the transaction info should be preserved in history */ -void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history); +void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, bool keep_history); /************************************************************************/ /** @brief Helper function to store transaction status code only diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 88e7d0f2..597790e8 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -47,7 +47,7 @@ void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) { CF_CFDP_SetTxnStatus(txn, txn_stat); - txn->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = true; } /*---------------------------------------------------------------- @@ -58,7 +58,7 @@ void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) *-----------------------------------------------------------------*/ void CF_CFDP_R1_Reset(CF_Transaction_t *txn) { - CF_CFDP_ResetTransaction(txn, 1); + CF_CFDP_ResetTransaction(txn, true); } /*---------------------------------------------------------------- @@ -78,7 +78,7 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *txn) else { /* not waiting for FIN ACK, so trigger send FIN */ - txn->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = true; } } @@ -100,7 +100,7 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) (unsigned long)txn->history->seq_num, (unsigned long)txn->crc.result, (unsigned long)expected_crc); ++CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.fault.crc_mismatch; - ret = 1; + ret = CF_ERROR; } return ret; @@ -115,8 +115,8 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) { uint32 ret; - int send_nak = 0; - int send_fin = 0; + int send_nak = false; + int send_fin = false; /* checking if r2 is complete. Check NAK list, and send NAK if appropriate */ /* if all data is present, then there will be no gaps in the chunk */ @@ -125,7 +125,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) /* first, check if md is received. If not, send specialized NAK */ if (!txn->flags.rx.md_recv) { - send_nak = 1; + send_nak = true; } else { @@ -135,12 +135,12 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) if (ret) { /* there is at least 1 gap, so send a NAK */ - send_nak = 1; + send_nak = true; } else if (txn->flags.rx.eof_recv) { /* the EOF was received, and there are no NAKs -- process completion in send FIN state */ - send_fin = 1; + send_fin = true; } } @@ -155,7 +155,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_NAK_LIMIT, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): NAK limited reach", (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); - send_fin = 1; + send_fin = true; ++CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.fault.nak_limit; /* don't use CF_CFDP_R2_SetFinTxnStatus because many places in this function set send_fin */ CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NAK_LIMIT_REACHED); @@ -163,13 +163,13 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) } else { - txn->flags.rx.send_nak = 1; + txn->flags.rx.send_nak = true; } } if (send_fin) { - txn->flags.rx.complete = 1; /* latch completeness, since send_fin is cleared later */ + txn->flags.rx.complete = true; /* latch completeness, since send_fin is cleared later */ /* the transaction is now considered complete, but this will not overwrite an * error status code if there was one set */ @@ -333,7 +333,7 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *p { eof = &ph->int_header.eof; - txn->flags.rx.eof_recv = 1; + txn->flags.rx.eof_recv = true; /* need to remember the EOF CRC for later */ txn->state_data.receive.r2.eof_crc = eof->crc; @@ -341,7 +341,7 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *p /* always ACK the EOF, even if we're not done */ txn->state_data.receive.r2.eof_cc = eof->cc; - txn->flags.rx.send_ack = 1; /* defer sending ACK to tick handling */ + txn->flags.rx.send_ack = true; /* defer sending ACK to tick handling */ /* only check for complete if EOF with no errors */ if (txn->state_data.receive.r2.eof_cc == CF_CFDP_ConditionCode_NO_ERROR) @@ -511,7 +511,7 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn) if (!cret) { /* no gaps left, so go ahead and check for completion */ - txn->flags.rx.complete = 1; /* we know md was received, and there's no gaps -- it's complete */ + txn->flags.rx.complete = true; /* we know md was received, and there's no gaps -- it's complete */ ret = CFE_SUCCESS; } else @@ -519,7 +519,7 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn) /* gaps are present, so let's send the NAK PDU */ nak->scope_end = 0; sret = CF_CFDP_SendNak(txn, ph); - txn->flags.rx.fd_nak_sent = 1; /* latch that at least one NAK has been sent requesting filedata */ + txn->flags.rx.fd_nak_sent = true; /* latch that at least one NAK has been sent requesting filedata */ CF_Assert(sret != CF_SEND_PDU_ERROR); /* NOTE: this CF_Assert is here because CF_CFDP_SendNak() does not return CF_SEND_PDU_ERROR, so if it's ever added to that function we need to test handling it here */ @@ -689,7 +689,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) 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) { /* CRC matched! We are happy */ txn->keep = 1; /* save the file */ @@ -703,7 +703,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILE_CHECKSUM_FAILURE); } - txn->flags.com.crc_calc = 1; + txn->flags.com.crc_calc = true; ret = CFE_SUCCESS; } @@ -855,7 +855,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) if (success) { txn->state_data.receive.cached_pos = 0; /* reset psn due to open */ - txn->flags.rx.md_recv = 1; + txn->flags.rx.md_recv = true; txn->state_data.receive.r2.acknak_count = 0; /* in case part of NAK */ CF_CFDP_R2_Complete(txn, 1); /* check for completion now that md is received */ } @@ -927,7 +927,7 @@ void CF_CFDP_R_Cancel(CF_Transaction_t *txn) /* for cancel, only need to send FIN if R2 */ if ((txn->state == CF_TxnState_R2) && (txn->state_data.receive.sub_state < CF_RxSubState_WAIT_FOR_FIN_ACK)) { - txn->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = true; } else { @@ -975,7 +975,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont /* unused */) CF_CFDP_R_SendInactivityEvent(txn); CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_INACTIVITY_DETECTED); - txn->flags.rx.inactivity_fired = 1; + txn->flags.rx.inactivity_fired = true; } else { @@ -994,21 +994,21 @@ void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont /* unused */) * CF_SEND_PDU_ERROR */ if (sret != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { - txn->flags.rx.send_ack = 0; + txn->flags.rx.send_ack = false; } } else if (txn->flags.rx.send_nak) { if (!CF_CFDP_R_SubstateSendNak(txn)) { - txn->flags.rx.send_nak = 0; /* will re-enter on error */ + txn->flags.rx.send_nak = false; /* will re-enter on error */ } } else if (txn->flags.rx.send_fin) { if (!CF_CFDP_R2_SubstateSendFin(txn)) { - txn->flags.rx.send_fin = 0; /* will re-enter on error */ + txn->flags.rx.send_fin = false; /* will re-enter on error */ } } else @@ -1044,7 +1044,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont /* unused */) } else { - txn->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = true; } } diff --git a/fsw/src/cf_cfdp_r.h b/fsw/src/cf_cfdp_r.h index 14b18569..4514c5ee 100644 --- a/fsw/src/cf_cfdp_r.h +++ b/fsw/src/cf_cfdp_r.h @@ -149,7 +149,7 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *txn); * txn must not be NULL. * * - * @retval CFE_SUCCESS on CRC match, otherwise error. + * @retval CFE_SUCCESS on CRC match, otherwise CF_ERROR. * * * @param txn Pointer to the transaction object diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index 12409bad..30ee5a9d 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -48,7 +48,7 @@ *-----------------------------------------------------------------*/ static inline void CF_CFDP_S_Reset(CF_Transaction_t *txn) { - CF_CFDP_ResetTransaction(txn, 1); + CF_CFDP_ResetTransaction(txn, true); } /*---------------------------------------------------------------- @@ -62,7 +62,7 @@ CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *txn) if (!txn->flags.com.crc_calc) { CF_CRC_Finalize(&txn->crc); - txn->flags.com.crc_calc = 1; + txn->flags.com.crc_calc = true; } return CF_CFDP_SendEof(txn); } @@ -93,7 +93,7 @@ void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *txn) void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *txn) { txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; - txn->flags.com.ack_timer_armed = 1; /* will cause tick to see ack_timer as expired, and act */ + txn->flags.com.ack_timer_armed = true; /* will cause tick to see ack_timer as expired, and act */ /* no longer need to send file data PDU except in the case of NAK response */ @@ -250,7 +250,7 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { const CF_Chunk_t *chunk; CFE_Status_t sret; - CFE_Status_t ret = 0; + CFE_Status_t ret = CFE_SUCCESS; if (txn->flags.tx.md_need_send) { @@ -263,7 +263,7 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { if (sret == CFE_SUCCESS) { - txn->flags.tx.md_need_send = 0; + txn->flags.tx.md_need_send = false; } /* unless CF_SEND_PDU_ERROR, return 1 to keep caller from sending file data */ ret = 1; /* 1 means nak processed, so don't send filedata */ @@ -494,7 +494,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) if (sr->offset_start == 0 && sr->offset_end == 0) { /* need to re-send metadata PDU */ - txn->flags.tx.md_need_send = 1; + txn->flags.tx.md_need_send = true; } else { @@ -566,7 +566,7 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) else { txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_FIN; - txn->flags.com.ack_timer_armed = 0; /* just wait for FIN now, nothing to re-send */ + txn->flags.com.ack_timer_armed = false; /* just wait for FIN now, nothing to re-send */ } } else diff --git a/fsw/src/cf_clist.c b/fsw/src/cf_clist.c index 5f7a25e4..a431eab2 100644 --- a/fsw/src/cf_clist.c +++ b/fsw/src/cf_clist.c @@ -190,7 +190,7 @@ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) { CF_CListNode_t *node = start; CF_CListNode_t *node_next; - int last = 0; + bool last = false; if (node) { @@ -200,7 +200,7 @@ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) node_next = node->next; if (node_next == start) { - last = 1; + last = true; } if (!CF_CListTraverse_Status_IS_CONTINUE(fn(node, context))) { @@ -231,7 +231,7 @@ void CF_CList_Traverse_R(CF_CListNode_t *end, CF_CListFn_t fn, void *context) { CF_CListNode_t *node = end->prev; CF_CListNode_t *node_next; - int last = 0; + bool last = false; if (node) { @@ -243,7 +243,7 @@ void CF_CList_Traverse_R(CF_CListNode_t *end, CF_CListFn_t fn, void *context) node_next = node->prev; if (node_next == end) { - last = 1; + last = true; } if (!CF_CListTraverse_Status_IS_CONTINUE(fn(node, context))) diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index f7fe592b..d47a1ee4 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -64,11 +64,11 @@ CFE_Status_t CF_NoopCmd(const CF_NoopCmd_t *msg) CFE_Status_t CF_ResetCmd(const CF_ResetCmd_t *msg) { const CF_UnionArgs_Payload_t *data = &msg->Payload; - static const char * names[5] = {"all", "cmd", "fault", "up", "down"}; + static const char *names[5] = {"all", "cmd", "fault", "up", "down"}; /* 0=all, 1=cmd, 2=fault 3=up 4=down */ uint8 param = data->byte[0]; int i; - int acc = 1; + bool acc = true; if (param > 4) { @@ -86,7 +86,7 @@ CFE_Status_t CF_ResetCmd(const CF_ResetCmd_t *msg) { /* command counters */ memset(&CF_AppData.hk.Payload.counters, 0, sizeof(CF_AppData.hk.Payload.counters)); - acc = 0; /* don't increment accept counter on command counter reset */ + acc = false; /* don't increment accept counter on command counter reset */ } /* if the param is CF_Reset_fault, or all counters */ @@ -426,7 +426,7 @@ void CF_DoSuspRes_Txn(CF_Transaction_t *txn, CF_ChanAction_SuspResArg_t *context void CF_DoSuspRes(const CF_Transaction_Payload_t *payload, uint8 action) { /* ok to not bounds check action, because the caller is using it in two places with constant values 0 or 1 */ - static const char * msgstr[] = {"resume", "suspend"}; + static const char *msgstr[] = {"resume", "suspend"}; CF_ChanAction_SuspResArg_t args = {0, action}; int ret = CF_TsnChanAction(payload, msgstr[action], (CF_TsnChanAction_fn_t)CF_DoSuspRes_Txn, &args); @@ -525,7 +525,7 @@ CFE_Status_t CF_CancelCmd(const CF_CancelCmd_t *msg) *-----------------------------------------------------------------*/ void CF_CmdAbandon_Txn(CF_Transaction_t *txn, void *ignored) { - CF_CFDP_ResetTransaction(txn, 0); + CF_CFDP_ResetTransaction(txn, false); } /*---------------------------------------------------------------- @@ -726,7 +726,7 @@ CF_CListTraverse_Status_t CF_PurgeHistory(CF_CListNode_t *node, void *arg) CF_CListTraverse_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); - CF_CFDP_ResetTransaction(txn, 0); + CF_CFDP_ResetTransaction(txn, false); return CF_CLIST_CONT; } @@ -740,25 +740,25 @@ CF_ChanAction_Status_t CF_DoPurgeQueue(uint8 chan_num, void *arg) { CF_ChanAction_Status_t ret = CF_ChanAction_Status_SUCCESS; /* no need to bounds check chan_num, done in caller */ - CF_Channel_t * chan = &CF_AppData.engine.channels[chan_num]; + CF_Channel_t *chan = &CF_AppData.engine.channels[chan_num]; const CF_UnionArgs_Payload_t *data = ((CF_ChanAction_MsgArg_t *)arg)->data; - int pend = 0; - int hist = 0; + bool pend = false; + bool hist = false; switch (data->byte[1]) { case 0: /* pend */ - pend = 1; + pend = true; break; case 1: /* history */ - hist = 1; + hist = true; break; case 2: /* both */ - pend = 1; - hist = 1; + pend = true; + hist = true; break; default: @@ -981,14 +981,14 @@ CF_ChanAction_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) * 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) { CF_ConfigTable_t *config; CFE_Status_t status = CF_ERROR; bool valid_set; struct { - void * ptr; + void *ptr; size_t size; CF_ChanAction_Status_t (*fn)(uint32, uint8 chan_num); } item; @@ -1061,7 +1061,7 @@ void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, { if (CF_ChanAction_Status_IS_SUCCESS(item.fn(value, chan_num))) { - valid_set = 1; + valid_set = true; } else { @@ -1071,7 +1071,7 @@ void CF_GetSetParamCmd(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, } else { - valid_set = 1; + valid_set = true; } if (valid_set) @@ -1140,7 +1140,7 @@ CFE_Status_t CF_SetParamCmd(const CF_SetParamCmd_t *msg) { const CF_SetParam_Payload_t *cmd = &msg->Payload; - CF_GetSetParamCmd(1, cmd->key, cmd->value, cmd->chan_num); + CF_GetSetParamCmd(true, cmd->key, cmd->value, cmd->chan_num); return CFE_SUCCESS; } @@ -1155,7 +1155,7 @@ CFE_Status_t CF_GetParamCmd(const CF_GetParamCmd_t *msg) { const CF_GetParam_Payload_t *cmd = &msg->Payload; - CF_GetSetParamCmd(0, cmd->key, 0, cmd->chan_num); + CF_GetSetParamCmd(false, cmd->key, 0, cmd->chan_num); return CFE_SUCCESS; } diff --git a/fsw/src/cf_cmd.h b/fsw/src/cf_cmd.h index 59fa9395..5aa387ed 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -554,13 +554,13 @@ CF_ChanAction_Status_t CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num); * @par Assumptions, External Events, and Notes: * None * - * @param is_set Whether to get (0) or set (1) + * @param is_set Whether to get (false) or set (true) * @param param_id Parameter ID * @param value Value to get/set * @param chan_num Channel number to operate on * */ -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); /************************************************************************/ /** @brief Ground command to set a configuration parameter. diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index f9068578..5f36bd25 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -331,7 +331,7 @@ CF_CListTraverse_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) *-----------------------------------------------------------------*/ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) { - int insert_back = 0; + bool insert_back = false; CF_Channel_t *chan = &CF_AppData.engine.channels[txn->chan_num]; CF_Assert(txn->chan_num < CF_NUM_CHANNELS); @@ -343,7 +343,7 @@ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) if (!chan->qs[queue]) { /* list is empty, so just insert */ - insert_back = 1; + insert_back = true; } else { @@ -355,7 +355,7 @@ void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) } else { - insert_back = 1; + insert_back = true; } } diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index 266bb89d..1cc82299 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -462,7 +462,7 @@ void Test_CF_CFDP_R_CheckCrc(void) UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); txn->state = CF_TxnState_R1; txn->crc.result = 0xdeadbeef; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x1badc0de), 1); + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x1badc0de), CF_ERROR); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.fault.crc_mismatch, 1); @@ -470,14 +470,14 @@ void Test_CF_CFDP_R_CheckCrc(void) UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); txn->state = CF_TxnState_R2; txn->crc.result = 0xdeadbeef; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x2badc0de), 1); + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x2badc0de), CF_ERROR); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.fault.crc_mismatch, 2); /* CRC match */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); txn->crc.result = 0xc0ffee; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0xc0ffee), 0); + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0xc0ffee), CFE_SUCCESS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } diff --git a/unit-test/cf_cfdp_sbintf_tests.c b/unit-test/cf_cfdp_sbintf_tests.c index c4a16049..564533b9 100644 --- a/unit-test/cf_cfdp_sbintf_tests.c +++ b/unit-test/cf_cfdp_sbintf_tests.c @@ -379,7 +379,7 @@ void Test_CF_CFDP_MsgOutGet(void) /* transaction is suspended */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); - txn->flags.com.suspended = 1; + txn->flags.com.suspended = true; UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index 0c238d0b..b9c3a5a7 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -982,7 +982,7 @@ void Test_CF_CFDP_PlaybackDir(void) for (i = 0; i < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++i) { pb = &chan->playback[i]; - pb->busy = 1; + pb->busy = true; } UtAssert_INT32_EQ(CF_CFDP_PlaybackDir(src, dest, CF_CFDP_CLASS_1, 1, UT_CFDP_CHANNEL, 0, 1), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_DIR_SLOT); @@ -1056,7 +1056,7 @@ void Test_CF_CFDP_CycleTxFirstActive(void) /* suspended, should return 0 */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); - txn->flags.com.suspended = 1; + txn->flags.com.suspended = true; UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), CF_CListTraverse_Status_CONTINUE); /* nominal, with chan->cur set non-null, should skip loop and return 1 */ @@ -1112,7 +1112,7 @@ void Test_CF_CFDP_DoTick(void) UtAssert_BOOL_FALSE(args.cont); UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); - txn->flags.com.suspended = 1; + txn->flags.com.suspended = true; args.cont = true; UtAssert_INT32_EQ(CF_CFDP_DoTick(&txn->cl_node, &args), CF_CLIST_CONT); UtAssert_BOOL_TRUE(args.cont); @@ -1219,7 +1219,7 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) CF_AppData.engine.enabled = 1; /* diropen is true but num_ts is high so operations are restricted */ - pb.busy = 1; + pb.busy = true; pb.num_ts = CF_NUM_TRANSACTIONS_PER_PLAYBACK + 1; pb.diropen = true; UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(chan, &pb)); @@ -1230,7 +1230,7 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) * enter the loop, but error calling OS_DirectoryRead(). * This should end up calling OS_DirectoryClose(). */ - pb.busy = 1; + pb.busy = true; pb.diropen = true; pb.num_ts = 0; OS_DirectoryOpen(&pb.dir_id, "ut"); @@ -1247,7 +1247,7 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) * - this calls CF_FindUnusedTransaction() so that must return non-NULL. * - this also calls CF_CFDP_FindUnusedChunks() and that pops an entry */ - pb.busy = 1; + pb.busy = true; pb.diropen = true; pb.num_ts = 0; strcpy(dirent[0].FileName, "."); /* ignored */ @@ -1275,7 +1275,7 @@ static int32 Ut_Hook_TickTransactions_SetEarlyExit(void *UserObj, int32 StubRetc /* set flag on the second call */ if ((CallCount & 1) == 1) { - args->early_exit = 1; + args->early_exit = true; } return StubRetcode; @@ -1364,12 +1364,12 @@ void Test_CF_CFDP_ResetTransaction(void) UT_ResetState(UT_KEY(CF_FreeTransaction)); UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); txn->flags.com.q_index = CF_QueueIdx_FREE; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); /* nominal call */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); CF_AppData.hk.Payload.channel_hk[UT_CFDP_CHANNEL].q_size[txn->flags.com.q_index] = 10; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, true)); UtAssert_STUB_COUNT(CF_FreeTransaction, 1); UT_ResetState(UT_KEY(CF_FreeTransaction)); @@ -1377,8 +1377,8 @@ void Test_CF_CFDP_ResetTransaction(void) txn->fd = OS_ObjectIdFromInteger(1); history->dir = CF_Direction_TX; txn->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, true)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); /* Transmit with move_dir set, without '/' in filename */ @@ -1386,14 +1386,14 @@ void Test_CF_CFDP_ResetTransaction(void) snprintf(CF_AppData.config_table->chan[txn->chan_num].move_dir, sizeof(CF_AppData.config_table->chan[txn->chan_num].move_dir), "/test"); memset(txn->history->fnames.src_filename, 0, sizeof(txn->history->fnames.src_filename)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(OS_mv, 0); UtAssert_STUB_COUNT(OS_remove, 1); /* Transmit with move_dir set with '/' in filename */ UT_ResetState(UT_KEY(OS_remove)); snprintf(txn->history->fnames.src_filename, sizeof(txn->history->fnames.src_filename), "/ram/test"); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(OS_mv, 1); UtAssert_STUB_COUNT(OS_remove, 0); @@ -1401,7 +1401,7 @@ void Test_CF_CFDP_ResetTransaction(void) UT_ResetState(UT_KEY(OS_remove)); UT_ResetState(UT_KEY(OS_mv)); UT_SetDefaultReturnValue(UT_KEY(OS_mv), -1); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(OS_mv, 1); UtAssert_STUB_COUNT(OS_remove, 1); @@ -1410,8 +1410,8 @@ void Test_CF_CFDP_ResetTransaction(void) txn->fd = OS_ObjectIdFromInteger(1); history->dir = CF_Direction_RX; txn->state = CF_TxnState_R1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, true)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); UT_ResetState(UT_KEY(CF_FreeTransaction)); @@ -1420,8 +1420,8 @@ void Test_CF_CFDP_ResetTransaction(void) history->dir = CF_Direction_TX; txn->keep = 1; txn->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, true)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, false)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); /* coverage completeness: @@ -1438,7 +1438,7 @@ void Test_CF_CFDP_ResetTransaction(void) chan->num_cmd_tx = 8; history->dir = CF_Direction_TX; txn->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, true)); UtAssert_NULL(chan->cur); UtAssert_UINT32_EQ(pb.num_ts, 9); UtAssert_UINT32_EQ(chan->num_cmd_tx, 7); @@ -1516,9 +1516,9 @@ void Test_CF_CFDP_DisableEngine(void) UtAssert_BOOL_FALSE(CF_AppData.engine.enabled); /* nominal call with playbacks and polls active */ - CF_AppData.engine.channels[UT_CFDP_CHANNEL].playback[0].busy = 1; + CF_AppData.engine.channels[UT_CFDP_CHANNEL].playback[0].busy = true; OS_DirectoryOpen(&CF_AppData.engine.channels[UT_CFDP_CHANNEL].playback[0].dir_id, "ut"); - CF_AppData.engine.channels[UT_CFDP_CHANNEL].poll[0].pb.busy = 1; + CF_AppData.engine.channels[UT_CFDP_CHANNEL].poll[0].pb.busy = true; OS_DirectoryOpen(&CF_AppData.engine.channels[UT_CFDP_CHANNEL].poll[0].pb.dir_id, "ut"); UtAssert_VOIDCALL(CF_CFDP_DisableEngine()); UtAssert_STUB_COUNT(OS_DirectoryClose, 2); @@ -1550,11 +1550,11 @@ void Test_CF_CFDP_CancelTransaction(void) /* nominal; cover both "flags.com.canceled" branches in here */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); - txn->flags.com.canceled = 1; + txn->flags.com.canceled = true; UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(txn)); UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); - txn->flags.com.canceled = 0; + txn->flags.com.canceled = false; UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(txn)); } diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index c04f5b13..a80ef370 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -1455,7 +1455,7 @@ void Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void /* Assert */ UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.txn, arg_t); - UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == 0, + UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == false, "CF_CFDP_CancelTransaction was called with int %d and should be 0 (constant in call)", context_CF_CFDP_ResetTransaction.keep_history); } @@ -2022,7 +2022,7 @@ void Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT /* Assert */ UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.txn, &txn); - UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == 0, + UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == false, "CF_CFDP_ResetTransaction received keep_history %u and should be 0 (constant)", context_CF_CFDP_ResetTransaction.keep_history); UtAssert_True(local_result == CF_CLIST_CONT, "CF_PurgeHistory returned %d and should be %d (CF_CLIST_CONT)", @@ -3421,7 +3421,7 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Retu void Test_CF_CmdGetSetParam(void) { /* Test cases for: - * 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); */ /* Arrange */ @@ -3438,7 +3438,7 @@ void Test_CF_CmdGetSetParam(void) for (param_id = 0; param_id < CF_GetSet_ValueID_MAX; ++param_id) { UT_CF_ResetEventCapture(); - UtAssert_VOIDCALL(CF_GetSetParamCmd(1, param_id, 1 + param_id, UT_CFDP_CHANNEL)); + UtAssert_VOIDCALL(CF_GetSetParamCmd(true, param_id, 1 + param_id, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_INF_CMD_GETSET1); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.counters.cmd, ++expected_count); } @@ -3459,26 +3459,26 @@ void Test_CF_CmdGetSetParam(void) for (param_id = 0; param_id < CF_GetSet_ValueID_MAX; ++param_id) { UT_CF_ResetEventCapture(); - UtAssert_VOIDCALL(CF_GetSetParamCmd(0, param_id, 1, UT_CFDP_CHANNEL)); + UtAssert_VOIDCALL(CF_GetSetParamCmd(false, param_id, 1, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_INF_CMD_GETSET2); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.counters.cmd, ++expected_count); } /* Bad param ID */ UT_CF_ResetEventCapture(); - UtAssert_VOIDCALL(CF_GetSetParamCmd(0, CF_GetSet_ValueID_MAX, 0, UT_CFDP_CHANNEL)); + UtAssert_VOIDCALL(CF_GetSetParamCmd(false, CF_GetSet_ValueID_MAX, 0, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_PARAM); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.counters.err, 1); /* Bad channel ID */ UT_CF_ResetEventCapture(); - UtAssert_VOIDCALL(CF_GetSetParamCmd(0, 0, 0, CF_NUM_CHANNELS + 1)); + UtAssert_VOIDCALL(CF_GetSetParamCmd(false, 0, 0, CF_NUM_CHANNELS + 1)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_CHAN); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.counters.err, 2); /* Validation fail */ UT_CF_ResetEventCapture(); - UtAssert_VOIDCALL(CF_GetSetParamCmd(1, CF_GetSet_ValueID_outgoing_file_chunk_size, + UtAssert_VOIDCALL(CF_GetSetParamCmd(true, CF_GetSet_ValueID_outgoing_file_chunk_size, 100 + sizeof(CF_CFDP_PduFileDataContent_t), UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_VALIDATE); UtAssert_UINT32_EQ(CF_AppData.hk.Payload.counters.err, 3); diff --git a/unit-test/stubs/cf_cfdp_handlers.c b/unit-test/stubs/cf_cfdp_handlers.c index 83a8c10a..771764ed 100644 --- a/unit-test/stubs/cf_cfdp_handlers.c +++ b/unit-test/stubs/cf_cfdp_handlers.c @@ -124,7 +124,7 @@ void UT_DefaultHandler_CF_CFDP_ResetTransaction(void *UserObj, UT_EntryKey_t Fun if (ctxt) { ctxt->txn = UT_Hook_GetArgValueByName(Context, "txn", CF_Transaction_t *); - ctxt->keep_history = UT_Hook_GetArgValueByName(Context, "keep_history", int); + ctxt->keep_history = UT_Hook_GetArgValueByName(Context, "keep_history", bool); } } diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index 3db3c393..fb523052 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -471,10 +471,10 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_ResetTransaction() * ---------------------------------------------------- */ -void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history) +void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, bool keep_history) { UT_GenStub_AddParam(CF_CFDP_ResetTransaction, CF_Transaction_t *, txn); - UT_GenStub_AddParam(CF_CFDP_ResetTransaction, int, keep_history); + UT_GenStub_AddParam(CF_CFDP_ResetTransaction, bool, keep_history); UT_GenStub_Execute(CF_CFDP_ResetTransaction, Basic, UT_DefaultHandler_CF_CFDP_ResetTransaction); } diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index ab750404..8595e24a 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -382,9 +382,9 @@ CFE_Status_t CF_GetParamCmd(const CF_GetParamCmd_t *msg) * Generated stub function for CF_GetSetParamCmd() * ---------------------------------------------------- */ -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) { - UT_GenStub_AddParam(CF_GetSetParamCmd, uint8, is_set); + UT_GenStub_AddParam(CF_GetSetParamCmd, bool, is_set); UT_GenStub_AddParam(CF_GetSetParamCmd, CF_GetSet_ValueID_t, param_id); UT_GenStub_AddParam(CF_GetSetParamCmd, uint32, value); UT_GenStub_AddParam(CF_GetSetParamCmd, uint8, chan_num); diff --git a/unit-test/utilities/cf_test_utils.h b/unit-test/utilities/cf_test_utils.h index b1883a7d..87b1a9af 100644 --- a/unit-test/utilities/cf_test_utils.h +++ b/unit-test/utilities/cf_test_utils.h @@ -103,7 +103,7 @@ typedef struct typedef struct { CF_Transaction_t *txn; - int keep_history; + bool keep_history; } CF_CFDP_ResetTransaction_context_t; typedef struct