Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] (PR#15840) common/dataio.c:700 is dubious
Home

[Freeciv-Dev] (PR#15840) common/dataio.c:700 is dubious

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15840) common/dataio.c:700 is dubious
From: "Guillaume Melquiond" <guillaume.melquiond@xxxxxxxxx>
Date: Fri, 10 Mar 2006 12:30:40 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15840 >

I was giving a shot at compiling freeciv (gtk client) with gcc 4.1 and
it went surprisingly well. The only type-prunning it detected was at
common/dataio.c:702. A pointer to an enumeration (possibly a single
char) is transformed into a pointer to int, and then used to store an
int in memory. Actually, this does not crash since this is the first
field of the structure and hence it is aligned; and moreover the other
fields it overrides along the way do not matter.

Still this is really bad practice and I was about to fix it. But then
I noticed that only four of the six fields of player_diplstate are
serialized: max_state and has_reason_to_cancel are neither serialized
nor initialized. So I'm wondering: Do these serialization functions
really do what they are expected to do?





[Prev in Thread] Current Thread [Next in Thread]