Module: sip-router
Branch: ser_core_cvs
Commit: 018226b08a8ec20c79d324bc4c398bff9a87728a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=018226b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Nov 28 15:24:15 2008 +0000
more type punning warnings fixed
---
io_wait.h | 8 ++++++--
ip_addr.c | 2 +-
ip_addr.h | 2 +-
modules/tm/t_cancel.c | 10 +++++++---
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/io_wait.h b/io_wait.h
index 9e047f4..148aa34 100644
--- a/io_wait.h
+++ b/io_wait.h
@@ -1142,6 +1142,9 @@ inline static int io_wait_loop_sigio_rt(io_wait_h* h, int t)
int sigio_fd;
struct fd_map* fm;
int revents;
+#ifdef SIGINFO64_WORKARROUND
+ int* pi;
+#endif
ret=1; /* 1 event per call normally */
@@ -1177,8 +1180,9 @@ again:
* On newer kernels this is fixed (si_band is long in the kernel too).
* -- andrei */
if ((_os_ver<0x020605) && (sizeof(siginfo.si_band)>sizeof(int))){
- sigio_band=*((int*)(void*)&siginfo.si_band);
- sigio_fd=*(((int*)(void*)&siginfo.si_band)+1);
+ pi=(int*)(void*)&siginfo.si_band; /* avoid type punning warnings */
+ sigio_band=*pi;
+ sigio_fd=*(pi+1);
}else
#endif
{
diff --git a/ip_addr.c b/ip_addr.c
index 7f73775..e17a69d 100644
--- a/ip_addr.c
+++ b/ip_addr.c
@@ -190,7 +190,7 @@ int is_mcast(struct ip_addr* ip)
return IN_MULTICAST(htonl(ip->u.addr32[0]));
#ifdef USE_IPV6
} else if (ip->af==AF_INET6){
- return IN6_IS_ADDR_MULTICAST((struct in6_addr *)&ip->u.addr);
+ return IN6_IS_ADDR_MULTICAST(&ip->u.addr32[0]);
#endif /* USE_IPV6 */
} else {
LOG(L_ERR, "ERROR: is_mcast: Unsupported protocol family\n");
diff --git a/ip_addr.h b/ip_addr.h
index 11d9f8c..6849a87 100644
--- a/ip_addr.h
+++ b/ip_addr.h
@@ -242,7 +242,7 @@ inline static int ip_addr_loopback(struct ip_addr* ip)
return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
#ifdef USE_IPV6
else if (ip->af==AF_INET6)
- return IN6_IS_ADDR_LOOPBACK((struct in6_addr *)&ip->u.addr32);
+ return IN6_IS_ADDR_LOOPBACK(&ip->u.addr32[0]);
#endif /* USE_IPV6 */
return 0;
}
diff --git a/modules/tm/t_cancel.c b/modules/tm/t_cancel.c
index 96e4a84..4856abe 100644
--- a/modules/tm/t_cancel.c
+++ b/modules/tm/t_cancel.c
@@ -194,6 +194,7 @@ int cancel_branch( struct cell *t, int branch, int flags )
struct retr_buf *crb, *irb;
int ret;
branch_bm_t tmp_bm;
+ void* pcbuf;
crb=&t->uac[branch].local_cancel;
irb=&t->uac[branch].request;
@@ -216,7 +217,8 @@ int cancel_branch( struct cell *t, int branch, int flags )
DBG("DEBUG: cancel_branch: no response ever received: "
"giving up on cancel\n");
/* remove BUSY_BUFFER -- mark cancel buffer as not used */
- atomic_set_long((void*)&crb->buffer, 0);
+ pcbuf=&crb->buffer; /* workaround for type punning warnings */
+ atomic_set_long(pcbuf, 0);
if (flags & F_CANCEL_B_FAKE_REPLY){
LOCK_REPLIES(t);
if (relay_reply(t, FAKED_REPLY, branch, 487, &tmp_bm, 1) ==
@@ -235,7 +237,8 @@ int cancel_branch( struct cell *t, int branch, int flags )
if (!(flags & F_CANCEL_B_FORCE_RETR))
stop_rb_retr(irb); /* stop retransmissions */
/* remove BUSY_BUFFER -- mark cancel buffer as not used */
- atomic_set_long((void*)&crb->buffer, 0);
+ pcbuf=&crb->buffer; /* workaround for type punning warnings */
+ atomic_set_long(pcbuf, 0);
if (flags & F_CANCEL_B_FAKE_REPLY){
stop_rb_timers( irb ); /* stop even the fr timer */
LOCK_REPLIES(t);
@@ -262,7 +265,8 @@ int cancel_branch( struct cell *t, int branch, int flags )
if (!cancel) {
LOG(L_ERR, "ERROR: attempt to build a CANCEL failed\n");
/* remove BUSY_BUFFER -- mark cancel buffer as not used */
- atomic_set_long((void*)&crb->buffer, 0);
+ pcbuf=&crb->buffer; /* workaround for type punning warnings */
+ atomic_set_long(pcbuf, 0);
return -1;
}
/* install cancel now */