From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ecotelecom.ru (mail.ecotelecom.ru [193.105.59.24]) by dpdk.org (Postfix) with ESMTP id 64C758D8E for ; Wed, 12 Aug 2015 11:11:16 +0200 (CEST) Received: from stand.ecotelecom.ru (unknown [10.210.0.221]) by mail.ecotelecom.ru (Postfix) with ESMTP id 4DABCD408F8; Wed, 12 Aug 2015 12:11:16 +0300 (MSK) From: Sergey Balabanov To: dev@dpdk.org Date: Wed, 12 Aug 2015 12:11:04 +0300 Message-Id: <1439370664-25728-1-git-send-email-balabanovsv@ecotelecom.ru> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] mbuf & mempool: explicit typecast on function return X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2015 09:11:16 -0000 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. Signed-off-by: Sergey Balabanov --- lib/librte_mbuf/rte_mbuf.h | 2 +- lib/librte_mempool/rte_mempool.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c3b8c98..8c2db1b 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -882,7 +882,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp); static inline struct rte_mbuf * rte_mbuf_from_indirect(struct rte_mbuf *mi) { - return RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size); + return (struct rte_mbuf *)RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size); } /** diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 075bcdf..8abeca9 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); } /** -- 2.1.4