diff options
author | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2002-08-20 23:43:28 +0000 |
---|---|---|
committer | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2002-08-20 23:43:28 +0000 |
commit | 8238c39018b6c0af18bebcb27062be2359a02a94 (patch) | |
tree | 0b5b4cbd6b355d39ad7be9a0671fa217f2f7c49e /strings | |
parent | 9768ce07c1e593b9040866468895294b7120f4d3 (diff) | |
download | libapr-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.c | 7 |
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 |