diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-11 17:04:14 +0200 |
---|---|---|
committer | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-19 12:44:07 +0200 |
commit | 5330b05c83ad9ce776d61c7ee2643a8e6d06e2f5 (patch) | |
tree | 11cbd7e273232621f851265faf5b0f0ee7c2d1ab | |
parent | 311478ec1f45cc840632ab4f0d8914b07bf5629b (diff) | |
download | neard-5330b05c83ad9ce776d61c7ee2643a8e6d06e2f5.tar.gz |
netlink: use proper format for integers (-Wformat)
Properly print signed and unsigned integers. This fixes warnings like:
src/netlink.c: In function ‘nfc_netlink_event_tm_deactivated’:
./include/near/log.h:45:14: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
45 | near_debug("%s:%s() " fmt, \
| ^~~~~~~~~~
src/netlink.c:759:2: note: in expansion of macro ‘DBG’
759 | DBG("%d", idx);
| ^~~
src/netlink.c: In function ‘nfc_netlink_event’:
src/netlink.c:772:54: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__u32’ {aka ‘unsigned int’} [-Werror=format=]
772 | near_error("WARNING: Wrong netlink message sender %d",
| ~^
| |
| int
| %d
773 | src->nl_pid);
| ~~~~~~~~~~~
| |
| __u32 {aka unsigned int}
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
-rw-r--r-- | src/netlink.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/netlink.c b/src/netlink.c index 3c77999..a3b206a 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -567,7 +567,7 @@ static int get_targets_handler(struct nl_msg *n, void *arg) iso15693_uid_len = 0; } - DBG("target idx %d proto 0x%x sens_res 0x%x sel_res 0x%x NFCID len %d", + DBG("target idx %u proto 0x%x sens_res 0x%x sel_res 0x%x NFCID len %d", target_idx, protocols, sens_res, sel_res, nfcid_len); DBG("\tiso15693_uid_len %d", iso15693_uid_len); @@ -607,7 +607,7 @@ static int nfc_netlink_event_targets_found(struct genlmsghdr *gnlh) adapter_idx = nla_get_u32(attr[NFC_ATTR_DEVICE_INDEX]); - DBG("adapter %d", adapter_idx); + DBG("adapter %u", adapter_idx); msg = nlmsg_alloc(); if (!msg) @@ -653,7 +653,7 @@ static int nfc_netlink_event_target_lost(struct genlmsghdr *gnlh) adapter_idx = nla_get_u32(attr[NFC_ATTR_DEVICE_INDEX]); target_idx = nla_get_u32(attr[NFC_ATTR_TARGET_INDEX]); - DBG("adapter %d target %d", adapter_idx, target_idx); + DBG("adapter %u target %u", adapter_idx, target_idx); return __near_adapter_remove_target(adapter_idx, target_idx); } @@ -690,7 +690,7 @@ static int nfc_netlink_event_dep_up(struct genlmsghdr *gnlh) target_idx = nla_get_u32(attrs[NFC_ATTR_TARGET_INDEX]); - DBG("%d %d", idx, target_idx); + DBG("%u %u", idx, target_idx); return __near_adapter_set_dep_state(idx, true); } else { @@ -735,7 +735,7 @@ static int nfc_netlink_event_tm_activated(struct genlmsghdr *gnlh) idx = nla_get_u32(attrs[NFC_ATTR_DEVICE_INDEX]); - DBG("%d", idx); + DBG("%u", idx); return __near_adapter_add_device(idx, NULL, 0); } @@ -756,7 +756,7 @@ static int nfc_netlink_event_tm_deactivated(struct genlmsghdr *gnlh) idx = nla_get_u32(attrs[NFC_ATTR_DEVICE_INDEX]); - DBG("%d", idx); + DBG("%u", idx); return __near_adapter_remove_device(idx); } @@ -769,8 +769,8 @@ static int nfc_netlink_event(struct nl_msg *n, void *arg) DBG("event 0x%x", gnlh->cmd); if (src->nl_pid) { - near_error("WARNING: Wrong netlink message sender %d", - src->nl_pid); + near_error("WARNING: Wrong netlink message sender %u", + src->nl_pid); return NL_SKIP; } |