From d02429b9a7fb8bb01961a51c2446eb1dce048c78 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 21 May 2012 14:49:08 +0200 Subject: [PATCH] Change APDU dump printing to avoid long leading blanks For levels 16 or larger the level is shown and the indentation is truncated but recursed with modula 8. This makes it still reasonable easy to read - even for nested BER dumps. --- src/odr_util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/odr_util.c b/src/odr_util.c index 22a6691..644c3c3 100644 --- a/src/odr_util.c +++ b/src/odr_util.c @@ -17,10 +17,13 @@ void odr_prname(ODR o, const char *name) { - if (name) - odr_printf(o, "%*s%s ", o->op->indent*4, "", name); + if (o->op->indent < 16) + odr_printf(o, "%*s", o->op->indent * 2, ""); else - odr_printf(o, "%*s", o->op->indent*4, ""); + odr_printf(o, "level=%-7d%*s", o->op->indent, + 2 * (o->op->indent % 8) , ""); + if (name) + odr_printf(o, "%s ", name); } int odp_more_chunks(ODR o, const unsigned char *base, int len) -- 1.7.10.4