b64_initialize_rmap ()
{
int i;
- char ch;
/* Null: end of string, stop parsing */
b64rmap[0] = b64rmap_end;
for (i = 1; i < 256; ++i) {
- ch = (char)i;
/* Whitespaces */
- if (isspace(ch))
+ if (isspace(i))
b64rmap[i] = b64rmap_space;
/* Padding: stop parsing */
- else if (ch == Pad64)
+ else if (i == Pad64)
b64rmap[i] = b64rmap_end;
/* Non-base64 char */
else
* Values are specified as for C:
* 0x=hex, 0=octal, isdigit=decimal.
*/
- if (!isdigit((int)c))
+ if (!isdigit((unsigned char)c))
return (0);
val = 0; base = 10;
if (c == '0') {
base = 8;
}
for (;;) {
- if (isascii((int)c) && isdigit((int)c)) {
+ if (isascii((unsigned char)c) && isdigit((unsigned char)c)) {
val = (val * base) + (c - '0');
c = *++cp;
- } else if (base == 16 && isascii((int)c) && isxdigit((int)c)) {
+ } else if (base == 16 && isascii((unsigned char)c) && isxdigit((unsigned char)c)) {
val = (val << 4) |
- (c + 10 - (islower((int)c) ? 'a' : 'A'));
+ (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
c = *++cp;
} else
break;
/*
* Check for trailing characters.
*/
- if (c != '\0' && (!isascii((int)c) || !isspace((int)c)))
+ if (c != '\0' && (!isascii((unsigned char)c) || !isspace((unsigned char)c)))
return (0);
/*
* Concoct the address according to
{
int ret=0, count=0;
- while (*buf[0] != '\0' && isdigit(*buf[0]) && count<max) {
+ while (*buf[0] != '\0' && isdigit((unsigned char)*buf[0]) && count<max) {
ret = ret*10 + (*buf[0] - '0');
(*buf)++;
count++;
int c, alt_format, ret;
int split_year = 0;
- while ((c = *format) != '\0') {
+ while ((c = (unsigned char)*format) != '\0') {
alt_format = 0;
/* whitespace, literal or format */
/** whitespace matches zero or more whitespace characters in the
* input string.
**/
- while (isspace(*s))
+ while (isspace((unsigned char)*s))
s++;
}
else if (c == '%') { /* format */
break;
case 'n': /* arbitrary whitespace */
case 't':
- while (isspace(*s))
+ while (isspace((unsigned char)*s))
s++;
break;
case 'p': /* am pm */
if (strncasecmp(name, "TYPE", 4) != 0)
return 0;
- if (!isdigit((int)name[4]))
+ if (!isdigit((unsigned char)name[4]))
return 0;
/* The rest from the string must be a number. */
if (strncasecmp(name, "CLASS", 5) != 0)
return 0;
- if (!isdigit((int)name[5]))
+ if (!isdigit((unsigned char)name[5]))
return 0;
/* The rest from the string must be a number. */
#ifdef HAVE_GETPWNAM
/* Parse the username into uid and gid */
if (*nsd.username) {
- if (isdigit((int)*nsd.username)) {
+ if (isdigit((unsigned char)*nsd.username)) {
char *t;
nsd.uid = strtol(nsd.username, &t, 10);
if (*t != 0) {
- if (*t != '.' || !isdigit((int)*++t)) {
+ if (*t != '.' || !isdigit((unsigned char)*++t)) {
error("-u user or -u uid or -u uid.gid");
}
nsd.gid = strtol(t, &t, 10);
if (ch=='.' || ch==';' || ch=='(' || ch==')' || ch=='\\') {
buffer_printf(output, "\\%c", (char) ch);
- } else if (!isgraph((int)(unsigned char) ch)) {
+ } else if (!isgraph((unsigned char) ch)) {
buffer_printf(output, "\\%03u", (unsigned int) ch);
- } else if (isprint((int)(unsigned char) ch)) {
+ } else if (isprint((unsigned char) ch)) {
buffer_printf(output, "%c", (char) ch);
} else {
buffer_printf(output, "\\%03u", (unsigned int) ch);
buffer_printf(output, "\"");
for (i = 1; i <= length; ++i) {
char ch = (char) data[i];
- if (isprint((int)(unsigned char)ch)) {
+ if (isprint((unsigned char)ch)) {
if (ch == '"' || ch == '\\') {
buffer_printf(output, "\\");
}
buffer_printf(output, "\"");
for (i = 1; i <= data[pos]; ++i) {
char ch = (char) data[pos + i];
- if (isprint((int)(unsigned char)ch)) {
+ if (isprint((unsigned char)ch)) {
if (ch == '"' || ch == '\\') {
buffer_printf(output, "\\");
}
buffer_printf(output, "\"");
for (i = 0; i < length; ++i) {
char ch = (char) data[i];
- if (isprint((int)(unsigned char)ch)) {
+ if (isprint((unsigned char)ch)) {
if (ch == '"' || ch == '\\') {
buffer_printf(output, "\\");
}
size_t i;
for (i = 1; i <= length; ++i) {
char ch = (char) data[i];
- if (isdigit((int)ch) || islower((int)ch))
+ if (isdigit((unsigned char)ch) || islower((unsigned char)ch))
buffer_printf(output, "%c", ch);
else return 0;
}
skipwhite(char* str)
{
/* EOS \0 is not a space */
- while( isspace(*str) )
+ while( isspace((unsigned char)*str) )
str++;
return str;
}
if(as) {
as[0]=0;
*arg2 = as+1;
- while(isspace(*as) && as > arg)
+ while(isspace((unsigned char)*as) && as > arg)
as--;
as[0]=0;
return 1;
tsig_strlowercmp(const char* str1, const char* str2)
{
while (str1 && str2 && *str1 != '\0' && *str2 != '\0') {
- if(tolower((int)*str1) != tolower((int)*str2)) {
- if(tolower((int)*str1) < tolower((int)*str2))
+ if(tolower((unsigned char)*str1) != tolower((unsigned char)*str2)) {
+ if(tolower((unsigned char)*str1) < tolower((unsigned char)*str2))
return -1;
return 1;
}
return -1;
}
while(*src) {
- if(!isxdigit((int)src[0]) || !isxdigit((int)src[1]))
+ if(!isxdigit((unsigned char)src[0]) || !isxdigit((unsigned char)src[1]))
return -1;
*t++ = hexdigit_to_int(src[0]) * 16 +
hexdigit_to_int(src[1]) ;
if(p+5 >= tsize*8)
return -1;
- if(isspace(ch))
+ if(isspace((unsigned char)ch))
continue;
if(ch >= '0' && ch <= '9')
char *start = str;
char *end = str + strlen(str) - 1;
- while (isspace(*start))
+ while (isspace((unsigned char)*start))
++start;
if (start > end) {
/* Completely blank. */
str[0] = '\0';
} else {
- while (isspace(*end))
+ while (isspace((unsigned char)*end))
--end;
*++end = '\0';
if (s[0] != '\\') {
/* Ordinary character. */
*p = *s;
- } else if (isdigit((int)s[1]) && isdigit((int)s[2]) && isdigit((int)s[3])) {
+ } else if (isdigit((unsigned char)s[1]) && isdigit((unsigned char)s[2]) && isdigit((unsigned char)s[3])) {
/* \DDD escape. */
int val = (hexdigit_to_int(s[1]) * 100 +
hexdigit_to_int(s[2]) * 10 +
while (*hex) {
*t = 0;
for (i = 16; i >= 1; i -= 15) {
- if (isxdigit((int)*hex)) {
+ if (isxdigit((unsigned char)*hex)) {
*t += hexdigit_to_int(*hex) * i;
} else {
zc_error_prev_line(
"illegal hex character '%c'",
- (int) *hex);
+ (int)(unsigned char) *hex);
return NULL;
}
++hex;
while (*hex) {
*t = 0;
for (i = 16; i >= 1; i -= 15) {
- if (isxdigit((int)*hex)) {
+ if (isxdigit((unsigned char)*hex)) {
*t += hexdigit_to_int(*hex) * i;
} else {
zc_error_prev_line(
"illegal hex character '%c'",
- (int) *hex);
+ (int)(unsigned char) *hex);
return NULL;
}
++hex;
} else {
/* Our grammar is stricter than the one accepted by
* strtol. */
- c = (int) *ch;
+ c = (unsigned char) *ch;
if (!isxdigit(c)) {
zc_error_prev_line("ilnp64: invalid "
"(non-hexadecimal) character %c", c);
nnum = len/8;
num = 1;
for (ch = text; *ch != '\0'; ch++) {
- int c = (int) *ch;
+ int c = (unsigned char) *ch;
if (*ch == '-') {
num++;
} else if (!isxdigit(c)) {
return NULL;
}
for (ptr = text; *ptr; ptr++) {
- if (!isdigit(*ptr) && !islower(*ptr)) {
+ if (!isdigit((unsigned char)*ptr) && !islower((unsigned char)*ptr)) {
zc_error_prev_line("invalid tag %s: contains invalid char %c",
text, *ptr);
return NULL;
int exponent;
int mantissa;
- while (isdigit((int)*cp))
+ while (isdigit((unsigned char)*cp))
mval = mval * 10 + hexdigit_to_int(*cp++);
if (*cp == '.') { /* centimeters */
cp++;
- if (isdigit((int)*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval = hexdigit_to_int(*cp++) * 10;
- if (isdigit((int)*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval += hexdigit_to_int(*cp++);
}
}
if (!parse_int(str, &str, °, "degrees", 0, 180))
return NULL;
- if (!isspace((int)*str)) {
+ if (!isspace((unsigned char)*str)) {
zc_error_prev_line("space expected after degrees");
return NULL;
}
++str;
/* Minutes? */
- if (isdigit((int)*str)) {
+ if (isdigit((unsigned char)*str)) {
if (!parse_int(str, &str, &min, "minutes", 0, 60))
return NULL;
- if (!isspace((int)*str)) {
+ if (!isspace((unsigned char)*str)) {
zc_error_prev_line("space expected after minutes");
return NULL;
}
}
/* Seconds? */
- if (isdigit((int)*str)) {
+ if (isdigit((unsigned char)*str)) {
start = str;
if (!parse_int(str, &str, &i, "seconds", 0, 60)) {
return NULL;
return NULL;
}
- if (!isspace((int)*str)) {
+ if (!isspace((unsigned char)*str)) {
zc_error_prev_line("space expected after seconds");
return NULL;
}
if (lat != 0 && lon != 0)
break;
- if (!isspace((int)*str)) {
+ if (!isspace((unsigned char)*str)) {
zc_error_prev_line("space expected after latitude/longitude");
return NULL;
}
return NULL;
}
- if (!isspace((int)*str)) {
+ if (!isspace((unsigned char)*str)) {
zc_error_prev_line("space expected before altitude");
return NULL;
}
if (!parse_int(str + 1, &str, &i, "altitude fraction", 0, 99)) {
return NULL;
}
- if (!isspace((int)*str) && *str != '\0' && *str != 'm') {
+ if (!isspace((unsigned char)*str) && *str != '\0' && *str != 'm') {
zc_error_prev_line("altitude fraction must be a number");
return NULL;
}
zc_error_prev_line("altitude must be expressed in meters");
return NULL;
}
- if (!isspace((int)*str) && *str != '\0')
+ if (!isspace((unsigned char)*str) && *str != '\0')
++str;
if (sscanf(start, "%lf", &d) != 1) {
alt = (uint32_t) (10000000.0 + d * 100 + 0.5);
- if (!isspace((int)*str) && *str != '\0') {
+ if (!isspace((unsigned char)*str) && *str != '\0') {
zc_error_prev_line("unexpected character after altitude");
return NULL;
}
/* Now parse size, horizontal precision and vertical precision if any */
- for(i = 1; isspace((int)*str) && i <= 3; i++) {
+ for(i = 1; isspace((unsigned char)*str) && i <= 3; i++) {
vszhpvp[i] = precsize_aton(str + 1, &str);
- if (!isspace((int)*str) && *str != '\0') {
+ if (!isspace((unsigned char)*str) && *str != '\0') {
zc_error_prev_line("invalid size or precision");
return NULL;
}