W3C home > Mailing lists > Public > www-amaya-dev@w3.org > July 2006

64-bit clean code

From: Chris Hodapp <hodapp87@gmail.com>
Date: Wed, 19 Jul 2006 18:19:56 -0400
To: www-amaya-dev@w3.org
Message-Id: <200607191819.57280.Hodapp87@gmail.com>

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
Received on Wednesday, 19 July 2006 22:17:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:49:01 GMT