summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-14 14:48:59 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-14 19:53:07 +0100
commit7dd468ff2e5a4c4ce503e1b8e024bf91dcf7a412 (patch)
treebb8a04d72eb3b840bc8456a74fe7e64ff9d533e2 /source4/pidl/lib/Parse/Pidl/Samba4
parente42322848b81a36528a0af88138acb3ec997bf01 (diff)
downloadsamba-7dd468ff2e5a4c4ce503e1b8e024bf91dcf7a412.tar.gz
samba-7dd468ff2e5a4c4ce503e1b8e024bf91dcf7a412.tar.bz2
samba-7dd468ff2e5a4c4ce503e1b8e024bf91dcf7a412.zip
python: Fix python code for winreg, add test.
(This used to be commit bd3e6c41c42738fcfcc5cef4e65f0e219d358260)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index e538771624..c8505e9904 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -665,6 +665,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
$self->pidl("} else {");
$self->indent;
}
+ $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
$self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, GetNextLevel($e, $l), get_value_of($var_name), $fail);
if ($l->{POINTER_TYPE} ne "ref") {
$self->deindent;
@@ -686,7 +687,9 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
$self->pidl("{");
$self->indent;
$self->pidl("int $counter;");
- $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ if (!$l->{IS_FIXED}) {
+ $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ }
$self->pidl("for ($counter = 0; $counter < PyList_Size($py_var); $counter++) {");
$self->indent;
$self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GetItem($py_var, $counter)", $e, GetNextLevel($e, $l), $var_name."[$counter]", $fail);
@@ -697,8 +700,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
}
} elsif ($l->{TYPE} eq "DATA") {
- if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE}) or
- Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
$var_name = get_pointer_to($var_name);
}
$self->ConvertObjectFromPythonData($mem_ctx, $py_var, $l->{DATA_TYPE}, $var_name, $fail);
@@ -841,8 +843,7 @@ sub ConvertObjectToPythonLevel($$$$$)
my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
$self->pidl("$py_var = py_import_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $var_name);");
} elsif ($l->{TYPE} eq "DATA") {
- if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE}) or
- Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
$var_name = get_pointer_to($var_name);
}
my $conv = $self->ConvertObjectToPythonData($mem_ctx, $l->{DATA_TYPE}, $var_name);