[glib/glib-2-22] Internally use the _stati64 API explicitly on Windows
- From: Tor Lillqvist <tml src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib/glib-2-22] Internally use the _stati64 API explicitly on Windows
- Date: Thu, 4 Feb 2010 17:58:00 +0000 (UTC)
commit 4b995337fe933900749b0a1488ec8af0fcf5dc1d
Author: Tor Lillqvist <tml iki fi>
Date: Thu Feb 4 19:20:08 2010 +0200
Internally use the _stati64 API explicitly on Windows
Avoids warnings and confusion when compiling with MSVC.
glib/giowin32.c | 24 ++++++++++--------------
glib/gkeyfile.c | 5 ++---
glib/gmappedfile.c | 5 ++---
3 files changed, 14 insertions(+), 20 deletions(-)
---
diff --git a/glib/giowin32.c b/glib/giowin32.c
index d661865..6dfeac4 100644
--- a/glib/giowin32.c
+++ b/glib/giowin32.c
@@ -81,10 +81,6 @@
#include <errno.h>
#include <sys/stat.h>
-#ifdef _MSC_VER
-#define fstat(a,b) _fstat(a,b)
-#endif
-
#include "gstdio.h"
#include "glibintl.h"
@@ -1795,8 +1791,8 @@ g_io_win32_unimpl_set_flags (GIOChannel *channel,
}
static GIOFlags
-g_io_win32_fd_get_flags_internal (GIOChannel *channel,
- struct stat *st)
+g_io_win32_fd_get_flags_internal (GIOChannel *channel,
+ struct _stati64 *st)
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
gchar c;
@@ -1828,13 +1824,13 @@ g_io_win32_fd_get_flags_internal (GIOChannel *channel,
static GIOFlags
g_io_win32_fd_get_flags (GIOChannel *channel)
{
- struct stat st;
+ struct _stati64 st;
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
g_return_val_if_fail (win32_channel != NULL, 0);
g_return_val_if_fail (win32_channel->type == G_IO_WIN32_FILE_DESC, 0);
- if (0 == fstat (win32_channel->fd, &st))
+ if (0 == _fstati64 (win32_channel->fd, &st))
return g_io_win32_fd_get_flags_internal (channel, &st);
else
return 0;
@@ -2002,8 +1998,8 @@ g_io_channel_win32_new_messages (guint hwnd)
}
static GIOChannel *
-g_io_channel_win32_new_fd_internal (gint fd,
- struct stat *st)
+g_io_channel_win32_new_fd_internal (gint fd,
+ struct _stati64 *st)
{
GIOWin32Channel *win32_channel;
GIOChannel *channel;
@@ -2039,9 +2035,9 @@ g_io_channel_win32_new_fd_internal (gint fd,
GIOChannel *
g_io_channel_win32_new_fd (gint fd)
{
- struct stat st;
+ struct _stati64 st;
- if (fstat (fd, &st) == -1)
+ if (_fstati64 (fd, &st) == -1)
{
g_warning ("g_io_channel_win32_new_fd: %d isn't an open file descriptor in the C library GLib uses.", fd);
return NULL;
@@ -2084,10 +2080,10 @@ GIOChannel *
g_io_channel_unix_new (gint fd)
{
gboolean is_fd, is_socket;
- struct stat st;
+ struct _stati64 st;
int optval, optlen;
- is_fd = (fstat (fd, &st) == 0);
+ is_fd = (_fstati64 (fd, &st) == 0);
optlen = sizeof (optval);
is_socket = (getsockopt (fd, SOL_SOCKET, SO_TYPE, (char *) &optval, &optlen) != SOCKET_ERROR);
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index a6a543c..2226e70 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -39,9 +39,8 @@
#ifdef G_OS_WIN32
#include <io.h>
-#ifdef _MSC_VER
-#define fstat(a,b) _fstat(a,b)
-#endif
+#define fstat(a,b) _fstati64(a,b)
+#define stat _stati64
#ifndef S_ISREG
#define S_ISREG(mode) ((mode)&_S_IFREG)
diff --git a/glib/gmappedfile.c b/glib/gmappedfile.c
index 77865b8..4b46cca 100644
--- a/glib/gmappedfile.c
+++ b/glib/gmappedfile.c
@@ -38,9 +38,8 @@
#include <windows.h>
#include <io.h>
-#ifdef _MSC_VER
-#define fstat(a,b) _fstat(a,b)
-#endif
+#define fstat(a,b) _fstati64(a,b)
+#define stat _stati64
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]