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

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

[Top] [All Lists]

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

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

Benoit Hudson wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9899 >
> 
> I've never seen python code before, but here's something that might work.

It looks right.  However we should pay at least lip service to style and 
have a few newlines with some indentation in there.  Try this patch and 
make sure it works.

jason

Index: common/generate_packets.py
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/generate_packets.py,v
retrieving revision 1.12
diff -u -r1.12 generate_packets.py
--- common/generate_packets.py  22 May 2004 11:37:40 -0000      1.12
+++ common/generate_packets.py  2 Sep 2004 05:15:31 -0000
@@ -432,7 +432,12 @@
         if not self.is_array:
             if self.struct_type=="bool":
                 return "dio_get_%(dataio_type)s(&din, 
&real_packet->%(name)s);"%self.__dict__
-            return "dio_get_%(dataio_type)s(&din, (int *) 
&real_packet->%(name)s);"%self.__dict__
+            return '''{
+  int readin;
+
+  dio_get_%(dataio_type)s(&din, &readin);
+  real_packet->%(name)s = readin;
+}'''%self.__dict__
 
         if self.is_struct:
             c="dio_get_%(dataio_type)s(&din, 
&real_packet->%(name)s[i]);"%self.__dict__
@@ -446,7 +451,12 @@
         elif self.struct_type=="bool":
             c="dio_get_%(dataio_type)s(&din, 
&real_packet->%(name)s[i]);"%self.__dict__
         else:
-            c="dio_get_%(dataio_type)s(&din, (int *) 
&real_packet->%(name)s[i]);"%self.__dict__
+            c='''{
+  int readin;
+
+  dio_get_%(dataio_type)s(&din, &readin);
+  real_packet->%(name)s[i] = readin;
+}'''%self.__dict__
         if self.is_array==2:
             array_size_u=self.array_size1_u
             array_size_d=self.array_size1_d

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