Fix issues spotted by PVS-Studio and SonarCloud

This commit is contained in:
Nikolaj Schlej 2022-09-10 14:20:49 +02:00
parent 75a1374c0c
commit 22d1db8c7f
2 changed files with 4 additions and 2 deletions

View File

@ -1539,7 +1539,7 @@ std::istream& operator >> (std::istream& sin, CBString& b) {
do { do {
b.gets ((bNgetc) istreamGets, &sin, '\n'); b.gets ((bNgetc) istreamGets, &sin, '\n');
if (b.slen > 0 && b.data[b.slen-1] == '\n') b.slen--; if (b.slen > 0 && b.data[b.slen-1] == '\n') b.slen--;
} while (b.slen == 0 && !sin.eof ()); } while (b.slen == 0 && !sin.eof() && !sin.fail());
return sin; return sin;
} }

View File

@ -2886,6 +2886,7 @@ USTATUS FfsParser::parseDepexSectionBody(const UModelIndex & index)
msg(usprintf("%s: DEPEX section ends with non-END opcode", __FUNCTION__), index); msg(usprintf("%s: DEPEX section ends with non-END opcode", __FUNCTION__), index);
return U_SUCCESS; return U_SUCCESS;
} }
// No further parsing required
return U_SUCCESS; return U_SUCCESS;
case EFI_DEP_AFTER: case EFI_DEP_AFTER:
if (body.size() != 2 * EFI_DEP_OPCODE_SIZE + sizeof(EFI_GUID)){ if (body.size() != 2 * EFI_DEP_OPCODE_SIZE + sizeof(EFI_GUID)){
@ -2899,6 +2900,7 @@ USTATUS FfsParser::parseDepexSectionBody(const UModelIndex & index)
msg(usprintf("%s: DEPEX section ends with non-END opcode", __FUNCTION__), index); msg(usprintf("%s: DEPEX section ends with non-END opcode", __FUNCTION__), index);
return U_SUCCESS; return U_SUCCESS;
} }
// No further parsing required
return U_SUCCESS; return U_SUCCESS;
case EFI_DEP_SOR: case EFI_DEP_SOR:
if (body.size() <= 2 * EFI_DEP_OPCODE_SIZE) { if (body.size() <= 2 * EFI_DEP_OPCODE_SIZE) {
@ -2967,8 +2969,8 @@ USTATUS FfsParser::parseDepexSectionBody(const UModelIndex & index)
break; break;
default: default:
msg(usprintf("%s: unknown opcode %02Xh", __FUNCTION__, *current), index); msg(usprintf("%s: unknown opcode %02Xh", __FUNCTION__, *current), index);
// No further parsing required
return U_SUCCESS; return U_SUCCESS;
break;
} }
} }