Fixed some compiler warnings

This commit is contained in:
zicodxx 2011-01-15 00:33:13 +01:00
parent 0d997ed81a
commit c0dfe46173
3 changed files with 20 additions and 9 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog D2X-Rebirth Changelog
20110115
--------
arch/linux/ipx.c, main/net_ipx.c: Fixed some compiler warnings
20110114 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) 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)

View file

@ -78,7 +78,8 @@ static int ipx_open_socket(socket_t *sk, int port)
} }
ipxs.sipx_family = AF_IPX; 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); */ /* ipxs.sipx_network = htonl(MyNetwork); */
bzero(ipxs.sipx_node, 6); /* Please fill in my node name */ bzero(ipxs.sipx_node, 6); /* Please fill in my node name */
ipxs.sipx_port = htons(port); 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 destination address is 0, then send to my net */
if (ipxs.sipx_network == 0) 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); memcpy(&ipxs.sipx_node, IPXHeader->Destination.Node, 6);

View file

@ -369,8 +369,8 @@ void ipxdrv_send_packet_data( ubyte * data, int datasize, ubyte *network, ubyte
if (driver->usepacketnum) if (driver->usepacketnum)
{ {
ubyte buf[MAX_IPX_DATA]; ubyte buf[MAX_IPX_DATA];
*(uint *)buf = ipx_packetnum++; memcpy(buf, &ipx_packetnum, 4);
ipx_packetnum++;
memcpy(buf + 4, data, datasize); memcpy(buf + 4, data, datasize);
driver->send_packet(&socket_data, &ipx_header, buf, datasize + 4); 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 objnum;
int pnum; int pnum;
uint server;
pnum = their->player.connected; 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; Netgame.players[pnum].version_minor=their->player.version_minor;
net_ipx_check_for_old_version(pnum); 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 ); ipxdrv_get_local_target( their->player.protocol.ipx.server, their->player.protocol.ipx.node, Players[pnum].net_address );
else else
memcpy(Players[pnum].net_address, their->player.protocol.ipx.node, 6); 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]; ubyte local_address[6];
int player_num; int player_num;
int i; int i;
uint server;
WaitForRefuseAnswer=0; WaitForRefuseAnswer=0;
@ -1174,7 +1177,8 @@ void net_ipx_welcome_player(IPX_sequence_packet *their)
memset(&IPX_sync_player, 0, sizeof(IPX_sequence_packet)); memset(&IPX_sync_player, 0, sizeof(IPX_sequence_packet));
Network_player_added = 0; 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 ); ipxdrv_get_local_target( their->player.protocol.ipx.server, their->player.protocol.ipx.node, local_address );
else else
memcpy(local_address, their->player.protocol.ipx.node, 6); 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; int i, j;
char temp_callsign[CALLSIGN_LEN+1]; char temp_callsign[CALLSIGN_LEN+1];
netgame_info tmp_info; netgame_info tmp_info;
uint server;
if (sp != &Netgame) 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 ); memcpy( Players[i].callsign, TempPlayersInfo->players[i].callsign, CALLSIGN_LEN+1 );
#ifdef WORDS_NEED_ALIGNMENT #ifdef WORDS_NEED_ALIGNMENT
uint server; memcpy(&server, sp->players[i].protocol.ipx.server, 4);
memcpy(&server, TempPlayersInfo->players[i].protocol.ipx.server, 4);
if (server != 0) if (server != 0)
ipxdrv_get_local_target((ubyte *)&server, TempPlayersInfo->players[i].protocol.ipx.node, Players[i].net_address); ipxdrv_get_local_target((ubyte *)&server, TempPlayersInfo->players[i].protocol.ipx.node, Players[i].net_address);
#else // WORDS_NEED_ALIGNMENT #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); ipxdrv_get_local_target(TempPlayersInfo->players[i].protocol.ipx.server, TempPlayersInfo->players[i].protocol.ipx.node, Players[i].net_address);
#endif // WORDS_NEED_ALIGNMENT #endif // WORDS_NEED_ALIGNMENT
else else