diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-07-20 17:31:30 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-07-21 10:32:41 +0100 |
commit | 95a5befc2f8b359e72926f89cd661d063c2cf06c (patch) | |
tree | 6589dd6adba5d123145be8e25e29e1bd0a8e69aa /hw/scsi | |
parent | 02ffa034fb747f09a4f5658ed64871dcee4aaca2 (diff) |
Use qemu_tolower() and qemu_toupper(), not tolower() and toupper()
On NetBSD, where tolower() and toupper() are implemented using an
array lookup, the compiler warns if you pass a plain 'char'
to these functions:
gdbstub.c:914:13: warning: array subscript has type 'char'
This reflects the fact that toupper() and tolower() give
undefined behaviour if they are passed a value that isn't
a valid 'unsigned char' or EOF.
We have qemu_tolower() and qemu_toupper() to avoid this problem;
use them.
(The use in scsi-generic.c does not trigger the warning because
it passes a uint8_t; we switch it anyway, for consistency.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> for the s390 part.
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-id: 1500568290-7966-1-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/scsi-generic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index a55ff87c22..7e1cbab77e 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -406,7 +406,7 @@ static int read_naa_id(const uint8_t *p, uint64_t *p_wwn) } *p_wwn = 0; for (i = 8; i < 24; i++) { - char c = toupper(p[i]); + char c = qemu_toupper(p[i]); c -= (c >= '0' && c <= '9' ? '0' : 'A' - 10); *p_wwn = (*p_wwn << 4) | c; } |