Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#11283) [C++] explicit cast on void pointer
Home

[Freeciv-Dev] Re: (PR#11283) [C++] explicit cast on void pointer

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#11283) [C++] explicit cast on void pointer
From: "Frédéric Brière" <fbriere@xxxxxxxxxxx>
Date: Sun, 6 Mar 2005 22:24:09 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's an updated patch, since the previous one has long been outdated.
(Three months is a looong time for freeciv CVS.)


-- 
             Frédéric Brière    <*>    fbriere@xxxxxxxxxxx

 =>  <fbriere@xxxxxxxxxx> IS NO MORE:  <http://www.abacomsucks.com>  <=

Index: utility/speclist.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/speclist.h,v
retrieving revision 1.8
diff -u -r1.8 speclist.h
--- utility/speclist.h  22 Jan 2005 19:45:45 -0000      1.8
+++ utility/speclist.h  7 Mar 2005 05:46:44 -0000
@@ -79,7 +79,7 @@
 
 static inline SPECLIST_LIST *SPECLIST_FOO(_list_new) (void)
 {
-  SPECLIST_LIST *speclist = fc_malloc(sizeof(*speclist));
+  SPECLIST_LIST *speclist = (SPECLIST_LIST *)fc_malloc(sizeof(*speclist));
 
   speclist->list = genlist_new();
   return speclist;
@@ -102,7 +102,7 @@
 
 static inline SPECLIST_TYPE *SPECLIST_FOO(_list_get) (const SPECLIST_LIST 
*tthis, int index)
 {
-  return genlist_get(tthis->list, index);
+  return (SPECLIST_TYPE *)genlist_get(tthis->list, index);
 }
 
 static inline void SPECLIST_FOO(_list_append) (SPECLIST_LIST *tthis, 
SPECLIST_TYPE *pfoo)
Index: utility/specvec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/specvec.h,v
retrieving revision 1.9
diff -u -r1.9 specvec.h
--- utility/specvec.h   5 Dec 2004 10:07:32 -0000       1.9
+++ utility/specvec.h   7 Mar 2005 05:46:44 -0000
@@ -93,7 +93,7 @@
   if (size > tthis->size_alloc) {
     size_t new_size = MAX(size, tthis->size_alloc * 2);
 
-    tthis->p = fc_realloc(tthis->p, new_size * sizeof(*tthis->p));
+    tthis->p = (SPECVEC_TYPE *)fc_realloc(tthis->p, new_size * 
sizeof(*tthis->p));
     tthis->size_alloc = new_size;
   }
   tthis->size = size;
Index: utility/genlist.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/genlist.h,v
retrieving revision 1.13
diff -u -r1.13 genlist.h
--- utility/genlist.h   22 Jan 2005 19:45:45 -0000      1.13
+++ utility/genlist.h   7 Mar 2005 05:49:00 -0000
@@ -94,7 +94,7 @@
   struct genlist_link *myiter = (typed_list)->list->head_link;\
   atype *var;                                              \
   for(; ITERATOR_PTR(myiter);) {                           \
-    var = ITERATOR_PTR(myiter);                                   \
+    var = (atype *)ITERATOR_PTR(myiter);                                  \
     ITERATOR_NEXT(myiter);
 
 /* Balance for above: */ 
@@ -106,7 +106,7 @@
   struct genlist_link *myiter = (typed_list)->list->tail_link;\
   atype *var;                                              \
   for(; ITERATOR_PTR(myiter);) {                           \
-    var = ITERATOR_PTR(myiter);                                   \
+    var = (atype *)ITERATOR_PTR(myiter);                                  \
     ITERATOR_PREV(myiter);
  
 /* Balance for above: */ 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#11283) [C++] explicit cast on void pointer, Frédéric Brière <=