diff utils.c @ 5883:fd37c39041cd libavformat

Add a lowercase parameter to ff_data_to_hex
author mstorsjo
date Thu, 25 Mar 2010 07:13:20 +0000
parents 731cb836bca6
children 416041cfd600
line wrap: on
line diff
--- a/utils.c	Wed Mar 24 23:06:58 2010 +0000
+++ b/utils.c	Thu Mar 25 07:13:20 2010 +0000
@@ -3464,13 +3464,18 @@
     }
 }
 
-char *ff_data_to_hex(char *buff, const uint8_t *src, int s)
+char *ff_data_to_hex(char *buff, const uint8_t *src, int s, int lowercase)
 {
     int i;
-    static const char hex_table[16] = { '0', '1', '2', '3',
+    static const char hex_table_uc[16] = { '0', '1', '2', '3',
                                         '4', '5', '6', '7',
                                         '8', '9', 'A', 'B',
                                         'C', 'D', 'E', 'F' };
+    static const char hex_table_lc[16] = { '0', '1', '2', '3',
+                                           '4', '5', '6', '7',
+                                           '8', '9', 'a', 'b',
+                                           'c', 'd', 'e', 'f' };
+    const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
 
     for(i = 0; i < s; i++) {
         buff[i * 2]     = hex_table[src[i] >> 4];