Bug#298492: mifluz: FTBFS (amd64/gcc-4.0): cast from 'char*' to 'int' loses precision
Package: mifluz
Severity: normal
Tags: patch
When building 'mifluz' on amd64 with gcc-4.0,
I get the following error:
rm -f .libs/WordDB.lo
g++ -DHAVE_CONFIG_H -I. -I. -I.. -DCONFIG_FILE=\"/etc/mifluz/mifluz.conf\" -I../mifluz -I../db -I../db -I../clib -I.. -DNOSTREAM -D_REENTRANT -g -O2 -Wall -Woverloaded-virtual -fno-rtti -fno-exceptions -Wp,-MD,.deps/WordDB.pp -c WordDB.cc -fPIC -DPIC -DPIC -o WordDB.o
Object.h:37: warning: 'virtual int Object::compare(const Object&)' was hidden
htString.h:132: warning: by 'String::compare'
List.h:84: warning: 'virtual void List::Insert(Object*, int)' was hidden
StringList.h:50: warning: by 'StringList::Insert'
List.h:76: warning: 'virtual void List::Add(Object*)' was hidden
StringList.h:48: warning: by 'StringList::Add'
List.h:93: warning: 'virtual void List::Assign(Object*, int)' was hidden
StringList.h:52: warning: by 'StringList::Assign'
WordDBCache.h: In member function 'int WordDBCache::Absolute()':
WordDBCache.h:152: error: cast from 'char*' to 'int' loses precision
WordDBCache.h:153: error: cast from 'char*' to 'int' loses precision
make[3]: *** [WordDB.lo] Error 1
make[3]: Leaving directory `/mifluz-0.24.0/mifluz'
With the attached patch 'mifluz' can be compiled
on amd64 using gcc-4.0.
Regards
Andreas Jochens
diff -urN ../tmp-orig/mifluz-0.24.0/db/db_int.h ./db/db_int.h
--- ../tmp-orig/mifluz-0.24.0/db/db_int.h 2000-06-28 18:47:01.000000000 +0200
+++ ./db/db_int.h 2005-03-07 21:37:22.741723718 +0100
@@ -108,10 +108,10 @@
* an array.
*/
#undef SSZ
-#define SSZ(name, field) ((int)&(((name *)0)->field))
+#define SSZ(name, field) ((long)&(((name *)0)->field))
#undef SSZA
-#define SSZA(name, field) ((int)&(((name *)0)->field[0]))
+#define SSZA(name, field) ((long)&(((name *)0)->field[0]))
/*
* Print an address as a u_long (a u_long is the largest type we can print
diff -urN ../tmp-orig/mifluz-0.24.0/mifluz/WordDBCache.h ./mifluz/WordDBCache.h
--- ../tmp-orig/mifluz-0.24.0/mifluz/WordDBCache.h 2001-06-29 16:14:08.000000000 +0200
+++ ./mifluz/WordDBCache.h 2005-03-07 21:37:22.746722753 +0100
@@ -149,8 +149,8 @@
inline int Absolute() {
int i;
for(i = 0; i < entries_length; i++) {
- entries[i].key = pool + (int)(entries[i].key);
- entries[i].data = pool + (int)(entries[i].data);
+ entries[i].key = pool + (long)(entries[i].key);
+ entries[i].data = pool + (long)(entries[i].data);
}
return OK;
}
diff -urN ../tmp-orig/mifluz-0.24.0/search/WordResults.cc ./search/WordResults.cc
--- ../tmp-orig/mifluz-0.24.0/search/WordResults.cc 2001-08-31 16:06:04.000000000 +0200
+++ ./search/WordResults.cc 2005-03-07 21:42:58.202973508 +0100
@@ -25,11 +25,11 @@
static int wordResults_cmp(const DBT* a, const DBT* b)
{
- int length = (int)a->app_private;
+ long length = (long)a->app_private;
WordKeyNum* a_values = (WordKeyNum*)a->data;
WordKeyNum* b_values = (WordKeyNum*)b->data;
- for(int i = 0; i < length; i++) {
+ for(long i = 0; i < length; i++) {
if(a_values[i] != b_values[i]) {
return a_values[i] > b_values[i] ? 1 : -1;
}
Reply to: