summaryrefslogtreecommitdiffstats
path: root/gatchat/gatio.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-01-18 15:11:31 +0100
committerMarcel Holtmann <marcel@holtmann.org>2011-01-18 15:11:31 +0100
commitd83da353702c8533c36e06ead14aaec5ba900cf4 (patch)
tree1674b39190a564d445a168db1e13841554633b5a /gatchat/gatio.c
parent5c4fbaf5122f3fea2372e6b6338d6f6313ba92f3 (diff)
downloadofono-d83da353702c8533c36e06ead14aaec5ba900cf4.tar.bz2
gatchat: Use g_io_channel_read_chars and g_io_channel_write_chars
Diffstat (limited to 'gatchat/gatio.c')
-rw-r--r--gatchat/gatio.c16
1 files changed, 9 insertions, 7 deletions
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;
}