summaryrefslogtreecommitdiff
path: root/pidl/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-05 11:52:20 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-05 23:42:08 +1100
commit135756c8ac34c4cf82992dce8c7218781e67f39b (patch)
tree7a91dd090ff03375acccdbaca2075b2365f61fba /pidl/lib
parent6d53d9f2ce68db1cc2cf6fc0ebaca548bcfb9a42 (diff)
downloadsamba-135756c8ac34c4cf82992dce8c7218781e67f39b.tar.gz
samba-135756c8ac34c4cf82992dce8c7218781e67f39b.tar.bz2
samba-135756c8ac34c4cf82992dce8c7218781e67f39b.zip
pidl: use a union assignment instead of memmove
this means we don't lose type checking Pair-Programmed-With: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'pidl/lib')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index f79981e317..00ada47d95 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -824,7 +824,8 @@ sub assign($$$)
if ($dest =~ /^\&/ and $src eq "NULL") {
$self->pidl("memset($dest, 0, sizeof(" . get_value_of($dest) . "));");
} elsif ($dest =~ /^\&/) {
- $self->pidl("memmove($dest, $src, sizeof(" . get_value_of($dest) . "));");
+ my $destvar = get_value_of($dest);
+ $self->pidl("$destvar = *$src;");
} else {
$self->pidl("$dest = $src;");
}
@@ -1047,7 +1048,8 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
my $switch_ptr = "$e->{NAME}_switch_$l->{LEVEL_INDEX}";
$self->pidl("{");
$self->indent;
- $self->pidl("void *$switch_ptr;");
+ my $union_type = mapTypeName(GetNextLevel($e, $l)->{DATA_TYPE});
+ $self->pidl("$union_type *$switch_ptr;");
$self->pidl("$switch_ptr = py_export_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $py_var);");
$self->pidl("if ($switch_ptr == NULL) { $fail }");
$self->assign($var_name, "$switch_ptr");