Package: kaya
Version: 0.1.24-1
Severity: serious
Tags: patch

When building 'kaya' on amd64/unstable,
I get the following error:

ValueFuns.h:93: warning: 'class ExceptionTable' has virtual functions but 
non-virtual destructor
Heap.h: In member function 'int Value::getInt()':
Heap.h:68: error: cast from 'void*' to 'int' loses precision
Heap.h: In member function 'void Value::addVal(Value*)':
Heap.h:132: error: cast from 'void*' to 'int' loses precision
Heap.h:132: error: cast from 'void*' to 'int' loses precision
Heap.h: In member function 'void Value::subVal(Value*)':
Heap.h:136: error: cast from 'void*' to 'int' loses precision
Heap.h:136: error: cast from 'void*' to 'int' loses precision
Heap.h: In member function 'void Value::mulVal(Value*)':
Heap.h:140: error: cast from 'void*' to 'int' loses precision
Heap.h:140: error: cast from 'void*' to 'int' loses precision
Heap.h: In member function 'void Value::divVal(Value*)':
Heap.h:144: error: cast from 'void*' to 'int' loses precision
Heap.h:144: error: cast from 'void*' to 'int' loses precision
make[2]: *** [Heap.o] Error 1
make[2]: Leaving directory `/kaya-0.1.24/rts'

With the attached patch 'kaya' can be compiled on amd64 using gcc-4.0.

Regards
Andreas Jochens

diff -urN ../tmp-orig/kaya-0.1.24/libs/image.cc ./libs/image.cc
--- ../tmp-orig/kaya-0.1.24/libs/image.cc       2005-08-02 16:04:33.000000000 
+0000
+++ ./libs/image.cc     2005-09-23 06:01:04.000000000 +0000
@@ -23,7 +23,7 @@
     int x = p->sx;
     int y = p->sy;
     KayaValue img = KayaUnion(0,3);
-    KayaUnionSetArg(img,0,KayaInt((int)p));
+    KayaUnionSetArg(img,0,KayaInt((long)p));
     KayaUnionSetArg(img,1,KayaInt(x));
     KayaUnionSetArg(img,2,KayaInt(y));
     return img;
@@ -36,7 +36,7 @@
     int x = p->sx;
     int y = p->sy;
     KayaValue img = KayaUnion(0,3);
-    KayaUnionSetArg(img,0,KayaInt((int)p));
+    KayaUnionSetArg(img,0,KayaInt((long)p));
     KayaUnionSetArg(img,1,KayaInt(x));
     KayaUnionSetArg(img,2,KayaInt(y));
     return img;
diff -urN ../tmp-orig/kaya-0.1.24/rts/Heap.cc ./rts/Heap.cc
--- ../tmp-orig/kaya-0.1.24/rts/Heap.cc 2005-09-23 06:04:18.000000000 +0000
+++ ./rts/Heap.cc       2005-09-23 06:04:15.000000000 +0000
@@ -92,7 +92,7 @@
 void Value::str2int()
 {
     String* s=getString();
-    int val=(int)(strtol(s->getVal(),NULL,10));
+    long val=(long)(strtol(s->getVal(),NULL,10));
     setInt(val);
     m_funtable = inttable;
 }
@@ -134,11 +134,11 @@
 void Value::real2int()
 {
     double v=getReal();
-    setInt((int)v);
+    setInt((long)v);
     m_funtable = inttable;
 }
 
-void Value::setInt(int i)
+void Value::setInt(long i)
 {
     m_val=(void*)i;
     m_funtable = inttable;
diff -urN ../tmp-orig/kaya-0.1.24/rts/Heap.h ./rts/Heap.h
--- ../tmp-orig/kaya-0.1.24/rts/Heap.h  2005-09-23 06:04:18.000000000 +0000
+++ ./rts/Heap.h        2005-09-23 06:03:16.000000000 +0000
@@ -65,7 +65,7 @@
     valtype getType() { return m_funtable->getType(); }
 
     /// Get an integer out. Assumes you've checked/know.
-    int getInt() { return (int)m_val; };
+    long getInt() { return (long)m_val; };
     /// Get a real number out
     double getReal() { return ((Real*)m_val)->number; }
 
@@ -104,7 +104,7 @@
 
 
     /// Update to be an integer.
-    void setInt(int i);
+    void setInt(long i);
 
     /// Update to be a real
     void setReal(double i);
@@ -129,19 +129,19 @@
     }
 
     void addVal(Value* v) {
-       m_val=(void*)((int)m_val+(int)(v->m_val));
+       m_val=(void*)((long)m_val+(long)(v->m_val));
     }
 
     void subVal(Value* v) {
-       m_val=(void*)((int)m_val-(int)(v->m_val));
+       m_val=(void*)((long)m_val-(long)(v->m_val));
     }
 
     void mulVal(Value* v) {
-       m_val=(void*)((int)m_val*(int)(v->m_val));
+       m_val=(void*)((long)m_val*(long)(v->m_val));
     }
 
     void divVal(Value* v) {
-       m_val=(void*)((int)m_val/(int)(v->m_val));
+       m_val=(void*)((long)m_val/(long)(v->m_val));
     }
 
     /// Set an array element.
diff -urN ../tmp-orig/kaya-0.1.24/rts/KayaAPI.cc ./rts/KayaAPI.cc
--- ../tmp-orig/kaya-0.1.24/rts/KayaAPI.cc      2005-08-02 16:04:33.000000000 
+0000
+++ ./rts/KayaAPI.cc    2005-09-23 06:02:43.000000000 +0000
@@ -67,7 +67,7 @@
     return v->getString()->getVal();
 }
 
-void KayaSetInt(KayaValue v,int i)
+void KayaSetInt(KayaValue v,long i)
 {
     v->setInt(i);
 }
diff -urN ../tmp-orig/kaya-0.1.24/rts/KayaAPI.h ./rts/KayaAPI.h
--- ../tmp-orig/kaya-0.1.24/rts/KayaAPI.h       2005-08-02 16:04:33.000000000 
+0000
+++ ./rts/KayaAPI.h     2005-09-23 06:02:51.000000000 +0000
@@ -22,7 +22,7 @@
     KayaArray newKayaArray(int size);
 
     // Make new, initialised values.
-    KayaValue KayaInt(int x);
+    KayaValue KayaInt(long x);
     KayaValue KayaChar(char c);
     KayaValue KayaFloat(float f);
     KayaValue KayaString(char* str);
@@ -36,7 +36,7 @@
     KayaArray KayaGetArray(KayaValue v);
 
     // Set basic values
-    void KayaSetInt(KayaValue v,int i);
+    void KayaSetInt(KayaValue v,long i);
     void KayaSetChar(KayaValue v,char c);
     void KayaSetFloat(KayaValue v,double f);
     void KayaSetString(KayaValue v,char* s);
diff -urN ../tmp-orig/kaya-0.1.24/rts/ValueFuns.cc ./rts/ValueFuns.cc
--- ../tmp-orig/kaya-0.1.24/rts/ValueFuns.cc    2005-08-02 16:04:33.000000000 
+0000
+++ ./rts/ValueFuns.cc  2005-09-23 05:58:50.000000000 +0000
@@ -94,7 +94,7 @@
 /// This is probably quite meaningless
 Value* FnTable::cmp(Value* x, Value* y)
 {
-    return new Value((void*)((int)(x->getRaw())-(int)(y->getRaw())),inttable);
+    return new 
Value((void*)((long)(x->getRaw())-(long)(y->getRaw())),inttable);
 //    kaya_throw("Can't compare closures sensibly",1);
 //    return new Value(0,inttable);
 }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to