From c0dfe461735db737f24356a4ab7a04ba37d500e8 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Sat, 15 Jan 2011 00:33:13 +0100 Subject: [PATCH] Fixed some compiler warnings --- CHANGELOG.txt | 4 ++++ arch/linux/ipx.c | 6 ++++-- main/net_ipx.c | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b7518925a..8f39369cb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20110115 +-------- +arch/linux/ipx.c, main/net_ipx.c: Fixed some compiler warnings + 20110114 -------- arch/include/event.h, arch/include/key.h, arch/include/mouse.h, arch/sdl/event.c, arch/sdl/key.c, arch/sdl/mouse.c, editor/med.c, include/ui.h, main/automap.c, main/credits.c, main/escort.c, main/gamecntl.c, main/inferno.c, main/inferno.h, main/kconfig.c, main/kmatrix.c, main/menu.c, main/movie.c, main/net_ipx.c, main/net_udp.c, main/newmenu.c, main/scores.c, main/titles.c, ui/file.c, ui/keypress.c, ui/menu.c, ui/menubar.c, ui/message.c, ui/mouse.c, ui/popup.c, ui/window.c: For editor, replace use of ui_mega_process() with event_process(), with the editor's own default event handler; add EVENT_MOUSE_MOVED event with event_mouse_get_delta() accessor; add event_key_get() to replace ugly casting; rename mouse_get_button() with event_mouse_get_button() to keep with name convention; only send idle events when there are no input events so editor still works properly (or the same anyway); add and use event_send() function for input events (including idle) diff --git a/arch/linux/ipx.c b/arch/linux/ipx.c index 86ed126e4..f47078785 100644 --- a/arch/linux/ipx.c +++ b/arch/linux/ipx.c @@ -78,7 +78,8 @@ static int ipx_open_socket(socket_t *sk, int port) } ipxs.sipx_family = AF_IPX; - ipxs.sipx_network = *((unsigned int *)&MyAddress[0]); + memcpy(&ipxs.sipx_network, MyAddress, 4); +// ipxs.sipx_network = *((unsigned int *)&MyAddress[0]); /* ipxs.sipx_network = htonl(MyNetwork); */ bzero(ipxs.sipx_node, 6); /* Please fill in my node name */ ipxs.sipx_port = htons(port); @@ -132,7 +133,8 @@ static int ipx_send_packet(socket_t *mysock, IPXPacket_t *IPXHeader, u_char *dat /* if destination address is 0, then send to my net */ if (ipxs.sipx_network == 0) { - ipxs.sipx_network = *((unsigned int *)&MyAddress[0]); + memcpy(&ipxs.sipx_network, MyAddress, 4); +// ipxs.sipx_network = *((unsigned int *)&MyAddress[0]); } memcpy(&ipxs.sipx_node, IPXHeader->Destination.Node, 6); diff --git a/main/net_ipx.c b/main/net_ipx.c index cc3dbb1de..cc833165c 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -369,8 +369,8 @@ void ipxdrv_send_packet_data( ubyte * data, int datasize, ubyte *network, ubyte if (driver->usepacketnum) { ubyte buf[MAX_IPX_DATA]; - *(uint *)buf = ipx_packetnum++; - + memcpy(buf, &ipx_packetnum, 4); + ipx_packetnum++; memcpy(buf + 4, data, datasize); driver->send_packet(&socket_data, &ipx_header, buf, datasize + 4); } @@ -1062,6 +1062,7 @@ net_ipx_new_player(IPX_sequence_packet *their) { int objnum; int pnum; + uint server; pnum = their->player.connected; @@ -1090,7 +1091,8 @@ net_ipx_new_player(IPX_sequence_packet *their) Netgame.players[pnum].version_minor=their->player.version_minor; net_ipx_check_for_old_version(pnum); - if ( (*(uint *)their->player.protocol.ipx.server) != 0 ) + memcpy(&server, their->player.protocol.ipx.server, 4); + if ( server != 0 ) ipxdrv_get_local_target( their->player.protocol.ipx.server, their->player.protocol.ipx.node, Players[pnum].net_address ); else memcpy(Players[pnum].net_address, their->player.protocol.ipx.node, 6); @@ -1134,6 +1136,7 @@ void net_ipx_welcome_player(IPX_sequence_packet *their) ubyte local_address[6]; int player_num; int i; + uint server; WaitForRefuseAnswer=0; @@ -1174,7 +1177,8 @@ void net_ipx_welcome_player(IPX_sequence_packet *their) memset(&IPX_sync_player, 0, sizeof(IPX_sequence_packet)); Network_player_added = 0; - if ( (*(uint *)their->player.protocol.ipx.server) != 0 ) + memcpy(&server, their->player.protocol.ipx.server, 4); + if ( server != 0 ) ipxdrv_get_local_target( their->player.protocol.ipx.server, their->player.protocol.ipx.node, local_address ); else memcpy(local_address, their->player.protocol.ipx.node, 6); @@ -3127,6 +3131,7 @@ void net_ipx_read_sync_packet( netgame_info * sp, int rsinit) int i, j; char temp_callsign[CALLSIGN_LEN+1]; netgame_info tmp_info; + uint server; if (sp != &Netgame) { @@ -3180,12 +3185,12 @@ void net_ipx_read_sync_packet( netgame_info * sp, int rsinit) memcpy( Players[i].callsign, TempPlayersInfo->players[i].callsign, CALLSIGN_LEN+1 ); #ifdef WORDS_NEED_ALIGNMENT - uint server; - memcpy(&server, TempPlayersInfo->players[i].protocol.ipx.server, 4); + memcpy(&server, sp->players[i].protocol.ipx.server, 4); if (server != 0) ipxdrv_get_local_target((ubyte *)&server, TempPlayersInfo->players[i].protocol.ipx.node, Players[i].net_address); #else // WORDS_NEED_ALIGNMENT - if ((*(uint *)TempPlayersInfo->players[i].protocol.ipx.server) != 0) + memcpy(&server, sp->players[i].protocol.ipx.server, 4); + if ( server != 0 ) ipxdrv_get_local_target(TempPlayersInfo->players[i].protocol.ipx.server, TempPlayersInfo->players[i].protocol.ipx.node, Players[i].net_address); #endif // WORDS_NEED_ALIGNMENT else