From 678a4273a30e9e073dabe684ba21f18faf426e15 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 24 Oct 2015 22:32:45 +0200 Subject: QtBase: combine adjacent qDebug()/qCritical() lines For qDebug() and qWarning(), this is just an optimization. For qCritical(), which can be fatal, the old code was just wrong. Change-Id: I6d8ab1d7531d766cd41b49569dc0fd4420ecab8b Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/mimetypes/qmimeprovider.cpp | 6 ++-- src/corelib/plugin/qfactoryloader.cpp | 4 +-- src/plugins/bearer/nla/qnlaengine.cpp | 42 ++++++++++++------------ src/plugins/platforms/android/androidjnimain.cpp | 4 +-- src/widgets/itemviews/qtableview.cpp | 12 +++---- src/widgets/util/qscroller.cpp | 4 +-- 6 files changed, 34 insertions(+), 38 deletions(-) diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 59aef39fb7..917c29b8d6 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -568,9 +568,9 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("mime/") + file); // pre-1.3 } if (mimeFiles.isEmpty()) { - qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist."; - qWarning() << "Either it was just removed, or the directory doesn't have executable permission..."; - qWarning() << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime"), QStandardPaths::LocateDirectory); + qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist.\n" + "Either it was just removed, or the directory doesn't have executable permission..." + << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime"), QStandardPaths::LocateDirectory); return; } diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 8de1669924..fb5b895851 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -164,8 +164,8 @@ void QFactoryLoader::update() library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); if (!library->isPlugin()) { if (qt_debug_component()) { - qDebug() << library->errorString; - qDebug() << " not a plugin"; + qDebug() << library->errorString << endl + << " not a plugin"; } library->release(); continue; diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 3680eb7305..cc65364a02 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -69,39 +69,39 @@ QWindowsSockInit2::~QWindowsSockInit2() #ifdef BEARER_MANAGEMENT_DEBUG static void printBlob(NLA_BLOB *blob) { - qDebug() << "==== BEGIN NLA_BLOB ===="; + qDebug() << "==== BEGIN NLA_BLOB ====" << endl - qDebug() << "type:" << blob->header.type; - qDebug() << "size:" << blob->header.dwSize; - qDebug() << "next offset:" << blob->header.nextOffset; + << "type:" << blob->header.type << endl + << "size:" << blob->header.dwSize << endl + << "next offset:" << blob->header.nextOffset; switch (blob->header.type) { case NLA_RAW_DATA: - qDebug() << "Raw Data"; - qDebug() << '\t' << blob->data.rawData; + qDebug() << "Raw Data" << endl + << '\t' << blob->data.rawData; break; case NLA_INTERFACE: - qDebug() << "Interface"; - qDebug() << "\ttype:" << blob->data.interfaceData.dwType; - qDebug() << "\tspeed:" << blob->data.interfaceData.dwSpeed; - qDebug() << "\tadapter:" << blob->data.interfaceData.adapterName; + qDebug() << "Interface" << endl + << "\ttype:" << blob->data.interfaceData.dwType << endl + << "\tspeed:" << blob->data.interfaceData.dwSpeed << endl + << "\tadapter:" << blob->data.interfaceData.adapterName; break; case NLA_802_1X_LOCATION: - qDebug() << "802.1x Location"; - qDebug() << '\t' << blob->data.locationData.information; + qDebug() << "802.1x Location" << endl + << '\t' << blob->data.locationData.information; break; case NLA_CONNECTIVITY: - qDebug() << "Connectivity"; - qDebug() << "\ttype:" << blob->data.connectivity.type; - qDebug() << "\tinternet:" << blob->data.connectivity.internet; + qDebug() << "Connectivity" << endl + << "\ttype:" << blob->data.connectivity.type << endl + << "\tinternet:" << blob->data.connectivity.internet; break; case NLA_ICS: - qDebug() << "ICS"; - qDebug() << "\tspeed:" << blob->data.ICS.remote.speed; - qDebug() << "\ttype:" << blob->data.ICS.remote.type; - qDebug() << "\tstate:" << blob->data.ICS.remote.state; - qDebug() << "\tmachine name:" << blob->data.ICS.remote.machineName; - qDebug() << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; + qDebug() << "ICS" << endl + << "\tspeed:" << blob->data.ICS.remote.speed << endl + << "\ttype:" << blob->data.ICS.remote.type << endl + << "\tstate:" << blob->data.ICS.remote.state << endl + << "\tmachine name:" << blob->data.ICS.remote.machineName << endl + << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; break; default: qDebug() << "UNKNOWN BLOB TYPE"; diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index d419e42cd5..f500d6e413 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -498,8 +498,8 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para } if (!m_main) { - qCritical() << "dlsym failed:" << dlerror(); - qCritical() << "Could not find main method"; + qCritical() << "dlsym failed:" << dlerror() << endl + << "Could not find main method"; return false; } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 1e2e81a4e3..ee0d41ce15 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -201,8 +201,7 @@ QDebug operator<<(QDebug str, const QSpanCollection::Span &span) void QSpanCollection::updateInsertedRows(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -250,8 +249,7 @@ void QSpanCollection::updateInsertedRows(int start, int end) void QSpanCollection::updateInsertedColumns(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -332,8 +330,7 @@ bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int void QSpanCollection::updateRemovedRows(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -460,8 +457,7 @@ void QSpanCollection::updateRemovedRows(int start, int end) void QSpanCollection::updateRemovedColumns(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 0065ccf6b3..38b104f9e9 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -1870,8 +1870,8 @@ void QScrollerPrivate::setContentPositionHelperScrolling() newPos.setY(nextSegmentPosition(ySegments, now, newPos.y())); // -- set the position and handle overshoot - qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()"; - qScrollerDebug() << " --> overshoot:" << overshootPosition << "- new pos:" << newPos; + qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()\n" + " --> overshoot:" << overshootPosition << "- new pos:" << newPos; QPointF newClampedPos = clampToRect(newPos, contentPosRange); -- cgit v1.2.3