| [Freeciv-Dev] Re: (PR#8591) win32: client crashes on middle click[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8591 >
James Canete wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8591 >
> 
>>[jdorje - Mon Apr 26 00:29:19 2004]:
>>
>>Casts like this are dangerous.  Are you sure the function type matches? 
>>  Can you change the function type that list_impr_or_unit_select takes?
>>
>>+      list_impr_or_unit_select(hLst,num,(TestCityFunc
> 
> *)city_got_building);
> 
> 
> The function is:
> bool city_got_building(struct city *pcity,  Impr_Type_id id)
> 
> and TestCityFunc is:
> typedef bool (*TestCityFunc)(struct city *, gint)
> 
> There's an identical cast on line 474 of gui-win32/cityrep.c, and
> similar ones on line 1625 and 1629 of gui-gtk-2.0/cityrep.c.
> 
> Perhaps a wrapper function should be made?
Perhaps.  But I don't think gui-win32 needs one.
gui-win32/cityrep.c:typedef bool TestCityFunc(struct city *, int);
So just change the int to an Impr_Type_id?
jason
 
 
 |  |