Skip to content

Commit 8bc7240

Browse files
committed
Remove redundant if
1 parent b24a6f7 commit 8bc7240

1 file changed

Lines changed: 26 additions & 30 deletions

File tree

Svc/FpySequencer/FpySequencerValidationState.cpp

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,21 @@ Fw::Success FpySequencer::readArgSpecs(Os::File& file) {
183183
argSpec.set_argNameLen(argNameLen);
184184

185185
// Read and deserialize arg_name string
186-
if (argNameLen > 0) {
187-
readStatus = this->readBytes(file, argNameLen, FpySequencer_FileReadStage::BODY);
188-
if (readStatus != Fw::Success::SUCCESS) {
186+
readStatus = this->readBytes(file, argNameLen, FpySequencer_FileReadStage::BODY);
187+
if (readStatus != Fw::Success::SUCCESS) {
188+
return Fw::Success::FAILURE;
189+
}
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());
189198
return Fw::Success::FAILURE;
190199
}
191-
// Store the arg_name bytes in the ArgSpec
192-
for (U8 j = 0; j < argNameLen; j++) {
193-
U8 byte;
194-
deserStatus = this->m_sequenceBuffer.deserializeTo(byte);
195-
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
196-
this->log_WARNING_HI_FileReadDeserializeError(
197-
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
198-
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
199-
return Fw::Success::FAILURE;
200-
}
201-
argSpec.get_argName()[j] = byte;
202-
}
200+
argSpec.get_argName()[j] = byte;
203201
}
204202

205203
// Read and deserialize type_name length
@@ -218,23 +216,21 @@ Fw::Success FpySequencer::readArgSpecs(Os::File& file) {
218216
argSpec.set_typeNameLen(typeNameLen);
219217

220218
// Read and deserialize type_name string
221-
if (typeNameLen > 0) {
222-
readStatus = this->readBytes(file, typeNameLen, FpySequencer_FileReadStage::BODY);
223-
if (readStatus != Fw::Success::SUCCESS) {
219+
readStatus = this->readBytes(file, typeNameLen, FpySequencer_FileReadStage::BODY);
220+
if (readStatus != Fw::Success::SUCCESS) {
221+
return Fw::Success::FAILURE;
222+
}
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());
224231
return Fw::Success::FAILURE;
225232
}
226-
// Store the type_name bytes in the ArgSpec
227-
for (U8 j = 0; j < typeNameLen; j++) {
228-
U8 byte;
229-
deserStatus = this->m_sequenceBuffer.deserializeTo(byte);
230-
if (deserStatus != Fw::SerializeStatus::FW_SERIALIZE_OK) {
231-
this->log_WARNING_HI_FileReadDeserializeError(
232-
FpySequencer_FileReadStage::BODY, this->m_sequenceFilePath, static_cast<I32>(deserStatus),
233-
this->m_sequenceBuffer.getDeserializeSizeLeft(), this->m_sequenceBuffer.getSize());
234-
return Fw::Success::FAILURE;
235-
}
236-
argSpec.get_typeName()[j] = byte;
237-
}
233+
argSpec.get_typeName()[j] = byte;
238234
}
239235

240236
// Read and deserialize size field

0 commit comments

Comments
 (0)