Update file_util.cpp

Use mingw32 macro definition "defined(MINGW_HAS_SECURE_API)" support "_s" functions,and "!defined(MINGW_HAS_SECURE_API)" disable "_s" functions supported
This commit is contained in:
yami-hack 2016-06-13 17:44:21 +08:00 committed by GitHub
parent de4059eef0
commit 4f09c3f915

View File

@ -928,7 +928,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[])
{ {
Close(); Close();
#ifdef _WIN32 #ifdef _WIN32
#if defined(__MINGW64__) #if defined(__MINGW64__) && !defined(MINGW_HAS_SECURE_API)
m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str(), SH_DENYNO); m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str(), SH_DENYNO);
#else #else
_wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str()); _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str());
@ -987,7 +987,7 @@ bool IOFile::Resize(u64 size)
if (!IsOpen() || 0 != if (!IsOpen() || 0 !=
#ifdef _WIN32 #ifdef _WIN32
#if defined(__MINGW64__) #if defined(__MINGW64__) && !defined(MINGW_HAS_SECURE_API)
//TDM-GCC64 does not supports _chsize_s ?in <io_s.h> //TDM-GCC64 does not supports _chsize_s ?in <io_s.h>
_chsize(_fileno(m_file), size) _chsize(_fileno(m_file), size)
#else #else