From: Sergey Balabanov Date: Wed, 12 Aug 2015 09:11:04 +0000 (+0300) Subject: mempool: fix explicit cast to build C++ app X-Git-Tag: spdx-start~8509 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ec10f96bd30840c83123198a54a3733f154f5f34;p=dpdk.git mempool: fix explicit cast to build C++ app When DPDK is being compiled in C++ project using g++ then 'invalid conversion from' error appears. Added explicit typecast on function return to get rid of the error. Fixes: 6cf14ce4ce6c ("mempool: silence warning on pointer arithmetic") Signed-off-by: Sergey Balabanov Acked-by: Olivier Matz --- diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 075bcdf200..8abeca9e34 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -268,7 +268,7 @@ struct rte_mempool { /* return the header of a mempool object (internal) */ static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj) { - return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr)); + return (struct rte_mempool_objhdr *)RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr)); } /** @@ -290,7 +290,7 @@ static inline struct rte_mempool *rte_mempool_from_obj(void *obj) static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj) { struct rte_mempool *mp = rte_mempool_from_obj(obj); - return RTE_PTR_ADD(obj, mp->elt_size); + return (struct rte_mempool_objtlr *)RTE_PTR_ADD(obj, mp->elt_size); } /**