[asterisk-commits] russell: trunk r364462 - /trunk/main/md5.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 27 20:34:00 CDT 2012


Author: russell
Date: Fri Apr 27 20:33:49 2012
New Revision: 364462

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=364462
Log:
md5: supress some compiler warnings.

md5.c: In function ‘MD5Final’:
md5.c:154:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
md5.c:155:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

There is an md5 unit test and it still passes.

Modified:
    trunk/main/md5.c

Modified: trunk/main/md5.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/md5.c?view=diff&rev=364462&r1=364461&r2=364462
==============================================================================
--- trunk/main/md5.c (original)
+++ trunk/main/md5.c Fri Apr 27 20:33:49 2012
@@ -123,6 +123,7 @@
 {
 	unsigned count;
 	unsigned char *p;
+	uint32_t *in_buf;
 
 	/* Compute number of bytes mod 64 */
 	count = (ctx->bits[0] >> 3) & 0x3F;
@@ -151,8 +152,9 @@
 	byteReverse(ctx->in, 14);
 
 	/* Append length in bits and transform */
-	((uint32_t *) ctx->in)[14] = ctx->bits[0];
-	((uint32_t *) ctx->in)[15] = ctx->bits[1];
+	in_buf = (uint32_t *) ctx->in;
+	in_buf[14] = ctx->bits[0];
+	in_buf[15] = ctx->bits[1];
 
 	MD5Transform(ctx->buf, (uint32_t *) ctx->in);
 	byteReverse((unsigned char *) ctx->buf, 4);




More information about the asterisk-commits mailing list