# HG changeset patch # User Elliott Sales de Andrade # Date 1275082017 0 # Node ID 015cf7cacf23609e8a6f6c1303017373f5e3d39f # Parent f91771ab2eb10932a3f5282f2b3f1050b5c8b644 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. diff -r f91771ab2eb1 -r 015cf7cacf23 libpurple/protocols/msn/directconn.c --- 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))),