aboutsummaryrefslogtreecommitdiff
path: root/ber/dump.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-07 18:04:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-07 18:04:02 +0200
commit88134e6da1628c7e73ced45e237e156985010e84 (patch)
tree3cfd141d4c8a7ccbae47538ccc30ee93665a65e5 /ber/dump.go
parent66ba61dbed05d27cd6cb632364d568f5d7eb4063 (diff)
Simplify
Diffstat (limited to 'ber/dump.go')
-rw-r--r--ber/dump.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/ber/dump.go b/ber/dump.go
index d207366..75d7f52 100644
--- a/ber/dump.go
+++ b/ber/dump.go
@@ -8,7 +8,10 @@ func Dump(b []byte) string {
return newState(b).dump(0)
}
-func (s *state) universal(h Header) string {
+func (s *state) primitive(h Header) string {
+ if h.Class != classUniversal {
+ return fmt.Sprint(s.next())
+ }
switch h.Tag {
case tagInteger, tagEnumerated:
return fmt.Sprint(s.unmarshalInt())
@@ -34,12 +37,7 @@ func (s *state) dump(indent int) (ret string) {
ret += fmt.Sprintf("%3d: %*s", s.Len(), 2*indent, "")
switch h.Kind {
case kindPrimitive:
- switch h.Class {
- case classUniversal:
- ret += fmt.Sprintln(h, "=", s.universal(h))
- default:
- ret += fmt.Sprintln(h, "=", s.next())
- }
+ ret += fmt.Sprintln(h, "=", s.primitive(h))
case kindConstructed:
ret += fmt.Sprintln(h, "→")
ret += s.subState().dump(indent + 1)