On alpha (and other 64-bit arches):

ut_AbiObject.cpp: In method `UT_uint32 UT_AbiObject::hashcode ()
const':
ut_AbiObject.cpp:108: reinterpret_cast from `const UT_AbiObject *' to
`UT_uint32' loses precision

The patch I've attached fixes it for me - don't know how portable it is, 
though (what? There are other OSes than Linux and FreeBSD?? Must be a 
rumor).

In theory, a simpler patch (simply replacing reinterpret_cast<UT_uint32> 
with reinterpret_cast<long>) should do the job as well - at least on the 
systems I'm familiar with, the size of long matches the size of a pointer.

It still doesn't build completely on alpha, though:

/usr/src/build/47578-alpha/BUILD/abiword-0.9.4.1/abi/src/Linux_2.4.7-10smp_alph
a_OBJ/obj/libAbiEv.a(ev_UnixToolbar.o): In function 
`_wd::s_callback(_GtkWidget *, void *)':
ev_UnixToolbar.o(._wd::gnu.linkonce.t.s_callback(_GtkWidget *, void 
*)+0x28): relocation truncated to fit: BRADDR text
[much the same follows for every other function]

I don't know what's causing this yet, probably the way the linker is 
invoked.

LLaP
bero

--- abiword-0.9.4.1/abi/src/af/util/xp/ut_AbiObject.cpp.64bit   Tue Oct 23 21:38:52 
2001
+++ abiword-0.9.4.1/abi/src/af/util/xp/ut_AbiObject.cpp Tue Oct 23 22:07:49 2001
@@ -18,6 +18,8 @@
  * 02111-1307, USA.
  */
 
+#define _XOPEN_SOURCE 1 // for LONG_BIT
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -105,7 +107,11 @@
 UT_uint32 UT_AbiObject::hashcode () const
 {
        // 9987001 is a reasnonably large prime
+#if !defined(LONG_BIT) || (LONG_BIT <= 32)
        return (UT_uint32) (reinterpret_cast<UT_uint32>(this) * 0x9863b9);
+#else
+       return (UT_uint32) (reinterpret_cast<unsigned long>(this) * 0x9863b9);
+#endif
 }
 
 /****************************************************************************/

Reply via email to