diff options
-rw-r--r-- | src/gui/painting/qcssutil.cpp | 4 | ||||
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 43 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp | 5 | ||||
-rw-r--r-- | src/tools/uic/cpp/cppwriteinitialization.cpp | 22 | ||||
-rw-r--r-- | tests/auto/network/access/qabstractnetworkcache/BLACKLIST | 7 |
5 files changed, 41 insertions, 40 deletions
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp index 86604c1586..a826532b43 100644 --- a/src/gui/painting/qcssutil.cpp +++ b/src/gui/painting/qcssutil.cpp @@ -337,8 +337,10 @@ static bool paintsOver(const QCss::BorderStyle *styles, const QBrush *colors, QC if (s2 == BorderStyle_None || colors[e2] == Qt::transparent) return true; - if ((s1 == BorderStyle_Solid && s2 == BorderStyle_Solid) && (colors[e1] == colors[e2])) + if ((s1 == BorderStyle_Solid && s2 == BorderStyle_Solid) && (colors[e1] == colors[e2]) + && colors[e1].isOpaque()) { return true; + } return false; } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 24b6746d23..ccc6e91147 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -468,6 +468,7 @@ #include <qtimer.h> #include <qelapsedtimer.h> #include <qscopedvaluerollback.h> +#include <qvarlengtharray.h> #ifndef QT_NO_SSL #include <QtNetwork/qsslsocket.h> @@ -1234,27 +1235,39 @@ bool QAbstractSocketPrivate::readFromSocket() // host has _not_ disappeared). bytesToRead = 4096; } - if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) - bytesToRead = readBufferMaxSize - buffer.size(); + + if (q->isReadable()) { + if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) + bytesToRead = readBufferMaxSize - buffer.size(); #if defined(QABSTRACTSOCKET_DEBUG) - qDebug("QAbstractSocketPrivate::readFromSocket() about to read %lld bytes", - bytesToRead); + qDebug("QAbstractSocketPrivate::readFromSocket() about to read %lld bytes", + bytesToRead); #endif - // Read from the socket, store data in the read buffer. - char *ptr = buffer.reserve(bytesToRead); - qint64 readBytes = socketEngine->read(ptr, bytesToRead); - if (readBytes == -2) { - // No bytes currently available for reading. - buffer.chop(bytesToRead); - return true; - } - buffer.chop(bytesToRead - ((readBytes < 0 || !q->isReadable()) ? qint64(0) : readBytes)); + // Read from the socket, store data in the read buffer. + char *ptr = buffer.reserve(bytesToRead); + qint64 readBytes = socketEngine->read(ptr, bytesToRead); + if (readBytes == -2) { + // No bytes currently available for reading. + buffer.chop(bytesToRead); + return true; + } + buffer.chop(bytesToRead - (readBytes < 0 ? qint64(0) : readBytes)); #if defined(QABSTRACTSOCKET_DEBUG) - qDebug("QAbstractSocketPrivate::readFromSocket() got %lld bytes, buffer size = %lld", - readBytes, buffer.size()); + qDebug("QAbstractSocketPrivate::readFromSocket() got %lld bytes, buffer size = %lld", + readBytes, buffer.size()); #endif + } else { + // Discard unwanted data if opened in WriteOnly mode + QVarLengthArray<char, 4096> discardBuffer(bytesToRead); + +#if defined(QABSTRACTSOCKET_DEBUG) + qDebug("QAbstractSocketPrivate::readFromSocket() about to discard %lld bytes", + bytesToRead); +#endif + socketEngine->read(discardBuffer.data(), bytesToRead); + } if (!socketEngine->isValid()) { setErrorAndEmit(socketEngine->error(), socketEngine->errorString()); diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index d2fadc957d..4b9d4690f3 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -64,8 +64,9 @@ void QBasicFontDatabase::populateFontDatabase() QDir dir(fontpath); if (!dir.exists()) { - qWarning("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", - qPrintable(fontpath)); + qWarning("QFontDatabase: Cannot find font directory %s.\n" + "Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.", + qPrintable(fontpath)); return; } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index bd036a13a6..4ad4f60ca8 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2488,24 +2488,16 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet<QS if (directives.isEmpty()) return; - QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map - foreach (const QString &str, directives) - map.insert(str, true); - - if (map.size() == 1) { - outputStream << "#ifndef " << map.constBegin().key() << endl; + if (directives.size() == 1) { + outputStream << "#ifndef " << *directives.cbegin() << endl; return; } - outputStream << "#if"; - bool doOr = false; - foreach (const QString &str, map.keys()) { - if (doOr) - outputStream << " ||"; - outputStream << " !defined(" << str << ')'; - doOr = true; - } - outputStream << endl; + auto list = directives.toList(); + // sort (always generate in the same order): + std::sort(list.begin(), list.end()); + + outputStream << "#if !defined(" << list.join(QLatin1String(") || !defined(")) << ')' << endl; } static void generateMultiDirectiveEnd(QTextStream &outputStream, const QSet<QString> &directives) diff --git a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST index 3bd3350e4b..2ad52f8b31 100644 --- a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST +++ b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST @@ -1,9 +1,2 @@ [cacheControl] windows -osx -[expires] -osx -[etag] -osx -[lastModified] -osx |