add glib/stdio compat wrapper for mingw64-w32
[ardour.git] / libs / pbd / pbd / gstdio_compat.h
1 /* glib mingw64/win32 compatibility
2  *
3  * see http://pidgin.im/pipermail/devel/2014-April/023475.html
4  * and https://pidgin.im/pipermail/commits/2014-April/025031.html
5  * http://tracker.ardour.org/view.php?id=6575
6  */
7
8 #ifndef __pbd_gstdio_compat_h__
9 #define __pbd_gstdio_compat_h__
10
11 #include <glib/gstdio.h>
12
13 /* glib's definition of g_stat+GStatBuf is broken for mingw64-w32
14  * (and possibly other 32-bit windows)
15  */
16 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
17 typedef struct _stat GStatBufW32;
18 static inline int
19 pbd_g_stat(const gchar *filename, GStatBufW32 *buf)
20 {
21         return g_stat(filename, (GStatBuf*)buf);
22 }
23 #  define GStatBuf GStatBufW32
24 #  define g_stat pbd_g_stat
25 #endif
26
27 #endif /* __pbd_gstdio_compat_h__ */