From ff088fc0d88ef97fe9559880643def6fe40ae086 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 17 May 2010 17:43:33 +0200 Subject: nlmsg: use size_t instead of int for several input parameters Signed-off-by: Pablo Neira Ayuso --- include/libmnl/libmnl.h | 8 ++++---- src/nlmsg.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h index d4bb7ed..8c3815d 100644 --- a/include/libmnl/libmnl.h +++ b/include/libmnl/libmnl.h @@ -34,13 +34,13 @@ extern int mnl_socket_getsockopt(const struct mnl_socket *nl, int type, void *bu #define MNL_ALIGN(len) (((len)+MNL_ALIGNTO-1) & ~(MNL_ALIGNTO-1)) #define MNL_NLMSG_HDRLEN MNL_ALIGN(sizeof(struct nlmsghdr)) -extern size_t mnl_nlmsg_size(int len); -extern size_t mnl_nlmsg_total_size(int len); +extern size_t mnl_nlmsg_size(size_t len); +extern size_t mnl_nlmsg_total_size(size_t len); extern size_t mnl_nlmsg_get_payload_len(const struct nlmsghdr *nlh); /* Netlink message header builder */ extern struct nlmsghdr *mnl_nlmsg_put_header(void *buf); -extern void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, int size); +extern void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size); /* Netlink message iterators */ extern int mnl_nlmsg_ok(const struct nlmsghdr *nlh, int len); @@ -54,7 +54,7 @@ int mnl_nlmsg_portid_ok(const struct nlmsghdr *nlh, unsigned int portid); /* Netlink message getters */ extern void *mnl_nlmsg_get_payload(const struct nlmsghdr *nlh); -extern void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, int offset); +extern void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, size_t offset); extern void *mnl_nlmsg_get_payload_tail(const struct nlmsghdr *nlh); /* Netlink dump message */ diff --git a/src/nlmsg.c b/src/nlmsg.c index 660ce80..146296a 100644 --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -45,7 +45,7 @@ * This function returns the size of a netlink message (header plus payload) * without alignment. */ -size_t mnl_nlmsg_size(int len) +size_t mnl_nlmsg_size(size_t len) { return len + MNL_NLMSG_HDRLEN; } @@ -57,7 +57,7 @@ size_t mnl_nlmsg_size(int len) * This function returns the size of a netlink message (header plus payload) * with alignment. */ -size_t mnl_nlmsg_aligned_size(int len) +size_t mnl_nlmsg_aligned_size(size_t len) { return MNL_ALIGN(mnl_nlmsg_size(len)); } @@ -104,7 +104,7 @@ struct nlmsghdr *mnl_nlmsg_put_header(void *buf) * you call this function. This function returns a pointer to the extra * header. */ -void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, int size) +void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size) { char *ptr = (char *)nlh + nlh->nlmsg_len; nlh->nlmsg_len += MNL_ALIGN(size); @@ -131,7 +131,7 @@ void *mnl_nlmsg_get_payload(const struct nlmsghdr *nlh) * This function returns a pointer to the payload of the netlink message plus * a given offset. */ -void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, int offset) +void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, size_t offset) { return (void *)nlh + MNL_NLMSG_HDRLEN + MNL_ALIGN(offset); } -- cgit v1.2.3