mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 19:22:11 +01:00
Internally use the _stati64 API explicitly on Windows
Avoids warnings and confusion when compiling with MSVC.
This commit is contained in:
parent
e27528cacc
commit
4b995337fe
@ -81,10 +81,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define fstat(a,b) _fstat(a,b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gstdio.h"
|
#include "gstdio.h"
|
||||||
#include "glibintl.h"
|
#include "glibintl.h"
|
||||||
|
|
||||||
@ -1796,7 +1792,7 @@ g_io_win32_unimpl_set_flags (GIOChannel *channel,
|
|||||||
|
|
||||||
static GIOFlags
|
static GIOFlags
|
||||||
g_io_win32_fd_get_flags_internal (GIOChannel *channel,
|
g_io_win32_fd_get_flags_internal (GIOChannel *channel,
|
||||||
struct stat *st)
|
struct _stati64 *st)
|
||||||
{
|
{
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
|
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
|
||||||
gchar c;
|
gchar c;
|
||||||
@ -1828,13 +1824,13 @@ g_io_win32_fd_get_flags_internal (GIOChannel *channel,
|
|||||||
static GIOFlags
|
static GIOFlags
|
||||||
g_io_win32_fd_get_flags (GIOChannel *channel)
|
g_io_win32_fd_get_flags (GIOChannel *channel)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct _stati64 st;
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
||||||
|
|
||||||
g_return_val_if_fail (win32_channel != NULL, 0);
|
g_return_val_if_fail (win32_channel != NULL, 0);
|
||||||
g_return_val_if_fail (win32_channel->type == G_IO_WIN32_FILE_DESC, 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);
|
return g_io_win32_fd_get_flags_internal (channel, &st);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -2003,7 +1999,7 @@ g_io_channel_win32_new_messages (guint hwnd)
|
|||||||
|
|
||||||
static GIOChannel *
|
static GIOChannel *
|
||||||
g_io_channel_win32_new_fd_internal (gint fd,
|
g_io_channel_win32_new_fd_internal (gint fd,
|
||||||
struct stat *st)
|
struct _stati64 *st)
|
||||||
{
|
{
|
||||||
GIOWin32Channel *win32_channel;
|
GIOWin32Channel *win32_channel;
|
||||||
GIOChannel *channel;
|
GIOChannel *channel;
|
||||||
@ -2039,9 +2035,9 @@ g_io_channel_win32_new_fd_internal (gint fd,
|
|||||||
GIOChannel *
|
GIOChannel *
|
||||||
g_io_channel_win32_new_fd (gint fd)
|
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);
|
g_warning ("g_io_channel_win32_new_fd: %d isn't an open file descriptor in the C library GLib uses.", fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2084,10 +2080,10 @@ GIOChannel *
|
|||||||
g_io_channel_unix_new (gint fd)
|
g_io_channel_unix_new (gint fd)
|
||||||
{
|
{
|
||||||
gboolean is_fd, is_socket;
|
gboolean is_fd, is_socket;
|
||||||
struct stat st;
|
struct _stati64 st;
|
||||||
int optval, optlen;
|
int optval, optlen;
|
||||||
|
|
||||||
is_fd = (fstat (fd, &st) == 0);
|
is_fd = (_fstati64 (fd, &st) == 0);
|
||||||
|
|
||||||
optlen = sizeof (optval);
|
optlen = sizeof (optval);
|
||||||
is_socket = (getsockopt (fd, SOL_SOCKET, SO_TYPE, (char *) &optval, &optlen) != SOCKET_ERROR);
|
is_socket = (getsockopt (fd, SOL_SOCKET, SO_TYPE, (char *) &optval, &optlen) != SOCKET_ERROR);
|
||||||
|
@ -39,9 +39,8 @@
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#define fstat(a,b) _fstati64(a,b)
|
||||||
#define fstat(a,b) _fstat(a,b)
|
#define stat _stati64
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISREG
|
||||||
#define S_ISREG(mode) ((mode)&_S_IFREG)
|
#define S_ISREG(mode) ((mode)&_S_IFREG)
|
||||||
|
@ -38,9 +38,8 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#define fstat(a,b) _fstati64(a,b)
|
||||||
#define fstat(a,b) _fstat(a,b)
|
#define stat _stati64
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user