[LEDE-DEV] [PATCH] netifd: Fix printf calls + function declarations.
Rosen Penev
rosenp at gmail.com
Sun Jun 25 17:18:06 PDT 2017
cppcheck found printf functions with signed instead of unsigned
formats. Fix those as well as some non-matching function
declarations.
Signed-off by: Rosen Penev <rosenp at gmail.com>
---
device.h | 4 ++--
system-dummy.c | 2 +-
system-linux.c | 22 +++++++++++-----------
system.h | 2 +-
utils.h | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/device.h b/device.h
index feb865f..74d20d6 100644
--- a/device.h
+++ b/device.h
@@ -253,11 +253,11 @@ void device_reset_old(void);
void device_set_default_ps(bool state);
void device_init_virtual(struct device *dev, struct device_type *type, const char *name);
-int device_init(struct device *iface, struct device_type *type, const char *ifname);
+int device_init(struct device *dev, struct device_type *type, const char *ifname);
void device_cleanup(struct device *dev);
struct device *device_find(const char *name);
struct device *device_get(const char *name, int create);
-void device_add_user(struct device_user *dep, struct device *iface);
+void device_add_user(struct device_user *dep, struct device *dev);
void device_remove_user(struct device_user *dep);
void device_broadcast_event(struct device *dev, enum device_event ev);
diff --git a/system-dummy.c b/system-dummy.c
index 165438c..11c8ccc 100644
--- a/system-dummy.c
+++ b/system-dummy.c
@@ -134,7 +134,7 @@ static int system_address_msg(struct device *dev, struct device_addr *addr, cons
char ipaddr[64];
int af = system_get_addr_family(addr->flags);
- D(SYSTEM, "ifconfig %s %s %s/%d\n",
+ D(SYSTEM, "ifconfig %s %s %s/%u\n",
dev->ifname, type, inet_ntop(af, &addr->addr.in, ipaddr, sizeof(ipaddr)),
addr->mask);
diff --git a/system-linux.c b/system-linux.c
index 06c6abd..f7704cf 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -708,7 +708,7 @@ int system_bridge_addif(struct device *bridge, struct device *dev)
system_bridge_set_wireless(bridge, dev);
if (dev->settings.flags & DEV_OPT_MULTICAST_ROUTER) {
- snprintf(buf, sizeof(buf), "%i", dev->settings.multicast_router);
+ snprintf(buf, sizeof(buf), "%u", dev->settings.multicast_router);
system_bridge_set_multicast_router(dev, buf, false);
}
@@ -995,7 +995,7 @@ static void system_bridge_conf_multicast(struct device *bridge,
bridge->ifname, buf);
if (bridge->settings.flags & DEV_OPT_MULTICAST_ROUTER) {
- snprintf(buf, buf_len, "%i", bridge->settings.multicast_router);
+ snprintf(buf, buf_len, "%u", bridge->settings.multicast_router);
system_bridge_set_multicast_router(bridge, buf, true);
}
@@ -1456,37 +1456,37 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned
s->flags &= ~DEV_OPT_PROMISC;
}
if (s->flags & DEV_OPT_RPFILTER & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->rpfilter);
+ snprintf(buf, sizeof(buf), "%u", s->rpfilter);
system_set_rpfilter(dev, buf);
}
if (s->flags & DEV_OPT_ACCEPTLOCAL & apply_mask)
system_set_acceptlocal(dev, s->acceptlocal ? "1" : "0");
if (s->flags & DEV_OPT_IGMPVERSION & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->igmpversion);
+ snprintf(buf, sizeof(buf), "%u", s->igmpversion);
system_set_igmpversion(dev, buf);
}
if (s->flags & DEV_OPT_MLDVERSION & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->mldversion);
+ snprintf(buf, sizeof(buf), "%u", s->mldversion);
system_set_mldversion(dev, buf);
}
if (s->flags & DEV_OPT_NEIGHREACHABLETIME & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->neigh4reachabletime);
+ snprintf(buf, sizeof(buf), "%u", s->neigh4reachabletime);
system_set_neigh4reachabletime(dev, buf);
- snprintf(buf, sizeof(buf), "%d", s->neigh6reachabletime);
+ snprintf(buf, sizeof(buf), "%u", s->neigh6reachabletime);
system_set_neigh6reachabletime(dev, buf);
}
if (s->flags & DEV_OPT_NEIGHLOCKTIME & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->neigh4locktime);
+ snprintf(buf, sizeof(buf), "%u", s->neigh4locktime);
system_set_neigh4locktime(dev, buf);
}
if (s->flags & DEV_OPT_NEIGHGCSTALETIME & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->neigh4gcstaletime);
+ snprintf(buf, sizeof(buf), "%u", s->neigh4gcstaletime);
system_set_neigh4gcstaletime(dev, buf);
- snprintf(buf, sizeof(buf), "%d", s->neigh6gcstaletime);
+ snprintf(buf, sizeof(buf), "%u", s->neigh6gcstaletime);
system_set_neigh6gcstaletime(dev, buf);
}
if (s->flags & DEV_OPT_DADTRANSMITS & apply_mask) {
- snprintf(buf, sizeof(buf), "%d", s->dadtransmits);
+ snprintf(buf, sizeof(buf), "%u", s->dadtransmits);
system_set_dadtransmits(dev, buf);
}
if (s->flags & DEV_OPT_MULTICAST & apply_mask) {
diff --git a/system.h b/system.h
index c8ddbad..1a3d023 100644
--- a/system.h
+++ b/system.h
@@ -216,6 +216,6 @@ time_t system_get_rtime(void);
void system_fd_set_cloexec(int fd);
-int system_update_ipv6_mtu(struct device *device, int mtu);
+int system_update_ipv6_mtu(struct device *dev, int mtu);
#endif
diff --git a/utils.h b/utils.h
index 4e14bcf..f40e14f 100644
--- a/utils.h
+++ b/utils.h
@@ -113,7 +113,7 @@ char * format_macaddr(uint8_t *mac);
uint32_t crc32_file(FILE *fp);
-const char * uci_get_validate_string(const struct uci_blob_param_list *c, int i);
+const char * uci_get_validate_string(const struct uci_blob_param_list *p, int i);
#ifdef __APPLE__
#define s6_addr32 __u6_addr.__u6_addr32
--
2.12.3
More information about the Lede-dev
mailing list