I've prepared small patch for _mingw_stat64.h and mkstemp.c files.

First problem is that in _mingw_stat64.h header file #define section for _USE_32BIT_TIME_T case is switched from
#define  new_name  msvcrt_function
to
#define  msvcrt_function  new_name
which is nonsense. ffmpeg in file libavformat/os_support.h undefines stat & fstat in blind for _WIN32.

Second problem is described in ticket #471
http://sourceforge.net/p/mingw-w64/bugs/471/
so I've removed _O_TEMPORARY flag.
diff --git a/mingw-w64-crt/misc/mkstemp.c b/mingw-w64-crt/misc/mkstemp.c
index d3c4aad..c78b7c5 100644
--- a/mingw-w64-crt/misc/mkstemp.c
+++ b/mingw-w64-crt/misc/mkstemp.c
@@ -48,7 +48,7 @@ int __cdecl mkstemp (char *template_name)
             template_name[j] = letters[rand () % 62];
         }
         fd = _sopen(template_name,
-                _O_RDWR | _O_CREAT | _O_EXCL | _O_TEMPORARY | _O_BINARY,
+                _O_RDWR | _O_CREAT | _O_EXCL | _O_BINARY,
                 _SH_DENYRW, _S_IREAD | _S_IWRITE);
         if (fd != -1) return fd;
         if (fd == -1 && errno != EEXIST) return -1;
diff --git a/mingw-w64-headers/crt/_mingw_stat64.h 
b/mingw-w64-headers/crt/_mingw_stat64.h
index 17e754c..8ce0975 100644
--- a/mingw-w64-headers/crt/_mingw_stat64.h
+++ b/mingw-w64-headers/crt/_mingw_stat64.h
@@ -1,12 +1,12 @@
 #ifndef _STAT_DEFINED
 
 #ifdef _USE_32BIT_TIME_T
-#define _fstat32 _fstat
-#define _stat32 _stat
-#define _wstat32 _wstat
-#define _fstat32i64 _fstati64
-#define _stat32i64 _stati64
-#define _wstat32i64 _wstati64
+#define _fstat _fstat32
+#define _fstati64 _fstat32i64
+#define _stat _stat32
+#define _stati64 _stat32i64
+#define _wstat _wstat32
+#define _wstati64 _wstat32i64
 #else
 #define _fstat _fstat64i32
 #define _fstati64 _fstat64
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to