[svn-commits] jpeeler: branch 1.4 r208746 - in /branches/1.4: channels/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jul 25 01:19:56 CDT 2009


Author: jpeeler
Date: Sat Jul 25 01:19:50 2009
New Revision: 208746

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=208746
Log:
Fix compiling under dev-mode with gcc 4.4.0.

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.


Modified:
    branches/1.4/channels/chan_iax2.c
    branches/1.4/channels/chan_skinny.c
    branches/1.4/main/translate.c

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=208746&r1=208745&r2=208746
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Sat Jul 25 01:19:50 2009
@@ -3722,7 +3722,7 @@
 		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;
 	}

Modified: branches/1.4/channels/chan_skinny.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_skinny.c?view=diff&rev=208746&r1=208745&r2=208746
==============================================================================
--- branches/1.4/channels/chan_skinny.c (original)
+++ branches/1.4/channels/chan_skinny.c Sat Jul 25 01:19:50 2009
@@ -4436,6 +4436,7 @@
 {
 	int res;
 	int dlen = 0;
+	int *bufaddr;
 	struct pollfd fds[1];
 
  	fds[0].fd = s->fd;
@@ -4482,7 +4483,8 @@
 			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 @@
 		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 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);
 

Modified: branches/1.4/main/translate.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/translate.c?view=diff&rev=208746&r1=208745&r2=208746
==============================================================================
--- branches/1.4/main/translate.c (original)
+++ branches/1.4/main/translate.c Sat Jul 25 01:19:50 2009
@@ -920,7 +920,7 @@
 	   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 @@
 	   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




More information about the svn-commits mailing list