mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 14:36:16 +01:00
Fix.
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com> * glib/giochannel.c (g_io_channel_get_buffer_condition): Fix. * glib/giunix.c: Fix prepare/check/dispatch for watches. * tests/unicode-normalize.c: #include <string.h>
This commit is contained in:
parent
6bad2c92ce
commit
7d676fb206
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -1,3 +1,11 @@
|
||||
Mon Jul 2 16:03:21 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/giochannel.c (g_io_channel_get_buffer_condition): Fix.
|
||||
|
||||
* glib/giunix.c: Fix prepare/check/dispatch for watches.
|
||||
|
||||
* tests/unicode-normalize.c: #include <string.h>
|
||||
|
||||
Sat Jun 30 23:14:32 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/glist.[hc]: added g_list_insert_before().
|
||||
|
@ -428,15 +428,16 @@ g_io_add_watch (GIOChannel *channel,
|
||||
*
|
||||
* This function returns a #GIOCondition depending on the status of the
|
||||
* internal buffers in the #GIOChannel. Only the flags %G_IO_IN and
|
||||
* %G_IO_OUT may be set.
|
||||
* %G_IO_OUT will be set.
|
||||
*
|
||||
* Return value: A #GIOCondition
|
||||
**/
|
||||
GIOCondition
|
||||
g_io_channel_get_buffer_condition (GIOChannel *channel)
|
||||
{
|
||||
return (((channel->read_buf->len > 0) || (channel->encoded_read_buf->len > 0))
|
||||
? G_IO_IN : 0) & ((channel->write_buf->len > 0) ? G_IO_OUT : 0);
|
||||
return
|
||||
((channel->read_buf && channel->read_buf->len > 0) ? G_IO_IN : 0) |
|
||||
((channel->write_buf && channel->write_buf->len <= channel->buf_size) ? G_IO_OUT : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,27 +118,23 @@ g_io_unix_prepare (GSource *source,
|
||||
gint *timeout)
|
||||
{
|
||||
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||
|
||||
*timeout = -1;
|
||||
|
||||
/* Only return TRUE if we're sure to match all conditions, otherwise
|
||||
* we need to check.
|
||||
/* Only return TRUE here if _all_ bits in watch->condition will be set
|
||||
*/
|
||||
|
||||
watch->condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||
|
||||
return (watch->pollfd.revents & (G_IO_IN | G_IO_OUT)) == watch->condition;
|
||||
|
||||
return ((watch->condition & buffer_condition) == watch->condition);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_io_unix_check (GSource *source)
|
||||
{
|
||||
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||
GIOCondition poll_condition = watch->pollfd.revents;
|
||||
|
||||
watch->condition &= g_io_channel_get_buffer_condition (watch->channel);
|
||||
|
||||
return (watch->pollfd.revents & watch->condition);
|
||||
return ((poll_condition | buffer_condition) & watch->condition);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -149,6 +145,7 @@ g_io_unix_dispatch (GSource *source,
|
||||
{
|
||||
GIOFunc func = (GIOFunc)callback;
|
||||
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||
|
||||
if (!func)
|
||||
{
|
||||
@ -158,7 +155,7 @@ g_io_unix_dispatch (GSource *source,
|
||||
}
|
||||
|
||||
return (*func) (watch->channel,
|
||||
watch->pollfd.revents & watch->condition,
|
||||
(watch->pollfd.revents | buffer_condition) & watch->condition,
|
||||
user_data);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
gboolean success = TRUE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user