summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-21 11:32:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:42 -0500
commita074602362acd881e3e7ac3b987df93fee3cb9f8 (patch)
tree997da2e212fea4b741c6c68c92cd6ce31e0bf571
parent613d1c1fb9d86120c062ab640b69842bd246187c (diff)
downloadsamba-a074602362acd881e3e7ac3b987df93fee3cb9f8.tar.gz
samba-a074602362acd881e3e7ac3b987df93fee3cb9f8.tar.bz2
samba-a074602362acd881e3e7ac3b987df93fee3cb9f8.zip
r21487: Fix warning when using anonymous types, initial work on nested type support in ejs.
(This used to be commit a396c5de12cd958fe0457fa5372e539132ad7ed9)
-rw-r--r--source4/librpc/idl/echo.idl2
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm34
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm3
3 files changed, 32 insertions, 7 deletions
diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl
index fa030be761..5b5d2ed326 100644
--- a/source4/librpc/idl/echo.idl
+++ b/source4/librpc/idl/echo.idl
@@ -99,7 +99,7 @@ interface rpcecho
} echo_Enum1_32;
typedef struct {
- echo_Enum1 e1;
+ enum { foo=1, bar=2} e1;
echo_Enum1_32 e2;
} echo_Enum2;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 13a8460a81..0d2f0fc8f2 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -157,7 +157,15 @@ sub EjsPullScalar($$$$$)
and (defined($pl) and $pl->{TYPE} eq "POINTER")) {
$var = get_pointer_to($var);
}
- pidl "NDR_CHECK(ejs_pull_$e->{TYPE}(ejs, v, $name, $var));";
+
+ my $t;
+ if (ref($e->{TYPE}) eq "HASH") {
+ $t = "$e->{TYPE}->{TYPE}_$e->{TYPE}->{NAME}";
+ } else {
+ $t = $e->{TYPE};
+ }
+
+ pidl "NDR_CHECK(ejs_pull_$t(ejs, v, $name, $var));";
}
###########################
@@ -449,7 +457,15 @@ sub EjsPushScalar($$$$$)
or (defined($pl) and $pl->{TYPE} eq "POINTER")) {
$var = get_pointer_to($var);
}
- pidl "NDR_CHECK(ejs_push_$e->{TYPE}(ejs, v, $name, $var));";
+
+ my $t;
+ if (ref($e->{TYPE}) eq "HASH") {
+ $t = "$e->{TYPE}->{TYPE}_$e->{TYPE}->{NAME}";
+ } else {
+ $t = $e->{TYPE};
+ }
+
+ pidl "NDR_CHECK(ejs_push_$t(ejs, v, $name, $var));";
}
###########################
@@ -877,11 +893,17 @@ sub NeededTypedef($$)
foreach (@{$t->{DATA}->{ELEMENTS}}) {
next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
- unless (defined($needed->{"pull_$_->{TYPE}"})) {
- $needed->{"pull_$_->{TYPE}"} = $needed->{"pull_$t->{NAME}"};
+ my $n;
+ if (ref($_->{TYPE}) eq "HASH") {
+ $n = "$_->{TYPE}->{TYPE}_$_->{TYPE}->{NAME}";
+ } else {
+ $n = $_->{TYPE};
+ }
+ unless (defined($needed->{"pull_$n"})) {
+ $needed->{"pull_$n"} = $needed->{"pull_$t->{NAME}"};
}
- unless (defined($needed->{"push_$_->{TYPE}"})) {
- $needed->{"push_$_->{TYPE}"} = $needed->{"push_$t->{NAME}"};
+ unless (defined($needed->{"push_$n"})) {
+ $needed->{"push_$n"} = $needed->{"push_$t->{NAME}"};
}
}
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 2ae4a3b17e..b6209d9f9a 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2651,6 +2651,9 @@ sub NeededElement($$$)
return if ($e->{TYPE} eq "EMPTY");
+ return if (ref($e->{TYPE}) eq "HASH" and
+ not defined($e->{TYPE}->{NAME}));
+
my ($t, $rt);
if (ref($e->{TYPE}) eq "HASH") {
$t = $e->{TYPE}->{TYPE}."_".$e->{TYPE}->{NAME};