ref: 7d1d2d658f93c9aa1d02d6df7b049db9380dd694
parent: aea1017562d48a83ca1acfb2ba7f9ef74e8dfd1e
parent: 9e00bf89aa22edafb1f1c6a0f9c8e9f6464a846b
author: dongzha <[email protected]>
date: Mon Jan 19 04:37:39 EST 2015
Merge pull request #1735 from mstorsjo/msvc-test-warnings Fix build warnings with MSVC
--- a/Makefile
+++ b/Makefile
@@ -127,6 +127,12 @@
COMMON_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -I$(SRC_PATH)test -I$(SRC_PATH)test/common
MODULE_INCLUDES += -I$(SRC_PATH)gmp-api
+DECODER_UNITTEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
+ENCODER_UNITTEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
+PROCESSING_UNITTEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
+API_TEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
+COMMON_UNITTEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
+
.PHONY: test gtest-bootstrap clean $(PROJECT_NAME).pc $(PROJECT_NAME)-static.pc
all: libraries binaries
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -10,7 +10,7 @@
endif
ifeq ($(ASM_ARCH), arm)
CCAS = gas-preprocessor.pl -as-type armasm -force-thumb -- armasm
-CCASFLAGS = -nologo -DHAVE_NEON
+CCASFLAGS = -nologo -DHAVE_NEON -ignore 4509
endif
CC=cl
@@ -42,3 +42,4 @@
EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
SHLDFLAGS=-Fd$(PROJECT_NAME).pdb -link -def:openh264.def -implib:$(EXTRA_LIBRARY)
STATIC_LDFLAGS=
+CODEC_UNITTEST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS
--- a/codec/console/dec/src/d3d9_utils.cpp
+++ b/codec/console/dec/src/d3d9_utils.cpp
@@ -605,23 +605,17 @@
OSVERSIONINFOEX osvi;
ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
+ osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
+ osvi.dwMajorVersion = 6; // Vista
+ DWORDLONG condmask = VerSetConditionMask (VerSetConditionMask (0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_PLATFORMID, VER_EQUAL);
- if (!GetVersionEx ((OSVERSIONINFO*) &osvi)) {
- osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- if (! GetVersionEx ((OSVERSIONINFO*) &osvi))
- return iType;
- }
-
- switch (osvi.dwPlatformId) {
- case VER_PLATFORM_WIN32_NT:
- if (osvi.dwMajorVersion >= 6)
- iType = OS_VISTA_UPPER;
- else if (osvi.dwMajorVersion == 5)
+ if (VerifyVersionInfo (&osvi, VER_MAJORVERSION | VER_PLATFORMID, condmask)) {
+ iType = OS_VISTA_UPPER;
+ } else {
+ osvi.dwMajorVersion = 5; // XP/2000
+ if (VerifyVersionInfo (&osvi, VER_MAJORVERSION | VER_PLATFORMID, condmask))
iType = OS_XP;
- break;
-
- default:
- break;
}
#endif
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -993,8 +993,8 @@
ResetDecStatNums (pDecStat);
pDecStat->iAvgLumaQp = iTotalQp;
} else
- pDecStat->iAvgLumaQp = (uint64_t) (pDecStat->iAvgLumaQp * pDecStat->uiDecodedFrameCount + iTotalQp) /
- (pDecStat->uiDecodedFrameCount + 1);
+ pDecStat->iAvgLumaQp = (int) ((uint64_t) (pDecStat->iAvgLumaQp * pDecStat->uiDecodedFrameCount + iTotalQp) /
+ (pDecStat->uiDecodedFrameCount + 1));
//update IDR number
if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag) {
--- a/test/BaseDecoderTest.h
+++ b/test/BaseDecoderTest.h
@@ -37,7 +37,7 @@
ISVCDecoder* decoder_;
private:
- void DecodeFrame (const uint8_t* src, int sliceSize, Callback* cbk);
+ void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
std::ifstream file_;
BufferedData buf_;
--- a/test/api/BaseDecoderTest.cpp
+++ b/test/api/BaseDecoderTest.cpp
@@ -70,13 +70,13 @@
}
-void BaseDecoderTest::DecodeFrame (const uint8_t* src, int sliceSize, Callback* cbk) {
+void BaseDecoderTest::DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk) {
uint8_t* data[3];
SBufferInfo bufInfo;
memset (data, 0, sizeof (data));
memset (&bufInfo, 0, sizeof (SBufferInfo));
- DECODING_STATE rv = decoder_->DecodeFrame2 (src, sliceSize, data, &bufInfo);
+ DECODING_STATE rv = decoder_->DecodeFrame2 (src, (int) sliceSize, data, &bufInfo);
ASSERT_TRUE (rv == dsErrorFree);
if (bufInfo.iBufferStatus == 1 && cbk != NULL) {
--- a/test/api/decode_encode_test.cpp
+++ b/test/api/decode_encode_test.cpp
@@ -83,7 +83,7 @@
break;
}
}
- return buf_.PopFront (static_cast<uint8_t*> (ptr), len);
+ return (int) buf_.PopFront (static_cast<uint8_t*> (ptr), len);
}
protected:
--- 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
@@ -726,7 +726,7 @@
int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLostSim>* p_SLostSim,
const char* pLossChars, bool bLossPara, int& iLossIdx, bool& bVCLLoss) {
unsigned char* pDst = new unsigned char[iSrcLen];
- int iLossCharLen = strlen (pLossChars);
+ int iLossCharLen = (int) strlen (pLossChars);
int iSkipedBytes = 0;
int iDstLen = 0;
int iBufPos = 0;
@@ -815,7 +815,7 @@
decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
int32_t iSpsPpsIdAddition = 1;
encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);
- int32_t iIDRPeriod = pow (2.0f, (param_.iTemporalLayerNum - 1)) * ((rand() % 5) + 1);
+ int32_t iIDRPeriod = (int32_t) pow (2.0f, (param_.iTemporalLayerNum - 1)) * ((rand() % 5) + 1);
encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
SLTRConfig sLtrConfigVal;
sLtrConfigVal.bEnableLongTermReference = 1;
@@ -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++;
@@ -1955,7 +1955,7 @@
decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
int32_t iSpsPpsIdAddition = 1;
encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);
- int32_t iIDRPeriod = pow (2.0f, (param_.iTemporalLayerNum - 1)) * ((rand() % 5) + 1);
+ int32_t iIDRPeriod = (int32_t) pow (2.0f, (param_.iTemporalLayerNum - 1)) * ((rand() % 5) + 1);
encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
SLTRConfig sLtrConfigVal;
sLtrConfigVal.bEnableLongTermReference = 1;
@@ -2400,10 +2400,10 @@
void EncodeOneFrame (int iIdx) {
int iFrameSize = iWidth_ * iHeight_ * 3 / 2;
- int iSize = fread (buf_.data(), sizeof (char), iFrameSize, fYuv_);
+ int iSize = (int) fread (buf_.data(), sizeof (char), iFrameSize, fYuv_);
if (feof (fYuv_) || iSize != iFrameSize) {
rewind (fYuv_);
- iSize = fread (buf_.data(), sizeof (char), iFrameSize, fYuv_);
+ iSize = (int) fread (buf_.data(), sizeof (char), iFrameSize, fYuv_);
ASSERT_TRUE (iSize == iFrameSize);
}
int rv = encoder_->EncodeFrame (&EncPic, &info);
--- a/test/build/win32/codec_ut/codec_unittest.vcproj
+++ b/test/build/win32/codec_ut/codec_unittest.vcproj
@@ -45,7 +45,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\;..\..\..\..\codec\encoder\plus\inc;..\..\..\..\codec\encoder\core\inc;..\..\..\..\codec\common\inc;..\..\..\..\codec\api\svc;..\..\..\..\gtest\include;..\..\..\codec\processing\src\common;..\..\..\..\codec\processing\interface"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;X86_ASM"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;X86_ASM;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -119,7 +119,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\;..\..\..\..\codec\encoder\plus\inc;..\..\..\..\codec\encoder\core\inc;..\..\..\..\codec\common\inc;..\..\..\..\codec\api\svc;..\..\..\..\gtest\include;..\..\..\codec\processing\src\common;..\..\..\..\codec\processing\interface"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -194,7 +194,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\;..\..\..\..\codec\encoder\plus\inc;..\..\..\..\codec\encoder\core\inc;..\..\..\..\codec\common\inc;..\..\..\..\codec\api\svc;..\..\..\..\gtest\include;..\..\..\codec\processing\src\common;..\..\..\..\codec\processing\interface"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;X86_ASM"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;X86_ASM;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -270,7 +270,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\;..\..\..\..\codec\encoder\plus\inc;..\..\..\..\codec\encoder\core\inc;..\..\..\..\codec\common\inc;..\..\..\..\codec\api\svc;..\..\..\..\gtest\include;..\..\..\codec\processing\src\common;..\..\..\..\codec\processing\interface"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
--- a/test/decoder/DecUT_DecExt.cpp
+++ b/test/decoder/DecUT_DecExt.cpp
@@ -122,9 +122,9 @@
#if defined(ANDROID_NDK)
std::string filename = std::string ("/sdcard/") + sFileName;
- ASSERT_TRUE (pH264File = fopen (filename.c_str(), "rb"));
+ ASSERT_TRUE ((pH264File = fopen (filename.c_str(), "rb")) != NULL);
#else
- ASSERT_TRUE (pH264File = fopen (sFileName, "rb"));
+ ASSERT_TRUE ((pH264File = fopen (sFileName, "rb")) != NULL);
#endif
fseek (pH264File, 0L, SEEK_END);
iFileSize = (int32_t) ftell (pH264File);
@@ -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();
}
--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -191,7 +191,7 @@
pSrcPic->uiTimeStamp += 30;
eOptionId = ENCODER_OPTION_FRAME_RATE;
- fValue = static_cast<int> (rand() % 60 - 5);
+ fValue = static_cast<float> (rand() % 60 - 5);
iResult = pPtrEnc->SetOption (eOptionId, &fValue);
if (fValue <= 0)
--- a/test/encoder/EncUT_MotionEstimate.cpp
+++ b/test/encoder/EncUT_MotionEstimate.cpp
@@ -250,7 +250,7 @@
SWelsFuncPtrList sFuncList;
SWelsME sMe;
SSlice sSlice;
- int32_t iUsageType = 1;
+ bool bUsageType = true;
uint8_t* pRef = m_pRefStart + PADDING_LENGTH * m_iWidthExt + PADDING_LENGTH;
const int32_t kiMaxBlock16Sad = 72000;//a rough number
@@ -257,7 +257,7 @@
memset (&sSlice, 0, sizeof (sSlice));
memset (&sMe, 0, sizeof (sMe));
WelsInitSampleSadFunc (&sFuncList, 0); //test c functions
- WelsInitMeFunc (&sFuncList, 0, iUsageType);
+ WelsInitMeFunc (&sFuncList, 0, bUsageType);
RandomPixelDataGenerator (m_pSrc, m_iWidth, m_iHeight, m_iWidth);
RandomPixelDataGenerator (m_pRefStart, m_iWidthExt, m_iHeightExt, m_iWidthExt);
--- a/test/utils/FileInputStream.h
+++ b/test/utils/FileInputStream.h
@@ -15,7 +15,7 @@
return -1;
}
file_.read (static_cast<char*> (ptr), len);
- return file_.gcount();
+ return (int) file_.gcount();
}
private:
std::ifstream file_;