diff --git a/gatchat/gatio.c b/gatchat/gatio.c index b65be86d..9cfc9989 100644 --- a/gatchat/gatio.c +++ b/gatchat/gatio.c @@ -82,7 +82,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, { unsigned char *buf; GAtIO *io = data; - GIOError err; + GIOStatus status; gsize rbytes; gsize toread; gsize total_read = 0; @@ -101,7 +101,8 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, rbytes = 0; buf = ring_buffer_write_ptr(io->buf, 0); - err = g_io_channel_read(channel, (char *) buf, toread, &rbytes); + status = g_io_channel_read_chars(channel, (char *) buf, + toread, &rbytes, NULL); g_at_util_debug_chat(TRUE, (char *)buf, rbytes, io->debugf, io->debug_data); @@ -112,7 +113,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, if (rbytes > 0) ring_buffer_write_advance(io->buf, rbytes); - } while (err == G_IO_ERROR_NONE && rbytes > 0 && + } while (status == G_IO_STATUS_NORMAL && rbytes > 0 && read_count < io->max_read_attempts); if (total_read > 0 && io->read_handler) @@ -121,7 +122,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, if (cond & (G_IO_HUP | G_IO_ERR)) return FALSE; - if (read_count > 0 && rbytes == 0 && err != G_IO_ERROR_AGAIN) + if (read_count > 0 && rbytes == 0 && status != G_IO_STATUS_AGAIN) return FALSE; /* We're overflowing the buffer, shutdown the socket */ @@ -133,12 +134,13 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, gsize g_at_io_write(GAtIO *io, const gchar *data, gsize count) { - GIOError err; + GIOStatus status; gsize bytes_written; - err = g_io_channel_write(io->channel, data, count, &bytes_written); + status = g_io_channel_write_chars(io->channel, data, + count, &bytes_written, NULL); - if (err != G_IO_ERROR_NONE) { + if (status != G_IO_STATUS_NORMAL) { g_source_remove(io->read_watch); return 0; }