From 75c1136c8ad1ba17d1180245d39087b03cb63550 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Mon, 24 Apr 2023 11:00:17 +1000 Subject: [PATCH] Fix #138, Convert `int32` return codes and variables to `CFE_Status_t` --- .github/workflows/codeql-build.yml | 4 ++-- fsw/src/ci_lab_app.c | 24 +++++++++++------------- fsw/src/ci_lab_msg.h | 2 -- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index a364b0b..9e71f60 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -3,11 +3,11 @@ name: "CodeQL Analysis" on: push: pull_request: - + jobs: codeql: name: CodeQL Analysis uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main - with: + with: component-path: apps/ci_lab make: 'make -C build/native/default_cpu1/apps/ci_lab' diff --git a/fsw/src/ci_lab_app.c b/fsw/src/ci_lab_app.c index 909c8c8..6c4b0b7 100644 --- a/fsw/src/ci_lab_app.c +++ b/fsw/src/ci_lab_app.c @@ -55,14 +55,14 @@ CI_LAB_GlobalData_t CI_LAB_Global; * Individual message handler function prototypes * * Per the recommended code pattern, these should accept a const pointer - * to a structure type which matches the message, and return an int32 + * to a structure type which matches the message, and return a CFE_Status_t * where CFE_SUCCESS (0) indicates successful handling of the message. */ -int32 CI_LAB_Noop(const CI_LAB_NoopCmd_t *data); -int32 CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data); +CFE_Status_t CI_LAB_Noop(const CI_LAB_NoopCmd_t *data); +CFE_Status_t CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data); /* Housekeeping message handler */ -int32 CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data); +CFE_Status_t CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data); /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -77,7 +77,7 @@ int32 CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ void CI_Lab_AppMain(void) { - int32 status; + CFE_Status_t status; uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; CFE_SB_Buffer_t *SBBufPtr; @@ -257,13 +257,11 @@ void CI_LAB_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr) /* Handle NOOP command packets */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CI_LAB_Noop(const CI_LAB_NoopCmd_t *data) +CFE_Status_t CI_LAB_Noop(const CI_LAB_NoopCmd_t *data) { /* Does everything the name implies */ CI_LAB_Global.HkTlm.Payload.CommandCounter++; - CFE_EVS_SendEvent(CI_LAB_COMMANDNOP_INF_EID, CFE_EVS_EventType_INFORMATION, "CI: NOOP command"); - return CFE_SUCCESS; } @@ -273,7 +271,7 @@ int32 CI_LAB_Noop(const CI_LAB_NoopCmd_t *data) /* Handle ResetCounters command packets */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data) +CFE_Status_t CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data) { CFE_EVS_SendEvent(CI_LAB_COMMANDRST_INF_EID, CFE_EVS_EventType_INFORMATION, "CI: RESET command"); CI_LAB_ResetCounters_Internal(); @@ -289,7 +287,7 @@ int32 CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data) /* the software bus */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data) +CFE_Status_t CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data) { CI_LAB_Global.HkTlm.Payload.SocketConnected = CI_LAB_Global.SocketConnected; CFE_SB_TimeStampMsg(CFE_MSG_PTR(CI_LAB_Global.HkTlm.TelemetryHeader)); @@ -322,9 +320,9 @@ void CI_LAB_ResetCounters_Internal(void) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ void CI_LAB_ReadUpLink(void) { - int i; - int32 status; - uint8 *bytes; + int i; + CFE_Status_t status; + uint8 * bytes; for (i = 0; i <= 10; i++) { diff --git a/fsw/src/ci_lab_msg.h b/fsw/src/ci_lab_msg.h index c72335e..c82562b 100644 --- a/fsw/src/ci_lab_msg.h +++ b/fsw/src/ci_lab_msg.h @@ -36,7 +36,6 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; - } CI_LAB_NoArgsCmd_t; /* @@ -63,7 +62,6 @@ typedef struct uint32 IngestPackets; uint32 IngestErrors; uint32 Spare2; - } CI_LAB_HkTlm_Payload_t; typedef struct