[gvfs] programs: Escape string properly



commit d76dce9e83ddc033b53d2603b4f4d9f73de1f112
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Tue Nov 5 09:44:01 2013 +0200

    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

 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 a42cde6..a685208 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]);
        }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]