summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1997-08-23 23:51:12 +0000
committersteve <steve@FreeBSD.org>1997-08-23 23:51:12 +0000
commitfc8b5b4955e847d86a82903f1e573bba3a391e5b (patch)
tree93ed9d1488be4da25ddc614356143e45a2039c15
parentc75d58a28c83f1cdf5f39f4c4e2fb22b04012fe1 (diff)
downloadFreeBSD-src-fc8b5b4955e847d86a82903f1e573bba3a391e5b.zip
FreeBSD-src-fc8b5b4955e847d86a82903f1e573bba3a391e5b.tar.gz
Get rid of integer overflow warning.
PR: misc/3575 Submitted by: Bruce Evans <bde@zeta.org.au>
-rw-r--r--lib/libc/stdlib/strtoll.c2
-rw-r--r--lib/libc/stdlib/strtoq.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c
index 2666749..f84e030 100644
--- a/lib/libc/stdlib/strtoll.c
+++ b/lib/libc/stdlib/strtoll.c
@@ -105,7 +105,7 @@ strtoq(nptr, endptr, base)
* overflow.
*/
qbase = (unsigned)base;
- cutoff = neg ? -(u_quad_t)QUAD_MIN : QUAD_MAX;
+ cutoff = neg ? (u_quad_t)-(QUAD_MIN + QUAD_MAX) + QUAD_MAX : QUAD_MAX;
cutlim = cutoff % qbase;
cutoff /= qbase;
for (acc = 0, any = 0;; c = *s++) {
diff --git a/lib/libc/stdlib/strtoq.c b/lib/libc/stdlib/strtoq.c
index 2666749..f84e030 100644
--- a/lib/libc/stdlib/strtoq.c
+++ b/lib/libc/stdlib/strtoq.c
@@ -105,7 +105,7 @@ strtoq(nptr, endptr, base)
* overflow.
*/
qbase = (unsigned)base;
- cutoff = neg ? -(u_quad_t)QUAD_MIN : QUAD_MAX;
+ cutoff = neg ? (u_quad_t)-(QUAD_MIN + QUAD_MAX) + QUAD_MAX : QUAD_MAX;
cutlim = cutoff % qbase;
cutoff /= qbase;
for (acc = 0, any = 0;; c = *s++) {
OpenPOWER on IntegriCloud