[v2,05/11] chardev: Let chr_sync_read() use unsigned type

Message ID 20181012002217.2864-6-philmd@redhat.com
State New
Headers show
Series
  • chardev: Convert IO handlers to use unsigned type
Related show

Commit Message

Philippe Mathieu-Daudé Oct. 12, 2018, 12:22 a.m.
Note than tcp_chr_recv() already use size_t.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 chardev/char-socket.c  | 2 +-
 include/chardev/char.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 76cc3c48b0..7e627b243e 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -494,7 +494,7 @@  static gboolean tcp_chr_hup(QIOChannel *channel,
     return G_SOURCE_REMOVE;
 }
 
-static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
+static size_t tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, size_t len)
 {
     SocketChardev *s = SOCKET_CHARDEV(chr);
     int size;
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 7becd8c80c..ef4509bfa3 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -251,7 +251,7 @@  typedef struct ChardevClass {
                  bool *be_opened, Error **errp);
 
     int (*chr_write)(Chardev *s, const uint8_t *buf, int len);
-    int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len);
+    size_t (*chr_sync_read)(Chardev *s, const uint8_t *buf, size_t len);
     GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond);
     void (*chr_update_read_handler)(Chardev *s);
     int (*chr_ioctl)(Chardev *s, int cmd, void *arg);