[gvfs/gnome-3-8] programs: Escape string properly



commit cfa747bc5733e46ecfa45b55698dc5ec3b70263c
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 6fddc4e..5d8b6cc 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]