diff libgaim/protocols/qq/crypt.c @ 14610:473b225e7352

[gaim-migrate @ 17338] Eliminate a dependency in crypt.c by replacing ntohl() (etc) with g_ntohl() (etc). Also replace those calls in the rest of the QQ prpl, to be consistent. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Fri, 22 Sep 2006 16:05:09 +0000
parents ca943d7fb274
children c039c920e11c
line wrap: on
line diff
--- a/libgaim/protocols/qq/crypt.c	Fri Sep 22 06:45:01 2006 +0000
+++ b/libgaim/protocols/qq/crypt.c	Fri Sep 22 16:05:09 2006 +0000
@@ -38,12 +38,6 @@
 0x61C88647 is what we can track on the ASM codes.!!
 */
 
-#ifdef _WIN32
-#include "win32dep.h"
-#else
-#include <arpa/inet.h>
-#endif
-
 #include <string.h>
 
 #include "crypt.h"
@@ -56,12 +50,12 @@
 /* Tiny Encryption Algorithm (TEA) */
 static void qq_encipher(guint32 *const v, const guint32 *const k, guint32 *const w)
 {
-	register guint32 y = ntohl(v[0]), 
-		 z = ntohl(v[1]), 
-		 a = ntohl(k[0]), 
-		 b = ntohl(k[1]), 
-		 c = ntohl(k[2]), 
-		 d = ntohl(k[3]), 
+	register guint32 y = g_ntohl(v[0]), 
+		 z = g_ntohl(v[1]), 
+		 a = g_ntohl(k[0]), 
+		 b = g_ntohl(k[1]), 
+		 c = g_ntohl(k[2]), 
+		 d = g_ntohl(k[3]), 
 		 n = 0x10, 
 		 sum = 0, 
 		 delta = 0x9E3779B9;	/*  0x9E3779B9 - 0x100000000 = -0x61C88647 */
@@ -72,8 +66,8 @@
 		z += ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d);
 	}
 
-	w[0] = htonl(y);
-	w[1] = htonl(z);
+	w[0] = g_htonl(y);
+	w[1] = g_htonl(z);
 }
 
 static gint rand(void) {	/* it can be the real random seed function */
@@ -175,12 +169,12 @@
 
 static void qq_decipher(guint32 *const v, const guint32 *const k, guint32 *const w)
 {
-	register guint32 y = ntohl(v[0]), 
-		z = ntohl(v[1]), 
-		a = ntohl(k[0]), 
-		b = ntohl(k[1]), 
-		c = ntohl(k[2]), 
-		d = ntohl(k[3]), 
+	register guint32 y = g_ntohl(v[0]), 
+		z = g_ntohl(v[1]), 
+		a = g_ntohl(k[0]), 
+		b = g_ntohl(k[1]), 
+		c = g_ntohl(k[2]), 
+		d = g_ntohl(k[3]), 
 		n = 0x10, 
 		sum = 0xE3779B90,	/* why this ? must be related with n value */
 		delta = 0x9E3779B9;
@@ -192,8 +186,8 @@
 		sum -= delta;
 	}
 
-	w[0] = htonl(y);
-	w[1] = htonl(z);
+	w[0] = g_htonl(y);
+	w[1] = g_htonl(z);
 }
 
 static gint decrypt_block(const guint8 **crypt_buff, const gint instrlen,