* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
#include <errno.h>
#include <sys/stat.h>
-#ifdef _MSC_VER
-#define fstat(a,b) _fstat(a,b)
-#endif
-
#include "gstdio.h"
#include "glibintl.h"
-#include "galias.h"
typedef struct _GIOWin32Channel GIOWin32Channel;
typedef struct _GIOWin32Watch GIOWin32Watch;
g_print ("%sNONBLOCK", bar), bar = "|";
if (flags & G_IO_FLAG_IS_READABLE)
g_print ("%sREADABLE", bar), bar = "|";
- if (flags & G_IO_FLAG_IS_WRITEABLE)
- g_print ("%sWRITEABLE", bar), bar = "|";
+ if (flags & G_IO_FLAG_IS_WRITABLE)
+ g_print ("%sWRITABLE", bar), bar = "|";
if (flags & G_IO_FLAG_IS_SEEKABLE)
g_print ("%sSEEKABLE", bar), bar = "|";
}
GSource *source;
source = g_source_new (&g_io_watch_funcs, sizeof (GIOWin32Watch));
+ g_source_set_name (source, "GIOChannel (Win32)");
watch = (GIOWin32Watch *)source;
watch->channel = channel;
MODE_W = 1 << 1,
MODE_A = 1 << 2,
MODE_PLUS = 1 << 3,
- } mode_num;
+ };
+ int mode_num;
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (mode != NULL, NULL);
}
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;
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;
/**
* g_io_channel_win32_new_messages:
* @hwnd: a window handle.
- * @Returns: a new #GIOChannel.
*
* Creates a new #GIOChannel given a window handle on Windows.
*
* This function creates a #GIOChannel that can be used to poll for
* Windows messages for the window in question.
+ *
+ * Returns: a new #GIOChannel.
**/
GIOChannel *
#if GLIB_SIZEOF_VOID_P == 8
}
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;
/**
* g_io_channel_win32_new_fd:
* @fd: a C library file descriptor.
- * @Returns: a new #GIOChannel.
*
* Creates a new #GIOChannel given a file descriptor on Windows. This
* works for file descriptors from the C runtime.
* thread. Your code should call only g_io_channel_read().
*
* This function is available only in GLib on Windows.
+ *
+ * Returns: a new #GIOChannel.
**/
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;
/**
* g_io_channel_win32_new_socket:
* @socket: a Winsock socket
- * @Returns: a new #GIOChannel
*
* Creates a new #GIOChannel given a socket on Windows.
*
* Polling a #GSource created to watch a channel for a socket puts the
* socket in non-blocking mode. This is a side-effect of the
* implementation and unavoidable.
+ *
+ * Returns: a new #GIOChannel
**/
GIOChannel *
g_io_channel_win32_new_socket (int socket)
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);
}
#endif
-
-#define __G_IO_WIN32_C__
-#include "galiasdef.c"