Hi,

openwrt "backfire 10.03.1-rc3"

g++ compiler issued some errors like "invalid conversion from void* to *struct 
nl_attr"
when compiling cpp file which calls libnl-tiny functions. (it is OK with gcc )

g++ seems picky and I applied the following patch to fix this problem.

I do appreciate any of your comments and suggestions.
If it looks ok, please update the upstream source.

thanks
Takayuki Kaiso


-------------------------------------------------------------

diff -Naur a/netlink/attr.h b/netlink/attr.h
--- a/netlink/attr.h 2010-07-22 11:17:24.000000000 +0900
+++ b/netlink/attr.h 2010-12-17 11:44:56.000000000 +0900
@@ -508,7 +508,7 @@
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 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 @@
* @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 -Naur a/netlink/handlers.h b/netlink/handlers.h
--- a/netlink/handlers.h 2010-12-14 19:50:29.000000000 +0900
+++ b/netlink/handlers.h 2010-12-17 09:55:39.000000000 +0900
@@ -172,7 +172,7 @@
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;
}



_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to