summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-01-18 16:19:39 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-01-18 16:19:39 +0100
commitbfbb0fb17f4eedb8f22d0694c5d4a3b82dfe189b (patch)
tree068b3849e31c7b90a465be8172aac7c2b472d205 /pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
parent5cf9989a70a23e5b955b7229fa95d3e604b1883d (diff)
parentc45b6ec29a5b3a39b83209e970b645e5ed0a411c (diff)
downloadsamba-bfbb0fb17f4eedb8f22d0694c5d4a3b82dfe189b.tar.gz
samba-bfbb0fb17f4eedb8f22d0694c5d4a3b82dfe189b.tar.bz2
samba-bfbb0fb17f4eedb8f22d0694c5d4a3b82dfe189b.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index e2b14c10b1..44d21f0b4a 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -857,14 +857,16 @@ sub ParseDataPull($$$$$$$)
if (my $range = has_property($e, "range")) {
$var_name = get_value_of($var_name);
+ my $signed = Parse::Pidl::Typelist::is_signed($l->{DATA_TYPE});
my ($low, $high) = split(/,/, $range, 2);
- $self->pidl("if ($var_name < $low || $var_name > $high) {");
- $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) {");
+ if ($low < 0 and not $signed) {
+ warning(0, "$low is invalid for the range of an unsigned type");
+ }
+ if ($low == 0 and not $signed) {
+ $self->pidl("if ($var_name > $high) {");
+ } else {
+ $self->pidl("if ($var_name < $low || $var_name > $high) {");
+ }
$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
$self->pidl("}");
}