summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba3/ServerNDR.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/ServerNDR.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/ServerNDR.pm')
-rw-r--r--pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index c9a8eea59f..5599de9d79 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -11,7 +11,7 @@ use Exporter;
@EXPORT_OK = qw(DeclLevel);
use strict;
-use Parse::Pidl qw(warning fatal);
+use Parse::Pidl qw(warning error fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
@@ -72,8 +72,13 @@ sub AllocOutVar($$$$$)
}
if ($l->{TYPE} eq "ARRAY") {
- my $size = ParseExpr($l->{SIZE_IS}, $env, $e);
- pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);";
+ unless(defined($l->{SIZE_IS})) {
+ error($e->{ORIGINAL}, "No size known for array `$e->{NAME}'");
+ pidl "#error No size known for array `$e->{NAME}'";
+ } else {
+ my $size = ParseExpr($l->{SIZE_IS}, $env, $e);
+ pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);";
+ }
} else {
pidl "$name = talloc_zero($mem_ctx, " . DeclLevel($e, 1) . ");";
}