fix bin2hex bug. lowercase = uppercase | 0x20, not | 0x10!
authorDenis Vlasenko <vda.linux@googlemail.com>
Fri, 26 Jan 2007 23:31:05 +0000 (23:31 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Fri, 26 Jan 2007 23:31:05 +0000 (23:31 -0000)
include/libbb.h
libbb/xfuncs.c

index d2da056f75980b2b11270616db0348b3bb322747..8b98423446e46f9fa1297975fde9cbee593d593f 100644 (file)
@@ -739,7 +739,7 @@ extern const char bb_msg_standard_input[];
 extern const char bb_msg_standard_output[];
 
 extern const char bb_str_default[];
-/* NB: (bb_hexdigits_upcase[i] | 0x10) -> lowercase hex digit */
+/* NB: (bb_hexdigits_upcase[i] | 0x20) -> lowercase hex digit */
 extern const char bb_hexdigits_upcase[];
 
 extern const char bb_path_mtab_file[];
index f6b904f78f807747ef102c54979058268a26334b..4d85b11818e66563bd5ce9ba08f59be331368d1d 100644 (file)
@@ -343,8 +343,8 @@ char *bin2hex(char *p, const char *cp, int count)
        while (count) {
                unsigned char c = *cp++;
                /* put lowercase hex digits */
-               *p++ = 0x10 | bb_hexdigits_upcase[c >> 4];
-               *p++ = 0x10 | bb_hexdigits_upcase[c & 0xf];
+               *p++ = 0x20 | bb_hexdigits_upcase[c >> 4];
+               *p++ = 0x20 | bb_hexdigits_upcase[c & 0xf];
                count--;
        }
        return p;