From 27eb0b90024cb4fdf1f46f435d301870872974ab Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Sun, 17 Sep 2017 19:33:22 -0700 Subject: [PATCH] Fix builds with mingw x86 and x86_64. - Deal with tmpnam_s() preproc issues in file_util.cc when building with mingw-w64.. - Add stdint.h include in mkvmuxer.cc. Change-Id: I819a27e6d805d772a6e1863982a2eeafd27b2a0d --- common/file_util.cc | 5 +++++ mkvmuxer/mkvmuxer.cc | 2 ++ 2 files changed, 7 insertions(+) diff --git a/common/file_util.cc b/common/file_util.cc index 252e74b..db4aad2 100644 --- a/common/file_util.cc +++ b/common/file_util.cc @@ -41,7 +41,12 @@ std::string GetTempFileName() { return temp_file_name; #else char tmp_file_name[_MAX_PATH]; +#if defined _MSC_VER || defined MINGW_HAS_SECURE_API errno_t err = tmpnam_s(tmp_file_name); +#else + char* fname_pointer = tmpnam(tmp_file_name); + errno_t err = (fname_pointer == &tmp_file_name[0]) ? 0 : -1; +#endif if (err == 0) { return std::string(tmp_file_name); } diff --git a/mkvmuxer/mkvmuxer.cc b/mkvmuxer/mkvmuxer.cc index 137585d..41732fb 100644 --- a/mkvmuxer/mkvmuxer.cc +++ b/mkvmuxer/mkvmuxer.cc @@ -8,6 +8,8 @@ #include "mkvmuxer/mkvmuxer.h" +#include + #include #include #include