shithub: openh264

Download patch

ref: 99925984b3abf7e6352e68488339aec00c382caf
parent: cd552016005342817acf92d70e3a6244f5c3592e
author: Martin Storsjö <martin@martin.st>
date: Fri Jan 16 05:20:57 EST 2015

Consistently compare integers with integers and bools with bools

MSVC warns when comparing integers with booleans in with the gtest
assertion macros.

--- a/test/api/decoder_test.cpp
+++ b/test/api/decoder_test.cpp
@@ -29,7 +29,7 @@
   EXPECT_EQ (sDecCap.iMaxCpb, 20000);
   EXPECT_EQ (sDecCap.iMaxDpb, 20480);
   EXPECT_EQ (sDecCap.iMaxBr, 20000);
-  EXPECT_EQ (sDecCap.bRedPicCap, 0);
+  EXPECT_EQ (sDecCap.bRedPicCap, false);
 }
 
 
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -1594,7 +1594,7 @@
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //no output
   rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
   //Ref picture is ECed, so current status is ECed, when EC disable, NO output
-  EXPECT_TRUE (rv & 32);
+  EXPECT_TRUE ((rv & 32) != 0);
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
   iIdx++;
 
@@ -1689,10 +1689,10 @@
   decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
   EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
   rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
-  EXPECT_TRUE (rv & 32); //parse correct, but reconstruct ECed
+  EXPECT_TRUE ((rv & 32) != 0); //parse correct, but reconstruct ECed
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 0
   rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //ECed status, reconstruction current frame 1
-  EXPECT_TRUE (rv & 32); //decoder ECed status
+  EXPECT_TRUE ((rv & 32) != 0); //decoder ECed status
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 1
   iIdx++;
 
@@ -1713,7 +1713,7 @@
   EXPECT_EQ (rv, 0); //parse correct
   rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
   // Ref picture is ECed, so reconstructed picture is ECed
-  EXPECT_TRUE (rv & 32);
+  EXPECT_TRUE ((rv & 32) != 0);
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
   iIdx++;
 
@@ -1734,7 +1734,7 @@
   EXPECT_EQ (rv, 0); //parse correct
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
   rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
-  EXPECT_TRUE (rv & 32);
+  EXPECT_TRUE ((rv & 32) != 0);
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss
   iIdx++;
 
@@ -1858,10 +1858,10 @@
   decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
   EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
   rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
-  EXPECT_TRUE (rv & 32); //parse OK but frame 2 ECed
+  EXPECT_TRUE ((rv & 32) != 0); //parse OK but frame 2 ECed
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //slice loss but ECed output Frame 2
   rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
-  EXPECT_TRUE (rv & 32);
+  EXPECT_TRUE ((rv & 32) != 0);
   EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss
   iIdx++;
 
--- a/test/decoder/DecUT_DecExt.cpp
+++ b/test/decoder/DecUT_DecExt.cpp
@@ -271,7 +271,7 @@
     EXPECT_EQ (eRet, cmResultSuccess);
     eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
     EXPECT_EQ (eRet, cmResultSuccess);
-    EXPECT_EQ (iOut, iTmp != 0);
+    EXPECT_EQ (iOut, iTmp != 0 ? 1 : 0);
   }
 
   //set false as input
@@ -281,7 +281,7 @@
   eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
   EXPECT_EQ (eRet, cmResultSuccess);
 
-  EXPECT_EQ (iOut, false);
+  EXPECT_EQ (iOut, 0);
 
   //set true as input
   iTmp = true;
@@ -290,7 +290,7 @@
   eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
   EXPECT_EQ (eRet, cmResultSuccess);
 
-  EXPECT_EQ (iOut, true);
+  EXPECT_EQ (iOut, 1);
 
   //Mock data packet in
   //Test NULL data input for decoder, should be true for EOS
@@ -297,17 +297,17 @@
   eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
   EXPECT_EQ (eRet, 0); //decode should return OK
   eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
-  EXPECT_EQ (iOut, true); //decoder should have EOS == true
+  EXPECT_EQ (iOut, 1); //decoder should have EOS == true
 
   //Test valid data input for decoder, should be false for EOS
   MockPacketType (NAL_UNIT_UNSPEC_0, 50);
   eRet = (CM_RETURN) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
   eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
-  EXPECT_EQ (iOut, false); //decoder should have EOS == false
+  EXPECT_EQ (iOut, 0); //decoder should have EOS == false
   //Test NULL data input for decoder, should be true for EOS
   eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
   eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
-  EXPECT_EQ (iOut, true); //decoder should have EOS == true
+  EXPECT_EQ (iOut, 1); //decoder should have EOS == true
 
   Uninit();
 }