summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-07-19 20:42:52 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-07-19 20:42:52 +0200
commit54a2f51d57a24104f1facff2674b4d441cdfde48 (patch)
treeec6d34668f600fedeade1879a5903df106a89e25 /pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
parent54670bb400f2f8c05d8331dbf17831354600e186 (diff)
downloadsamba-54a2f51d57a24104f1facff2674b4d441cdfde48.tar.gz
samba-54a2f51d57a24104f1facff2674b4d441cdfde48.tar.bz2
samba-54a2f51d57a24104f1facff2674b4d441cdfde48.zip
pidl: Print proper errors when arrays don't have a specified size rather than spewing pages of perl warnings.
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm')
-rw-r--r--pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index ed1b71a236..a2a61d87d0 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -96,11 +96,17 @@ sub ParseOutputArgument($$$)
# structure, the user should be able to know the size beforehand
# to allocate a structure of the right size.
my $env = GenerateFunctionInEnv($fn, "r.");
- my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL});
- if (has_property($e, "charset")) {
- $self->pidl("memcpy(CONST_DISCARD(char *, $e->{NAME}), r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));");
+ my $l = $e->{LEVELS}[$level];
+ unless (defined($l->{SIZE_IS})) {
+ error($e->{ORIGINAL}, "no size known for [out] array `$e->{NAME}'");
+ $self->pidl('#error No size known for [out] array `$e->{NAME}');
} else {
- $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));");
+ my $size_is = ParseExpr($l->{SIZE_IS}, $env, $e->{ORIGINAL});
+ if (has_property($e, "charset")) {
+ $self->pidl("memcpy(CONST_DISCARD(char *, $e->{NAME}), r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));");
+ } else {
+ $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));");
+ }
}
} else {
$self->pidl("*$e->{NAME} = *r.out.$e->{NAME};");