pidgin: 3a5b66b8: It's probably best just to be explicit a...

qulogic at pidgin.im qulogic at pidgin.im
Fri May 28 20:15:46 EDT 2010


-----------------------------------------------------------------
Revision: 3a5b66b889bbbc9a205caa41ca48bad7daba53f7
Ancestor: 3d06dcec459627c8d74d000f5ade3e6734a1508f
Author: qulogic at pidgin.im
Date: 2010-05-28T23:30:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3a5b66b889bbbc9a205caa41ca48bad7daba53f7

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

ChangeLog: 

It's probably best just to be explicit about the ordering here.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c	d55f3140d0dee9f71217f6b088035960eaba7c62
+++ libpurple/protocols/msn/directconn.c	ec805da71f3a0f8d8e1a9a985490dc634965cfd1
@@ -50,7 +50,6 @@ 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) {
@@ -63,18 +62,29 @@ 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,
+	          "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
 
-	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[3],
+	          digest[2],
+	          digest[1],
+	          digest[0],
+
+	          digest[5],
+	          digest[4],
+
+	          digest[7],
+	          digest[6],
+
+	          digest[8],
+	          digest[9],
+
+	          digest[10],
+	          digest[11],
+	          digest[12],
+	          digest[13],
+	          digest[14],
+	          digest[15]
 	);
 }
 


More information about the Commits mailing list