projects
/
platform
/
upstream
/
dbus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e5310ab
)
Bug 21646 - Fix a signed char comparison
author
Colin Walters
<walters@verbum.org>
Fri, 10 Jul 2009 23:26:52 +0000
(19:26 -0400)
committer
Colin Walters
<walters@verbum.org>
Fri, 10 Jul 2009 23:26:52 +0000
(19:26 -0400)
Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com>
Explicitly cast to unsigned char before we do comparisons.
dbus/dbus-sysdeps-util-unix.c
patch
|
blob
|
history
diff --git
a/dbus/dbus-sysdeps-util-unix.c
b/dbus/dbus-sysdeps-util-unix.c
index
f1e2033
..
07efdfe
100644
(file)
--- a/
dbus/dbus-sysdeps-util-unix.c
+++ b/
dbus/dbus-sysdeps-util-unix.c
@@
-1149,10
+1149,13
@@
string_squash_nonprintable (DBusString *str)
len = _dbus_string_get_length (str);
for (i = 0; i < len; i++)
- if (buf[i] == '\0')
- buf[i] = ' ';
- else if (buf[i] < 0x20 || buf[i] > 127)
- buf[i] = '?';
+ {
+ unsigned char c = (unsigned char) buf[i];
+ if (c == '\0')
+ c = ' ';
+ else if (c < 0x20 || c > 127)
+ c = '?';
+ }
}
/**