summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorjim <jim@13f79535-47bb-0310-9956-ffa450edef68>2002-08-20 23:43:28 +0000
committerjim <jim@13f79535-47bb-0310-9956-ffa450edef68>2002-08-20 23:43:28 +0000
commit8238c39018b6c0af18bebcb27062be2359a02a94 (patch)
tree0b5b4cbd6b355d39ad7be9a0671fa217f2f7c49e /strings
parent9768ce07c1e593b9040866468895294b7120f4d3 (diff)
downloadlibapr-8238c39018b6c0af18bebcb27062be2359a02a94.tar.gz
comment the checks being done, making it clear that the
short-circuit is safe, because we've already noted an over/underflow (so we're just biding our time) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63823 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'strings')
-rw-r--r--strings/apr_strings.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/strings/apr_strings.c b/strings/apr_strings.c
index 75cb8289b..93b8b9305 100644
--- a/strings/apr_strings.c
+++ b/strings/apr_strings.c
@@ -355,9 +355,10 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base)
if (c >= base)
break;
val *= base;
- if ( (any < 0) || (neg && (val > acc || (val -= c) > acc))
- || (val < acc || (val += c) < acc)) {
- any = -1;
+ if ( (any < 0) /* already noted an over/under flow - short circuit */
+ || (neg && (val > acc || (val -= c) > acc)) /* underflow */
+ || (val < acc || (val += c) < acc)) { /* overflow */
+ any = -1; /* once noted, over/underflows never go away */
#ifdef APR_STRTOI64_OVERFLOW_IS_BAD_CHAR
break;
#endif