summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-24 14:13:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:09 -0500
commit8973ac8a393f9df64ea37de79397161815e1ce2c (patch)
tree119d25f3ea3516cdad9dd9c91538964fdd81ac3b /source4
parent5d9ea9170d2e0fd816285bd460de05f800ce26e8 (diff)
downloadsamba-8973ac8a393f9df64ea37de79397161815e1ce2c.tar.gz
samba-8973ac8a393f9df64ea37de79397161815e1ce2c.tar.bz2
samba-8973ac8a393f9df64ea37de79397161815e1ce2c.zip
r14691: Fix printing elements with represent_as set
(This used to be commit f4428db2f922e921c54cdb0849eaad5018cb5a01)
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm17
2 files changed, 14 insertions, 7 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 1d5059bfb5..c8a9717889 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -917,6 +917,10 @@ sub ValidElement($)
fatal($e, el_name($e) . " : represent_as() and transmit_as() can not be used on the same element");
}
+ if (has_property($e, "represent_as") and has_property($e, "value")) {
+ fatal($e, el_name($e) . " : represent_as() and value() can not be used on the same element");
+ }
+
if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index d9666a20fe..e3058665f2 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -729,9 +729,15 @@ sub ParseElementPrint($$$)
{
my($e,$var_name,$env) = @_;
- $var_name = append_prefix($e, $var_name);
return if (has_property($e, "noprint"));
+ if ($e->{REPRESENTATION_TYPE}) {
+ pidl "ndr_print_$e->{REPRESENTATION_TYPE}(ndr, \"$e->{NAME}\", $var_name);";
+ return;
+ }
+
+ $var_name = append_prefix($e, $var_name);
+
if (my $value = has_property($e, "value")) {
$var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env) . ":$var_name";
}
@@ -1411,18 +1417,15 @@ sub ParseStructPrint($$)
EnvSubstituteValue($env, $struct);
- foreach my $e (@{$struct->{ELEMENTS}}) {
- DeclareArrayVariables($e);
- }
+ DeclareArrayVariables($_) foreach (@{$struct->{ELEMENTS}});
pidl "ndr_print_struct(ndr, name, \"$name\");";
start_flags($struct);
pidl "ndr->depth++;";
- foreach my $e (@{$struct->{ELEMENTS}}) {
- ParseElementPrint($e, "r->$e->{NAME}", $env);
- }
+
+ ParseElementPrint($_, "r->$_->{NAME}", $env) foreach (@{$struct->{ELEMENTS}});
pidl "ndr->depth--;";
end_flags($struct);