Skip to content

Commit

Permalink
Review and CodeQL fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch committed Sep 27, 2023
1 parent a5d7186 commit 12ec38e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Svc/CmdSplitter/CmdSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <FpConfig.hpp>
#include <Fw/Cmd/CmdPacket.hpp>
#include <Svc/CmdSplitter/CmdSplitter.hpp>
#include <Fw/Types/Assert.hpp>
#include <FppConstantsAc.hpp>

namespace Svc {

Expand All @@ -30,6 +32,7 @@ void CmdSplitter ::CmdBuff_handler(const NATIVE_INT_TYPE portNum, Fw::ComBuffer&
Fw::CmdPacket cmdPkt;
Fw::SerializeStatus stat = cmdPkt.deserialize(data);

FW_ASSERT(portNum < CmdSplitterPorts);
if (stat != Fw::FW_SERIALIZE_OK) {
// Let the local command dispatcher deal with it
this->LocalCmd_out(portNum, data, context);
Expand All @@ -47,6 +50,7 @@ void CmdSplitter ::seqCmdStatus_handler(const NATIVE_INT_TYPE portNum,
FwOpcodeType opCode,
U32 cmdSeq,
const Fw::CmdResponse& response) {
FW_ASSERT(portNum < CmdSplitterPorts);
// Forward the command status
this->forwardSeqCmdStatus_out(portNum, opCode, cmdSeq, response);
}
Expand Down
10 changes: 5 additions & 5 deletions Svc/CmdSplitter/CmdSplitter.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ module Svc {
# ----------------------------------------------------------------------

@ Input port for local or remote commands
sync input port CmdBuff: [CmdDispatcherSequencePorts] Fw.Com
sync input port CmdBuff: [CmdSplitterPorts] Fw.Com

@ Output port for forwarding the Command status
output port forwardSeqCmdStatus: [CmdDispatcherSequencePorts] Fw.CmdResponse
output port forwardSeqCmdStatus: [CmdSplitterPorts] Fw.CmdResponse

# ----------------------------------------------------------------------
# Downstream connections: local and remote command sequencers
# ----------------------------------------------------------------------

@ Input port for receiving the command status
sync input port seqCmdStatus: [CmdDispatcherSequencePorts] Fw.CmdResponse
sync input port seqCmdStatus: [CmdSplitterPorts] Fw.CmdResponse

@ Output port for local commands
output port LocalCmd: [CmdDispatcherSequencePorts] Fw.Com
output port LocalCmd: [CmdSplitterPorts] Fw.Com

@ Output port for remote commands
output port RemoteCmd: [CmdDispatcherSequencePorts] Fw.Com
output port RemoteCmd: [CmdSplitterPorts] Fw.Com

}
}
4 changes: 2 additions & 2 deletions Svc/CmdSplitter/test/ut/Tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Tester ::test_local_routing() {

U32 context = static_cast<U32>(STest::Pick::any());
this->active_command_source = static_cast<NATIVE_INT_TYPE>(STest::Pick::lowerUpper(
0, CmdDispatcherSequencePorts));
0, CmdSplitterPorts));
this->invoke_to_CmdBuff(this->active_command_source, testBuffer, context);
ASSERT_from_RemoteCmd_SIZE(0);
ASSERT_from_LocalCmd_SIZE(1);
Expand All @@ -85,7 +85,7 @@ void Tester ::test_remote_routing() {

U32 context = static_cast<U32>(STest::Pick::any());
this->active_command_source = static_cast<NATIVE_INT_TYPE>(STest::Pick::lowerUpper(
0, CmdDispatcherSequencePorts));
0, CmdSplitterPorts));
this->invoke_to_CmdBuff(this->active_command_source, testBuffer, context);
ASSERT_from_LocalCmd_SIZE(0);
ASSERT_from_RemoteCmd_SIZE(1);
Expand Down

0 comments on commit 12ec38e

Please sign in to comment.