diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-14 06:23:13 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-01-14 19:53:07 +0100 |
commit | e231e24d89dfe3faaf0f791dc5e0df5fa9c21590 (patch) | |
tree | 2eac145c40192d9dc387abcd41f671e712e3fa43 /source4/pidl/lib/Parse/Pidl/Samba4 | |
parent | 271f5f18f2c871cfba256f7088839e4eb195e289 (diff) | |
download | samba-e231e24d89dfe3faaf0f791dc5e0df5fa9c21590.tar.gz samba-e231e24d89dfe3faaf0f791dc5e0df5fa9c21590.tar.bz2 samba-e231e24d89dfe3faaf0f791dc5e0df5fa9c21590.zip |
pidl/python: Deal with arrays that are not pointers.
(This used to be commit 7516af7c7262240df3b804dda962194a811d4e96)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index e0751d0c72..1483083e22 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -673,8 +673,14 @@ sub ConvertObjectFromPythonLevel($$$$$$$$) } elsif ($l->{TYPE} eq "ARRAY") { if (is_charset_array($e, $l)) { $self->pidl("PY_CHECK_TYPE(PyUnicode, $py_var, $fail);"); + # FIXME: Use Unix charset setting rather than utf-8 $self->pidl(get_pointer_to($var_name) . " = PyString_AsString(PyUnicode_AsEncodedString($py_var, \"utf-8\", \"ignore\"));"); } else { + my $pl = GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { + $var_name = get_pointer_to($var_name); + } + my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}"; $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);"); $self->pidl("{"); @@ -816,8 +822,14 @@ sub ConvertObjectToPythonLevel($$$$$) } elsif ($l->{TYPE} eq "ARRAY") { if (is_charset_array($e, $l)) { $var_name = get_pointer_to($var_name); + # FIXME: Use Unix charset setting rather than utf-8 $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");"); } else { + my $pl = GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { + $var_name = get_pointer_to($var_name); + } + die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS})); my $length = $l->{SIZE_IS}; if (defined($l->{LENGTH_IS})) { |