From 6d8524ba705d92c59effe75bd20d3fb0279c3429 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 6 Sep 2012 14:21:46 -0500 Subject: [PATCH] res_rtp_asterisk: Eliminate "type-punned pointer" build warning. Removes "res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules" warning from the build on 32-bit platforms. The problem is that 'size' was referenced aliased to both (pj_size_t *) and (pj_ssize_t *). Now just make a copy of size that is the right type so there isn't any pointer aliasing happening. --- res/res_rtp_asterisk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 9a78dbd..84103ca 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -700,14 +700,15 @@ static pj_status_t ast_rtp_on_ice_tx_pkt(pj_ice_sess *ice, unsigned comp_id, uns { struct ast_rtp *rtp = ice->user_data; pj_status_t status = PJ_EINVALIDOP; + pj_ssize_t _size = (pj_ssize_t)size; if (transport_id == TRANSPORT_SOCKET_RTP) { /* Traffic is destined to go right out the RTP socket we already have */ - status = pj_sock_sendto(rtp->s, pkt, (pj_ssize_t*)&size, 0, dst_addr, dst_addr_len); + status = pj_sock_sendto(rtp->s, pkt, &_size, 0, dst_addr, dst_addr_len); } else if (transport_id == TRANSPORT_SOCKET_RTCP) { /* Traffic is destined to go right out the RTCP socket we already have */ if (rtp->rtcp) { - status = pj_sock_sendto(rtp->rtcp->s, pkt, (pj_ssize_t*)&size, 0, dst_addr, dst_addr_len); + status = pj_sock_sendto(rtp->rtcp->s, pkt, &_size, 0, dst_addr, dst_addr_len); } else { status = PJ_SUCCESS; } -- 1.7.11.2