diff --git a/glib/gstdio.h b/glib/gstdio.h index cc094cbb3..b92eb6c49 100644 --- a/glib/gstdio.h +++ b/glib/gstdio.h @@ -27,6 +27,31 @@ G_BEGIN_DECLS +#if defined (_MSC_VER) && !defined(_WIN64) + +/* Make it clear that we mean the struct with 32-bit st_size and + * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally + * has been compiled. If you get a compiler warning when calling + * g_stat(), do take it seriously and make sure that the type of + * struct stat the code in GLib fills in matches the struct the type + * of struct stat you pass to g_stat(). To avoid hassle, to get file + * attributes just use the GIO API instead which doesn't use struct + * stat. + * + * Sure, it would be nicer to use a struct with 64-bit st_size and + * 64-bit st_*time fields, but changing that now would break ABI. And + * in MinGW, a plain "struct stat" is the one with 32-bit st_size and + * st_*time fields. + */ + +typedef struct _stat32 GStatBuf; + +#else + +typedef struct stat GStatBuf; + +#endif + #if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX) /* Just pass on to the system functions, so there's no potential for data @@ -89,31 +114,6 @@ int g_mkdir (const gchar *filename, int g_chdir (const gchar *path); -#if defined (_MSC_VER) && !defined(_WIN64) - -/* Make it clear that we mean the struct with 32-bit st_size and - * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally - * has been compiled. If you get a compiler warning when calling - * g_stat(), do take it seriously and make sure that the type of - * struct stat the code in GLib fills in matches the struct the type - * of struct stat you pass to g_stat(). To avoid hassle, to get file - * attributes just use the GIO API instead which doesn't use struct - * stat. - * - * Sure, it would be nicer to use a struct with 64-bit st_size and - * 64-bit st_*time fields, but changing that now would break ABI. And - * in MinGW, a plain "struct stat" is the one with 32-bit st_size and - * st_*time fields. - */ - -typedef struct _stat32 GStatBuf; - -#else - -typedef struct stat GStatBuf; - -#endif - int g_stat (const gchar *filename, GStatBuf *buf);