From d559401c50690c65993b519bb2e28754e46dd179 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 21 Jul 2012 16:16:00 +0200 Subject: Supposed fix for g_io_channel_read() deprecation --- src/common/plugin.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/common/plugin.c') diff --git a/src/common/plugin.c b/src/common/plugin.c index 71e1ae61..d8211e82 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -212,7 +212,19 @@ xchat_dummy (xchat_plugin *ph) static int xchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len) { - return g_io_channel_read (source, buf, *len, len); + GError *error = NULL; + + g_io_channel_set_buffered (source, FALSE); + g_io_channel_set_encoding (source, NULL, &error); + + if (g_io_channel_read_chars (source, buf, *len, (gsize*)len, &error) == G_IO_STATUS_NORMAL) + { + return 0; + } + else + { + return -1; + } } #endif -- cgit 1.4.1