diff options
author | Luiz Augusto von Dentz <luiz.dentz-von@nokia.com> | 2011-01-19 13:53:20 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz-von@nokia.com> | 2011-01-19 13:53:20 +0200 |
commit | 291b8885cd2b2c8459923c56b21ad41646f8e79c (patch) | |
tree | 52fb81a35e5f2ebbd01869e072d69d9a71b3995c | |
parent | 4aecf0a27cfdd08d84a1c61271f5c59da3ae370a (diff) | |
download | bluez-291b8885cd2b2c8459923c56b21ad41646f8e79c.tar.gz |
Fix use of deprecated glib on input plugin
-rw-r--r-- | input/device.c | 12 | ||||
-rw-r--r-- | input/fakehid.c | 10 |
2 files changed, 14 insertions, 8 deletions
diff --git a/input/device.c b/input/device.c index 8a17966b8..5cb57eaf5 100644 --- a/input/device.c +++ b/input/device.c @@ -275,8 +275,9 @@ static gboolean rfcomm_io_cb(GIOChannel *chan, GIOCondition cond, gpointer data) struct fake_input *fake = data; const char *ok = "\r\nOK\r\n"; char buf[BUF_SIZE]; - gsize bread = 0, bwritten; + ssize_t bread = 0, bwritten; uint16_t key; + int fd; if (cond & G_IO_NVAL) return FALSE; @@ -286,16 +287,19 @@ static gboolean rfcomm_io_cb(GIOChannel *chan, GIOCondition cond, gpointer data) goto failed; } + fd = g_io_channel_unix_get_fd(chan); + memset(buf, 0, BUF_SIZE); - if (g_io_channel_read(chan, buf, sizeof(buf) - 1, - &bread) != G_IO_ERROR_NONE) { + bread = read(fd, buf, sizeof(buf) - 1); + if (bread < 0) { error("IO Channel read error"); goto failed; } DBG("Received: %s", buf); - if (g_io_channel_write(chan, ok, 6, &bwritten) != G_IO_ERROR_NONE) { + bwritten = write(fd, ok, 6); + if (bwritten < 0) { error("IO Channel write error"); goto failed; } diff --git a/input/fakehid.c b/input/fakehid.c index ab10f9cff..eebca0565 100644 --- a/input/fakehid.c +++ b/input/fakehid.c @@ -214,8 +214,9 @@ static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond, struct fake_input *fake = data; struct uinput_event event; unsigned int key, value = 0; - gsize size; + ssize_t size; char buff[50]; + int fd; if (cond & G_IO_NVAL) return FALSE; @@ -225,10 +226,11 @@ static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond, goto failed; } - memset(buff, 0, sizeof(buff)); + fd = g_io_channel_unix_get_fd(chan); - if (g_io_channel_read(chan, buff, sizeof(buff), &size) != - G_IO_ERROR_NONE) { + memset(buff, 0, sizeof(buff)); + size = read(fd, buff, sizeof(buff)); + if (size < 0) { error("IO Channel read error"); goto failed; } |