Bug 117124 - kcirc_message.cpp QT compiling incompatible
Summary: kcirc_message.cpp QT compiling incompatible
Status: RESOLVED DUPLICATE of bug 116339
Alias: None
Product: kopete
Classification: Applications
Component: IRC Plugin (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-27 03:19 UTC by Christopher Cradock
Modified: 2005-11-30 09:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Cradock 2005-11-27 03:19:30 UTC
Version:            (using KDE KDE 3.4.91)
Installed from:    Compiled From Sources
Compiler:          gcc V4.0.2 
OS:                Linux

Lines 171/172 (and further examples lower down) use an array offest into 'raw' which has been defined as a QTString. Unfortunately the indexing variable has been defined as a Q_Long when Troll Tech have only catered for a simple 'int' in the QTmemarray base-object.
GCC V4 now complains that it can't decide between the built-in array mechanism and the QTmemarray mechanism.

I've resolved it for the moment by redefining the index as an int inline with the QT definition.
Comment 1 Thiago Macieira 2005-11-27 16:12:50 UTC
I can't find kcirc_message.cpp on the KDE website.
Comment 2 Christopher Cradock 2005-11-28 21:04:10 UTC
Apologies I've reported this against the wrong filename and/or index. Will you still take the call or would you prefer I start a new reference ID?

The affect file is: kdenetwork-3.5.0/kopete/protocols/irc/libkirc/kircmessage.cpp

--- kircmessage.cpp     2005-11-08 22:27:57.000000000 +0000
+++ kircmessage.cpp.fix 2005-10-24 20:59:09.000000000 +0100
@@ -158,7 +158,7 @@
        if (engine->socket()->canReadLine())
        {
                QCString raw(engine->socket()->bytesAvailable()+1);
-               Q_LONG length = engine->socket()->readLine(raw.data(), raw.count());
+               int length = engine->socket()->readLine(raw.data(), raw.count());

                if( length > -1 )
                {

This is being compiled against QT 3.3.5 on a fedora 4 x64 base (the Fedora supplied QT and KDE having been previously uninstalled).

Chris.

-----Original Message-----
From: owner@bugs.kde.org on behalf of Thiago Macieira
Sent: Sun 27/11/2005 15:12
To: CRADOCK, Christopher
Subject: [Bug 117124] kcirc_message.cpp QT compiling incompatible   
 
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
         
http://bugs.kde.org/show_bug.cgi?id=117124         
thiago kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID
            Summary|kcirc_message.cpp QT        |kcirc_message.cpp QT
                   |compiling incompatible      |compiling incompatible



------- Additional Comments From thiago kde org  2005-11-27 16:12 -------
I can't find kcirc_message.cpp on the KDE website.
Comment 3 Thiago Macieira 2005-11-29 01:12:07 UTC
Qt 3.3.5 has Q_LONG for that method. Please paste your error message.
Comment 4 Dirk Mueller 2005-11-29 18:36:11 UTC
foo
Comment 5 Christopher Cradock 2005-11-29 20:07:36 UTC
The make ends with:

make[5]: Entering directory `/usr/local/src/kde-3.5/kdenetwork-3.5.0/kopete/protocols/irc/libkirc'
if /bin/sh ../../../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../../..  -I../../../../kopete/protocols/irc -I../../../../kopete/libkopete -I../../../../kopete/libkopete -I../../../../kopete/libkopete/avdevice -I../../../../kopete/libkopete/ui -I../../../../kopete/libkopete/ui -I/opt/kde-3.5/include -I/opt/qt/include -I/usr/X11R6/include  -DQT_THREAD_SUPPORT  -D_REENTRANT  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -g -O2 -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT kircmessage.lo -MD -MP -MF ".deps/kircmessage.Tpo" -c -o kircmessage.lo kircmessage.cpp; \
then mv -f ".deps/kircmessage.Tpo" ".deps/kircmessage.Plo"; else rm -f ".deps/kircmessage.Tpo"; exit 1; fi
kircmessage.cpp: In static member function 'static KIRC::Message KIRC::Message::parse(KIRC::Engine*, const QTextCodec*, bool*)':
kircmessage.cpp:171: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/opt/qt/include/qmemarray.h:99: note: candidate 1: type& QMemArray<type>::operator[](int) const [with type = char]
kircmessage.cpp:171: note: candidate 2: operator[](const char*, long int) <built-in>
kircmessage.cpp:172: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/opt/qt/include/qmemarray.h:99: note: candidate 1: type& QMemArray<type>::operator[](int) const [with type = char]
kircmessage.cpp:172: note: candidate 2: operator[](const char*, long int) <built-in>
kircmessage.cpp:174: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/opt/qt/include/qmemarray.h:99: note: candidate 1: type& QMemArray<type>::operator[](int) const [with type = char]
kircmessage.cpp:174: note: candidate 2: operator[](const char*, long int) <built-in>
kircmessage.cpp:175: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/opt/qt/include/qmemarray.h:99: note: candidate 1: type& QMemArray<type>::operator[](int) const [with type = char]
kircmessage.cpp:175: note: candidate 2: operator[](const char*, long int) <built-in>
make[5]: *** [kircmessage.lo] Error 1


The relevant line from qt-3.3.5/include/qmemarray.h:99 reads:

    type& operator[]( int i ) const
        { return (type &)(*(type *)QGArray::at(i*sizeof(type))); }

and not the expected:

    type& operator[]( Q_LONG i ) const
        { return (type &)(*(type *)QGArray::at(i*sizeof(type))); }

I had initially thought Q_LONG was typedef int somewhere but on searching that through its definitely assigned 64 bits which doesn't match the qmemarray.h definition. There is no analogous lookup for a 64 bit quantity so GCC has cast the index to 32 bits and then is in a quandary.
Comment 6 Tommi Rantala 2005-11-30 09:27:40 UTC

*** This bug has been marked as a duplicate of 116339 ***