From: short <> Date: Thu, 20 May 2004 16:47:23 +0000 (+0000) Subject: Fixed some fatal networking bugs during the first run. X-Git-Tag: udpgate-1_0~56 X-Git-Url: http://git.jankratochvil.net/?p=udpgate.git;a=commitdiff_plain;h=675e86b3896b2cc3e570233230e016a12752e87b Fixed some fatal networking bugs during the first run. --- diff --git a/src/network.c b/src/network.c index e39dfc1..aaa0f47 100644 --- a/src/network.c +++ b/src/network.c @@ -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); diff --git a/src/packet.c b/src/packet.c index 82dbecb..142c1bf 100644 --- a/src/packet.c +++ b/src/packet.c @@ -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;