Skip to content

Commit d89d0c8

Browse files
committed
Direct deser
1 parent 8bc7240 commit d89d0c8

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

Svc/FpySequencer/FpySequencerValidationState.cpp

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,13 @@ Fw::Success FpySequencer::readArgSpecs(Os::File& file) {
187187
if (readStatus != Fw::Success::SUCCESS) {
188188
return Fw::Success::FAILURE;
189189
}
190-
// Store the arg_name bytes in the ArgSpec
191-
for (U8 j = 0; j < argNameLen; j++) {
192-
U8 byte;
193-
deserStatus = this->m_sequenceBuffer.deserializeTo(byte);
194-
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
195-
this->log_WARNING_HI_FileReadDeserializeError(
196-
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
197-
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
198-
return Fw::Success::FAILURE;
199-
}
200-
argSpec.get_argName()[j] = byte;
190+
FwSizeType argNameSize = static_cast<FwSizeType>(argNameLen);
191+
deserStatus = this->m_sequenceBuffer.deserializeTo(argSpec.get_argName(), argNameSize, Fw::Serialization::OMIT_LENGTH);
192+
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
193+
this->log_WARNING_HI_FileReadDeserializeError(
194+
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
195+
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
196+
return Fw::Success::FAILURE;
201197
}
202198

203199
// Read and deserialize type_name length
@@ -220,17 +216,13 @@ Fw::Success FpySequencer::readArgSpecs(Os::File& file) {
220216
if (readStatus != Fw::Success::SUCCESS) {
221217
return Fw::Success::FAILURE;
222218
}
223-
// Store the type_name bytes in the ArgSpec
224-
for (U8 j = 0; j < typeNameLen; j++) {
225-
U8 byte;
226-
deserStatus = this->m_sequenceBuffer.deserializeTo(byte);
227-
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
228-
this->log_WARNING_HI_FileReadDeserializeError(
229-
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
230-
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
231-
return Fw::Success::FAILURE;
232-
}
233-
argSpec.get_typeName()[j] = byte;
219+
FwSizeType typeNameSize = static_cast<FwSizeType>(typeNameLen);
220+
deserStatus = this->m_sequenceBuffer.deserializeTo(argSpec.get_typeName(), typeNameSize, Fw::Serialization::OMIT_LENGTH);
221+
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
222+
this->log_WARNING_HI_FileReadDeserializeError(
223+
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
224+
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
225+
return Fw::Success::FAILURE;
234226
}
235227

236228
// Read and deserialize size field

0 commit comments

Comments
 (0)