mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 22:52:09 +01:00
New function, otherwise like g_io_channel_win32_wait_for_condition(), but
2000-08-27 Tor Lillqvist <tml@iki.fi> * giowin32.c (g_io_channel_win32_poll): New function, otherwise like g_io_channel_win32_wait_for_condition(), but accept several GIOChannels. (g_io_channel_win32_wait_for_condition): Call g_io_channel_win32_poll(). * glib.h: Declare g_io_channel_win32_poll(). * gwin32.c (g_win32_error_message): Don't believe return value from FormatMessage.
This commit is contained in:
parent
a435aaff03
commit
3d0a1b3b22
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
like g_io_channel_win32_wait_for_condition(), but accept several
|
||||||
|
GIOChannels.
|
||||||
|
(g_io_channel_win32_wait_for_condition): Call
|
||||||
|
g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* glib.h: Declare g_io_channel_win32_poll().
|
||||||
|
|
||||||
|
* gwin32.c (g_win32_error_message): Don't believe return value
|
||||||
|
from FormatMessage.
|
||||||
|
|
||||||
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
2000-08-25 Elliot Lee <sopwith@redhat.com>
|
||||||
* glib.h, gunicode.h, gmodule/gmodule.h:
|
* glib.h, gunicode.h, gmodule/gmodule.h:
|
||||||
: Mark the following functions G_GNUC_CONST (to allow
|
: Mark the following functions G_GNUC_CONST (to allow
|
||||||
|
55
giowin32.c
55
giowin32.c
@ -872,29 +872,62 @@ g_io_channel_win32_set_debug (GIOChannel *channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
g_io_channel_win32_poll (GIOChannel **channels,
|
||||||
|
gint n_channels,
|
||||||
GIOCondition condition,
|
GIOCondition condition,
|
||||||
gint timeout)
|
gint timeout)
|
||||||
{
|
{
|
||||||
GPollFD pollfd;
|
GPollFD *pollfd;
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
|
GIOWin32Channel *win32_channel;
|
||||||
|
int i;
|
||||||
int result;
|
int result;
|
||||||
|
gboolean debug = FALSE;
|
||||||
|
|
||||||
pollfd.fd = (gint) win32_channel->data_avail_event;
|
g_return_val_if_fail (n_channels >= 0, 0);
|
||||||
pollfd.events = condition;
|
|
||||||
|
|
||||||
if (win32_channel->debug)
|
pollfd = g_new (GPollFD, n_channels);
|
||||||
g_print ("g_io_channel_win32_wait_for_condition: fd:%d event:%#x timeout:%d\n",
|
|
||||||
win32_channel->fd, pollfd.fd, timeout);
|
|
||||||
|
|
||||||
result = (*g_main_win32_get_poll_func ()) (&pollfd, 1, timeout);
|
for (i = 0; i < n_channels; i++)
|
||||||
|
{
|
||||||
|
win32_channel = (GIOWin32Channel *) channels[i];
|
||||||
|
debug |= win32_channel->debug;
|
||||||
|
pollfd[i].fd = (gint) win32_channel->data_avail_event;
|
||||||
|
pollfd[i].events = condition;
|
||||||
|
}
|
||||||
|
|
||||||
if (win32_channel->debug)
|
if (debug)
|
||||||
g_print ("g_io_channel_win32_wait_for_condition: done:%d\n", result);
|
{
|
||||||
|
g_print ("g_io_channel_win32_poll: ");
|
||||||
|
for (i = 0; i < n_channels; i++)
|
||||||
|
{
|
||||||
|
win32_channel = (GIOWin32Channel *) channels[i];
|
||||||
|
g_print ("fd:%d event:%#x ", win32_channel->fd, pollfd[i].fd);
|
||||||
|
}
|
||||||
|
g_print ("condition:%s%s%s%s timeout:%d\n",
|
||||||
|
(condition & G_IO_ERR) ? " ERR" : "",
|
||||||
|
(condition & G_IO_HUP) ? " HUP" : "",
|
||||||
|
(condition & G_IO_IN) ? " IN" : "",
|
||||||
|
(condition & G_IO_PRI) ? " PRI" : "",
|
||||||
|
timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*g_main_win32_get_poll_func ()) (pollfd, n_channels, timeout);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
g_print ("g_io_channel_win32_poll: done:%d\n", result);
|
||||||
|
|
||||||
|
g_free (pollfd);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
||||||
|
GIOCondition condition,
|
||||||
|
gint timeout)
|
||||||
|
{
|
||||||
|
return g_io_channel_win32_poll (&channel, 1, condition, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
/* This variable and the functions below are present just to be
|
/* This variable and the functions below are present just to be
|
||||||
* binary compatible with old clients... But note that in GIMP, the
|
* binary compatible with old clients... But note that in GIMP, the
|
||||||
|
1
glib.def
1
glib.def
@ -166,6 +166,7 @@ EXPORTS
|
|||||||
g_io_channel_win32_new_stream_socket
|
g_io_channel_win32_new_stream_socket
|
||||||
g_io_channel_win32_pipe_readable
|
g_io_channel_win32_pipe_readable
|
||||||
g_io_channel_win32_pipe_request_wakeups
|
g_io_channel_win32_pipe_request_wakeups
|
||||||
|
g_io_channel_win32_poll
|
||||||
g_io_channel_win32_set_debug
|
g_io_channel_win32_set_debug
|
||||||
g_io_channel_win32_wait_for_condition
|
g_io_channel_win32_wait_for_condition
|
||||||
g_io_channel_write
|
g_io_channel_write
|
||||||
|
9
glib.h
9
glib.h
@ -2921,11 +2921,12 @@ gint g_io_channel_unix_get_fd (GIOChannel *channel);
|
|||||||
|
|
||||||
#define G_WIN32_MSG_HANDLE 19981206
|
#define G_WIN32_MSG_HANDLE 19981206
|
||||||
|
|
||||||
/* This can be used to wait until a channel is readable. On Unix you
|
/* This can be used to wait a until at least one of the channels is readable.
|
||||||
* would do a select() on the fd of the channel. This should probably
|
* On Unix you would do a select() on the file descriptors of the channels.
|
||||||
* be replaced by something for all platforms?
|
* This should probably be available for all platforms?
|
||||||
*/
|
*/
|
||||||
gint g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
gint g_io_channel_win32_poll (GIOChannel **channels,
|
||||||
|
gint n_channels,
|
||||||
GIOCondition condition,
|
GIOCondition condition,
|
||||||
gint timeout);
|
gint timeout);
|
||||||
|
|
||||||
|
@ -872,29 +872,62 @@ g_io_channel_win32_set_debug (GIOChannel *channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
g_io_channel_win32_poll (GIOChannel **channels,
|
||||||
|
gint n_channels,
|
||||||
GIOCondition condition,
|
GIOCondition condition,
|
||||||
gint timeout)
|
gint timeout)
|
||||||
{
|
{
|
||||||
GPollFD pollfd;
|
GPollFD *pollfd;
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
|
GIOWin32Channel *win32_channel;
|
||||||
|
int i;
|
||||||
int result;
|
int result;
|
||||||
|
gboolean debug = FALSE;
|
||||||
|
|
||||||
pollfd.fd = (gint) win32_channel->data_avail_event;
|
g_return_val_if_fail (n_channels >= 0, 0);
|
||||||
pollfd.events = condition;
|
|
||||||
|
|
||||||
if (win32_channel->debug)
|
pollfd = g_new (GPollFD, n_channels);
|
||||||
g_print ("g_io_channel_win32_wait_for_condition: fd:%d event:%#x timeout:%d\n",
|
|
||||||
win32_channel->fd, pollfd.fd, timeout);
|
|
||||||
|
|
||||||
result = (*g_main_win32_get_poll_func ()) (&pollfd, 1, timeout);
|
for (i = 0; i < n_channels; i++)
|
||||||
|
{
|
||||||
|
win32_channel = (GIOWin32Channel *) channels[i];
|
||||||
|
debug |= win32_channel->debug;
|
||||||
|
pollfd[i].fd = (gint) win32_channel->data_avail_event;
|
||||||
|
pollfd[i].events = condition;
|
||||||
|
}
|
||||||
|
|
||||||
if (win32_channel->debug)
|
if (debug)
|
||||||
g_print ("g_io_channel_win32_wait_for_condition: done:%d\n", result);
|
{
|
||||||
|
g_print ("g_io_channel_win32_poll: ");
|
||||||
|
for (i = 0; i < n_channels; i++)
|
||||||
|
{
|
||||||
|
win32_channel = (GIOWin32Channel *) channels[i];
|
||||||
|
g_print ("fd:%d event:%#x ", win32_channel->fd, pollfd[i].fd);
|
||||||
|
}
|
||||||
|
g_print ("condition:%s%s%s%s timeout:%d\n",
|
||||||
|
(condition & G_IO_ERR) ? " ERR" : "",
|
||||||
|
(condition & G_IO_HUP) ? " HUP" : "",
|
||||||
|
(condition & G_IO_IN) ? " IN" : "",
|
||||||
|
(condition & G_IO_PRI) ? " PRI" : "",
|
||||||
|
timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*g_main_win32_get_poll_func ()) (pollfd, n_channels, timeout);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
g_print ("g_io_channel_win32_poll: done:%d\n", result);
|
||||||
|
|
||||||
|
g_free (pollfd);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
||||||
|
GIOCondition condition,
|
||||||
|
gint timeout)
|
||||||
|
{
|
||||||
|
return g_io_channel_win32_poll (&channel, 1, condition, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
/* This variable and the functions below are present just to be
|
/* This variable and the functions below are present just to be
|
||||||
* binary compatible with old clients... But note that in GIMP, the
|
* binary compatible with old clients... But note that in GIMP, the
|
||||||
|
@ -166,6 +166,7 @@ EXPORTS
|
|||||||
g_io_channel_win32_new_stream_socket
|
g_io_channel_win32_new_stream_socket
|
||||||
g_io_channel_win32_pipe_readable
|
g_io_channel_win32_pipe_readable
|
||||||
g_io_channel_win32_pipe_request_wakeups
|
g_io_channel_win32_pipe_request_wakeups
|
||||||
|
g_io_channel_win32_poll
|
||||||
g_io_channel_win32_set_debug
|
g_io_channel_win32_set_debug
|
||||||
g_io_channel_win32_wait_for_condition
|
g_io_channel_win32_wait_for_condition
|
||||||
g_io_channel_write
|
g_io_channel_write
|
||||||
|
@ -2921,11 +2921,12 @@ gint g_io_channel_unix_get_fd (GIOChannel *channel);
|
|||||||
|
|
||||||
#define G_WIN32_MSG_HANDLE 19981206
|
#define G_WIN32_MSG_HANDLE 19981206
|
||||||
|
|
||||||
/* This can be used to wait until a channel is readable. On Unix you
|
/* This can be used to wait a until at least one of the channels is readable.
|
||||||
* would do a select() on the fd of the channel. This should probably
|
* On Unix you would do a select() on the file descriptors of the channels.
|
||||||
* be replaced by something for all platforms?
|
* This should probably be available for all platforms?
|
||||||
*/
|
*/
|
||||||
gint g_io_channel_win32_wait_for_condition (GIOChannel *channel,
|
gint g_io_channel_win32_poll (GIOChannel **channels,
|
||||||
|
gint n_channels,
|
||||||
GIOCondition condition,
|
GIOCondition condition,
|
||||||
gint timeout);
|
gint timeout);
|
||||||
|
|
||||||
|
@ -806,11 +806,13 @@ g_win32_error_message (gint error)
|
|||||||
gchar *retval;
|
gchar *retval;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
nbytes = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||||
|FORMAT_MESSAGE_IGNORE_INSERTS
|
|FORMAT_MESSAGE_IGNORE_INSERTS
|
||||||
|FORMAT_MESSAGE_FROM_SYSTEM,
|
|FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, error, 0,
|
NULL, error, 0,
|
||||||
(LPTSTR) &msg, 0, NULL);
|
(LPTSTR) &msg, 0, NULL);
|
||||||
|
nbytes = strlen (msg);
|
||||||
|
|
||||||
if (nbytes > 2 && msg[nbytes-1] == '\n' && msg[nbytes-2] == '\r')
|
if (nbytes > 2 && msg[nbytes-1] == '\n' && msg[nbytes-2] == '\r')
|
||||||
msg[nbytes-2] = '\0';
|
msg[nbytes-2] = '\0';
|
||||||
|
|
||||||
|
4
gwin32.c
4
gwin32.c
@ -806,11 +806,13 @@ g_win32_error_message (gint error)
|
|||||||
gchar *retval;
|
gchar *retval;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
nbytes = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||||
|FORMAT_MESSAGE_IGNORE_INSERTS
|
|FORMAT_MESSAGE_IGNORE_INSERTS
|
||||||
|FORMAT_MESSAGE_FROM_SYSTEM,
|
|FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, error, 0,
|
NULL, error, 0,
|
||||||
(LPTSTR) &msg, 0, NULL);
|
(LPTSTR) &msg, 0, NULL);
|
||||||
|
nbytes = strlen (msg);
|
||||||
|
|
||||||
if (nbytes > 2 && msg[nbytes-1] == '\n' && msg[nbytes-2] == '\r')
|
if (nbytes > 2 && msg[nbytes-1] == '\n' && msg[nbytes-2] == '\r')
|
||||||
msg[nbytes-2] = '\0';
|
msg[nbytes-2] = '\0';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user