Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 4 insertions, 2 deletions
-rw-r--r--ui-tree.c6
diff --git a/ui-tree.c b/ui-tree.c
index 6a16c21..2447fec 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -65,12 +65,12 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
static void print_binary_buffer(char *buf, unsigned long size)
{
- unsigned long ofs, idx;
+ unsigned long ofs, idx, maxofs = 32768 /* up to 1 MiB */;
static char ascii[ROWLEN + 1];
html("<table summary='blob content' class='bin-blob'>\n");
html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>");
- for (ofs = 0; ofs < size; ofs += ROWLEN, buf += ROWLEN) {
+ for (ofs = 0; ofs < size && ofs < maxofs; ofs += ROWLEN, buf += ROWLEN) {
htmlf("<tr><td class='right'>%04lx</td><td class='hex'>", ofs);
for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++)
htmlf("%*s%02x",
@@ -83,6 +83,8 @@ static void print_binary_buffer(char *buf, unsigned long size)
html_txt(ascii);
html("</td></tr>\n");
}
+ if (size > maxofs)
+ html("<tr><td>...</td><td>...</td><td></td></tr>\n");
html("</table>\n");
}