|
diff --git a/ui-tree.c b/ui-tree.c index a37a4e5..c6159ec 100644 --- a/ ui-tree.c+++ b/ ui-tree.c |
|
@@ -39,2 +39,4 @@ static void print_text_buffer(char *buf, unsigned long size) |
39 | |
39 | |
| |
40 | #define ROWLEN 32 |
| |
41 | |
40 | static void print_binary_buffer(char *buf, unsigned long size) |
42 | static void print_binary_buffer(char *buf, unsigned long size) |
@@ -42,2 +44,3 @@ static void print_binary_buffer(char *buf, unsigned long size) |
42 | unsigned long ofs, idx; |
44 | unsigned long ofs, idx; |
| |
45 | static char ascii[ROWLEN + 1]; |
43 | |
46 | |
@@ -45,5 +48,5 @@ static void print_binary_buffer(char *buf, unsigned long size) |
45 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); |
48 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); |
46 | for (ofs = 0; ofs < size; ofs += 32, buf += 32) { |
49 | for (ofs = 0; ofs < size; ofs += ROWLEN, buf += ROWLEN) { |
47 | htmlf("<tr><td class='right'>%04x</td><td class='hex'>", ofs); |
50 | htmlf("<tr><td class='right'>%04x</td><td class='hex'>", ofs); |
48 | for (idx = 0; idx < 32 && ofs + idx < size; idx++) |
51 | for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++) |
49 | htmlf("%*s%02x", |
52 | htmlf("%*s%02x", |
@@ -52,4 +55,6 @@ static void print_binary_buffer(char *buf, unsigned long size) |
52 | html(" </td><td class='hex'>"); |
55 | html(" </td><td class='hex'>"); |
53 | for (idx = 0; idx < 32 && ofs + idx < size; idx++) |
56 | for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++) |
54 | htmlf("%c", isgraph(buf[idx]) ? buf[idx] : '.'); |
57 | ascii[idx] = isgraph(buf[idx]) ? buf[idx] : '.'; |
| |
58 | ascii[idx] = '\0'; |
| |
59 | html_txt(ascii); |
55 | html("</td></tr>\n"); |
60 | html("</td></tr>\n"); |
|