optimization

This commit is contained in:
Robin Müller 2023-08-16 13:15:34 +02:00
parent 073cb4b3d5
commit 9ef63825f3
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 5 additions and 5 deletions

View File

@ -356,15 +356,15 @@ ReturnValue_t cfdp::DestHandler::startTransaction(MetadataPduReader& reader,
transactionParams.fileSize); transactionParams.fileSize);
params.destFileName = transactionParams.destName.data(); params.destFileName = transactionParams.destName.data();
params.sourceFileName = transactionParams.sourceName.data(); params.sourceFileName = transactionParams.sourceName.data();
unsigned tlvIdx = 0; params.numberOfMsgsToUser = 0;
for (const auto& opt : tlvVec) { for (const auto& opt : tlvVec) {
if (opt.getType() == TlvType::MSG_TO_USER) { if (opt.getType() == TlvType::MSG_TO_USER) {
msgToUserVec[tlvIdx] = MessageToUserTlv(opt.getValue(), opt.getLengthField()); msgToUserVec[params.numberOfMsgsToUser] =
tlvIdx++; MessageToUserTlv(opt.getValue(), opt.getLengthField());
params.numberOfMsgsToUser++;
} }
} }
params.msgsToUserArray = msgToUserVec.data(); params.msgsToUserArray = msgToUserVec.data();
params.msgsToUserLen = tlvIdx;
destParams.user.metadataRecvdIndication(params); destParams.user.metadataRecvdIndication(params);
return result; return result;
} }

View File

@ -35,7 +35,7 @@ struct MetadataRecvdParams {
Fss fileSize{}; Fss fileSize{};
const char* sourceFileName = ""; const char* sourceFileName = "";
const char* destFileName = ""; const char* destFileName = "";
size_t msgsToUserLen = 0; size_t numberOfMsgsToUser = 0;
const MessageToUserTlv* msgsToUserArray = nullptr; const MessageToUserTlv* msgsToUserArray = nullptr;
}; };