pidgin: 3c21b2e0: For some reason, this line creates the f...

qulogic at pidgin.im qulogic at pidgin.im
Fri May 28 17:35:41 EDT 2010


-----------------------------------------------------------------
Revision: 3c21b2e016838fd091f44504a2642f7e090323e0
Ancestor: 7f7ef3aa89b9c72fb9cb9d2eb1916d051a108d17
Author: qulogic at pidgin.im
Date: 2010-05-28T21:26:57
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3c21b2e016838fd091f44504a2642f7e090323e0

Modified files:
        libpurple/protocols/msn/directconn.c

ChangeLog: 

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.


-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c	a01f57fef4de034cb9fae5b9aab70dfad4ae8a7b
+++ libpurple/protocols/msn/directconn.c	d55f3140d0dee9f71217f6b088035960eaba7c62
@@ -50,6 +50,7 @@ msn_dc_calculate_nonce_hash(MsnDirectCon
 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 @@ msn_dc_calculate_nonce_hash(MsnDirectCon
 		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))),


More information about the Commits mailing list