From 651494a5f1183fa7a351ff494970640ba9c6f3d8 Mon Sep 17 00:00:00 2001 From: luigi Date: Sat, 11 Jan 2014 00:00:11 +0000 Subject: [PATCH] use explicit casts with void* to compile when included by C++ code --- sys/net/netmap_user.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index bd6fe0db22a..72882b08a2a 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -164,6 +164,7 @@ struct nm_desc_t { /* * when the descriptor is open correctly, d->self == d + * Eventually we should also use some magic number. */ #define P2NMD(p) ((struct nm_desc_t *)(p)) #define IS_NETMAP_DESC(d) (P2NMD(d)->self == P2NMD(d)) @@ -181,8 +182,9 @@ struct nm_desc_t { static inline void pkt_copy(const void *_src, void *_dst, int l) { - const uint64_t *src = _src; - uint64_t *dst = _dst; + const uint64_t *src = (const uint64_t *)_src; + uint64_t *dst = (uint64_t *)_dst; + if (unlikely(l >= 1024)) { memcpy(dst, src, l); return; @@ -317,7 +319,8 @@ nm_close(struct nm_desc_t *d) * ugly trick to avoid unused warnings */ static void *__xxzt[] __attribute__ ((unused)) = - { nm_open, nm_inject, nm_dispatch, nm_nextpkt } ; + { (void *)nm_open, (void *)nm_inject, + (void *)nm_dispatch, (void *)nm_nextpkt } ; if (d == NULL || d->self != d) return EINVAL; -- 2.45.0