summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorКоренберг Марк <mark@ideco.ru>2012-06-08 20:15:06 +0600
committerThomas Graf <tgraf@redhat.com>2012-06-13 13:30:26 +0200
commit2bdcde7e8e8bb78b165f093f1a708134f417e557 (patch)
tree52d56b1b1d1f75373a33c27988ded96e6a62e36e /src
parent4f933648622fff2b7fd6ec6c71724da4992c2544 (diff)
downloadlibnl-2bdcde7e8e8bb78b165f093f1a708134f417e557.tar.gz
Fix types-related warnings based on clang diagnostics
1. Fix some places where unsigned value compared < 0 2. Fix obsolete %Z specifier to more portable %z 3. Some erroneous types substitution 4. nl_msec2str() - 64-bit msec is now properly used, Only safe changes. I mean int <--> uint32_t and signed/unsigned fixes. Some functinos require size_t argument instead of int, but changes of signatures of that functions is terrible thing. Also, I do not pretend for a full list of fixes. Just to shut up clang -Wall -Wextra One more thing. ifindex. I don't change that because changes will be too big for simple fix.
Diffstat (limited to 'src')
-rw-r--r--src/lib/route.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/route.c b/src/lib/route.c
index 05cb2ad..f2d6c60 100644
--- a/src/lib/route.c
+++ b/src/lib/route.c
@@ -198,12 +198,16 @@ void nl_cli_route_parse_table(struct rtnl_route *route, char *arg)
{
unsigned long lval;
char *endptr;
+ int table;
lval = strtoul(arg, &endptr, 0);
if (endptr == arg) {
- if ((lval = rtnl_route_str2table(arg)) < 0)
+ if ((table = rtnl_route_str2table(arg)) < 0)
nl_cli_fatal(EINVAL, "Unknown table name \"%s\"", arg);
}
+ else {
+ table = lval;
+ }
rtnl_route_set_table(route, lval);
}
@@ -233,16 +237,20 @@ void nl_cli_route_parse_protocol(struct rtnl_route *route, char *arg)
{
unsigned long lval;
char *endptr;
+ int proto;
lval = strtoul(arg, &endptr, 0);
if (endptr == arg) {
- if ((lval = rtnl_route_str2proto(arg)) < 0)
+ if ((proto = rtnl_route_str2proto(arg)) < 0)
nl_cli_fatal(EINVAL,
"Unknown routing protocol name \"%s\"",
arg);
}
+ else {
+ proto = lval;
+ }
- rtnl_route_set_protocol(route, lval);
+ rtnl_route_set_protocol(route, proto);
}
void nl_cli_route_parse_type(struct rtnl_route *route, char *arg)