diff options
author | Peter Maydell | 2017-07-20 18:31:30 +0200 |
---|---|---|
committer | Peter Maydell | 2017-07-21 11:32:41 +0200 |
commit | 95a5befc2f8b359e72926f89cd661d063c2cf06c (patch) | |
tree | 6589dd6adba5d123145be8e25e29e1bd0a8e69aa /hw/s390x/s390-virtio-ccw.c | |
parent | util/oslib-posix.c: Avoid warning on NetBSD (diff) | |
download | qemu-95a5befc2f8b359e72926f89cd661d063c2cf06c.tar.gz qemu-95a5befc2f8b359e72926f89cd661d063c2cf06c.tar.xz qemu-95a5befc2f8b359e72926f89cd661d063c2cf06c.zip |
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/s390x/s390-virtio-ccw.c')
-rw-r--r-- | hw/s390x/s390-virtio-ccw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index ce3921e4de..1c7af39ce6 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -318,7 +318,7 @@ static void machine_set_loadparm(Object *obj, const char *val, Error **errp) int i; for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) { - uint8_t c = toupper(val[i]); /* mimic HMC */ + uint8_t c = qemu_toupper(val[i]); /* mimic HMC */ if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || (c == ' ')) { |