diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-01-31 14:57:35 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-02 11:16:09 +0100 |
commit | c3008e086b1a87c5f4add2a7d1474c2f9a34bfd2 (patch) | |
tree | e3162199c03f56f02382c8514c289aa238e605d0 /source4/pidl/lib/Parse/Pidl/CUtil.pm | |
parent | b3d4f22b30b98d16d9a779e26cd9555fe18a67e4 (diff) | |
download | samba-c3008e086b1a87c5f4add2a7d1474c2f9a34bfd2.tar.gz samba-c3008e086b1a87c5f4add2a7d1474c2f9a34bfd2.tar.bz2 samba-c3008e086b1a87c5f4add2a7d1474c2f9a34bfd2.zip |
pidl/Samba4::NDR::Parser: correctly get the name of an array element
When we have "*r->out.ous"
(char ***ous, a pointer to a pointer to an array of pointers).
we need to use "(*r->out.ous)[3]" to access the 3rd
element of the array "*r->out.ous[3]" was generated before,
but that's the same as "*(r->out.ous[3])" which would mean
the array would apply to a different level.
This patch prepares support for:
[out,ref,size_is(,num)] [string,charset(UTF16)] uint16 ***names;
It means a [ref] pointer to a [unique] pointer to an array
of [unique] pointers which point to an UTF16 string.
metze
(This used to be commit ec0ee2aa5f4bef32f09a426d91c28c985f843038)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/CUtil.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm index bd7b16812c..9deb6ee177 100644 --- a/source4/pidl/lib/Parse/Pidl/CUtil.pm +++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm @@ -6,7 +6,7 @@ package Parse::Pidl::CUtil; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(get_pointer_to get_value_of); +@EXPORT = qw(get_pointer_to get_value_of get_array_element); use vars qw($VERSION); $VERSION = '0.01'; @@ -36,4 +36,17 @@ sub get_value_of($) } } +sub get_array_element($$) +{ + my ($var_name, $idx) = @_; + + if ($var_name =~ /^\*.*$/) { + $var_name = "($var_name)"; + } elsif ($var_name =~ /^\&.*$/) { + $var_name = "($var_name)"; + } + + return "$var_name"."[$idx]"; +} + 1; |