Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9899) Assertion failed: cont > 0, file improvement.c,
Home

[Freeciv-Dev] (PR#9899) Assertion failed: cont > 0, file improvement.c,

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bh@xxxxxxxxxxxxxxxxxxx, brett.albertson@xxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9899) Assertion failed: cont > 0, file improvement.c, line 289
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Wed, 1 Sep 2004 22:29:42 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9899 >

> [per - Thu Sep 02 04:46:24 2004]:
> 
> On Wed, 1 Sep 2004, Benoit Hudson wrote:
> > OK; thanks.Brett is right: it's related to byte order.  Basically, it's
> > a bug to cast a short* to an int*.On a little-endian machine, everything
> > turns out fine because you just clobber the following field with a
> > zero.On a big-endian machine, you set your field to zero, and the
> > following field to the right value (but then it'll be read next).
> >
> > Patch attached for the bug we noticed; there's lots more casting to int*
> > though that I am not fixing.
> 
> This patch does not help, since you fix an autogenerated file. We will
> need to fix common/generate_packets.py, which is a python script, so I
> cannot help out there.

I am not really strogn in this part of the code but it sort of feels as
if current code just cannot hadnle signed non-int variables.

Benoit, can you please check if the attached patch works?

G

? fix_cont.diff
Index: common/fc_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/fc_types.h,v
retrieving revision 1.4
diff -u -r1.4 fc_types.h
--- common/fc_types.h   1 Sep 2004 03:16:47 -0000       1.4
+++ common/fc_types.h   2 Sep 2004 05:21:41 -0000
@@ -18,7 +18,7 @@
  * occurs when a type which is defined in one file is needed for a fuction
  * definition in another file */
 
-typedef signed short Continent_id;
+typedef int Continent_id;
 typedef enum tile_terrain_type Terrain_type_id;
 
 /* TODO: Remove this enum and make this an integer when gen-eff is done. */

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