1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-01 05:45:45 +00:00
freebsd-ports/devel/pwlib152/files/patch-src-ptclib-ansper.cxx
Pav Lucistnik 4c44860299 - Update to 1.5.2
PR:		ports/82086
Submitted by:	Steve Ames <steve@energistic.com>
2005-06-10 21:29:51 +00:00

57 lines
1.2 KiB
C++

--- src/ptclib/asnper.cxx Fri Aug 1 02:11:38 2003
+++ src/ptclib/asnper.cxx Fri Jun 3 14:32:55 2005
@@ -1224,6 +1224,11 @@
return -1;
value += lower;
+
+ // clamp value to upper limit
+ if (value > upper)
+ value = upper;
+
return 0;
}
@@ -1268,7 +1273,14 @@
unsigned base;
if (!MultiBitDecode(CountBits(upper - lower + 1), base))
return -1;
- return lower + base; // 10.9.4.1
+ len = lower + base; // 10.9.4.1
+
+ // clamp value to upper limit
+ if (len > upper)
+ len = upper;
+
+ return len;
+
}
if (upper < 65536) // 10.9.3.3
@@ -1279,13 +1291,20 @@
if (IsAtEnd())
return -1;
- if (SingleBitDecode() == 0)
- return MultiBitDecode(7, len) ? 0 : -1; // 10.9.3.6
+ if (SingleBitDecode() == 0) {
+ if (!MultiBitDecode(7, len)) // 10.9.3.6
+ return -1; // 10.9.3.8 unsupported
+ }
+ else if (SingleBitDecode() == 0) {
+ if (!MultiBitDecode(14, len)) // 10.9.3.7
+ return -1; // 10.9.3.8 unsupported
+ }
- if (SingleBitDecode() == 0)
- return MultiBitDecode(14, len) ? 0 : -1; // 10.9.3.7
+ // clamp value to upper limit
+ if (len > upper)
+ len = upper;
- return -1; // 10.9.3.8 unsupported
+ return 0;
}