From 831611e221d82b8074727fb8e948d0cbe3eb6f0a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Aug 2010 11:12:16 +0200 Subject: pidl:Samba4/NDR/Client: support argument based stubs for [in,out,string] metze --- pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'pidl/lib/Parse') diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index 9be7641799..bd2616a799 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -366,8 +366,20 @@ sub ParseOutputArgument($$$$$$) my $copy_len_var = "_copy_len_$e->{NAME}"; $self->pidl("size_t $copy_len_var;"); - unless (defined($l->{SIZE_IS})) { - fatal($e->{ORIGINAL}, "no size known for [out] array `$e->{NAME}'"); + if (not defined($l->{SIZE_IS})) { + if (not $l->{IS_ZERO_TERMINATED}) { + fatal($e->{ORIGINAL}, "no size known for [out] array `$e->{NAME}'"); + } + if (has_property($e, "charset")) { + $avail_len = "ndr_charset_length($in_var, CH_UNIX)"; + $needed_len = "ndr_charset_length($out_var, CH_UNIX)"; + } else { + $avail_len = "ndr_string_length($in_var, sizeof(*$in_var))"; + $needed_len = "ndr_string_length($out_var, sizeof(*$out_var))"; + } + $in_size_is = ""; + $out_size_is = ""; + $out_length_is = ""; } else { $in_size_is = ParseExpr($l->{SIZE_IS}, $in_env, $e->{ORIGINAL}); $out_size_is = ParseExpr($l->{SIZE_IS}, $out_env, $e->{ORIGINAL}); @@ -743,6 +755,9 @@ sub ParseFunction($$$) if ($e->{LEVELS}[1]->{TYPE} eq "DATA" and $e->{LEVELS}[1]->{DATA_TYPE} eq "string") { $reason = "is a pointer to type 'string'"; + } elsif ($e->{LEVELS}[1]->{TYPE} eq "ARRAY" and + $e->{LEVELS}[1]->{IS_ZERO_TERMINATED}) { + next; } elsif ($e->{LEVELS}[1]->{TYPE} eq "ARRAY" and not defined($e->{LEVELS}[1]->{SIZE_IS})) { $reason = "is a pointer to an unsized array"; -- cgit