]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix compiling under dev-mode with gcc 4.4.0.
authorJeff Peeler <jpeeler@digium.com>
Sat, 25 Jul 2009 06:19:50 +0000 (06:19 +0000)
committerJeff Peeler <jpeeler@digium.com>
Sat, 25 Jul 2009 06:19:50 +0000 (06:19 +0000)
Mostly trivial changes, but I did not know of any other way to fix the
"dereferencing type-punned pointer will break strict-aliasing rules" error
without creating a tmp variable in chan_skinny.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@208746 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c
channels/chan_skinny.c
main/translate.c

index efce3d14d8f1918cca588ce5697619af173af149..a7f008f2b695112c3bca1ba989fc2b0a78b6a745 100644 (file)
@@ -3722,7 +3722,7 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha
                return AST_BRIDGE_FAILED;
        }
        /* Put them in native bridge mode */
-       if (!flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1)) {
+       if ((!flags) & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1)) {
                iaxs[callno0]->bridgecallno = callno1;
                iaxs[callno1]->bridgecallno = callno0;
        }
index 983dbf847391e7e328af1d799aa3ca184ef1793c..90e59c2a3c91e5c7ce1744e73e7c2d855605e4bb 100644 (file)
@@ -4436,6 +4436,7 @@ static int get_input(struct skinnysession *s)
 {
        int res;
        int dlen = 0;
+       int *bufaddr;
        struct pollfd fds[1];
 
        fds[0].fd = s->fd;
@@ -4482,7 +4483,8 @@ static int get_input(struct skinnysession *s)
                        return -1;
                }
                
-               dlen = letohl(*(int *)s->inbuf);
+               bufaddr = (int *)s->inbuf;
+               dlen = letohl(*bufaddr);
                if (dlen < 4) {
                        ast_log(LOG_WARNING, "Skinny Client sent invalid data.\n");
                        ast_mutex_unlock(&s->lock);
@@ -4491,7 +4493,7 @@ static int get_input(struct skinnysession *s)
                if (dlen+8 > sizeof(s->inbuf)) {
                        dlen = sizeof(s->inbuf) - 8;
                }
-               *(int *)s->inbuf = htolel(dlen);
+               *bufaddr = htolel(dlen);
 
                res = read(s->fd, s->inbuf+4, dlen+4);
                ast_mutex_unlock(&s->lock);
@@ -4510,13 +4512,15 @@ static int get_input(struct skinnysession *s)
 static struct skinny_req *skinny_req_parse(struct skinnysession *s)
 {
        struct skinny_req *req;
+       int *bufaddr;
 
        if (!(req = ast_calloc(1, SKINNY_MAX_PACKET)))
                return NULL;
 
        ast_mutex_lock(&s->lock);
        memcpy(req, s->inbuf, skinny_header_size);
-       memcpy(&req->data, s->inbuf+skinny_header_size, letohl(*(int*)(s->inbuf))-4);
+       bufaddr = (int *)(s->inbuf);
+       memcpy(&req->data, s->inbuf+skinny_header_size, letohl(*bufaddr)-4);
 
        ast_mutex_unlock(&s->lock);
 
index 598520c07040834dc4580bf9037cf9a29523abe6..e801e0e448712a720381215e95b09f68fe9ad0cc 100644 (file)
@@ -920,7 +920,7 @@ unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src
           destination format. */
        for (x = 1; src_audio && x < AST_FORMAT_MAX_AUDIO; x <<= 1) {
                /* if this is not a desired format, nothing to do */
-               if (!dest & x)
+               if ((!dest) & x)
                        continue;
 
                /* if the source is supplying this format, then
@@ -946,7 +946,7 @@ unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src
           destination format. */
        for (; src_video && x < AST_FORMAT_MAX_VIDEO; x <<= 1) {
                /* if this is not a desired format, nothing to do */
-               if (!dest & x)
+               if ((!dest) & x)
                        continue;
 
                /* if the source is supplying this format, then