1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-23 20:23:50 +03:00

r14691: Fix printing elements with represent_as set

This commit is contained in:
Jelmer Vernooij
2006-03-24 14:13:02 +00:00
committed by Gerald (Jerry) Carter
parent 31e847a084
commit f4428db2f9
2 changed files with 14 additions and 7 deletions

View File

@@ -917,6 +917,10 @@ sub ValidElement($)
fatal($e, el_name($e) . " : represent_as() and transmit_as() can not be used on the same element"); 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"))) { 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"); fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
} }

View File

@@ -729,9 +729,15 @@ sub ParseElementPrint($$$)
{ {
my($e,$var_name,$env) = @_; my($e,$var_name,$env) = @_;
$var_name = append_prefix($e, $var_name);
return if (has_property($e, "noprint")); 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")) { if (my $value = has_property($e, "value")) {
$var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env) . ":$var_name"; $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env) . ":$var_name";
} }
@@ -1411,18 +1417,15 @@ sub ParseStructPrint($$)
EnvSubstituteValue($env, $struct); EnvSubstituteValue($env, $struct);
foreach my $e (@{$struct->{ELEMENTS}}) { DeclareArrayVariables($_) foreach (@{$struct->{ELEMENTS}});
DeclareArrayVariables($e);
}
pidl "ndr_print_struct(ndr, name, \"$name\");"; pidl "ndr_print_struct(ndr, name, \"$name\");";
start_flags($struct); start_flags($struct);
pidl "ndr->depth++;"; pidl "ndr->depth++;";
foreach my $e (@{$struct->{ELEMENTS}}) {
ParseElementPrint($e, "r->$e->{NAME}", $env); ParseElementPrint($_, "r->$_->{NAME}", $env) foreach (@{$struct->{ELEMENTS}});
}
pidl "ndr->depth--;"; pidl "ndr->depth--;";
end_flags($struct); end_flags($struct);