summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorLove Hörnquist Åstrand <lha@samba.org>2005-07-12 22:22:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:20:14 -0500
commit61edb97bdfabf1ab313fbec5f47f5e6c8a79da1a (patch)
tree7b554690182fd2be55ba76a793227c3d3e46064c /source4/lib
parentdf426e5d4a33491c6b4bd8878ae3fbf29e728b5f (diff)
downloadsamba-61edb97bdfabf1ab313fbec5f47f5e6c8a79da1a.tar.gz
samba-61edb97bdfabf1ab313fbec5f47f5e6c8a79da1a.tar.bz2
samba-61edb97bdfabf1ab313fbec5f47f5e6c8a79da1a.zip
r8394: Make sure the argument to ctype is*(3) macros are unsigned char as
required by ISO C99. (This used to be commit 56fd21c806e816cf4c3d23881f26474f858b45e2)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ejs/var.c18
-rw-r--r--source4/lib/genrand.c6
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c3
-rw-r--r--source4/lib/ldb/common/ldb_dn.c2
-rw-r--r--source4/lib/ldb/common/ldb_parse.c12
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c5
-rw-r--r--source4/lib/socket/socket_ipv6.c2
-rw-r--r--source4/lib/util_str.c7
8 files changed, 29 insertions, 26 deletions
diff --git a/source4/lib/ejs/var.c b/source4/lib/ejs/var.c
index 7cbf8a0b7f..9d2afe5306 100644
--- a/source4/lib/ejs/var.c
+++ b/source4/lib/ejs/var.c
@@ -1730,18 +1730,18 @@ MprVar mprParseVar(char *buf, MprType preferredType)
} else if (isdigit((int) *buf)) {
type = MPR_NUM_VAR;
cp = buf;
- if (*cp && tolower(cp[1]) == 'x') {
+ if (*cp && tolower((unsigned char)cp[1]) == 'x') {
cp = &cp[2];
}
for (cp = buf; *cp; cp++) {
- if (! isdigit((int) *cp)) {
+ if (! isdigit((unsigned char) *cp)) {
break;
}
}
if (*cp != '\0') {
#if BLD_FEATURE_FLOATING_POINT
- if (*cp == '.' || tolower(*cp) == 'e') {
+ if (*cp == '.' || tolower((unsigned char)*cp) == 'e') {
type = MPR_TYPE_FLOAT;
} else
#endif
@@ -1993,11 +1993,11 @@ int64 mprParseInteger64(char *str)
}
} else {
cp++;
- if (tolower(*cp) == 'x') {
+ if (tolower((unsigned char)*cp) == 'x') {
cp++;
radix = 16;
while (*cp) {
- c = tolower(*cp);
+ c = tolower((unsigned char)*cp);
if (isdigit(c)) {
num64 = (c - '0') + (num64 * radix);
} else if (c >= 'a' && c <= 'f') {
@@ -2011,7 +2011,7 @@ int64 mprParseInteger64(char *str)
} else{
radix = 8;
while (*cp) {
- c = tolower(*cp);
+ c = tolower((unsigned char)*cp);
if (isdigit(c) && c < '8') {
num64 = (c - '0') + (num64 * radix);
} else {
@@ -2110,11 +2110,11 @@ int mprParseInteger(char *str)
}
} else {
cp++;
- if (tolower(*cp) == 'x') {
+ if (tolower((unsigned char)*cp) == 'x') {
cp++;
radix = 16;
while (*cp) {
- c = tolower(*cp);
+ c = tolower((unsigned char)*cp);
if (isdigit(c)) {
num = (c - '0') + (num * radix);
} else if (c >= 'a' && c <= 'f') {
@@ -2128,7 +2128,7 @@ int mprParseInteger(char *str)
} else{
radix = 8;
while (*cp) {
- c = tolower(*cp);
+ c = tolower((unsigned char)*cp);
if (isdigit(c) && c < '8') {
num = (c - '0') + (num * radix);
} else {
diff --git a/source4/lib/genrand.c b/source4/lib/genrand.c
index 9d40e72afc..ca79116b6a 100644
--- a/source4/lib/genrand.c
+++ b/source4/lib/genrand.c
@@ -261,11 +261,11 @@ BOOL check_password_quality(const char *s)
{
int has_digit=0, has_capital=0, has_lower=0;
while (*s) {
- if (isdigit(*s)) {
+ if (isdigit((unsigned char)*s)) {
has_digit++;
- } else if (isupper(*s)) {
+ } else if (isupper((unsigned char)*s)) {
has_capital++;
- } else if (islower(*s)) {
+ } else if (islower((unsigned char)*s)) {
has_lower++;
}
s++;
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 7f71d3574a..da2d945419 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -128,7 +128,8 @@ static int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
while (*s2 == ' ') s2++;
/* TODO: make utf8 safe, possibly with helper function from application */
while (*s1 && *s2) {
- if (toupper(*s1) != toupper(*s2)) break;
+ if (toupper((unsigned char)*s1) != toupper((unsigned char)*s2))
+ break;
if (*s1 == ' ') {
while (s1[0] == s1[1]) s1++;
while (s2[0] == s2[1]) s2++;
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index b421a7fe75..32b575dd36 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -47,7 +47,7 @@ static int ldb_dn_is_valid_attribute_name(const char *name)
if (! isascii(*name)) {
return 0;
}
- if (! (isalnum(*name) || *name == '-')) {
+ if (! (isalnum((unsigned char)*name) || *name == '-')) {
return 0;
}
name++;
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index b519489b48..ad3cbd883d 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -68,7 +68,7 @@ static char *ldb_parse_lex(void *ctx, const char **s, const char *sep)
const char *p = *s;
char *ret;
- while (isspace(*p)) {
+ while (isspace((unsigned char)*p)) {
p++;
}
*s = p;
@@ -86,7 +86,7 @@ static char *ldb_parse_lex(void *ctx, const char **s, const char *sep)
return ret;
}
- while (*p && (isalnum(*p) || !strchr(sep, *p))) {
+ while (*p && (isalnum((unsigned char)*p) || !strchr(sep, *p))) {
p++;
}
@@ -423,7 +423,7 @@ static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx,
return NULL;
}
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
while (*s && (next = ldb_parse_filter(ret->u.list.elements, &s))) {
struct ldb_parse_tree **e;
@@ -438,7 +438,7 @@ static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx,
ret->u.list.elements = e;
ret->u.list.elements[ret->u.list.num_elements] = next;
ret->u.list.num_elements++;
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
}
return ret;
@@ -474,7 +474,7 @@ static struct ldb_parse_tree *ldb_parse_not(void *mem_ctx, const char *s)
*/
static struct ldb_parse_tree *ldb_parse_filtercomp(void *mem_ctx, const char *s)
{
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
switch (*s) {
case '&':
@@ -543,7 +543,7 @@ static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s)
*/
struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s)
{
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
if (*s == '(') {
return ldb_parse_filter(mem_ctx, &s);
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index 38c117d7e0..5df5a6bba7 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -50,7 +50,7 @@ char *ldb_casefold(void *mem_ctx, const char *s)
return NULL;
}
for (i=0;ret[i];i++) {
- ret[i] = toupper(ret[i]);
+ ret[i] = toupper((unsigned char)ret[i]);
}
return ret;
}
@@ -63,7 +63,8 @@ int ldb_caseless_cmp(const char *s1, const char *s2)
{
int i;
for (i=0;s1[i] != 0;i++) {
- int c1 = toupper(s1[i]), c2 = toupper(s2[i]);
+ int c1 = toupper((unsigned char)s1[i]),
+ c2 = toupper((unsigned char)s2[i]);
if (c1 != c2) {
return c1 - c2;
}
diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c
index 25c5ca5798..58e35d87de 100644
--- a/source4/lib/socket/socket_ipv6.c
+++ b/source4/lib/socket/socket_ipv6.c
@@ -290,7 +290,7 @@ static char *ipv6_tcp_get_peer_addr(struct socket_context *sock, TALLOC_CTX *mem
return NULL;
}
- he = gethostbyaddr(&peer_addr.sin6_addr, sizeof(peer_addr.sin6_addr), AF_INET6);
+ he = gethostbyaddr((char *)&peer_addr.sin6_addr, sizeof(peer_addr.sin6_addr), AF_INET6);
if (!he || !he->h_name) {
return NULL;
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index fea7170014..592c38e53c 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -159,7 +159,8 @@ int strwicmp(const char *psz1, const char *psz2)
psz1++;
while (isspace((int)*psz2))
psz2++;
- if (toupper(*psz1) != toupper(*psz2) || *psz1 == '\0'
+ if (toupper((unsigned char)*psz1) != toupper((unsigned char)*psz2)
+ || *psz1 == '\0'
|| *psz2 == '\0')
break;
psz1++;
@@ -412,12 +413,12 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex)
continue;
}
- if (!(p1 = strchr_m(hexchars, toupper(strhex[i]))))
+ if (!(p1 = strchr_m(hexchars, toupper((unsigned char)strhex[i]))))
break;
i++; /* next hex digit */
- if (!(p2 = strchr_m(hexchars, toupper(strhex[i]))))
+ if (!(p2 = strchr_m(hexchars, toupper((unsigned char)strhex[i]))))
break;
/* get the two nybbles */