Use _wfopen and fseeko64 on MinGW in C++11 mode

Since MinGW 4.5 does not define these functions if __STRICT_ANSI__ is defined
(in case of _wfopen it defines it inconsistently between stdio.h and wchar.h)
use the baseline functions for MinGW 4.5 and earlier.

Fixes #23.
This commit is contained in:
Arseny Kapoulkine 2014-11-24 20:49:12 -08:00
parent 3e1ae89cf6
commit b7a1feccf7
2 changed files with 3 additions and 3 deletions

View file

@ -3995,7 +3995,7 @@ PUGI__NS_BEGIN
_fseeki64(file, 0, SEEK_END);
length_type length = _ftelli64(file);
_fseeki64(file, 0, SEEK_SET);
#elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && !defined(__STRICT_ANSI__)
#elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && !(defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405)
// there are 64-bit versions of fseek/ftell, let's use them
typedef off64_t length_type;
@ -4240,7 +4240,7 @@ PUGI__NS_BEGIN
}
#endif
#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && !defined(__STRICT_ANSI__))
#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && !(defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405))
PUGI__FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode)
{
return _wfopen(path, mode);

View file

@ -323,7 +323,7 @@ TEST(document_load_file_wide_ascii)
CHECK_NODE(doc, STR("<node />"));
}
#if !defined(__DMC__) && !defined(__MWERKS__)
#if !defined(__DMC__) && !defined(__MWERKS__) && !(defined(__MINGW32__) && defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405)
TEST(document_load_file_wide_unicode)
{
pugi::xml_document doc;