diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-09 02:20:26 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-09 02:20:26 +0000 |
commit | 75a30ad8283c49bb426c087344e40ed09abe95fd (patch) | |
tree | ef456080e40ed037c710fc9db4f0ea536cd5aba6 /source4/build/pidl/parser.pm | |
parent | 30d45fc57c2269486567f7c207bc923a5b269a5b (diff) | |
download | samba-75a30ad8283c49bb426c087344e40ed09abe95fd.tar.gz samba-75a30ad8283c49bb426c087344e40ed09abe95fd.tar.bz2 samba-75a30ad8283c49bb426c087344e40ed09abe95fd.zip |
added support for arrays as function arguments and for unistr_noterm
(This used to be commit 7bb45a21aeb9ea653c86ae7aa45ceee850b4b255)
Diffstat (limited to 'source4/build/pidl/parser.pm')
-rw-r--r-- | source4/build/pidl/parser.pm | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index 86837dbc3b..49a54d3bb7 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -28,14 +28,16 @@ sub ParseProperties($) ##################################################################### # parse an array - push side -sub ParseArrayPush($) +sub ParseArrayPush($$) { my $e = shift; + my $var_prefix = shift; + my $size = util::has_property($e->{PROPERTIES}, "size_is"); if (util::is_scalar_type($e->{TYPE})) { - $res .= "\t\tNDR_CHECK(ndr_push_array_$e->{TYPE}(ndr, r->$e->{NAME}, r->$size));\n:"; + $res .= "\t\tNDR_CHECK(ndr_push_array_$e->{TYPE}(ndr, $var_prefix$e->{NAME}, $var_prefix$size));\n:"; } else { - $res .= "\t\tNDR_CHECK(ndr_push_array(ndr, ndr_flags, r->$e->{NAME}, sizeof(r->$e->{NAME}\[0]), r->$size, (ndr_push_flags_fn_t)ndr_push_$e->{TYPE}));\n"; + $res .= "\t\tNDR_CHECK(ndr_push_array(ndr, ndr_flags, $var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $var_prefix$size, (ndr_push_flags_fn_t)ndr_push_$e->{TYPE}));\n"; } } @@ -141,7 +143,7 @@ sub ParseElementPushBuffer($$) } if (util::has_property($e->{PROPERTIES}, "size_is")) { - ParseArrayPush($e); + ParseArrayPush($e, "r->"); } else { if (util::is_scalar_type($e->{TYPE})) { $res .= "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, *$var_prefix$e->{NAME}));\n"; @@ -184,7 +186,7 @@ sub ParseElementPullBuffer($$$) ParseArrayPull($e); } else { if (!$e->{POINTERS} || - $e->{TYPE} =~ "unistr") { + $e->{TYPE} =~ "unistr.*") { if (util::is_builtin_type($e->{TYPE})) { $res .= "\t\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, &$var_prefix$e->{NAME}));\n"; } else { @@ -404,8 +406,15 @@ sub ParseFunctionPush($) foreach my $arg (@{$function->{DATA}}) { if (util::has_property($arg->{PROPERTIES}, "in")) { - ParseElementPushScalar($arg, "r->in.", "NDR_SCALARS|NDR_BUFFERS"); - ParseElementPushBuffer($arg, "r->in."); + if (util::has_property($arg->{PROPERTIES}, "size_is")) { + $res .= "\tif (r->in.$arg->{NAME}) {\n"; + $res .= "\t\tint ndr_flags = NDR_SCALARS|NDR_BUFFERS;\n"; + ParseArrayPush($arg, "r->in."); + $res .= "\t}\n"; + } else { + ParseElementPushScalar($arg, "r->in.", "NDR_SCALARS|NDR_BUFFERS"); + ParseElementPushBuffer($arg, "r->in."); + } } } |