>From a657889d8fa59e90f340b51e57bdb9843614957e Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Tue, 1 Oct 2013 12:10:18 -0700 Subject: [PATCH 11/13] pidl-wireshark: SWITCH_TYPE is not always defined use switch_dt->{DATA}->{NAME} when not Signed-off-by: Matthieu Patou --- pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 92a3806..96045b3 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -444,7 +444,13 @@ sub Element($$$$$) if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; + if (defined $e->{SWITCH_TYPE}) { + $switch_type = "g$e->{SWITCH_TYPE}"; + } else { + $switch_type = "g$switch_dt->{DATA}->{NAME}"; + } + } else { + $switch_type = "guint32"; } $moreparam = ", $switch_type *".$name; $param = $name; @@ -661,7 +667,11 @@ sub Struct($$$$) if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; + if (defined $e->{SWITCH_TYPE}) { + $switch_type = "g$e->{SWITCH_TYPE}"; + } else { + $switch_type = "g$switch_dt->{DATA}->{NAME}"; + } } push @$vars, "$switch_type $v;"; @@ -753,8 +763,13 @@ sub Union($$$$) $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); $switch_dissect = "dissect_ndr_" .Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; - $switch_dissect = "dissect_ndr_$e->{SWITCH_TYPE}"; + if (defined $e->{SWITCH_TYPE}) { + $switch_type = "g$e->{SWITCH_TYPE}"; + $switch_dissect = "dissect_ndr_$e->{SWITCH_TYPE}"; + } else { + $switch_type = "g$switch_dt->{DATA}->{NAME}"; + $switch_dissect = "dissect_ndr_$switch_dt->{DATA}->{NAME}"; + } } $self->pidl_fn_start($dissectorname); -- 1.8.1.2