Fixed some fatal networking bugs during the first run.
authorshort <>
Thu, 20 May 2004 16:47:23 +0000 (16:47 +0000)
committershort <>
Thu, 20 May 2004 16:47:23 +0000 (16:47 +0000)
src/network.c
src/packet.c

index e39dfc1..aaa0f47 100644 (file)
@@ -474,8 +474,8 @@ size_t packet_length;
        probe_unique=g_random_int();
 
        probe_hash=g_hash_table_new(
-                       g_int_hash,     /* hash_func */
-                       g_int_equal);   /* key_equal_func */
+                       g_direct_hash,  /* hash_func */
+                       g_direct_equal);        /* key_equal_func */
        g_hash_table_insert(probe_hash,GUINT_TO_POINTER(PACKET_ELEM_TYPE_CLIENT_PORT) ,GUINT_TO_POINTER(port_local));
        g_hash_table_insert(probe_hash,GUINT_TO_POINTER(PACKET_ELEM_TYPE_DATA_GUINT32),GUINT_TO_POINTER(probe_unique));
        packet=packet_assembly(&packet_length,probe_hash);
index 82dbecb..142c1bf 100644 (file)
@@ -56,7 +56,7 @@ guint32 value_guint32_htonl=htonl(value_guint32);
 
        g_return_if_fail(gstring!=NULL);
 
-       g_assert(sizeof(value_guint32_htonl)==4);
+       g_assert(4==sizeof(value_guint32_htonl));
        packet_assembly_guint32(gstring,sizeof(value_guint32_htonl));
        packet_assembly_guint32(gstring,value_guint32_htonl);
 }
@@ -67,7 +67,7 @@ guint16 value_guint16_htonl=htons(value_guint16);
 
        g_return_if_fail(gstring!=NULL);
 
-       g_assert(sizeof(value_guint16_htonl)==4);
+       g_assert(2==sizeof(value_guint16_htonl));
        packet_assembly_guint32(gstring,sizeof(value_guint16_htonl));
        packet_assembly_guint16(gstring,value_guint16_htonl);
 }
@@ -269,8 +269,8 @@ GSList *items;
        g_return_val_if_fail(packet!=NULL,NULL);
 
        r=g_hash_table_new_full(
-                       g_int_hash,     /* hash_func */
-                       g_int_equal,    /* key_equal_func */
+                       g_direct_hash,  /* hash_func */
+                       g_direct_equal, /* key_equal_func */
                        NULL,   /* key_destroy_func */
                        packet_disassembly_value_destroy_func); /* value_destroy_func */
        packet_end=packet+packet_length;