mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
wip
This commit is contained in:
parent
225854072a
commit
55647c8ada
@ -716,12 +716,12 @@ g_io_channel_get_buffer_condition (GIOChannel *channel)
|
|||||||
|
|
||||||
if (channel->encoding)
|
if (channel->encoding)
|
||||||
{
|
{
|
||||||
if (channel->encoded_read_buf && (channel->encoded_read_buf->len > 0))
|
if (!channel->encoded_read_buf || channel->encoded_read_buf->len > 0)
|
||||||
condition |= G_IO_IN; /* Only return if we have full characters */
|
condition |= G_IO_IN; /* Only return if we have full characters */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (channel->read_buf && (channel->read_buf->len > 0))
|
if (!channel->read_buf || channel->read_buf->len > 0)
|
||||||
condition |= G_IO_IN;
|
condition |= G_IO_IN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +101,6 @@ static GIOStatus g_io_unix_set_flags (GIOChannel *channel,
|
|||||||
GError **err);
|
GError **err);
|
||||||
static GIOFlags g_io_unix_get_flags (GIOChannel *channel);
|
static GIOFlags g_io_unix_get_flags (GIOChannel *channel);
|
||||||
|
|
||||||
static gboolean g_io_unix_prepare (GSource *source,
|
|
||||||
gint *timeout);
|
|
||||||
static gboolean g_io_unix_check (GSource *source);
|
static gboolean g_io_unix_check (GSource *source);
|
||||||
static gboolean g_io_unix_dispatch (GSource *source,
|
static gboolean g_io_unix_dispatch (GSource *source,
|
||||||
GSourceFunc callback,
|
GSourceFunc callback,
|
||||||
@ -110,7 +108,7 @@ static gboolean g_io_unix_dispatch (GSource *source,
|
|||||||
static void g_io_unix_finalize (GSource *source);
|
static void g_io_unix_finalize (GSource *source);
|
||||||
|
|
||||||
GSourceFuncs g_io_watch_funcs = {
|
GSourceFuncs g_io_watch_funcs = {
|
||||||
g_io_unix_prepare,
|
NULL,
|
||||||
g_io_unix_check,
|
g_io_unix_check,
|
||||||
g_io_unix_dispatch,
|
g_io_unix_dispatch,
|
||||||
g_io_unix_finalize,
|
g_io_unix_finalize,
|
||||||
@ -128,18 +126,6 @@ static GIOFuncs unix_channel_funcs = {
|
|||||||
g_io_unix_get_flags,
|
g_io_unix_get_flags,
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean
|
|
||||||
g_io_unix_prepare (GSource *source,
|
|
||||||
gint *timeout)
|
|
||||||
{
|
|
||||||
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
|
||||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
|
||||||
|
|
||||||
/* Only return TRUE here if _all_ bits in watch->condition will be set
|
|
||||||
*/
|
|
||||||
return ((watch->condition & buffer_condition) == watch->condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
g_io_unix_check (GSource *source)
|
g_io_unix_check (GSource *source)
|
||||||
{
|
{
|
||||||
@ -147,7 +133,7 @@ g_io_unix_check (GSource *source)
|
|||||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||||
GIOCondition poll_condition = watch->pollfd.revents;
|
GIOCondition poll_condition = watch->pollfd.revents;
|
||||||
|
|
||||||
return ((poll_condition | buffer_condition) & watch->condition);
|
return (poll_condition & watch->condition) && (buffer_condition & watch->condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user