[patch] Compile failures on amd64/gcc 4.0

Mickael Marchand marchand at kde.org
Sat Jan 8 13:25:16 GMT 2005


Thiago Macieira wrote:
> Waldo Bastian wrote:
> 
>>On Thursday 06 January 2005 23:31, Alejandro Exojo wrote:
>>
>>>In the reports, Andreas Jochens, contributed some patches against the
>>>3.3 packages, but I've tried to adapt them to CVS HEAD. I'm sending
>>>them attached. Please, review and tell me if I should commit them.
>>
>>I applied all of them except the khtml ones because khtml didn't compile
>>for me. They look ok though.
> 
> 
> I believe the proper type for most of those pointer-to-integer casts is 
> ptrdiff_t. That way, we avoid future errors.
> 
> It is a "long int" here, at least.
> 
Hi,

here is another patch for konsole this time
I used ptrdiff_t as suggested by Thiago

the rest of kdebase and kdelibs compiled fine (apart from khtml but the
patch given before worked for me)

can I commit ?

Cheers,
Mik
-------------- next part --------------
Index: konsole/keytrans.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/keytrans.cpp,v
retrieving revision 1.48
diff -u -3 -p -r1.48 keytrans.cpp
--- konsole/keytrans.cpp	22 Sep 2004 20:02:16 -0000	1.48
+++ konsole/keytrans.cpp	8 Jan 2005 13:22:12 -0000
@@ -372,7 +372,7 @@ Loop:
 //printf("line %3d: ",startofsym);
     getSymbol(); assertSyntax(sym == SYMName, "Name expected")
     assertSyntax(syms->keysyms[res], "Unknown key name")
-    int key = (int)syms->keysyms[res]-1;
+    int key = (ptrdiff_t)( syms->keysyms[res] ) -1;
 //printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1);
     getSymbol(); // + - :
     int mode = 0;
@@ -384,7 +384,7 @@ Loop:
       // mode name
       assertSyntax(sym == SYMName, "Name expected")
       assertSyntax(syms->modsyms[res], "Unknown mode name")
-      int bits = (int)syms->modsyms[res]-1;
+      int bits = (ptrdiff_t)syms->modsyms[res]-1;
       if (mask & (1 << bits))
       {
         fprintf(stderr,"%s(%d,%d): mode name used multible times.\n",path.ascii(),slinno,scolno);
@@ -405,7 +405,7 @@ Loop:
     if (sym == SYMName)
     {
       assertSyntax(syms->oprsyms[res], "Unknown operator name")
-      cmd = (int)syms->oprsyms[res]-1;
+      cmd = (ptrdiff_t)syms->oprsyms[res]-1;
 //printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1);
     }
     if (sym == SYMString)


More information about the kde-core-devel mailing list