[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qe
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace() |
Date: |
Mon, 31 Jan 2011 16:28:49 +0100 |
From: Jes Sorensen <address@hidden>
isspace() behavior is undefined for signed char.
Bug pointed out by Eric Blake, thanks!
Signed-off-by: Jes Sorensen <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
cutils.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/cutils.c b/cutils.c
index 4d2e27c..a067cf4 100644
--- a/cutils.c
+++ b/cutils.c
@@ -294,7 +294,8 @@ int fcntl_setfl(int fd, int flag)
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;
@@ -314,7 +315,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;
@@ -361,7 +362,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.2.3
- [Qemu-devel] [PULL 00/28] Block patches, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 04/28] strtosz(): Use suffix macros in switch() statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 02/28] strtosz() use qemu_toupper() to simplify switch statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 07/28] virtio-blk: tell the guest about size changes, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 03/28] strtosz(): Fix name confusion in use of modf(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 12/28] sheepdog: support creating images on remote hosts, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 05/28] block: add block_resize monitor command, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 08/28] virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 10/28] ahci: Fix cpu_physical_memory_unmap() argument ordering, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 18/28] qcow2-refcount: remove write-only variables, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 15/28] qed: Images with backing file do not require QED_F_NEED_CHECK, Kevin Wolf, 2011/01/31