*/
static inline int is_idchar(char c)
{
- return isalnum((int)(unsigned char)c) ||
+ return isalnum((unsigned char)c) ||
c == '.' || c == '_' || c == '-' || c == '+' || c == ':';
}
}
fprintf(o, " ");
for (i = 0; (from + i < to) && (i < 16) ; i++) {
- fprintf(o, "%c", isprint((int)b_orig(b)[from + i]) ? b_orig(b)[from + i] : '.') ;
+ fprintf(o, "%c", isprint((unsigned char)b_orig(b)[from + i]) ? b_orig(b)[from + i] : '.') ;
if ((((from + i) & 15) == 15) && ((from + i) != to-1))
fprintf(o, "\n");
}
}
val = args[cur_arg + 1];
while (*val) {
- if (iscntrl(*val) || *val == ';') {
+ if (iscntrl((unsigned char)*val) || *val == ';') {
ha_alert("parsing [%s:%d]: character '%%x%02X' is not permitted in attribute value.\n",
file, linenum, *val);
err_code |= ERR_ALERT | ERR_FATAL;
char *name, *end;
name = args[cur_arg+1] + 7;
- while (isspace(*name))
+ while (isspace((unsigned char)*name))
name++;
end = name;
- while (*end && !isspace(*end) && *end != ',' && *end != ')')
+ while (*end && !isspace((unsigned char)*end) && *end != ',' && *end != ')')
end++;
curproxy->conn_src.opts &= ~CO_SRC_TPROXY_MASK;
curproxy->conn_src.bind_hdr_occ = -1;
/* now look for an occurrence number */
- while (isspace(*end))
+ while (isspace((unsigned char)*end))
end++;
if (*end == ',') {
end++;
name = end;
if (*end == '-')
end++;
- while (isdigit((int)*end))
+ while (isdigit((unsigned char)*end))
end++;
curproxy->conn_src.bind_hdr_occ = strl2ic(name, end-name);
}
for (p = arg; *p; p++) {
if (*p == '-' && !dash)
dash = p;
- else if (!isdigit((int)*p)) {
+ else if (!isdigit((unsigned char)*p)) {
memprintf(err, "'%s' is not a valid number/range.", arg);
return -1;
}
char *dash;
unsigned int low, high;
- if (!isdigit((int)*args[cur_arg])) {
+ if (!isdigit((unsigned char)*args[cur_arg])) {
memprintf(err, "'%s' is not a CPU range.\n", args[cur_arg]);
return -1;
}
braces = 1;
}
- if (!isalpha((int)(unsigned char)*var_beg) && *var_beg != '_') {
+ if (!isalpha((unsigned char)*var_beg) && *var_beg != '_') {
ha_alert("parsing [%s:%d] : Variable expansion: Unrecognized character '%c' in variable name.\n", file, linenum, *var_beg);
err_code |= ERR_ALERT | ERR_FATAL;
goto next_line; /* skip current line */
}
- while (isalnum((int)(unsigned char)*var_end) || *var_end == '_')
+ while (isalnum((unsigned char)*var_end) || *var_end == '_')
var_end++;
save_char = *var_end;
c = src->area[i];
- if (!isascii(c) || !isprint((unsigned char)c) || c == '&' || c == '"' || c == '\'' || c == '<' || c == '>') {
+ if (!isascii((unsigned char)c) || !isprint((unsigned char)c) || c == '&' || c == '"' || c == '\'' || c == '<' || c == '>') {
l = snprintf(dst->area + dst->data, free, "&#%u;",
(unsigned char)c);
c = src->area[i];
- if (!isascii(c) || !isprint((unsigned char)c) || c == '<' || c == '>' || c == qc) {
+ if (!isascii((unsigned char)c) || !isprint((unsigned char)c) || c == '<' || c == '>' || c == qc) {
l = snprintf(dst->area + dst->data, free, "<%02X>",
(unsigned char)c);
memcpy(dst, ":fcgi-", 6);
ofs1 = 6;
for (ofs2 = 0; ofs2 < name.len; ofs2++) {
- if (isalnum((int)name.ptr[ofs2]))
+ if (isalnum((unsigned char)name.ptr[ofs2]))
dst[ofs1++] = ist_lc[(unsigned char)name.ptr[ofs2]];
else
dst[ofs1++] = '_';
}
for (off = 0; off < p->n.len; off++) {
- if (isalnum((int)p->n.ptr[off]))
+ if (isalnum((unsigned char)p->n.ptr[off]))
out->area[len++] = ist_uc[(unsigned char)p->n.ptr[off]];
else
out->area[len++] = '_';
vsn = -1;
/* skip leading spaces */
- while (p < end && isspace(*p))
+ while (p < end && isspace((unsigned char)*p))
p++;
/* parse Major number, until the '.' */
goto out;
/* skip trailing spaces */
- while (p < end && isspace(*p))
+ while (p < end && isspace((unsigned char)*p))
p++;
if (p != end)
goto out;
char *delim;
/* Skip leading spaces */
- for (; isspace(*str) && sz; str++, sz--);
+ for (; isspace((unsigned char)*str) && sz; str++, sz--);
if (sz >= 10 && !strncmp(str, "pipelining", 10)) {
str += 10; sz -= 10;
- if (!sz || isspace(*str) || *str == ',')
+ if (!sz || isspace((unsigned char)*str) || *str == ',')
flags |= SPOE_APPCTX_FL_PIPELINING;
}
else if (sz >= 5 && !strncmp(str, "async", 5)) {
str += 5; sz -= 5;
- if (!sz || isspace(*str) || *str == ',')
+ if (!sz || isspace((unsigned char)*str) || *str == ',')
flags |= SPOE_APPCTX_FL_ASYNC;
}
else if (sz >= 13 && !strncmp(str, "fragmentation", 13)) {
str += 13; sz -= 13;
- if (!sz || isspace(*str) || *str == ',')
+ if (!sz || isspace((unsigned char)*str) || *str == ',')
flags |= SPOE_APPCTX_FL_FRAGMENTATION;
}
goto out;
tmp = args[2];
while (*tmp) {
- if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z0-9_.] chars.\n",
file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
tmp = args[2];
while (*tmp) {
- if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z0-9_.] chars.\n",
file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
tmp = args[2];
while (*tmp) {
- if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z0-9_.] chars.\n",
file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
tmp = args[2];
while (*tmp) {
- if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z0-9_.] chars.\n",
file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
char *tmp = curagent->id;
while (*tmp) {
- if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
memprintf(err, "Invalid variable prefix '%s' for SPOE agent '%s' declared at %s:%d. "
"Use 'option var-prefix' to set it. Only [a-zA-Z0-9_.] chars are supported.\n",
curagent->id, curagent->id, curagent->conf.file, curagent->conf.line);
if (i % 16 == 15) {
fprintf(stderr, " |");
for(j = i - 15; j <= i && j < ist.len; j++)
- fprintf(stderr, "%c", (isprint(*(ist.ptr+j)) ? *(ist.ptr+j) : '.'));
+ fprintf(stderr, "%c", (isprint((unsigned char)*(ist.ptr+j)) ? *(ist.ptr+j) : '.'));
fprintf(stderr, "|\n");
}
}
*argv, strerror(errno));
exit(1);
} else if (endptr && strlen(endptr)) {
- while (isspace(*endptr)) endptr++;
+ while (isspace((unsigned char)*endptr)) endptr++;
if (*endptr != 0) {
ha_alert("-%2s option: some bytes unconsumed in PID list {%s}\n",
flag, endptr);
*(p-1) = '.';
break;
}
- if (isprint(*msg))
+ if (isprint((unsigned char)*msg))
*p = *msg;
else
*p = '.';
int pos;
for (pos = 0; pos < arg[0].data.str.data; pos++) {
- if (!isdigit(arg[0].data.str.area[pos])) {
+ if (!isdigit((unsigned char)arg[0].data.str.area[pos])) {
memprintf(err_msg, "invalid block position");
return 0;
}
else {
char c = *str;
*str = 0;
- if (isprint(c))
+ if (isprint((unsigned char)c))
memprintf(err, "expected ']' after '%s', but found '%c'", var, c);
else
memprintf(err, "missing ']' after '%s'", var);
/* Display the displayable chars*. */
b_putchr(buf, '<');
for (i = 0; i < tmp.data.u.str.data; i++) {
- if (isprint(tmp.data.u.str.area[i]))
+ if (isprint((unsigned char)tmp.data.u.str.area[i]))
b_putchr(buf, tmp.data.u.str.area[i]);
else
b_putchr(buf, '.');
len = 2;
str = "\\t";
}
- else if (c > 0xff || !isprint(c)) {
+ else if (c > 0xff || !isprint((unsigned char)c)) {
/* isprint generate a segfault if c is too big. The man says that
* c must have the value of an unsigned char or EOF.
*/
char *name, *end;
name = args[*cur_arg + 1] + 7;
- while (isspace(*name))
+ while (isspace((unsigned char)*name))
name++;
end = name;
- while (*end && !isspace(*end) && *end != ',' && *end != ')')
+ while (*end && !isspace((unsigned char)*end) && *end != ',' && *end != ')')
end++;
newsrv->conn_src.opts &= ~CO_SRC_TPROXY_MASK;
newsrv->conn_src.bind_hdr_occ = -1;
/* now look for an occurrence number */
- while (isspace(*end))
+ while (isspace((unsigned char)*end))
end++;
if (*end == ',') {
end++;
name = end;
if (*end == '-')
end++;
- while (isdigit((int)*end))
+ while (isdigit((unsigned char)*end))
end++;
newsrv->conn_src.bind_hdr_occ = strl2ic(name, end - name);
}
}
/* ignore blank characters at the beginning of the line */
- while (isspace(*cur))
+ while (isspace((unsigned char)*cur))
++cur;
/* Ignore empty or commented lines */
arg = 1;
srv_arg = 0;
while (*cur && arg < SRV_STATE_FILE_MAX_FIELDS) {
- if (isspace(*cur)) {
+ if (isspace((unsigned char)*cur)) {
*cur = '\0';
++cur;
- while (isspace(*cur))
+ while (isspace((unsigned char)*cur))
++cur;
switch (version) {
case 1:
return name;
while (*name) {
- if (!isalnum((int)(unsigned char)*name) && *name != '.' && *name != ':' &&
+ if (!isalnum((unsigned char)*name) && *name != '.' && *name != ':' &&
*name != '_' && *name != '-')
return name;
name++;
return name;
while (*name) {
- if (!f((int)(unsigned char)*name) && *name != '.' &&
+ if (!f((unsigned char)*name) && *name != '.' &&
*name != '_' && *name != '-')
return name;
port1 = "";
}
- if (isdigit((int)(unsigned char)*port1)) { /* single port or range */
+ if (isdigit((unsigned char)*port1)) { /* single port or range */
port2 = strchr(port1, '-');
if (port2)
*port2++ = '\0';
var_beg++;
var_end = var_beg;
- while (isalnum((int)(unsigned char)*var_end) || *var_end == '_') {
+ while (isalnum((unsigned char)*var_end) || *var_end == '_') {
var_end++;
}
while (buf[ptr] && ptr < bsize) {
c = buf[ptr];
- if (isprint(c) && isascii(c) && c != '\\' && c != ' ' && c != '=') {
+ if (isprint((unsigned char)c) && isascii((unsigned char)c) && c != '\\' && c != ' ' && c != '=') {
if (out->data > out->size - 1)
break;
out->area[out->data++] = c;
chunk_strcat(out, "'");
else if (unsafe > 1)
chunk_strcat(out, "*");
- else if (isprint(d[i + j]))
+ else if (isprint((unsigned char)d[i + j]))
chunk_appendf(out, "%c", d[i + j]);
else
chunk_strcat(out, ".");
while (ptr < len && ptr < bsize) {
c = buf[ptr];
- if (isprint(c) && isascii(c) && c != '\\') {
+ if (isprint((unsigned char)c) && isascii((unsigned char)c) && c != '\\') {
if (out->data > end - 2)
break;
out->area[out->data++] = c;
if (flags & STAT_SHLGNDS) {
chunk_appendf(out, "<div class=tips>");
- if (isdigit(*field_str(stats, ST_F_ADDR)))
+ if (isdigit((unsigned char)*field_str(stats, ST_F_ADDR)))
chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_F_ADDR));
else if (*field_str(stats, ST_F_ADDR) == '[')
chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_F_ADDR));
if (flags & STAT_SHLGNDS) {
chunk_appendf(out, "<div class=tips>");
- if (isdigit(*field_str(stats, ST_F_ADDR)))
+ if (isdigit((unsigned char)*field_str(stats, ST_F_ADDR)))
chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_F_ADDR));
else if (*field_str(stats, ST_F_ADDR) == '[')
chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_F_ADDR));
/* Check variable name syntax. */
tmp = var_names[var_names_nb - 1];
while (*tmp) {
- if (!isalnum((int)(unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
+ if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') {
memprintf(err, "invalid syntax at char '%s'", tmp);
res = NULL;
goto end;