From 95311a220e7107ec8b3012d67d5efef57313a274 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Sep 2009 11:08:42 -0700 Subject: Fix the problem with pidl generating invalid C for enums. According to the C standard an enum is guarenteed to be an (int), which means for 4 byte ints specifying a type of 0x80000000 is an invalid value. The Solaris compiler complains about this. Fix by adding an (int) cast in front of the value generation. Jeremy. --- pidl/lib/Parse/Pidl/Samba4/Header.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pidl') diff --git a/pidl/lib/Parse/Pidl/Samba4/Header.pm b/pidl/lib/Parse/Pidl/Samba4/Header.pm index 5315957946..bb497bb3a7 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -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--; -- cgit