summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4/NDR
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-01-15 10:51:57 -0800
committerTim Prouty <tprouty@samba.org>2009-01-15 14:52:35 -0800
commit7c861cac534801dd7938f07eeccd3680c84d3f30 (patch)
treebc976ce4a0578496254f274e2eaf5e9fac46c3f6 /pidl/lib/Parse/Pidl/Samba4/NDR
parent3913d0a20547ad9c93255fdbc4fdf6629aa226b9 (diff)
downloadsamba-7c861cac534801dd7938f07eeccd3680c84d3f30.tar.gz
samba-7c861cac534801dd7938f07eeccd3680c84d3f30.tar.bz2
samba-7c861cac534801dd7938f07eeccd3680c84d3f30.zip
pidl: Add max property to be used instead of range for unsigned types.
Compilers complain about ranges starting at 0 for unsigned types, since an unsigned type is never less than 0. The max property implicitly makes 0 the lower bound when used with unsigned types.
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4/NDR')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 0a4e44ef0e..e2b14c10b1 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -862,6 +862,12 @@ sub ParseDataPull($$$$$$$)
$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
$self->pidl("}");
}
+ if (my $max = has_property($e, "max")) {
+ $var_name = get_value_of($var_name);
+ $self->pidl("if ($var_name > $max) {");
+ $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
+ $self->pidl("}");
+ }
} else {
$self->ParseTypePull($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
}