From patchwork Fri Oct 12 00:22:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 982797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42WTDq4Wmbz9s3Z for ; Fri, 12 Oct 2018 11:27:23 +1100 (AEDT) Received: from localhost ([::1]:37709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAlIX-0000St-5F for incoming@patchwork.ozlabs.org; Thu, 11 Oct 2018 20:27:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAlFG-0006X5-Ld for qemu-devel@nongnu.org; Thu, 11 Oct 2018 20:23:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAlFF-0006iB-PQ for qemu-devel@nongnu.org; Thu, 11 Oct 2018 20:23:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33726) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gAlFF-0006hs-HV for qemu-devel@nongnu.org; Thu, 11 Oct 2018 20:23:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E057D30BF447 for ; Fri, 12 Oct 2018 00:23:56 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C09616055B; Fri, 12 Oct 2018 00:23:48 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Paolo Bonzini , Prasad J Pandit Date: Fri, 12 Oct 2018 02:22:15 +0200 Message-Id: <20181012002217.2864-10-philmd@redhat.com> In-Reply-To: <20181012002217.2864-1-philmd@redhat.com> References: <20181012002217.2864-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 12 Oct 2018 00:23:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 09/11] chardev: Let qemu_chr_fe_* use unsigned type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- chardev/char-fe.c | 8 ++++---- chardev/char-win-stdio.c | 2 +- chardev/char-win.c | 2 +- include/chardev/char-fe.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chardev/char-fe.c b/chardev/char-fe.c index a8931f7afd..b732f6566b 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -31,7 +31,7 @@ #include "chardev/char-io.h" #include "chardev/char-mux.h" -int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len) +size_t qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, size_t len) { Chardev *s = be->chr; @@ -42,7 +42,7 @@ int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len) return qemu_chr_write(s, buf, len, false); } -int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len) +size_t qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, size_t len) { Chardev *s = be->chr; @@ -53,10 +53,10 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len) return qemu_chr_write(s, buf, len, true); } -int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len) +size_t qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, size_t len) { Chardev *s = be->chr; - int offset = 0; + size_t offset = 0; int res; if (!s || !CHARDEV_GET_CLASS(s)->chr_sync_read) { diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c index efcf7827eb..6b1a97144b 100644 --- a/chardev/char-win-stdio.c +++ b/chardev/char-win-stdio.c @@ -221,7 +221,7 @@ static void char_win_stdio_finalize(Object *obj) } } -static int win_stdio_write(Chardev *chr, const uint8_t *buf, int len) +static size_t win_stdio_write(Chardev *chr, const uint8_t *buf, size_t len) { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); DWORD dwSize; diff --git a/chardev/char-win.c b/chardev/char-win.c index 05518e0958..7ea7d0a371 100644 --- a/chardev/char-win.c +++ b/chardev/char-win.c @@ -152,7 +152,7 @@ int win_chr_pipe_poll(void *opaque) } /* Called with chr_write_lock held. */ -static int win_chr_write(Chardev *chr, const uint8_t *buf, int len1) +static size_t win_chr_write(Chardev *chr, const uint8_t *buf, size_t len1) { WinChardev *s = WIN_CHARDEV(chr); DWORD len, ret, size, err; diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h index 46c997d352..2f95c890d8 100644 --- a/include/chardev/char-fe.h +++ b/include/chardev/char-fe.h @@ -184,7 +184,7 @@ guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond, * * Returns: the number of bytes consumed (0 if no associated Chardev) */ -int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len); +size_t qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, size_t len); /** * qemu_chr_fe_write_all: @@ -198,7 +198,7 @@ int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len); * * Returns: the number of bytes consumed (0 if no associated Chardev) */ -int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len); +size_t qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, size_t len); /** * qemu_chr_fe_read_all: @@ -209,7 +209,7 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len); * * Returns: the number of bytes read (0 if no associated Chardev) */ -int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len); +size_t qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, size_t len); /** * qemu_chr_fe_ioctl: