summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2009-08-25 14:11:44 -0700
committerJustin Pettit <jpettit@nicira.com>2009-08-25 14:11:44 -0700
commitbe2c418b73fcb6c606725d84c18b0ad618082c75 (patch)
treee544e801ce0d59f1977892bff5b0a4b665203f71
parent00908dc27a4d93bd1c5bda3bcdc84ec351e9a09a (diff)
downloadopenvswitch-be2c418b73fcb6c606725d84c18b0ad618082c75.tar.gz
Cleanup isdigit() warnings.
NetBSD's gcc complains if isdigit()'s argument is an unadorned char. This provides an appropriate cast.
-rw-r--r--CodingStyle4
-rw-r--r--SubmittingPatches2
-rw-r--r--extras/ezio/ovs-switchui.c9
-rw-r--r--lib/dpif-linux.c3
-rw-r--r--lib/dpif-netdev.c2
-rw-r--r--lib/unixctl.c4
-rw-r--r--lib/vlog.c2
7 files changed, 17 insertions, 9 deletions
diff --git a/CodingStyle b/CodingStyle
index 69df907a2..f4765ad8d 100644
--- a/CodingStyle
+++ b/CodingStyle
@@ -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);
}
diff --git a/SubmittingPatches b/SubmittingPatches
index 50398f89c..917cddbf2 100644
--- a/SubmittingPatches
+++ b/SubmittingPatches
@@ -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 {
diff --git a/extras/ezio/ovs-switchui.c b/extras/ezio/ovs-switchui.c
index ad006faec..721717eef 100644
--- a/extras/ezio/ovs-switchui.c
+++ b/extras/ezio/ovs-switchui.c
@@ -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;
}
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 4d8c8048d..a1a666bdd 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -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);
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 4ff1a425f..d8f5ba73c 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -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;
diff --git a/lib/unixctl.c b/lib/unixctl.c
index 17bd6cb56..7d6fdd67b 100644
--- a/lib/unixctl.c
+++ b/lib/unixctl.c
@@ -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;
diff --git a/lib/vlog.c b/lib/vlog.c
index 1b95d96c1..5496f010e 100644
--- a/lib/vlog.c
+++ b/lib/vlog.c
@@ -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++;
}