Conversation
…oids a bunch of commands but needs a file uplinked.
| } | ||
|
|
||
| void DpCatalog::getFileState(DpStateEntry& entry) { | ||
| FwSignedSizeType DpCatalog::findStateFileEntryIndex(FwDpIdType id, U32 tSec, U32 tSub, FwIndexType dir) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| return found; | ||
| } | ||
|
|
||
| DpCatalog::DpBtreeNode* DpCatalog::findTreeNode(FwDpIdType id, U32 tSec, U32 tSub) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
Svc/DpCatalog/DpCatalog.cpp
Outdated
| this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR); | ||
| } | ||
|
|
||
| void DpCatalog ::PROCESS_DP_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& fileName) { |
Check notice
Code scanning / CodeQL
Function too long Note
Svc/DpCatalog/DpCatalog.cpp
Outdated
| this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR); | ||
| } | ||
|
|
||
| void DpCatalog ::PROCESS_DP_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& fileName) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Extracted helper functions to reduce line count and improve code organization: - PROCESS_DP_FILE_cmdHandler: 101 → 60 lines - changeDpPriorityHelper: 64 → 33 lines - retransmitDpHelper: 207 → 56 lines New helper functions: - openAndValidateOpFile: Validates and opens DP operations files - parseFileOperationRecord: Parses binary operation records - readDpHeader: Reads DP file headers - updateNodePriority: Updates priority of existing catalog nodes - addDpToCatalog: Adds new DP files to catalog - updateExistingDpForRetransmit: Handles retransmit priority updates All functions now meet the 60-line limit requirement and maintain proper assertions. All 43 unit tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR); | ||
| } | ||
|
|
||
| void DpCatalog ::CHANGE_DP_PRIORITY_cmdHandler(FwOpcodeType opCode, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR); | ||
| } | ||
|
|
||
| void DpCatalog ::RETRANSMIT_DP_cmdHandler(FwOpcodeType opCode, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| FW_ASSERT(desStat == Fw::FW_SERIALIZE_OK, desStat); | ||
| } | ||
|
|
||
| bool DpCatalog::readDpHeader(const Fw::FileNameString& dpFileName, Fw::DpContainer& container) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
|
|
||
| // Parse record fields | ||
| U8 operationCode; | ||
| U32 id, tSec, tSub, priority; |
Check notice
Code scanning / CodeQL
Multiple variable declarations on one line Note
| U32 cmdSeq) { | ||
| // Open the operations file | ||
| Os::File::Status stat = opFile.open(fileName.toChar(), Os::File::OPEN_READ); | ||
| if (stat != Os::File::OP_OK) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| U32& tSub, | ||
| U32& priority) { | ||
| const FwSizeType DATA_SIZE = 17; // Size of data fields (excludes CRC32) | ||
| Fw::ExternalSerializeBuffer serialBuffer(const_cast<U8*>(recordBuf), DATA_SIZE); |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| U32 newPriority, | ||
| U32 oldPriority) { | ||
| // Copy the entry before removing from tree | ||
| DpStateEntry updatedEntry = node->entry; |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // Read the DP header | ||
| U8 dpBuff[Fw::DpContainer::MIN_PACKET_SIZE]; | ||
| Fw::Buffer hdrBuff(dpBuff, sizeof(dpBuff)); | ||
| Fw::DpContainer container; |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| U32 tSub, | ||
| U32 priorityOverride) { | ||
| // Determine the new priority | ||
| U32 newPriority; |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| foundDir = dir; | ||
| break; | ||
| } | ||
| } |
Check notice
Code scanning / CodeQL
Function too long Note
| foundDir = dir; | ||
| break; | ||
| } | ||
| } |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| this->log_WARNING_LO_DpPriorityXmitInProgress(id, tSec, tSub); | ||
| return false; | ||
| } | ||
|
|
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
|
|
||
| if (foundDir == DP_MAX_DIRECTORIES) { | ||
| this->log_WARNING_LO_DpNotFound(id, tSec, tSub); |
Check notice
Code scanning / CodeQL
Function too long Note
| } | ||
|
|
||
| if (foundDir == DP_MAX_DIRECTORIES) { | ||
| this->log_WARNING_LO_DpNotFound(id, tSec, tSub); |
Check notice
Code scanning / CodeQL
Long function without assertion Note
Change Description
Rationale
Testing/Review Recommendations
Future Work
AI Usage (see policy)