64-bit clean code

Chris Hodapp <[email protected]>
Newsgroups gmane.comp.web.amaya.devel
Message-ID <[email protected]>
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
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.