Author: jelmer
Date: 2006-11-04 02:51:03 +0000 (Sat, 04 Nov 2006)
New Revision: 19546

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19546

Log:
fix number of bytes pushed when using switch_type() set to enum types.
die() on invalid used of enum_type_fn()

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm  
2006-11-04 01:53:29 UTC (rev 19545)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm  
2006-11-04 02:51:03 UTC (rev 19546)
@@ -1694,7 +1694,7 @@
        pidl "int level;";
        if (defined($switch_type)) {
                if (Parse::Pidl::Typelist::typeIs($switch_type, "ENUM")) {
-                       $switch_type = 
Parse::Pidl::Typelist::enum_type_fn(getType($switch_type));
+                       $switch_type = 
Parse::Pidl::Typelist::enum_type_fn(getType($switch_type)->{DATA});
                }
                pidl mapType($switch_type) . " _level;";
        }

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm   2006-11-04 
01:53:29 UTC (rev 19545)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm   2006-11-04 
02:51:03 UTC (rev 19546)
@@ -153,6 +153,7 @@
 sub enum_type_fn($)
 {
        my $enum = shift;
+       $enum->{TYPE} eq "ENUM" or die("not an enum");
        if (has_property($enum->{PARENT}, "enum8bit")) {
                return "uint8";
        } elsif (has_property($enum->{PARENT}, "v1_enum")) {

Reply via email to