Re: 64-bit clean code

Laurent Carcone <[email protected]>
Newsgroups gmane.comp.web.amaya.devel
Organization W3C
Message-ID <[email protected]>
Hello Chris,

We'll test yours patches as soon as possible.

Thanks,
Laurent Carcone


On Wed, 19 Jul 2006 18:19:56 -0400
Chris Hodapp <[email protected]> wrote:

> 
> Hello,
> I'm on pure64 Debian right now (etch, GCC 4.0.4), and no AMD64 packages 
> existed, so I tried to build the source. Two errors occurred, and I'm pretty 
> sure it's because an assumption was made that the hardware was 32-bit:
> 
> .../../thotlib/dialogue/AmayaXMLPanel.cpp: In member function ___virtual void 
> AmayaXMLPanel::SendDataToPanel(AmayaParams&)___:
> .../../thotlib/dialogue/AmayaXMLPanel.cpp:105: error: cast from ___void*___ 
> to ___int___ loses precision
> 
> .../../amaya/MENUconf.c: In function ___void PreferenceCallbackDialog(int, int, 
> char*)___:
> .../../amaya/MENUconf.c:4655: error: cast from ___char*___ to ___int___ loses precision
> 
> In both cases, I used a 'long' instead of an 'int' and then the code compiled. 
> Everything seems to run well, but I don't know if I broke something in a 
> subtle way.
> 
> 
> Here are the changes I tried; hopefully they make sense
> 
> --- Amaya/amaya/MENUconf.c      2006-07-18 22:37:35.000000000 -0400
> +++ Amaya/amaya/MENUconf.c~     2006-04-11 05:10:17.000000000 -0400
> @@ -4645,14 +4645,14 @@
>  static void PreferenceCallbackDialog (int ref, int typedata, char *data)
>  {
>  #ifdef _WX
> -  long val;
> +  int val;
> 
>    if (ref == -1)
>      TtaDestroyDialogue (PreferenceBase);
>    else
>      {
>        /* has the user changed the options? */
> -      val = (long) data;
> +      val = (int) data;
>        switch (ref - PreferenceBase)
>          {
>          case 0:
> 
> 
> --- Amaya/thotlib/dialogue/AmayaXMLPanel.cpp    2006-07-18 
> 22:19:17.000000000 -0400
> +++ Amaya/thotlib/dialogue/AmayaXMLPanel.cpp~   2006-01-10 
> 09:18:28.000000000 -0500
> @@ -102,7 +102,7 @@
>    int nb_el                 = (int)p.param1;
>    const char * listBuffer   = (char *)p.param2;
>    const char * currentEl    = (char *)p.param3;
> -  long ref                   = (long)p.param4;;
> +  int ref                   = (int)p.param4;;
> 
>    m_XMLRef = ref;
> 
> 
> 
> 
> Thanks,
>  - Chris Hodapp
> 
> 
> 


-- 
  Laurent Carcone	
  [email protected]              W3C/ERCIM
  +33 (0)4 76 61 52 67        INRIA Rhône-Alpes, 655 Avenue de l'Europe
                              38334 Saint Ismier Cedex - France
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.