mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r8394: Make sure the argument to ctype is*(3) macros are unsigned char as
required by ISO C99.
This commit is contained in:
parent
707e3726d3
commit
56fd21c806
@ -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 {
|
||||
|
@ -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++;
|
||||
|
@ -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++;
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -429,7 +429,7 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s)
|
||||
int i, len;
|
||||
char *ret;
|
||||
const char *valid_chars = "_-.$@ ";
|
||||
#define NBT_CHAR_ALLOW(c) (isalnum(c) || strchr(valid_chars, c))
|
||||
#define NBT_CHAR_ALLOW(c) (isalnum((unsigned char)c) || strchr(valid_chars, c))
|
||||
|
||||
for (len=i=0;s[i];i++,len++) {
|
||||
if (!NBT_CHAR_ALLOW(s[i])) {
|
||||
|
@ -469,7 +469,7 @@ static char *name_map(struct pvfs_mangle_context *ctx,
|
||||
if (! FLAG_CHECK(lead_chars[i], FLAG_ASCII)) {
|
||||
lead_chars[i] = '_';
|
||||
}
|
||||
lead_chars[i] = toupper(lead_chars[i]);
|
||||
lead_chars[i] = toupper((unsigned char)lead_chars[i]);
|
||||
}
|
||||
for (;i<ctx->mangle_prefix;i++) {
|
||||
lead_chars[i] = '_';
|
||||
@ -487,7 +487,7 @@ static char *name_map(struct pvfs_mangle_context *ctx,
|
||||
extension_length = 0;
|
||||
if (dot_p) {
|
||||
for (i=1; extension_length < 3 && dot_p[i]; i++) {
|
||||
char c = dot_p[i];
|
||||
unsigned char c = dot_p[i];
|
||||
if (FLAG_CHECK(c, FLAG_ASCII)) {
|
||||
extension[extension_length++] = toupper(c);
|
||||
}
|
||||
|
@ -2283,7 +2283,7 @@ static BOOL lp_do_parameter_parametric(int snum, const char *pszParmName, const
|
||||
struct param_opt *paramo, *data;
|
||||
char *name;
|
||||
|
||||
while (isspace(*pszParmName)) {
|
||||
while (isspace((unsigned char)*pszParmName)) {
|
||||
pszParmName++;
|
||||
}
|
||||
|
||||
@ -2485,7 +2485,7 @@ BOOL lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
|
||||
int parmnum = map_parameter(pszParmName);
|
||||
int i;
|
||||
|
||||
while (isspace(*pszParmValue)) pszParmValue++;
|
||||
while (isspace((unsigned char)*pszParmValue)) pszParmValue++;
|
||||
|
||||
|
||||
if (parmnum < 0 && strchr(pszParmName, ':')) {
|
||||
|
@ -198,7 +198,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
|
||||
len_count = count_chars(fmt2, '*');
|
||||
/* find the type string */
|
||||
tstr = &fmt2[len];
|
||||
while (tstr > fmt2 && isalpha(tstr[-1])) {
|
||||
while (tstr > fmt2 && isalpha((unsigned char)tstr[-1])) {
|
||||
tstr--;
|
||||
}
|
||||
if (strcmp(tstr, "%") == 0) {
|
||||
|
@ -49,7 +49,7 @@ static const char *clean_name(TALLOC_CTX *mem_ctx, const char *name)
|
||||
char *ret = talloc_strdup(mem_ctx, name);
|
||||
int i;
|
||||
for (i=0;ret[i];i++) {
|
||||
if (!isprint(ret[i])) ret[i] = '.';
|
||||
if (!isprint((unsigned char)ret[i])) ret[i] = '.';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user