From 7208ed14b137582c16dc6231ecc1f12f7f99d71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 19 Feb 2015 01:08:44 +0200 Subject: [PATCH] Store a const char* instead of a std::string in gtest parameter arrays This avoids valgrind warnings about using unintialized data. --- test/api/encode_decode_api_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/api/encode_decode_api_test.cpp b/test/api/encode_decode_api_test.cpp index d5fd3f5b..1ce84ed6 100644 --- a/test/api/encode_decode_api_test.cpp +++ b/test/api/encode_decode_api_test.cpp @@ -3401,7 +3401,7 @@ struct EncodeOptionParam { int uiMaxNalLen; float fFramerate; int iThreads; - std::string sFileSave; + const char* sFileSave; }; static const EncodeOptionParam kOptionParamArray[] = { @@ -3466,8 +3466,8 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { srand(1002); EncodeOptionParam p = GetParam(); FILE * pFile = NULL; - if(!p.sFileSave.empty()) { - pFile = fopen(p.sFileSave.c_str(), "wb"); + if (p.sFileSave != NULL && strlen(p.sFileSave) > 0) { + pFile = fopen(p.sFileSave, "wb"); } memset (¶m_, 0, sizeof (SEncParamExt)); encoder_->GetDefaultParams (¶m_);