Fix the problem with pidl generating invalid C for enums. According
[ira/wip.git] / pidl / lib / Parse / Pidl / Samba4 / Header.pm
index 0411466c8251bf55f7adbe97113347ac97d62390..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--;
@@ -407,6 +415,9 @@ sub Parse($)
        }
        pidl "#include <stdint.h>\n";
        pidl "\n";
+       # FIXME: Include this only if NTSTATUS was actually used
+       pidl choose_header("libcli/util/ntstatus.h", "core/ntstatus.h") . "\n";
+       pidl "\n";
 
        foreach (@{$ndr}) {
                ($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_);