test_util: Remove tmpnam() usage on non-MSVC targets.
Change-Id: Icd3a68fa4e52401a41f4afe52a6206d6092bc8fb
This commit is contained in:
@@ -58,9 +58,19 @@ bool CompareFiles(const std::string& file1, const std::string& file2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string GetTempFileName() {
|
std::string GetTempFileName() {
|
||||||
// TODO(tomfinegan): This is only test code, but it would be nice to avoid
|
#ifndef _MSC_VER
|
||||||
// using std::tmpnam().
|
char temp_file_name_template[] = "libwebm_temp.XXXXXX";
|
||||||
|
int fd = mkstemp(temp_file_name_template);
|
||||||
|
if (fd != -1) {
|
||||||
|
close(fd);
|
||||||
|
return std::string(temp_file_name_template);
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
|
#else
|
||||||
|
// TODO(tomfinegan): Add the MSVC version of mkstemp() to quiet the MSVC
|
||||||
|
// version of the security warning.
|
||||||
return std::tmpnam(nullptr);
|
return std::tmpnam(nullptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint64_t GetFileSize(const std::string& file_name) {
|
std::uint64_t GetFileSize(const std::string& file_name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user