changeset 30120:ef7303c25751

For some reason, this line creates the following warning: directconn.c:67: warning: dereferencing type-punned pointer will break strict-aliasing rules I don't understand why it only happens for this line, and not the ones after it. At least this change stops the warning. If anyone knows how to properly fix it, or whether it's a bug in GCC or something, please let me know.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 28 May 2010 21:26:57 +0000
parents ee1af22b7242
children bf088afdc813 fc93bc1a546f
files libpurple/protocols/msn/directconn.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Fri May 28 20:51:29 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Fri May 28 21:26:57 2010 +0000
@@ -50,6 +50,7 @@
 msn_dc_calculate_nonce_hash(MsnDirectConnNonceType type,
                             const guchar nonce[16], gchar nonce_hash[37])
 {
+	guint32 *tmp;
 	guchar digest[20];
 
 	if (type == DC_NONCE_SHA1) {
@@ -62,9 +63,13 @@
 		memcpy(digest, nonce, 16);
 	}
 
+	/* TODO: Somebody please tell me why this first one causes a warning,
+	         but the others don't! */
+	tmp = (guint32 *)&digest[0];
+
 	g_sprintf(nonce_hash,
 	          "%08X-%04X-%04X-%04X-%08X%04X",
-	          GUINT32_FROM_LE(*((guint32 *)(digest + 0))),
+	          GUINT32_FROM_LE(*tmp),
 	          GUINT16_FROM_LE(*((guint16 *)(digest + 4))),
 	          GUINT16_FROM_LE(*((guint16 *)(digest + 6))),
 	          GUINT16_FROM_BE(*((guint16 *)(digest + 8))),