core: pointer aliasing warnings fixed
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Mon, 12 Oct 2009 16:49:28 +0000 (18:49 +0200)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Mon, 12 Oct 2009 16:49:28 +0000 (18:49 +0200)
pass_fd.c
route.c
usr_avp.c

index 7a2b30c..f7fbf7f 100644 (file)
--- a/pass_fd.c
+++ b/pass_fd.c
@@ -160,6 +160,7 @@ int send_fd(int unix_socket, void* data, int data_len, int fd)
        struct iovec iov[1];
        int ret;
 #ifdef HAVE_MSGHDR_MSG_CONTROL
+       int* pi;
        struct cmsghdr* cmsg;
        /* make sure msg_control will point to properly aligned data */
        union {
@@ -176,7 +177,8 @@ int send_fd(int unix_socket, void* data, int data_len, int fd)
        cmsg->cmsg_level = SOL_SOCKET;
        cmsg->cmsg_type = SCM_RIGHTS;
        cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
-       *(int*)CMSG_DATA(cmsg)=fd;
+       pi=(int*)CMSG_DATA(cmsg);
+       *pi=fd;
        msg.msg_flags=0;
 #else
        msg.msg_accrights=(caddr_t) &fd;
@@ -225,6 +227,7 @@ int receive_fd(int unix_socket, void* data, int data_len, int* fd, int flags)
        int f;
 #endif /*NO_MSG_WAITALL */
 #ifdef HAVE_MSGHDR_MSG_CONTROL
+       int* pi;
        struct cmsghdr* cmsg;
        union{
                struct cmsghdr cm;
@@ -308,7 +311,8 @@ poll_again:
                        ret=-1;
                        goto error;
                }
-               *fd=*((int*) CMSG_DATA(cmsg));
+               pi=(int*) CMSG_DATA(cmsg);
+               *fd=*pi;
        }else{
                /*
                LOG(L_ERR, "ERROR: receive_fd: no descriptor passed, cmsg=%p,"
diff --git a/route.c b/route.c
index fc25c64..2d9036c 100644 (file)
--- a/route.c
+++ b/route.c
@@ -727,7 +727,7 @@ int fix_actions(struct action* a)
                                                return E_UNSPEC;
                                        }
                                        */
-                                       if ((ret=fix_rval_expr((void**)&rve))<0)
+                                       if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
                                                return ret;
                                }
                                if ( (t->val[1].type==ACTIONS_ST)&&(t->val[1].u.data) ){
@@ -800,7 +800,7 @@ int fix_actions(struct action* a)
                                                                rve->fpos.s_line, rve->fpos.s_col);
                                                return E_UNSPEC;
                                        }
-                                       if ((ret=fix_rval_expr((void**)&rve))<0)
+                                       if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
                                                return ret;
                                }else{
                                        LOG(L_CRIT, "BUG: fix_actions: null while()"
@@ -841,7 +841,7 @@ int fix_actions(struct action* a)
                                                                rve->fpos.s_line, rve->fpos.s_col);
                                                return E_UNSPEC;
                                        }
-                                       if ((ret=fix_rval_expr((void**)&rve))<0)
+                                       if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
                                                return ret;
                                }else{
                                        LOG(L_CRIT, "BUG: fix_actions: null drop/return"
index 53f38e4..a759664 100644 (file)
--- a/usr_avp.c
+++ b/usr_avp.c
@@ -306,10 +306,10 @@ inline str* get_avp_name(avp_t *avp)
                        return 0;
                case AVP_NAME_STR:
                        /* avp type str, int value */
-                       return &((struct str_int_data*)&avp->d.data[0])->name;
+                       return &((struct str_int_data*)avp->d.p)->name;
                case AVP_NAME_STR|AVP_VAL_STR:
                        /* avp type str, str value */
-                       return &((struct str_str_data*)&avp->d.data[0])->name;
+                       return &((struct str_str_data*)avp->d.p)->name;
        }
 
        LOG(L_ERR,"BUG:avp:get_avp_name: unknown avp type (name&val) %d\n",
@@ -331,15 +331,15 @@ inline void get_avp_val(avp_t *avp, avp_value_t *val)
                        break;
                case AVP_NAME_STR:
                        /* avp type str, int value */
-                       val->n = ((struct str_int_data*)&avp->d.data[0])->val;
+                       val->n = ((struct str_int_data*)avp->d.p)->val;
                        break;
                case AVP_VAL_STR:
                        /* avp type ID, str value */
-                       val->s = *(str*)&avp->d.data[0];
+                       val->s = *(str*)avp->d.p;
                        break;
                case AVP_NAME_STR|AVP_VAL_STR:
                        /* avp type str, str value */
-                       val->s = ((struct str_str_data*)&avp->d.data[0])->val;
+                       val->s = ((struct str_str_data*)avp->d.p)->val;
                        break;
        }
 }