Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-14389

torrent example: compiling with QT_NO_CAST_TO_ASCII ORQT_NO_CAST_FROM_BYTEARRAY not possible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.2
    • Network
    • None

      =======================================================================
      FIXED compiling with QT_NO_CAST_TO_ASCII not possible
      ========================================================================
      DEFINES += QT_NO_CAST_TO_ASCII

      g++ -c -pipe -march=native -O2 -Wall -W -D_REENTRANT -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o trackerclient.o trackerclient.cpp
      trackerclient.cpp: In member function 'void TrackerClient::fetchPeerList()':
      trackerclient.cpp:122: error: no match for 'operator+=' in 'query += passkey'
      /usr/include/qt4/QtCore/qbytearray.h:486: note: candidates are: QByteArray& QByteArray::operator+=(char)
      /usr/include/qt4/QtCore/qbytearray.h:488: note: QByteArray& QByteArray::operator+=(const char*)
      /usr/include/qt4/QtCore/qbytearray.h:490: note: QByteArray& QByteArray::operator+=(const QByteArray&)
      trackerclient.cpp:123: error: no match for 'operator+=' in 'query = operator(const char*, const QString&)(((const QString&)((const QString*)(& encodedSum))))'
      /usr/include/qt4/QtCore/qbytearray.h:486: note: candidates are: QByteArray& QByteArray::operator+=(char)
      /usr/include/qt4/QtCore/qbytearray.h:488: note: QByteArray& QByteArray::operator+=(const char*)
      /usr/include/qt4/QtCore/qbytearray.h:490: note: QByteArray& QByteArray::operator+=(const QByteArray&)
      make: *** [trackerclient.o] Error 1

      i fixed this with
      query += "info_hash=" + encodedSum.toLatin1();
      not sure if that is correct

      ========================================================================
      FIXED compiling with QT_NO_CAST_FROM_BYTEARRAY not possible
      ========================================================================
      DEFINES += QT_NO_CAST_FROM_BYTEARRAY

      ============= metainfo.cpp ============
      /usr/include/qt4/QtCore/qbytearray.h: In member function 'bool MetaInfo::parse(const QByteArray&)':
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:106: error: within this context
      metainfo.cpp:106: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:106: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:111: error: within this context
      metainfo.cpp:111: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:111: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:120: error: within this context
      metainfo.cpp:120: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:120: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:128: error: within this context
      metainfo.cpp:128: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:128: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:137: error: within this context
      metainfo.cpp:137: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:137: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      metainfo.cpp:139: error: within this context
      metainfo.cpp:139: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      metainfo.cpp:139: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'

      ============= trackerclient.cpp ============
      /usr/include/qt4/QtCore/qbytearray.h: In member function 'void TrackerClient::httpRequestDone(bool)':
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      trackerclient.cpp:185: error: within this context
      trackerclient.cpp:185: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      trackerclient.cpp:185: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      trackerclient.cpp:191: error: within this context
      trackerclient.cpp:191: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      trackerclient.cpp:191: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      trackerclient.cpp:215: error: within this context
      trackerclient.cpp:215: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      trackerclient.cpp:215: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      /usr/include/qt4/QtCore/qbytearray.h:364: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
      trackerclient.cpp:216: error: within this context
      trackerclient.cpp:216: error: invalid conversion from 'QNoImplicitBoolCast' to 'const char*'
      trackerclient.cpp:216: error: initializing argument 1 of 'static QString QString::fromUtf8(const char*, int)'
      make: *** [trackerclient.o] Error 1

      == fix ==
      fixing is easy, as it requires a constData() explicit cast

      == the torrent client status after this fix ==
      i was able to download with 16kb/s, so it seem to work

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            earthdomain Earth Domain (Inactive)
            qknight Joachim Schiele
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes