Clarify use of struct stat on Windows

This commit is contained in:
Tor Lillqvist
2010-02-04 19:54:50 +02:00
parent 5589d2b455
commit 021643cda4
4 changed files with 76 additions and 18 deletions

View File

@@ -89,12 +89,49 @@ int g_mkdir (const gchar *filename,
int g_chdir (const gchar *path);
#ifdef G_OS_WIN32
/* The _g_stat_struct struct tag is an internal implementation detail
* and not part of the public GLib API.
*/
#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, just use the
* GIO API instead which doesn't use struct stat to get file
* attributes, .
*/
#define _g_stat_struct _stat32
#else
#define _g_stat_struct _stat
#endif
int g_stat (const gchar *filename,
struct _g_stat_struct *buf);
int g_lstat (const gchar *filename,
struct _g_stat_struct *buf);
#else
/* No _g_stat_struct used on Unix */
int g_stat (const gchar *filename,
struct stat *buf);
int g_lstat (const gchar *filename,
struct stat *buf);
#endif
int g_unlink (const gchar *filename);
int g_remove (const gchar *filename);