Skip to content

Commit

Permalink
Fixes: #47 2nd - Debug output using print instead of printf
Browse files Browse the repository at this point in the history
Chris Ridd patch to improve the asn_dump
  • Loading branch information
timlegge committed Aug 2, 2023
1 parent 86c7a2f commit 1d2fbae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/Convert/ASN1/Debug.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,19 @@ my %type = (
11 SET
02 INTEGER
03 BIT STRING
C0 [PRIVATE %d]
04 STRING
40 [APPLICATION %d]
05 NULL
06 OBJECT ID
)
)
);

my %classes = (
split(/[\t\n]\s*/,
q(C0 [PRIVATE %d]
40 [APPLICATION %d]
80 [CONTEXT %d]
00 [UNIVERSAL %d]
)
)
);
Expand Down Expand Up @@ -93,9 +100,8 @@ sub asn_dump {
printf $fmt. " %4d: %s",$start,$len,$indent;

my $label = $type{sprintf("%02X",$tag & ~0x20)}
|| $type{sprintf("%02X",$tag & 0xC0)}
|| "[UNIVERSAL %d]";
printf "$label: $tnum";
|| sprintf($classes{sprintf("%02X",$tag & 0xC0)}, $tag & ~0xE0);
print "$label: $tnum";

if ($tag & ASN_CONSTRUCTOR) {
print " {\n";
Expand Down

0 comments on commit 1d2fbae

Please sign in to comment.