Received: from eggs.gnu.org ([2001:4830:134:3::10]:54478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCOif-0005s0-KC for qemu-devel@nongnu.org; Mon, 13 Jun 2016 06:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCOid-0007W3-CU for qemu-devel@nongnu.org; Mon, 13 Jun 2016 06:03:44 -0400 References: <1465805418-15906-1-git-send-email-thuth@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 13 Jun 2016 12:03:38 +0200 MIME-Version: 1.0 In-Reply-To: <1465805418-15906-1-git-send-email-thuth@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] scsi-disk: Use (unsigned long) typecasts when using "%lu" format string List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org On 13/06/2016 10:10, Thomas Huth wrote: > Some source code analyzers like cppcheck spill out a warning if > the sign of the argument does not match the format string. > > Ticket: https://bugs.launchpad.net/qemu/+bug/1589564 > Signed-off-by: Thomas Huth > --- > hw/scsi/scsi-disk.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c > index 1881969..36f8a85 100644 > --- a/hw/scsi/scsi-disk.c > +++ b/hw/scsi/scsi-disk.c > @@ -2060,13 +2060,13 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf) > } > break; > case MODE_SELECT: > - DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer); > + DPRINTF("Mode Select(6) (len %lu)\n", (unsigned long)r->req.cmd.xfer); > break; > case MODE_SELECT_10: > - DPRINTF("Mode Select(10) (len %lu)\n", (long)r->req.cmd.xfer); > + DPRINTF("Mode Select(10) (len %lu)\n", (unsigned long)r->req.cmd.xfer); > break; > case UNMAP: > - DPRINTF("Unmap (len %lu)\n", (long)r->req.cmd.xfer); > + DPRINTF("Unmap (len %lu)\n", (unsigned long)r->req.cmd.xfer); > break; > case VERIFY_10: > case VERIFY_12: > @@ -2080,7 +2080,7 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf) > case WRITE_SAME_16: > DPRINTF("WRITE SAME %d (len %lu)\n", > req->cmd.buf[0] == WRITE_SAME_10 ? 10 : 16, > - (long)r->req.cmd.xfer); > + (unsigned long)r->req.cmd.xfer); > break; > default: > DPRINTF("Unknown SCSI command (%2.2x=%s)\n", buf[0], > Queued, thanks. Paolo