diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-11-05 09:44:01 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-11-07 16:50:05 +0200 |
commit | d76dce9e83ddc033b53d2603b4f4d9f73de1f112 (patch) | |
tree | 09f8202e531c7bba62a1e50210bcefac937277f3 /programs | |
parent | 74e284c7f1bd3377d27250755b3c2fad5a2aa5c8 (diff) | |
download | gvfs-d76dce9e83ddc033b53d2603b4f4d9f73de1f112.tar.gz |
programs: Escape string properly
Use an unsigned char to avoid implementation-defined behavior of a right
shift.
Shift by 4 rather than 8 to get the second half of a byte.
https://bugzilla.gnome.org/show_bug.cgi?id=711457
Diffstat (limited to 'programs')
-rw-r--r-- | programs/gvfs-info.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/programs/gvfs-info.c b/programs/gvfs-info.c index a42cde6d..a685208a 100644 --- a/programs/gvfs-info.c +++ b/programs/gvfs-info.c @@ -77,7 +77,7 @@ escape_string (const char *in) { GString *str; static char *hex_digits = "0123456789abcdef"; - char c; + unsigned char c; str = g_string_new (""); @@ -89,7 +89,7 @@ escape_string (const char *in) else { g_string_append (str, "\\x"); - g_string_append_c (str, hex_digits[(c >> 8) & 0xf]); + g_string_append_c (str, hex_digits[(c >> 4) & 0xf]); g_string_append_c (str, hex_digits[c & 0xf]); } } |