When building with gcc 9.3 or newer it, the following warning is emitted: ``` [141/182] Compiling C++ object 'test/decoder/6757f86@@test_decoder@exe/DecUT_ParseSyntax.cpp.o' ../test/decoder/DecUT_ParseSyntax.cpp: In member function ‘bool DecoderParseSyntaxTest::DecodeBs(const char*, EDecCase)’: ../test/decoder/DecUT_ParseSyntax.cpp:284:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 284 | else if (eDecCase == ErrorDec) | ^ ../test/decoder/DecUT_ParseSyntax.cpp: In member function ‘bool DecoderParseSyntaxTest::ParseBs(const char*, EDecCase)’: ../test/decoder/DecUT_ParseSyntax.cpp:350:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 350 | if (eDecCase == CorrectParseOnly) | ^ ../test/decoder/DecUT_ParseSyntax.cpp:357:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 357 | if (eDecCase == ErrorDec) | ^ ``` These changes add the braces to make the compiler happy and avoid dangling else.
Showing the changes to test/decoder/DecUT_ParseSyntax.cpp (1 of 1 file). Show all
Unified · Split
| @@ -279,10 +279,11 @@ bool DecoderParseSyntaxTest::DecodeBs (const char* sFileName, EDecCase eDecCase) · 278 unmodified lines | ||
| 279 | 279 | iRet |= DecodeFrame (pBuf + iBufPos, iSliceSize, m_pData, &m_sBufferInfo, m_pCtx); |
| 280 | 280 | iBufPos += iSliceSize; |
| 281 | 281 | } |
| 282 | − if (eDecCase == CorrectDec) | |
| 282 | + if (eDecCase == CorrectDec) { | |
| 283 | 283 | EXPECT_TRUE (iRet == dsErrorFree); |
| 284 | − else if (eDecCase == ErrorDec) | |
| 284 | + } else if (eDecCase == ErrorDec) { | |
| 285 | 285 | EXPECT_TRUE ((iRet & (dsBitstreamError | dsRefLost | dsDataErrorConcealed)) != 0) << "iRet = " << iRet; |
| 286 | + } | |
| 286 | 287 | |
| 287 | 288 | fclose (pH264File); |
| 288 | 289 | if (pBuf) { |
| @@ -347,15 +348,18 @@ bool DecoderParseSyntaxTest::ParseBs (const char* sFileName, EDecCase eDecCase) · 58 unmodified lines | ||
| 347 | 348 | memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo)); |
| 348 | 349 | iRet |= m_pDec->DecodeParser (pBuf + iBufPos, iSliceSize, &m_sParserBsInfo); |
| 349 | 350 | iRet |= m_pDec->DecodeParser (NULL, 0, &m_sParserBsInfo); |
| 350 | − if (eDecCase == CorrectParseOnly) | |
| 351 | + if (eDecCase == CorrectParseOnly) { | |
| 351 | 352 | EXPECT_TRUE (iRet == dsErrorFree || iRet == dsFramePending); |
| 353 | + } | |
| 354 | + | |
| 352 | 355 | iBufPos += iSliceSize; |
| 353 | 356 | ++iSliceIndex; |
| 354 | 357 | if (iSliceIndex == 4) |
| 355 | 358 | break; |
| 356 | 359 | } |
| 357 | − if (eDecCase == ErrorDec) | |
| 360 | + if (eDecCase == ErrorDec) { | |
| 358 | 361 | EXPECT_TRUE ((iRet & (dsBitstreamError | dsRefLost | dsDataErrorConcealed)) != 0) << iRet; |
| 362 | + } | |
| 359 | 363 | |
| 360 | 364 | fclose (pH264File); |
| 361 | 365 | if (pBuf) { |