commit 456accc8d5107946b806ddae4f7844a9d18f44de
parent 9302f6a12bb0a4fd3101b59618cb7d0a85ddfc39
Author: sin <sin@2f30.org>
Date: Wed, 30 Dec 2015 23:05:26 +0000
cast to unsigned char not int
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/torrentd.c b/torrentd.c
@@ -539,7 +539,7 @@ parsestr(char *s, char *e, struct ben **b)
char *p;
long long len = 0;
- for (p = s; p != e && isdigit((int)*p); p++)
+ for (p = s; p != e && isdigit((unsigned char)*p); p++)
len = len * 10 + *p - '0';
if (p == e)
error("bad string");
@@ -587,7 +587,7 @@ parseint(char *s, char *e, struct ben **b)
}
if (isneg && *p == '0')
error("i-0 is invalid");
- if (!isdigit((int)*p))
+ if (!isdigit((unsigned char)*p))
error("unexpected char in integer");
v = v * 10 + *p - '0';
}
@@ -661,7 +661,7 @@ parse(char *s, char *e, struct ben **b)
return parsedl(s, e, b);
break;
default:
- if (!isdigit((int)*s))
+ if (!isdigit((unsigned char)*s))
error("unknown type");
return parsestr(s, e, b);
}