diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-01-26 11:33:38 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-01-26 11:33:38 +0000 |
commit | b86e1f46aba4d9f348e4295ea7c652b600adfa8f (patch) | |
tree | e5945fac7a7dec1709375bd4897ba4dafd2de923 | |
parent | 5e1086da2dea492398407519d31310f5fb61880a (diff) |
libnl-tiny: Fix for c++ compatibility
g++ compiler issued some errors like "invalid conversion from void* to *struct nl_attr"
when compiling cpp file which calls libnl-tiny functions. (it's OK with gcc)
Also see https://dev.openwrt.org/ticket/7854
Patch from: kentarou matsuyama <matsuyama@thinktube.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25101 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | package/libnl-tiny/Makefile | 2 | ||||
-rw-r--r-- | package/libnl-tiny/src/include/netlink/attr.h | 8 | ||||
-rw-r--r-- | package/libnl-tiny/src/include/netlink/handlers.h | 2 | ||||
-rw-r--r-- | package/libnl-tiny/src/include/netlink/msg.h | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/package/libnl-tiny/Makefile b/package/libnl-tiny/Makefile index 4b02ef16b..f96424928 100644 --- a/package/libnl-tiny/Makefile +++ b/package/libnl-tiny/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnl-tiny PKG_VERSION:=0.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk diff --git a/package/libnl-tiny/src/include/netlink/attr.h b/package/libnl-tiny/src/include/netlink/attr.h index 7076d67e2..3b56a82dc 100644 --- a/package/libnl-tiny/src/include/netlink/attr.h +++ b/package/libnl-tiny/src/include/netlink/attr.h @@ -508,7 +508,7 @@ static inline int nla_nest_end(struct nl_msg *msg, struct nlattr *start) static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla, struct nla_policy *policy) { - return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); + return nla_parse(tb, maxtype, (struct nlattr *)nla_data(nla), nla_len(nla), policy); } /** @@ -563,8 +563,8 @@ static inline int nla_strcmp(const struct nlattr *nla, const char *str) */ static inline size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) { - size_t srclen = nla_len(nla); - char *src = nla_data(nla); + size_t srclen = (size_t)nla_len(nla); + char *src = (char*)nla_data(nla); if (srclen > 0 && src[srclen - 1] == '\0') srclen--; @@ -713,7 +713,7 @@ static inline size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dst * @arg rem initialized to len, holds bytes currently remaining in stream */ #define nla_for_each_nested(pos, nla, rem) \ - for (pos = nla_data(nla), rem = nla_len(nla); \ + for (pos = (struct nlattr *)nla_data(nla), rem = nla_len(nla); \ nla_ok(pos, rem); \ pos = nla_next(pos, &(rem))) diff --git a/package/libnl-tiny/src/include/netlink/handlers.h b/package/libnl-tiny/src/include/netlink/handlers.h index 5c62368a8..7fb53b4ee 100644 --- a/package/libnl-tiny/src/include/netlink/handlers.h +++ b/package/libnl-tiny/src/include/netlink/handlers.h @@ -172,7 +172,7 @@ static inline int nl_cb_set_all(struct nl_cb *cb, enum nl_cb_kind kind, int i, err; for (i = 0; i <= NL_CB_TYPE_MAX; i++) { - err = nl_cb_set(cb, i, kind, func, arg); + err = nl_cb_set(cb,(enum nl_cb_type)i, kind, func, arg); if (err < 0) return err; } diff --git a/package/libnl-tiny/src/include/netlink/msg.h b/package/libnl-tiny/src/include/netlink/msg.h index aedcb0829..b3e2b0b2b 100644 --- a/package/libnl-tiny/src/include/netlink/msg.h +++ b/package/libnl-tiny/src/include/netlink/msg.h @@ -144,7 +144,7 @@ static inline int nlmsg_len(const struct nlmsghdr *nlh) */ static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh, int hdrlen) { - unsigned char *data = nlmsg_data(nlh); + unsigned char *data = (unsigned char*)nlmsg_data(nlh); return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen)); } @@ -160,7 +160,7 @@ static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen) static inline int nlmsg_valid_hdr(const struct nlmsghdr *nlh, int hdrlen) { - if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) + if (nlh->nlmsg_len < (uint)nlmsg_msg_size(hdrlen)) return 0; return 1; @@ -263,7 +263,7 @@ static inline int nlmsg_expand(struct nl_msg *n, size_t newlen) if (tmp == NULL) return -NLE_NOMEM; - n->nm_nlh = tmp; + n->nm_nlh = (struct nlmsghdr*)tmp; n->nm_size = newlen; return 0; |