diff libpurple/protocols/qq/packet_parse.c @ 23051:55f986ccbb6a

patch-05-reconnect-and-code-cleanup
author SHiNE CsyFeK <csyfek@gmail.com>
date Tue, 24 Jun 2008 12:28:38 +0000
parents 51dbe83ebbd3
children 1c50f12b1c52
line wrap: on
line diff
--- a/libpurple/protocols/qq/packet_parse.c	Tue Jun 24 12:22:40 2008 +0000
+++ b/libpurple/protocols/qq/packet_parse.c	Tue Jun 24 12:28:38 2008 +0000
@@ -33,9 +33,7 @@
 /* note:
  * 1, in these functions, 'b' stands for byte, 'w' stands for word, 'dw' stands for double word.
  * 2, we use '*cursor' and 'buf' as two addresses to calculate the length.
- * 3, fixed obscure bugs, thanks ccpaging.
- * 4, change '0' to '1', if want to get more info about the packet parsing.
- * by s3e, 20070717 */
+ * 3, change '0' to '1', if want to get more info about the packet parsing. */
 
 #if 0
 #define PARSER_DEBUG
@@ -49,8 +47,8 @@
 	memcpy(&b_dest, buf, sizeof(b_dest));
 	*b = b_dest;
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get8] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get8] b_dest 0x%2x, *b 0x%02x\n", b_dest, *b);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get8] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get8] b_dest 0x%2x, *b 0x%02x\n", b_dest, *b);
 #endif
 	return sizeof(b_dest);
 }
@@ -64,8 +62,8 @@
 	memcpy(&w_dest, buf, sizeof(w_dest));
 	*w = g_ntohs(w_dest);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get16] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get16] w_dest 0x%04x, *w 0x%04x\n", w_dest, *w);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get16] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get16] w_dest 0x%04x, *w 0x%04x\n", w_dest, *w);
 #endif
 	return sizeof(w_dest);
 }
@@ -79,8 +77,8 @@
 	memcpy(&dw_dest, buf, sizeof(dw_dest));
 	*dw = g_ntohl(dw_dest);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get32] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][get32] dw_dest 0x%08x, *dw 0x%08x\n", dw_dest, *dw);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get32] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][get32] dw_dest 0x%08x, *dw 0x%08x\n", dw_dest, *dw);
 #endif
 	return sizeof(dw_dest);
 }
@@ -92,7 +90,7 @@
 {
     memcpy(data, buf, datalen);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][getdata] buf %lu\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][getdata] buf %p\n", (void *)buf);
 #endif
     return datalen;
 }
@@ -106,12 +104,12 @@
 	guint32 dw_dest;
 	memcpy(&dw_dest, buf, sizeof(dw_dest));
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][getime] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][getime] dw_dest before 0x%08x\n", dw_dest);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][getime] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][getime] dw_dest before 0x%08x\n", dw_dest);
 #endif
 	dw_dest = g_ntohl(dw_dest);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][getime] dw_dest after 0x%08x\n", dw_dest);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][getime] dw_dest after 0x%08x\n", dw_dest);
 #endif
 	memcpy(t, &dw_dest, sizeof(dw_dest));
 	return sizeof(dw_dest);
@@ -124,8 +122,8 @@
 {
     memcpy(buf, &b, sizeof(b));
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put8] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put8] b 0x%02x\n", b);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put8] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put8] b 0x%02x\n", b);
 #endif
     return sizeof(b);
 }
@@ -138,8 +136,8 @@
     guint16 w_porter;
     w_porter = g_htons(w);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put16] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put16] w 0x%04x, w_porter 0x%04x\n", w, w_porter);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put16] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put16] w 0x%04x, w_porter 0x%04x\n", w, w_porter);
 #endif
     memcpy(buf, &w_porter, sizeof(w_porter));
     return sizeof(w_porter);
@@ -153,8 +151,8 @@
     guint32 dw_porter;
     dw_porter = g_htonl(dw);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put32] buf %lu\n", (void *)buf);
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put32] buf %p\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter);
 #endif
     memcpy(buf, &dw_porter, sizeof(dw_porter));
     return sizeof(dw_porter);
@@ -167,7 +165,7 @@
 {
     memcpy(buf, data, datalen);
 #ifdef PARSER_DEBUG
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "[DBG][putdata] buf %lu\n", (void *)buf);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "[DBG][putdata] buf %p\n", (void *)buf);
 #endif
     return datalen;
 }