Fix the problem with pidl generating invalid C for enums. According
[ira/wip.git] / pidl / lib / Parse / Pidl / Samba4 / Header.pm
index 53159579463368b518ce4ded67e1d9a9d918e8e0..bb497bb3a77471e331bdf91128efec86b26bae3e 100644 (file)
@@ -120,10 +120,18 @@ sub HeaderEnum($$;$)
                pidl " {\n";
                $tab_depth++;
                foreach my $e (@{$enum->{ELEMENTS}}) {
+                       my @enum_els = ();
                        unless ($first) { pidl ",\n"; }
                        $first = 0;
                        pidl tabs();
-                       pidl $e;
+                       @enum_els = split(/=/, $e);
+                       if (@enum_els == 2) {
+                               pidl $enum_els[0];
+                               pidl "=(int)";
+                               pidl $enum_els[1];
+                       } else {
+                               pidl $e;
+                       }
                }
                pidl "\n";
                $tab_depth--;