aboutsummaryrefslogtreecommitdiff
path: root/ber/new/dump.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-09-26 00:29:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-09-26 00:29:02 +0200
commit108e965580cbbae0d5029b7cc2ca592bd955883e (patch)
treeb031c9ab06f9913f2bb74f5e463ca1f0eea28092 /ber/new/dump.go
parent4083fc0161bcf1a669ad0af50145ed92c8b776ce (diff)
Add len test
Diffstat (limited to 'ber/new/dump.go')
-rw-r--r--ber/new/dump.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/ber/new/dump.go b/ber/new/dump.go
index 42ca123..787ba11 100644
--- a/ber/new/dump.go
+++ b/ber/new/dump.go
@@ -8,19 +8,13 @@ func Dump(b []byte) string {
return newState(b).dump(0)
}
-func (s *state) dump(ident int) string {
+func (s *state) dump(indent int) string {
if s.Len() == 0 {
return ""
}
- fmt.Printf("%x %x\n", s.Len(), s.Bytes())
+ fmt.Println(s.Len(), s.Bytes())
h := s.ident()
- fmt.Printf("%*s", 2*ident, "")
- fmt.Println(h)
- for s.Len() > 0 {
- if h.Kind == kindConstructed {
- return s.subState().dump(ident + 1)
- }
- s.next()
- }
- return ""
+ fmt.Printf("%*s%v\n", 2*indent, "", h)
+ s.subState().dump(indent + 1)
+ return s.dump(indent)
}