test_util: Don't pass NULL to std::string() in GetTestDataDir().

Change-Id: Iaafa78a17580d962e260d9553b11d2cd3cb4726f
Also: quiet MSVC warnings that suggest making code non-portable.
This commit is contained in:
Tom Finegan
2016-03-08 10:07:43 -08:00
parent 1f74651b5b
commit b9dc4ac09c

View File

@@ -10,6 +10,9 @@
#include <sys/stat.h>
#ifndef _MSC_VER
#include <unistd.h> // close()
#else
// Disable MSVC warnings that suggest making code non-portable.
#pragma warning(disable:4996)
#endif
#include <cstdint>
@@ -28,7 +31,8 @@ namespace libwebm {
namespace test {
std::string GetTestDataDir() {
return std::getenv("LIBWEBM_TEST_DATA_PATH");
const char* test_data_path = std::getenv("LIBWEBM_TEST_DATA_PATH");
return test_data_path ? std::string(test_data_path) : std::string();
}
std::string GetTestFilePath(const std::string& name) {