From aa24d1f2121d5633c8f48d862e637a201a2c8810 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 31 Jan 2011 12:23:26 -0200 Subject: [PATCH 32/37] strtosz(): use unsigned char and switch to qemu_isspace() RH-Author: Jes Sorensen Message-id: <1296476610-28514-23-git-send-email-Jes.Sorensen@redhat.com> Patchwork-id: 17317 O-Subject: [PATCH 22/26] strtosz(): use unsigned char and switch to qemu_isspace() Bugzilla: 637701 RH-Acked-by: Alex Williamson RH-Acked-by: Marcelo Tosatti RH-Acked-by: Kevin Wolf From: Jes Sorensen isspace() behavior is undefined for signed char. Bug pointed out by Eric Blake, thanks! Signed-off-by: Jes Sorensen Signed-off-by: Kevin Wolf (cherry picked from block branch) --- cutils.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Signed-off-by: Luiz Capitulino --- cutils.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cutils.c b/cutils.c index 3217b1d..ee5bcc8 100644 --- a/cutils.c +++ b/cutils.c @@ -282,7 +282,8 @@ void qemu_iovec_memset(QEMUIOVector *qiov, int c, size_t count) int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) { int64_t retval = -1; - char *endptr, c, d; + char *endptr; + unsigned char c, d; int mul_required = 0; double val, mul, integral, fraction; @@ -302,7 +303,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) */ c = *endptr; d = c; - if (isspace(c) || c == '\0' || c == ',') { + if (qemu_isspace(c) || c == '\0' || c == ',') { c = 0; if (default_suffix) { d = default_suffix; @@ -349,7 +350,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) */ if (c != 0) { endptr++; - if (!isspace(*endptr) && *endptr != ',' && *endptr != 0) { + if (!qemu_isspace(*endptr) && *endptr != ',' && *endptr != 0) { goto fail; } } -- 1.7.4.rc1.16.gd2f15e