diff options
author | Коренберг Марк <mark@ideco.ru> | 2012-06-08 14:15:06 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@redhat.com> | 2012-06-13 11:30:26 (GMT) |
commit | 2bdcde7e8e8bb78b165f093f1a708134f417e557 (patch) | |
tree | 52d56b1b1d1f75373a33c27988ded96e6a62e36e /lib/msg.c | |
parent | 4f933648622fff2b7fd6ec6c71724da4992c2544 (diff) | |
download | libnl-2bdcde7e8e8bb78b165f093f1a708134f417e557.zip libnl-2bdcde7e8e8bb78b165f093f1a708134f417e557.tar.gz libnl-2bdcde7e8e8bb78b165f093f1a708134f417e557.tar.bz2 |
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 'lib/msg.c')
-rw-r--r-- | lib/msg.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -178,7 +178,7 @@ int nlmsg_valid_hdr(const struct nlmsghdr *nlh, int hdrlen) */ int nlmsg_ok(const struct nlmsghdr *nlh, int remaining) { - return (remaining >= (int)sizeof(struct nlmsghdr) && + return (remaining >= sizeof(struct nlmsghdr) && nlh->nlmsg_len >= sizeof(struct nlmsghdr) && nlh->nlmsg_len <= remaining); } @@ -867,7 +867,7 @@ void nl_msg_dump(struct nl_msg *msg, FILE *ofd) "-------------------------- BEGIN NETLINK MESSAGE " "---------------------------\n"); - fprintf(ofd, " [HEADER] %Zu octets\n", sizeof(struct nlmsghdr)); + fprintf(ofd, " [HEADER] %zu octets\n", sizeof(struct nlmsghdr)); print_hdr(ofd, msg); if (hdr->nlmsg_type == NLMSG_ERROR && @@ -875,10 +875,10 @@ void nl_msg_dump(struct nl_msg *msg, FILE *ofd) struct nl_msg *errmsg; struct nlmsgerr *err = nlmsg_data(hdr); - fprintf(ofd, " [ERRORMSG] %Zu octets\n", sizeof(*err)); + fprintf(ofd, " [ERRORMSG] %zu octets\n", sizeof(*err)); fprintf(ofd, " .error = %d \"%s\"\n", err->error, strerror(-err->error)); - fprintf(ofd, " [ORIGINAL MESSAGE] %Zu octets\n", sizeof(*hdr)); + fprintf(ofd, " [ORIGINAL MESSAGE] %zu octets\n", sizeof(*hdr)); errmsg = nlmsg_inherit(&err->msg); print_hdr(ofd, errmsg); |