Supposed fix for g_io_channel_read() deprecation
This commit is contained in:
parent
0e3fbb01d7
commit
d559401c50
@ -212,7 +212,19 @@ xchat_dummy (xchat_plugin *ph)
|
|||||||
static int
|
static int
|
||||||
xchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len)
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -392,11 +392,14 @@ int
|
|||||||
waitline2 (GIOChannel *source, char *buf, int bufsize)
|
waitline2 (GIOChannel *source, char *buf, int bufsize)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int len;
|
gsize len;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (g_io_channel_read (source, &buf[i], 1, &len) != G_IO_ERROR_NONE)
|
g_io_channel_set_buffered (source, FALSE);
|
||||||
|
g_io_channel_set_encoding (source, NULL, &error);
|
||||||
|
if (g_io_channel_read_chars (source, &buf[i], 1, &len, &error) != G_IO_STATUS_NORMAL)
|
||||||
return -1;
|
return -1;
|
||||||
if (buf[i] == '\n' || bufsize == i + 1)
|
if (buf[i] == '\n' || bufsize == i + 1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user