diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2004-04-04 14:54:17 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2004-04-04 14:54:17 +0000 |
commit | a03fa8323c725b07e3a797b9e7b18f2dda215a73 (patch) | |
tree | 8b12b572a69d06829f43a701801bdb4ec8a77e27 /strings | |
parent | 62be42783bba0d4a5baf6b423b0c4653b9f064b6 (diff) | |
download | libapr-a03fa8323c725b07e3a797b9e7b18f2dda215a73.tar.gz |
* strings/apr_strings.c (apr_strtoi64): Fix handling of negative
integers on platforms without strtoll.
* test/teststr.c (string_strtoi64): New function.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65039 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'strings')
-rw-r--r-- | strings/apr_strings.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/strings/apr_strings.c b/strings/apr_strings.c index ee1c1f1c3..a88f35e09 100644 --- a/strings/apr_strings.c +++ b/strings/apr_strings.c @@ -278,7 +278,7 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) } /* The classic bsd implementation requires div/mod operators - * to compute a cutoff. Benchmarking proves that iss very, very + * to compute a cutoff. Benchmarking proves that is very, very * evil to some 32 bit processors. Instead, look for underflow * in both the mult and add/sub operation. Unlike the bsd impl, * we also work strictly in a signed int64 word as we haven't @@ -319,7 +319,7 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) val *= base; if ( (any < 0) /* already noted an over/under flow - short circuit */ || (neg && (val > acc || (val -= c) > acc)) /* underflow */ - || (val < acc || (val += c) < acc)) { /* overflow */ + || (!neg && (val < acc || (val += c) < acc))) { /* overflow */ any = -1; /* once noted, over/underflows never go away */ #ifdef APR_STRTOI64_OVERFLOW_IS_BAD_CHAR break; |