[Freeciv-Dev] Re: 3 suspicous code parts
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 2000/08/06 11:47 , Dirk Stoecker wrote:
>
>the source has some suspicous format strings:
We require an ANSI compiler...
>server/gamehand.c lines 429 and 719:
>%8X is used, where %X is non-standard. Only lower case %x ist standard.
>I know at least 1 compiler, which does not support %X.
And, well, "X" is a defined conversion in the ANSI C spec that I use...
However, since it only occurs in two format strings, both of which are used
for save games, *and* changing to "x" will not break backward
compatibility, I think we could make this change.
>clients/options.c lines 272 and 314:
>%2.2d is used, but %d does not support anything with '.'. It is integer
>an not floating point.
Again, this is ANSI compliant...
However (again :), an analogous effect can be had by changing to "%02d", so
we could make this change, also...
>And another thing:
>
>server/meta.c line 193:
> if ((bad = ((serv_addr.sin_addr.s_addr = inet_addr(servername)) == -1))) {
>
>Isn't the value of type u_long? It is at least on my machine.
>So the compiler removes the comparison. Either it must be == (u_long) -1
>or it has no effect:
>
>warning 165 in line 193 of "server/meta.c": comparison redundant because
operand is unsigned
Yup. (Well, "unsigned long", actually.) There is another case of this in
the client code.
Attached is a patch which makes these changes.
suspicious-0.diff
Description: Text document
jjm
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: 3 suspicous code parts,
Jeff Mallatt <=
|
|