svn commit: samba r2958 - in branches/SAMBA_4_0/source/build/pidl: .
tridge at samba.org
tridge at samba.org
Wed Oct 13 23:33:18 GMT 2004
Author: tridge
Date: 2004-10-13 23:33:17 +0000 (Wed, 13 Oct 2004)
New Revision: 2958
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2958&nolog=1
Log:
the warnings from the swig code in pidl were totally swamping valid
warnings, making real errors impossible to spot.
this fixes the warnings, and probably fixes some pidl/python bugs as
well.
Modified:
branches/SAMBA_4_0/source/build/pidl/swig.pm
branches/SAMBA_4_0/source/build/pidl/util.pm
Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-10-13 20:13:39 UTC (rev 2957)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-10-13 23:33:17 UTC (rev 2958)
@@ -141,7 +141,7 @@
my($prefix) = shift;
my($result) = "";
- my($array_len) = $e->{ARRAY_LEN};
+ my($array_len) = util::array_size($e);
if ($array_len eq "*" or util::has_property($e, "size_is")) {
$array_len = util::has_property($e, "size_is");
@@ -476,14 +476,16 @@
$result .= "\tu = talloc(mem_ctx, sizeof(union $u->{NAME}));\n\n";
for my $e (@{$u->{DATA}{DATA}}) {
- $result .= "\tif ((dict = PyDict_GetItemString(obj, \"$e->{DATA}{NAME}\"))) {\n";
- if ($e->{DATA}{POINTERS} == 0) {
- $result .= "\t\t$e->{DATA}{TYPE}_from_python(mem_ctx, &u->$e->{DATA}{NAME}, dict, \"$e->{DATA}{NAME}\");\n";
- } elsif ($e->{DATA}{POINTERS} == 1) {
- $result .= "\t\tu->$e->{DATA}{NAME} = $e->{DATA}{TYPE}_ptr_from_python(mem_ctx, dict, \"$e->{DATA}{NAME}\");\n";
- } else {
- $result .= "\t\t// $e->{DATA}{TYPE} pointers=$e->{DATA}{POINTERS}\n";
- }
+ if (defined $e->{DATA}{NAME}) {
+ $result .= "\tif ((dict = PyDict_GetItemString(obj, \"$e->{DATA}{NAME}\"))) {\n";
+ if ($e->{DATA}{POINTERS} == 0) {
+ $result .= "\t\t$e->{DATA}{TYPE}_from_python(mem_ctx, &u->$e->{DATA}{NAME}, dict, \"$e->{DATA}{NAME}\");\n";
+ } elsif ($e->{DATA}{POINTERS} == 1) {
+ $result .= "\t\tu->$e->{DATA}{NAME} = $e->{DATA}{TYPE}_ptr_from_python(mem_ctx, dict, \"$e->{DATA}{NAME}\");\n";
+ } else {
+ $result .= "\t\t// $e->{DATA}{TYPE} pointers=$e->{DATA}{POINTERS}\n";
+ }
+ }
$result .= "\t\treturn u;\n";
$result .= "\t}\n\n";
@@ -511,6 +513,7 @@
$result .= "\t}\n\n";
for my $e (@{$u->{DATA}{DATA}}) {
+ if (defined $e->{DATA}{NAME}) {
$result .= "\tif ((dict = PyDict_GetItemString(obj, \"$e->{DATA}{NAME}\"))) {\n";
if ($e->{DATA}{POINTERS} == 0) {
$result .= "\t\t$e->{DATA}{TYPE}_from_python(mem_ctx, &u->$e->{DATA}{NAME}, dict, \"$e->{DATA}{NAME}\");\n";
@@ -519,7 +522,7 @@
} else {
$result .= "\t\t// $e->{DATA}{TYPE} pointers=$e->{DATA}{POINTERS}\n";
}
-
+ }
$result .= "\t\treturn;\n";
$result .= "\t}\n\n";
}
@@ -542,10 +545,9 @@
for my $e (@{$u->{DATA}{DATA}}) {
$result .= "\tif (switch_is == $e->{CASE}) {\n";
- if ($e->{POINTERS} == 0) {
- $result .= "\t\tPyDict_SetItemString(obj, \"$e->{DATA}{NAME}\", $e->{DATA}{TYPE}_ptr_to_python(mem_ctx, &u->$e->{DATA}{NAME}));\n";
- } else {
- $result .= "\t\tPyDict_SetItemString(obj, \"$e->{DATA}{NAME}\", $e->{DATA}{TYPE}_ptr_to_python(mem_ctx, u->$e->{DATA}{NAME}));\n";
+ my $prefix = util::c_pull_prefix($e);
+ if (defined $e->{DATA}{NAME}) {
+ $result .= "\t\tPyDict_SetItemString(obj, \"$e->{DATA}{NAME}\", $e->{DATA}{TYPE}_ptr_to_python(mem_ctx, $prefix\u->$e->{DATA}{NAME}));\n";
}
$result .= "\t}\n";
}
Modified: branches/SAMBA_4_0/source/build/pidl/util.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/util.pm 2004-10-13 20:13:39 UTC (rev 2957)
+++ branches/SAMBA_4_0/source/build/pidl/util.pm 2004-10-13 23:33:17 UTC (rev 2958)
@@ -360,7 +360,7 @@
sub is_constant($)
{
my $s = shift;
- if ($s =~ /^\d/) {
+ if (defined $s && $s =~ /^\d/) {
return 1;
}
return 0;
More information about the samba-cvs
mailing list