[Kde-games-devel] Legacy code problem in libkdegames/kgame

Ian Wadham iandw.au at gmail.com
Thu Dec 29 06:17:05 UTC 2011


On 29/12/2011, at 1:13 PM, Ian Wadham wrote:
> In libkdegames/kgame there is a header file kgamepropertyarray.h which
> contains a definition for class KGamePropertyArray.  In this class there is
> a method declaration and definition as follows:
> 
>  void sort()
>  {
>    QByteArray b;
>    QDataStream s(b, QIODevice::WriteOnly);
>    ….
>  }
> 
> <snip>In Qt 4.7, QDataStream can have a constructor with a const QByteArray & and
> no second parameter, so the QByteArray must have read-only mode.  Or it can
> be constructed with a QByteArray * and a second parameter for the mode,
> which can then be ReadOnly, WriteOnly, etc.
> 
> Neither constructor matches the existing code, so whatever compiler Macports
> is using is quite right to flag an error, but why don't other compilers, especially the
> ones KDE releases use?

The compiler being used is "clang".  I think KDE usually uses one of the GCC compilers.

I worked around the problem by commenting out the whole sort() method, i.e.
   /* void sort()
       {
          …
       } */
Apparently KFourInLIne does not reference it.  Do any other games use the KGame
class, or is KFourInLine the only one?  I think it might be.

FWIW there was another problem in KPat, file kpat/patsolve/memory.cpp, caused by
free(void *) not being declared early enough in kpat/patsolve/memory.h, where it is used.
My workaround was to move #include "memory.h" (line 19) to line 28, after the standard
library includes.

Now my build is messed up anyway: nothing runs (some dependency is missing at run
time), so back to square 1 … :-)

Cheers, Ian W.



More information about the kde-games-devel mailing list