mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
Cleanup isdigit() warnings.
NetBSD's gcc complains if isdigit()'s argument is an unadorned char. This provides an appropriate cast.
This commit is contained in:
@@ -430,7 +430,9 @@ and
|
||||
precedence makes it necessary, or unless the operands are themselves
|
||||
expressions that use && and ||. Thus:
|
||||
|
||||
if (!isdigit(s[0]) || !isdigit(s[1]) || !isdigit(s[2])) {
|
||||
if (!isdigit((unsigned char)s[0])
|
||||
|| !isdigit((unsigned char)s[1])
|
||||
|| !isdigit((unsigned char)s[2])) {
|
||||
printf("string %s does not start with 3-digit code\n", s);
|
||||
}
|
||||
|
||||
|
@@ -180,7 +180,7 @@ index 32647ea..00cffbc 100644
|
||||
- svec_init(&new_br);
|
||||
- for (i = 0; i < raw_new_br.n; i++) {
|
||||
- const char *name = raw_new_br.names[i];
|
||||
- if (!strncmp(name, "dp", 2) && isdigit(name[2])) {
|
||||
- if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
|
||||
- VLOG_ERR("%s is not a valid bridge name (bridges may not be "
|
||||
- "named \"dp\" followed by a digit)", name);
|
||||
- } else {
|
||||
|
@@ -2801,7 +2801,8 @@ cmd_configure(const struct dict *dict UNUSED)
|
||||
out = prompt("Ctlr rate limit:", in,
|
||||
"^(Disabled|("NUM100_TO_99999_RE")/s)$");
|
||||
free(in);
|
||||
config.rate_limit = isdigit(out[0]) ? atoi(out) : -1;
|
||||
config.rate_limit
|
||||
= isdigit((unsigned char)out[0]) ? atoi(out) : -1;
|
||||
free(out);
|
||||
break;
|
||||
|
||||
@@ -2812,7 +2813,8 @@ cmd_configure(const struct dict *dict UNUSED)
|
||||
out = prompt("Activity probe:", in,
|
||||
"^(Default|("NUM5_TO_99999_RE") s)$");
|
||||
free(in);
|
||||
config.inactivity_probe = isdigit(out[0]) ? atoi(out) : -1;
|
||||
config.inactivity_probe
|
||||
= isdigit((unsigned char)out[0]) ? atoi(out) : -1;
|
||||
free(out);
|
||||
break;
|
||||
|
||||
@@ -2823,7 +2825,8 @@ cmd_configure(const struct dict *dict UNUSED)
|
||||
out = prompt("Max backoff:", in,
|
||||
"^(Default|("NUM1_TO_99999_RE") s)$");
|
||||
free(in);
|
||||
config.max_backoff = isdigit(out[0]) ? atoi(out) : -1;
|
||||
config.max_backoff
|
||||
= isdigit((unsigned char)out[0]) ? atoi(out) : -1;
|
||||
free(out);
|
||||
break;
|
||||
}
|
||||
|
@@ -104,7 +104,8 @@ dpif_linux_open(const char *name UNUSED, char *suffix, bool create,
|
||||
{
|
||||
int minor;
|
||||
|
||||
minor = !strncmp(name, "dp", 2) && isdigit(name[2]) ? atoi(name + 2) : -1;
|
||||
minor = !strncmp(name, "dp", 2)
|
||||
&& isdigit((unsigned char)name[2]) ? atoi(name + 2) : -1;
|
||||
if (create) {
|
||||
if (minor >= 0) {
|
||||
return create_minor(suffix, minor, dpifp);
|
||||
|
@@ -160,7 +160,7 @@ get_dp_netdev(const struct dpif *dpif)
|
||||
static int
|
||||
name_to_dp_idx(const char *name)
|
||||
{
|
||||
if (!strncmp(name, "dp", 2) && isdigit(name[2])) {
|
||||
if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
|
||||
int dp_idx = atoi(name + 2);
|
||||
if (dp_idx >= 0 && dp_idx < N_DP_NETDEVS) {
|
||||
return dp_idx;
|
||||
|
@@ -553,7 +553,9 @@ unixctl_client_transact(struct unixctl_client *client,
|
||||
|
||||
s = ds_cstr(&line);
|
||||
if (*reply_code == -1) {
|
||||
if (!isdigit(s[0]) || !isdigit(s[1]) || !isdigit(s[2])) {
|
||||
if (!isdigit((unsigned char)s[0])
|
||||
|| !isdigit((unsigned char)s[1])
|
||||
|| !isdigit((unsigned char)s[2])) {
|
||||
VLOG_WARN("reply from %s does not start with 3-digit code",
|
||||
client->connect_path);
|
||||
error = EPROTO;
|
||||
|
@@ -522,7 +522,7 @@ format_log_message(enum vlog_module module, enum vlog_level level,
|
||||
p++;
|
||||
}
|
||||
field = 0;
|
||||
while (isdigit(*p)) {
|
||||
while (isdigit((unsigned char)*p)) {
|
||||
field = (field * 10) + (*p - '0');
|
||||
p++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user