From: Brian Pane Date: Tue, 18 Jun 2002 04:10:57 +0000 (+0000) Subject: use signed long to avoid compiler complaints about the negation of unsigned X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50c1e8cfb1fe8ec698602170e747f6e766f1adc4;p=thirdparty%2Fapache%2Fhttpd.git use signed long to avoid compiler complaints about the negation of unsigned git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@95758 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ap/ap_strtol.c b/src/ap/ap_strtol.c index 2a639af603c..c374d4cbef3 100644 --- a/src/ap/ap_strtol.c +++ b/src/ap/ap_strtol.c @@ -118,6 +118,7 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base) char c; unsigned long cutoff; int neg, any, cutlim; + long result; /* * Skip white space and pick up leading +/- sign if any. @@ -189,15 +190,16 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base) } } if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; + result = neg ? LONG_MIN : LONG_MAX; errno = ERANGE; } else if (!any) { noconv: + result = (long)acc; errno = EINVAL; } else if (neg) - acc = -acc; + result = -(long)acc; if (endptr != NULL) *endptr = (char *)(any ? s - 1 : nptr); - return (acc); + return (result); }