summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/bind/bsd/strtoul.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind9/lib/bind/bsd/strtoul.c')
-rw-r--r--contrib/bind9/lib/bind/bsd/strtoul.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/bind9/lib/bind/bsd/strtoul.c b/contrib/bind9/lib/bind/bsd/strtoul.c
index f419227..c2efeda 100644
--- a/contrib/bind9/lib/bind/bsd/strtoul.c
+++ b/contrib/bind9/lib/bind/bsd/strtoul.c
@@ -1,6 +1,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: strtoul.c,v 1.2.164.1 2005/04/27 05:00:47 sra Exp $";
+static const char rcsid[] = "$Id: strtoul.c,v 1.2.164.2 2008/02/18 04:04:06 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -70,7 +70,7 @@ strtoul(const char *nptr, char **endptr, int base) {
* See strtol for comments as to the logic used.
*/
do {
- c = *(unsigned char *)s++;
+ c = *(const unsigned char *)s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
@@ -87,7 +87,7 @@ strtoul(const char *nptr, char **endptr, int base) {
base = c == '0' ? 8 : 10;
cutoff = (u_long)ULONG_MAX / (u_long)base;
cutlim = (u_long)ULONG_MAX % (u_long)base;
- for (acc = 0, any = 0;; c = *(unsigned char*)s++) {
+ for (acc = 0, any = 0;; c = *(const unsigned char*)s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))
@@ -96,7 +96,7 @@ strtoul(const char *nptr, char **endptr, int base) {
break;
if (c >= base)
break;
- if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
+ if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
@@ -110,7 +110,7 @@ strtoul(const char *nptr, char **endptr, int base) {
} else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
+ DE_CONST((any ? s - 1 : nptr), *endptr);
return (acc);
}
OpenPOWER on IntegriCloud