changeset 30123:f7e1d5d397b6

It's probably best just to be explicit about the ordering here.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 28 May 2010 23:30:20 +0000
parents fc93bc1a546f
children bc9f74e9f596
files libpurple/protocols/msn/directconn.c
diffstat 1 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Fri May 28 23:16:57 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Fri May 28 23:30:20 2010 +0000
@@ -50,7 +50,6 @@
 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) {
@@ -63,18 +62,29 @@
 		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,
+	          "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+
+	          digest[3],
+	          digest[2],
+	          digest[1],
+	          digest[0],
+
+	          digest[5],
+	          digest[4],
 
-	g_sprintf(nonce_hash,
-	          "%08X-%04X-%04X-%04X-%08X%04X",
-	          GUINT32_FROM_LE(*tmp),
-	          GUINT16_FROM_LE(*((guint16 *)(digest + 4))),
-	          GUINT16_FROM_LE(*((guint16 *)(digest + 6))),
-	          GUINT16_FROM_BE(*((guint16 *)(digest + 8))),
-	          GUINT32_FROM_BE(*((guint32 *)(digest + 10))),
-	          GUINT16_FROM_BE(*((guint16 *)(digest + 14)))
+	          digest[7],
+	          digest[6],
+
+	          digest[8],
+	          digest[9],
+
+	          digest[10],
+	          digest[11],
+	          digest[12],
+	          digest[13],
+	          digest[14],
+	          digest[15]
 	);
 }