[Freeciv-Dev] (PR#9750) compile warning in 1.14
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9750 >
<per> packets.c: In function `get_packet_from_connection':
<per> packets.c:202: warning: dereferencing type-punned pointer will
break strict-aliasing rules
<per> warning in S1_14
<per> packets.c: In function `receive_packet_goto_route':
<per> packets.c:2904: warning: dereferencing type-punned pointer will
break strict-aliasing rules
This patch should fix it (untested).
jason
? common/aicore/.deps
? common/aicore/Makefile
? common/aicore/Makefile.in
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.219.2.4
diff -u -r1.219.2.4 packets.c
--- common/packets.c 19 Jul 2003 04:08:39 -0000 1.219.2.4
+++ common/packets.c 20 Aug 2004 19:54:13 -0000
@@ -185,7 +185,7 @@
void *get_packet_from_connection(struct connection *pc,
enum packet_type *ptype, bool * presult)
{
- int len;
+ int len, itpe;
enum packet_type type;
struct data_in din;
@@ -199,7 +199,8 @@
dio_input_init(&din, pc->buffer->data, pc->buffer->ndata);
dio_get_uint16(&din, &len);
- dio_get_uint8(&din, (int *) &type);
+ dio_get_uint8(&din, &itype);
+ type = itype;
if(pc->first_packet) {
/* the first packet better be short: */
@@ -2890,7 +2891,7 @@
struct packet_goto_route *receive_packet_goto_route(struct connection *pc)
{
struct data_in din;
- int i, num_valid = 0;
+ int i, num_valid = 0, itype;
enum packet_goto_route_type type;
struct map_position pos[GOTO_CHUNK];
struct map_position *pos2;
@@ -2901,7 +2902,8 @@
dio_get_uint16(&din, NULL);
dio_get_uint8(&din, NULL);
- dio_get_uint8(&din, (int *)&type);
+ dio_get_uint8(&din, &itype);
+ type = itype;
for (i = 0; i < GOTO_CHUNK; i++) {
dio_get_uint8(&din, &pos[i].x);
dio_get_uint8(&din, &pos[i].y);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9750) compile warning in 1.14,
Jason Short <=
|
|