Subject: centericq on amd64 (pkg/36399)
To: None <netbsd-bugs@netbsd.org>
From: Andreas Burghardt <a-burghardt@gmx.de>
List: netbsd-bugs
Date: 07/05/2007 23:13:50
Hello,

as I reported in pkg/36399 centericq fails to compile on amd64. Well, I'm
absolutely no programmer but I fixed it for me .. I'm unsure if this is
a good method. Below are the patches.

Regards,

   Andreas Burghardt


--- src/icqdialogs.cc.orig	2007-07-02 20:52:48.000000000 +0200
+++ src/icqdialogs.cc	2007-07-02 20:53:48.000000000 +0200
@@ -894,7 +894,7 @@
     i = m.open();
     m.close();
 
-    if(i) f = (unsigned short) ((int) m.getref(i-1));
+    if(i) f = (unsigned short) ((intptr_t) m.getref(i-1));
 }
 
 void icqface::selectlanguage(unsigned short &f) {
@@ -946,7 +946,7 @@
     int i = m.open();
     m.close();
 
-    if(i) f = (imgender) ((int) m.getref(i-1));
+    if(i) f = (imgender) ((intptr_t) m.getref(i-1));
 }
 
 void icqface::selectagerange(ICQ2000::AgeRange &r) {
@@ -967,7 +967,7 @@
     int i = m.open();
     m.close();
 
-    if(i) r = (ICQ2000::AgeRange) ((int) m.getref(i-1));
+    if(i) r = (ICQ2000::AgeRange) ((intptr_t) m.getref(i-1));
 }
 
 bool icqface::edit(string &txt, const string &header) {
@@ -1256,7 +1256,7 @@
 
 	void *p;
 	finished = !db.open(n, b, &p);
-	i = (int) p;
+	i = (intptr_t) p;
 
 	if(!finished)
 	switch(b) {
@@ -1750,7 +1750,7 @@
 	    it = transfers.end();
 
 	    if(!db.gettree()->isnode(db.gettree()->getid(np-1)))
-		it = transfers.begin() + (int) db.getmenu()->getref(n-1);
+		it = transfers.begin() + (intptr_t) db.getmenu()->getref(n-1);
 
 	    switch(b) {
 		case 0:


--- src/icqface.cc.orig	2007-07-02 20:55:38.000000000 +0200
+++ src/icqface.cc	2007-07-02 20:57:27.000000000 +0200
@@ -401,7 +401,7 @@
 
     m.scale();
     m.idle = &menuidle;
-    i = (int) m.getref(m.open()-1);
+    i = (intptr_t) m.getref(m.open()-1);
     m.close();
 
     if(i) lastr = i;
@@ -450,7 +450,7 @@
 
     if(i) {
 	lastitem = i-1;
-	r = (int) m.getref(lastitem);
+	r = (intptr_t) m.getref(lastitem);
     }
 
     return r;
@@ -513,7 +513,7 @@
 	    g = 0;
 	}
 	
-	if((unsigned int) c < 100) c = 0;
+	if((unsigned intptr_t) c < 100) c = 0;
 
 	if(i) {
 	    switch(action = extk) {
@@ -1484,7 +1484,7 @@
 	m.scale();
 
 	i = m.open();
-	choice = (int) m.getref(i-1);
+	choice = (intptr_t) m.getref(i-1);
 
 	m.close();
     }
@@ -1539,7 +1539,7 @@
 	m.close();
 
 	if(r = i) {
-	    st = (imstatus) ((int) m.getref(i-1));
+	    st = (imstatus) ((intptr_t) m.getref(i-1));
 	}
     }
 
@@ -2003,7 +2003,7 @@
 	    mvaddchnstr(i-1, sizeWArea.x1+1, logline, sizeWArea.x2-sizeWArea.x1);
 	}
 
-	delete logline;
+	delete[] logline;
 
 	if(text.size() > sizeWArea.x2-sizeWArea.x1-2) text.resize(sizeWArea.x2-sizeWArea.x1-2);
 	mvhline(LINES-3, sizeWArea.x1+2, ' ', sizeWArea.x2-sizeWArea.x1-2);
@@ -2132,7 +2132,7 @@
 			    c = (icqcontact *) cm->getref(i);
 			}
 
-			if((unsigned int) c > 100) {
+			if((unsigned intptr_t) c > 100) {
 			    string current = c->getdispnick();
 			    len = current.size();
 			    if(len > nick.size()) len = nick.size();


--- kkstrtext-0.1/kkstrtext.cc.orig	2007-07-02 20:44:52.000000000 +0200
+++ kkstrtext-0.1/kkstrtext.cc	2007-07-02 20:58:59.000000000 +0200
@@ -431,7 +431,7 @@
 }
 
 int intcompare(void *s1, void *s2) {
-    return (int) s1 != (int) s2;
+    return (intptr_t) s1 != (intptr_t) s2;
 }
 
 string i2str(int i) {
@@ -885,7 +885,7 @@
 #ifdef HAVE_ICONV
     iconv_t cd = iconv_open(tocs.c_str(), fromcs.c_str());
 
-    if(((int) cd) != -1) {
+    if(((intptr_t) cd) != -1) {
 	string r, text(atext);
 	size_t inleft, outleft, soutleft;
 	char *inbuf, *outbuf, *sinbuf, *soutbuf;
@@ -907,8 +907,8 @@
 	    r += soutbuf;
 	    text.erase(0, text.size()-inleft);
 
-	    delete soutbuf;
-	    delete sinbuf;
+	    delete[] soutbuf;
+	    free(sinbuf);
 
 	    if(res == -1 && errno != EILSEQ)
 		break;


--- kkconsui-0.1/src/texteditor.cc.orig	2007-07-02 20:31:31.000000000 +0200
+++ kkconsui-0.1/src/texteditor.cc	2007-07-02 20:32:10.000000000 +0200
@@ -1940,11 +1940,11 @@
 }
 
 int texteditor::findint(void *p1, void *p2) {
-    return *(int *) p1 != (int) p2;
+    return *(intptr_t *) p1 != (intptr_t) p2;
 }
 
 int texteditor::findhighline(void *p1, void *p2) {
-    return *(int *) p1 != ((highline *) p2)->line;
+    return *(intptr_t *) p1 != ((highline *) p2)->line;
 }
 
 void texteditor::shiftmarkedblock(int delta) {