summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp2
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp28
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp4
-rw-r--r--src/corelib/json/qjsondocument.cpp2
-rw-r--r--src/corelib/json/qjsonparser.cpp4
-rw-r--r--src/corelib/kernel/qppsobject.cpp28
-rw-r--r--src/corelib/kernel/qppsobjectprivate_p.h4
-rw-r--r--src/corelib/kernel/qsystemsemaphore_posix.cpp4
-rw-r--r--src/corelib/kernel/qsystemsemaphore_systemv.cpp2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp6
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp10
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp2
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp4
-rw-r--r--src/corelib/thread/qreadwritelock.cpp528
-rw-r--r--src/corelib/thread/qreadwritelock.h6
-rw-r--r--src/corelib/thread/qreadwritelock_p.h39
-rw-r--r--src/corelib/thread/qwaitcondition_unix.cpp10
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp10
-rw-r--r--src/corelib/tools/qcollator_macx.cpp4
-rw-r--r--src/corelib/tools/qcollator_win.cpp2
-rw-r--r--src/corelib/tools/qmap.h4
-rw-r--r--src/corelib/tools/qtimeline.cpp2
-rw-r--r--src/dbus/qdbusintegrator.cpp2
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h6
-rw-r--r--src/gui/kernel/qopenglwindow.cpp5
-rw-r--r--src/gui/kernel/qplatformwindow.cpp5
-rw-r--r--src/gui/kernel/qrasterwindow.cpp5
-rw-r--r--src/gui/kernel/qwindow.cpp4
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp4
-rw-r--r--src/gui/text/qzip.cpp9
-rw-r--r--src/gui/util/qdesktopservices.cpp8
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp2
-rw-r--r--src/network/kernel/qhostinfo.cpp62
-rw-r--r--src/opengl/qglshaderprogram.cpp4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm2
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp20
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp4
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp8
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp4
-rw-r--r--src/plugins/generic/tuiotouch/qoscbundle.cpp6
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp4
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp1
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp234
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.h60
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp4
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp32
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm4
-rw-r--r--src/plugins/platforms/directfb/qdirectfbglcontext.cpp2
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm2
-rw-r--r--src/plugins/platforms/ios/qiosglobal.h6
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm2
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm36
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm8
-rw-r--r--src/plugins/platforms/minimal/qminimalbackingstore.cpp2
-rw-r--r--src/plugins/platforms/mirclient/qmirclientinput.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfddevice.cpp26
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdglcontext.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp4
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdport.cpp4
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdscreen.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp14
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwmsupport.cpp4
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp10
-rw-r--r--src/printsupport/kernel/qprinter.cpp2
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp2
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp8
85 files changed, 799 insertions, 599 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index cbcc6d02a6..35213f8a4c 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -426,7 +426,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
*/
/*!
- \fn QFlags QFlags::setFlag(Enum flag, bool on) const
+ \fn QFlags QFlags::setFlag(Enum flag, bool on)
\since 5.7
Sets the indicated \a flag if \a on is \c true or unsets it if
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index e26d412cf9..8b11830fbe 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -317,11 +317,11 @@ QStringList QFileSystemWatcher::addPaths(const QStringList &paths)
// Autotest override case - use the explicitly selected engine only
const QStringRef forceName = on.midRef(26);
if(forceName == QLatin1String("poller")) {
- qDebug() << "QFileSystemWatcher: skipping native engine, using only polling engine";
+ qDebug("QFileSystemWatcher: skipping native engine, using only polling engine");
d_func()->initPollerEngine();
engine = d->poller;
} else if(forceName == QLatin1String("native")) {
- qDebug() << "QFileSystemWatcher: skipping polling engine, using only native engine";
+ qDebug("QFileSystemWatcher: skipping polling engine, using only native engine");
engine = d->native;
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 791429cc5a..5564bc7dca 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -344,7 +344,7 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
void QInotifyFileSystemWatcherEngine::readFromInotify()
{
- // qDebug() << "QInotifyFileSystemWatcherEngine::readFromInotify";
+ // qDebug("QInotifyFileSystemWatcherEngine::readFromInotify");
int buffSize = 0;
ioctl(inotifyFd, FIONREAD, (char *) &buffSize);
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index dd913f957b..b2aacfa5aa 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -327,6 +327,15 @@ static void indexesFromRange(const QItemSelectionRange &range, ModelIndexContain
}
}
+template<typename ModelIndexContainer>
+static ModelIndexContainer qSelectionIndexes(const QItemSelection &selection)
+{
+ ModelIndexContainer result;
+ for (const auto &range : selection)
+ indexesFromRange(range, result);
+ return result;
+}
+
/*!
Returns \c true if the selection range contains no selectable item
\since 4.7
@@ -469,20 +478,7 @@ bool QItemSelection::contains(const QModelIndex &index) const
QModelIndexList QItemSelection::indexes() const
{
- QModelIndexList result;
- QList<QItemSelectionRange>::const_iterator it = begin();
- for (; it != end(); ++it)
- indexesFromRange(*it, result);
- return result;
-}
-
-static QVector<QPersistentModelIndex> qSelectionPersistentindexes(const QItemSelection &sel)
-{
- QVector<QPersistentModelIndex> result;
- QList<QItemSelectionRange>::const_iterator it = sel.constBegin();
- for (; it != sel.constEnd(); ++it)
- indexesFromRange(*it, result);
- return result;
+ return qSelectionIndexes<QModelIndexList>(*this);
}
static QVector<QPair<QPersistentModelIndex, uint> > qSelectionPersistentRowLengths(const QItemSelection &sel)
@@ -892,8 +888,8 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersiste
savedPersistentRowLengths = qSelectionPersistentRowLengths(ranges);
savedPersistentCurrentRowLengths = qSelectionPersistentRowLengths(currentSelection);
} else {
- savedPersistentIndexes = qSelectionPersistentindexes(ranges);
- savedPersistentCurrentIndexes = qSelectionPersistentindexes(currentSelection);
+ savedPersistentIndexes = qSelectionIndexes<QVector<QPersistentModelIndex>>(ranges);
+ savedPersistentCurrentIndexes = qSelectionIndexes<QVector<QPersistentModelIndex>>(currentSelection);
}
}
/*!
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index dc159c8f7c..18cb49d483 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -376,7 +376,7 @@ QModelIndex QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex &pro
if (!proxy_index.isValid())
return QModelIndex(); // for now; we may want to be able to set a root index later
if (proxy_index.model() != q_func()) {
- qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapToSource";
+ qWarning("QSortFilterProxyModel: index from wrong model passed to mapToSource");
Q_ASSERT(!"QSortFilterProxyModel: index from wrong model passed to mapToSource");
return QModelIndex();
}
@@ -394,7 +394,7 @@ QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &sou
if (!source_index.isValid())
return QModelIndex(); // for now; we may want to be able to set a root index later
if (source_index.model() != model) {
- qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapFromSource";
+ qWarning("QSortFilterProxyModel: index from wrong model passed to mapFromSource");
Q_ASSERT(!"QSortFilterProxyModel: index from wrong model passed to mapFromSource");
return QModelIndex();
}
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index 1fde69ecf6..b2fa16d22a 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -184,7 +184,7 @@ QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other)
QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation)
{
if (quintptr(data) & 3) {
- qWarning() <<"QJsonDocument::fromRawData: data has to have 4 byte alignment";
+ qWarning("QJsonDocument::fromRawData: data has to have 4 byte alignment");
return QJsonDocument();
}
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp
index a896d17519..2926adf10a 100644
--- a/src/corelib/json/qjsonparser.cpp
+++ b/src/corelib/json/qjsonparser.cpp
@@ -300,7 +300,7 @@ QJsonDocument Parser::parse(QJsonParseError *error)
{
#ifdef PARSER_DEBUG
indent = 0;
- qDebug() << ">>>>> parser begin";
+ qDebug(">>>>> parser begin");
#endif
// allocate some space
dataLength = qMax(end - json, (ptrdiff_t) 256);
@@ -346,7 +346,7 @@ QJsonDocument Parser::parse(QJsonParseError *error)
error:
#ifdef PARSER_DEBUG
- qDebug() << ">>>>> parser error";
+ qDebug(">>>>> parser error");
#endif
if (error) {
error->offset = json - head;
diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp
index 5990deb9c3..dbff997c88 100644
--- a/src/corelib/kernel/qppsobject.cpp
+++ b/src/corelib/kernel/qppsobject.cpp
@@ -72,7 +72,7 @@ public:
{
int fd = qt_safe_open("/pps/.all", O_RDONLY);
if (fd == -1) {
- qWarning() << "qppsobject.cpp: qt_safe_open failed";
+ qWarning("qppsobject.cpp: qt_safe_open failed");
value = -1;
}
@@ -114,7 +114,7 @@ QPpsAttributeMap QPpsObjectPrivate::decode(const QByteArray &rawData, bool *ok)
// no need to check ok in this case
attributeMap = decodeObject(&decoder, ok);
} else {
- qWarning() << "QPpsObjectPrivate::decode: pps_decoder_initialize failed";
+ qWarning("QPpsObjectPrivate::decode: pps_decoder_initialize failed");
*ok = false;
}
@@ -162,7 +162,7 @@ QPpsAttribute QPpsObjectPrivate::decodeString(pps_decoder_t *decoder)
pps_decoder_error_t error = pps_decoder_get_string(decoder, 0, &value);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeString: PPS_DECODER_GET_STRING failed";
+ qWarning("QPpsObjectPrivate::decodeString: PPS_DECODER_GET_STRING failed");
return QPpsAttribute();
}
@@ -189,19 +189,19 @@ QPpsAttribute QPpsObjectPrivate::decodeNumber(pps_decoder_t *decoder)
case PPS_DECODER_CONVERSION_FAILED:
error = pps_decoder_get_int64(decoder, 0, &llValue);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeNumber: failed to decode integer";
+ qWarning("QPpsObjectPrivate::decodeNumber: failed to decode integer");
return QPpsAttribute();
}
flags = readFlags(decoder);
return QPpsAttributePrivate::createPpsAttribute(llValue, flags);
default:
- qWarning() << "QPpsObjectPrivate::decodeNumber: pps_decoder_get_int failed";
+ qWarning("QPpsObjectPrivate::decodeNumber: pps_decoder_get_int failed");
return QPpsAttribute();
}
} else {
pps_decoder_error_t error = pps_decoder_get_double(decoder, 0, &dValue);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeNumber: pps_decoder_get_double failed";
+ qWarning("QPpsObjectPrivate::decodeNumber: pps_decoder_get_double failed");
return QPpsAttribute();
}
flags = readFlags(decoder);
@@ -215,7 +215,7 @@ QPpsAttribute QPpsObjectPrivate::decodeBool(pps_decoder_t *decoder)
pps_decoder_error_t error = pps_decoder_get_bool(decoder, 0, &value);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeBool: pps_decoder_get_bool failed";
+ qWarning("QPpsObjectPrivate::decodeBool: pps_decoder_get_bool failed");
return QPpsAttribute();
}
@@ -278,7 +278,7 @@ QPpsAttribute QPpsObjectPrivate::decodeData(pps_decoder_t *decoder)
case PPS_TYPE_NONE:
case PPS_TYPE_UNKNOWN:
default:
- qWarning() << "QPpsObjectPrivate::decodeData: invalid pps_node_type";
+ qWarning("QPpsObjectPrivate::decodeData: invalid pps_node_type");
return QPpsAttribute();
}
}
@@ -292,7 +292,7 @@ QPpsAttributeList QPpsObjectPrivate::decodeArray(pps_decoder_t *decoder, bool *o
// Force movement to a specific index.
pps_decoder_error_t error = pps_decoder_goto_index(decoder, i);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeArray: pps_decoder_goto_index failed";
+ qWarning("QPpsObjectPrivate::decodeArray: pps_decoder_goto_index failed");
*ok = false;
return QPpsAttributeList();
}
@@ -319,7 +319,7 @@ QPpsAttributeMap QPpsObjectPrivate::decodeObject(pps_decoder_t *decoder, bool *o
// Force movement to a specific index.
pps_decoder_error_t error = pps_decoder_goto_index(decoder, i);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeObject: pps_decoder_goto_index failed";
+ qWarning("QPpsObjectPrivate::decodeObject: pps_decoder_goto_index failed");
*ok = false;
return QPpsAttributeMap();
}
@@ -368,7 +368,7 @@ QVariant QPpsObjectPrivate::variantFromPpsAttribute(const QPpsAttribute &attribu
return variantMapFromPpsAttributeMap(attribute.toMap());
case QPpsAttribute::None:
default:
- qWarning() << "QPpsObjectPrivate::variantFromPpsAttribute: invalid attribute parameter";
+ qWarning("QPpsObjectPrivate::variantFromPpsAttribute: invalid attribute parameter");
return QVariant();
}
}
@@ -385,7 +385,7 @@ QByteArray QPpsObjectPrivate::encode(const QVariantMap &ppsData, bool *ok)
// The memory will be freed when pps_encoder_cleanup is called.
rawData = pps_encoder_buffer(&encoder);
if (!rawData) {
- qWarning() << "QPpsObjectPrivate::encode: pps_encoder_buffer failed";
+ qWarning("QPpsObjectPrivate::encode: pps_encoder_buffer failed");
*ok = false;
}
}
@@ -448,7 +448,7 @@ void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, con
errorFunction = QStringLiteral("pps_encoder_add_null");
break;
default:
- qWarning() << "QPpsObjectPrivate::encodeData: the type of the parameter data is invalid";
+ qWarning("QPpsObjectPrivate::encodeData: the type of the parameter data is invalid");
*ok = false;
return;
}
@@ -685,7 +685,7 @@ QByteArray QPpsObject::read(bool *ok)
const int maxSize = ppsMaxSize->value;
if (maxSize == -1) {
- qWarning() << "QPpsObject::read: maxSize is equal to -1";
+ qWarning("QPpsObject::read: maxSize is equal to -1");
safeAssign(ok, false);
return QByteArray();
}
diff --git a/src/corelib/kernel/qppsobjectprivate_p.h b/src/corelib/kernel/qppsobjectprivate_p.h
index 26d89ab7f0..e1d54e58de 100644
--- a/src/corelib/kernel/qppsobjectprivate_p.h
+++ b/src/corelib/kernel/qppsobjectprivate_p.h
@@ -105,7 +105,7 @@ inline bool QPpsObjectPrivate::decoderPush(pps_decoder_t *decoder, const char *n
{
pps_decoder_error_t error = pps_decoder_push(decoder, name);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeData: pps_decoder_push failed";
+ qWarning("QPpsObjectPrivate::decodeData: pps_decoder_push failed");
return false;
}
return true;
@@ -115,7 +115,7 @@ inline bool QPpsObjectPrivate::decoderPop(pps_decoder_t *decoder)
{
pps_decoder_error_t error = pps_decoder_pop(decoder);
if (error != PPS_DECODER_OK) {
- qWarning() << "QPpsObjectPrivate::decodeData: pps_decoder_pop failed";
+ qWarning("QPpsObjectPrivate::decodeData: pps_decoder_pop failed");
return false;
}
return true;
diff --git a/src/corelib/kernel/qsystemsemaphore_posix.cpp b/src/corelib/kernel/qsystemsemaphore_posix.cpp
index 76ab0d42eb..6137239467 100644
--- a/src/corelib/kernel/qsystemsemaphore_posix.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_posix.cpp
@@ -119,7 +119,7 @@ void QSystemSemaphorePrivate::cleanHandle()
if (::sem_close(semaphore) == -1) {
setErrorString(QLatin1String("QSystemSemaphore::cleanHandle (sem_close)"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::cleanHandle sem_close failed.");
+ qDebug("QSystemSemaphore::cleanHandle sem_close failed.");
#endif
}
semaphore = SEM_FAILED;
@@ -129,7 +129,7 @@ void QSystemSemaphorePrivate::cleanHandle()
if (::sem_unlink(QFile::encodeName(fileName).constData()) == -1 && errno != ENOENT) {
setErrorString(QLatin1String("QSystemSemaphore::cleanHandle (sem_unlink)"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::cleanHandle sem_unlink failed.");
+ qDebug("QSystemSemaphore::cleanHandle sem_unlink failed.");
#endif
}
createdSemaphore = false;
diff --git a/src/corelib/kernel/qsystemsemaphore_systemv.cpp b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
index 69e1bf7705..f4fdfa5f58 100644
--- a/src/corelib/kernel/qsystemsemaphore_systemv.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
@@ -153,7 +153,7 @@ void QSystemSemaphorePrivate::cleanHandle()
if (-1 == semctl(semaphore, 0, IPC_RMID, 0)) {
setErrorString(QLatin1String("QSystemSemaphore::cleanHandle"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::cleanHandle semctl failed.");
+ qDebug("QSystemSemaphore::cleanHandle semctl failed.");
#endif
}
semaphore = -1;
diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp
index ca31e9d59d..236e346afe 100644
--- a/src/corelib/kernel/qsystemsemaphore_win.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_win.cpp
@@ -101,7 +101,7 @@ void QSystemSemaphorePrivate::cleanHandle()
{
if (semaphore && !CloseHandle(semaphore)) {
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphorePrivate::CloseHandle: sem failed");
+ qDebug("QSystemSemaphorePrivate::CloseHandle: sem failed");
#endif
}
semaphore = 0;
@@ -116,7 +116,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
if (0 == ReleaseSemaphore(semaphore, count, 0)) {
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore ReleaseSemaphore failed");
+ qDebug("QSystemSemaphore::modifySemaphore ReleaseSemaphore failed");
#endif
return false;
}
@@ -128,7 +128,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
#endif
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore WaitForSingleObject failed");
+ qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed");
#endif
return false;
}
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 4ba98ad2c4..0db3407b7b 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -234,7 +234,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
m_mask(mask),
m_matchFunction(nullptr)
{
- if (m_type == Invalid)
+ if (Q_UNLIKELY(m_type == Invalid))
*errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported");
// Parse for offset as "1" or "1:10"
@@ -247,7 +247,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
return;
}
- if (m_value.isEmpty()) {
+ if (Q_UNLIKELY(m_value.isEmpty())) {
m_type = Invalid;
if (errorString)
*errorString = QStringLiteral("Invalid empty magic rule value");
@@ -257,7 +257,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
if (m_type >= Host16 && m_type <= Byte) {
bool ok;
m_number = m_value.toUInt(&ok, 0); // autodetect base
- if (!ok) {
+ if (Q_UNLIKELY(!ok)) {
m_type = Invalid;
if (errorString)
*errorString = QLatin1String("Invalid magic rule value \"") + QLatin1String(m_value) + QLatin1Char('"');
@@ -271,7 +271,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
m_pattern = makePattern(m_value);
m_pattern.squeeze();
if (!m_mask.isEmpty()) {
- if (m_mask.size() < 4 || !m_mask.startsWith("0x")) {
+ if (Q_UNLIKELY(m_mask.size() < 4 || !m_mask.startsWith("0x"))) {
m_type = Invalid;
if (errorString)
*errorString = QLatin1String("Invalid magic rule mask \"") + QLatin1String(m_mask) + QLatin1Char('"');
@@ -279,7 +279,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
}
const QByteArray &tempMask = QByteArray::fromHex(QByteArray::fromRawData(
m_mask.constData() + 2, m_mask.size() - 2));
- if (tempMask.size() != m_pattern.size()) {
+ if (Q_UNLIKELY(tempMask.size() != m_pattern.size())) {
m_type = Invalid;
if (errorString)
*errorString = QLatin1String("Invalid magic rule mask size \"") + QLatin1String(m_mask) + QLatin1Char('"');
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index c2add4aeef..c961c25c07 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -559,7 +559,7 @@ QList<QMimeType> QMimeBinaryProvider::allMimeTypes()
void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
{
#ifdef QT_NO_XMLSTREAMREADER
- qWarning() << "Cannot load mime type since QXmlStreamReader is not available.";
+ qWarning("Cannot load mime type since QXmlStreamReader is not available.");
return;
#else
if (data.loaded)
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 9ed345d37e..63e8f14018 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -164,7 +164,7 @@ bool QMimeTypeParserBase::parseNumber(const QStringRef &n, int *target, QString
{
bool ok;
*target = n.toInt(&ok);
- if (!ok) {
+ if (Q_UNLIKELY(!ok)) {
*errorMessage = QLatin1String("Not a number '") + n + QLatin1String("'.");
return false;
}
@@ -325,7 +325,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
}
}
- if (reader.hasError()) {
+ if (Q_UNLIKELY(reader.hasError())) {
if (errorMessage)
*errorMessage = QString::fromLatin1("An error has been encountered at line %1 of %2: %3:").arg(reader.lineNumber()).arg(fileName, reader.errorString());
return false;
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index 117da2e30b..5665bf74f6 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -2,6 +2,7 @@
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,11 +46,36 @@
#include "qmutex.h"
#include "qthread.h"
#include "qwaitcondition.h"
-
#include "qreadwritelock_p.h"
+#include "qelapsedtimer.h"
+#include "private/qfreelist_p.h"
QT_BEGIN_NAMESPACE
+/*
+ * Implementation details of QReadWriteLock:
+ *
+ * Depending on the valued of d_ptr, the lock is in the following state:
+ * - when d_ptr == 0x0: Unlocked (no readers, no writers) and non-recursive.
+ * - when d_ptr & 0x1: If the least significant bit is set, we are locked for read.
+ * In that case, d_ptr>>4 represents the number of reading threads minus 1. No writers
+ * are waiting, and the lock is not recursive.
+ * - when d_ptr == 0x2: We are locked for write and nobody is waiting. (no contention)
+ * - In any other case, d_ptr points to an actual QReadWriteLockPrivate.
+ */
+
+namespace {
+enum {
+ StateMask = 0x3,
+ StateLockedForRead = 0x1,
+ StateLockedForWrite = 0x2,
+};
+const auto dummyLockedForRead = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(StateLockedForRead));
+const auto dummyLockedForWrite = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(StateLockedForWrite));
+inline bool isUncontendedLocked(const QReadWriteLockPrivate *d)
+{ return quintptr(d) & StateMask; }
+}
+
/*! \class QReadWriteLock
\inmodule QtCore
\brief The QReadWriteLock class provides read-write locking.
@@ -116,8 +142,10 @@ QT_BEGIN_NAMESPACE
\sa lockForRead(), lockForWrite(), RecursionMode
*/
QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)
- : d(new QReadWriteLockPrivate(recursionMode))
-{ }
+ : d_ptr(recursionMode == Recursive ? new QReadWriteLockPrivate(true) : nullptr)
+{
+ Q_ASSERT_X(!(quintptr(d_ptr.load()) & StateMask), "QReadWriteLock::QReadWriteLock", "bad d_ptr alignment");
+}
/*!
Destroys the QReadWriteLock object.
@@ -127,6 +155,11 @@ QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)
*/
QReadWriteLock::~QReadWriteLock()
{
+ auto d = d_ptr.load();
+ if (isUncontendedLocked(d)) {
+ qWarning("QReadWriteLock: destroying locked QReadWriteLock");
+ return;
+ }
delete d;
}
@@ -141,32 +174,9 @@ QReadWriteLock::~QReadWriteLock()
*/
void QReadWriteLock::lockForRead()
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
-
- QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
- if (it != d->currentReaders.end()) {
- ++it.value();
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()",
- "Overflow in lock counter");
- return;
- }
- }
-
- while (d->accessCount < 0 || d->waitingWriters) {
- ++d->waitingReaders;
- d->readerWait.wait(&d->mutex);
- --d->waitingReaders;
- }
- if (d->recursive)
- d->currentReaders.insert(self, 1);
-
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()", "Overflow in lock counter");
+ if (d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead))
+ return;
+ tryLockForRead(-1);
}
/*!
@@ -187,31 +197,7 @@ void QReadWriteLock::lockForRead()
*/
bool QReadWriteLock::tryLockForRead()
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
-
- QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
- if (it != d->currentReaders.end()) {
- ++it.value();
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()",
- "Overflow in lock counter");
- return true;
- }
- }
-
- if (d->accessCount < 0)
- return false;
- if (d->recursive)
- d->currentReaders.insert(self, 1);
-
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter");
-
- return true;
+ return tryLockForRead(0);
}
/*! \overload
@@ -235,36 +221,58 @@ bool QReadWriteLock::tryLockForRead()
*/
bool QReadWriteLock::tryLockForRead(int timeout)
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
+ // Fast case: non contended:
+ QReadWriteLockPrivate *d;
+ if (d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead, d))
+ return true;
+
+ while (true) {
+ if (d == 0) {
+ if (!d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead, d))
+ continue;
+ return true;
+ }
- QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
- if (it != d->currentReaders.end()) {
- ++it.value();
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()",
+ if ((quintptr(d) & StateMask) == StateLockedForRead) {
+ // locked for read, increase the counter
+ const auto val = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(d) + (1U<<4));
+ Q_ASSERT_X(quintptr(val) > (1U<<4), "QReadWriteLock::tryLockForRead()",
"Overflow in lock counter");
+ if (!d_ptr.testAndSetAcquire(d, val, d))
+ continue;
return true;
}
- }
- while (d->accessCount < 0 || d->waitingWriters) {
- ++d->waitingReaders;
- bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout));
- --d->waitingReaders;
- if (!success)
- return false;
+ if (d == dummyLockedForWrite) {
+ // locked for write, assign a d_ptr and wait.
+ auto val = QReadWriteLockPrivate::allocate();
+ val->writerCount = 1;
+ if (!d_ptr.testAndSetOrdered(d, val, d)) {
+ val->writerCount = 0;
+ val->release();
+ continue;
+ }
+ d = val;
+ }
+ Q_ASSERT(!isUncontendedLocked(d));
+ // d is an actual pointer;
+
+ if (d->recursive)
+ return d->recursiveLockForRead(timeout);
+
+ QMutexLocker lock(&d->mutex);
+ if (d != d_ptr.load()) {
+ // d_ptr has changed: this QReadWriteLock was unlocked before we had
+ // time to lock d->mutex.
+ // We are holding a lock to a mutex within a QReadWriteLockPrivate
+ // that is already released (or even is already re-used). That's ok
+ // because the QFreeList never frees them.
+ // Just unlock d->mutex (at the end of the scope) and retry.
+ d = d_ptr.loadAcquire();
+ continue;
+ }
+ return d->lockForRead(timeout);
}
- if (d->recursive)
- d->currentReaders.insert(self, 1);
-
- ++d->accessCount;
- Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter");
-
- return true;
}
/*!
@@ -280,30 +288,7 @@ bool QReadWriteLock::tryLockForRead(int timeout)
*/
void QReadWriteLock::lockForWrite()
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
-
- if (d->currentWriter == self) {
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::lockForWrite()",
- "Overflow in lock counter");
- return;
- }
- }
-
- while (d->accessCount != 0) {
- ++d->waitingWriters;
- d->writerWait.wait(&d->mutex);
- --d->waitingWriters;
- }
- if (d->recursive)
- d->currentWriter = self;
-
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::lockForWrite()", "Overflow in lock counter");
+ tryLockForWrite(-1);
}
/*!
@@ -323,30 +308,7 @@ void QReadWriteLock::lockForWrite()
*/
bool QReadWriteLock::tryLockForWrite()
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
-
- if (d->currentWriter == self) {
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::lockForWrite()",
- "Overflow in lock counter");
- return true;
- }
- }
-
- if (d->accessCount != 0)
- return false;
- if (d->recursive)
- d->currentWriter = self;
-
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::tryLockForWrite()",
- "Overflow in lock counter");
-
- return true;
+ return tryLockForWrite(0);
}
/*! \overload
@@ -370,36 +332,48 @@ bool QReadWriteLock::tryLockForWrite()
*/
bool QReadWriteLock::tryLockForWrite(int timeout)
{
- QMutexLocker lock(&d->mutex);
-
- Qt::HANDLE self = 0;
- if (d->recursive) {
- self = QThread::currentThreadId();
-
- if (d->currentWriter == self) {
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::lockForWrite()",
- "Overflow in lock counter");
+ // Fast case: non contended:
+ QReadWriteLockPrivate *d;
+ if (d_ptr.testAndSetAcquire(nullptr, dummyLockedForWrite, d))
+ return true;
+
+ while (true) {
+ if (d == 0) {
+ if (!d_ptr.testAndSetAcquire(d, dummyLockedForWrite, d))
+ continue;
return true;
}
- }
-
- while (d->accessCount != 0) {
- ++d->waitingWriters;
- bool success = d->writerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout));
- --d->waitingWriters;
- if (!success)
- return false;
+ if (isUncontendedLocked(d)) {
+ // locked for either read or write, assign a d_ptr and wait.
+ auto val = QReadWriteLockPrivate::allocate();
+ if (d == dummyLockedForWrite)
+ val->writerCount = 1;
+ else
+ val->readerCount = (quintptr(d) >> 4) + 1;
+ if (!d_ptr.testAndSetOrdered(d, val, d)) {
+ val->writerCount = val->readerCount = 0;
+ val->release();
+ continue;
+ }
+ d = val;
+ }
+ Q_ASSERT(!isUncontendedLocked(d));
+ // d is an actual pointer;
+
+ if (d->recursive)
+ return d->recursiveLockForWrite(timeout);
+
+ QMutexLocker lock(&d->mutex);
+ if (d != d_ptr.load()) {
+ // The mutex was unlocked before we had time to lock the mutex.
+ // We are holding to a mutex within a QReadWriteLockPrivate that is already released
+ // (or even is already re-used) but that's ok because the QFreeList never frees them.
+ d = d_ptr.loadAcquire();
+ continue;
+ }
+ return d->lockForWrite(timeout);
}
- if (d->recursive)
- d->currentWriter = self;
-
- --d->accessCount;
- Q_ASSERT_X(d->accessCount < 0, "QReadWriteLock::tryLockForWrite()",
- "Overflow in lock counter");
-
- return true;
}
/*!
@@ -412,36 +386,246 @@ bool QReadWriteLock::tryLockForWrite(int timeout)
*/
void QReadWriteLock::unlock()
{
- QMutexLocker lock(&d->mutex);
+ QReadWriteLockPrivate *d = d_ptr.load();
+ while (true) {
+ Q_ASSERT_X(d, "QReadWriteLock::unlock()", "Cannot unlock an unlocked lock");
+
+ // Fast case: no contention: (no waiters, no other readers)
+ if (quintptr(d) <= 2) { // 1 or 2 (StateLockedForRead or StateLockedForWrite)
+ if (!d_ptr.testAndSetRelease(d, nullptr, d))
+ continue;
+ return;
+ }
- Q_ASSERT_X(d->accessCount != 0, "QReadWriteLock::unlock()", "Cannot unlock an unlocked lock");
+ if ((quintptr(d) & StateMask) == StateLockedForRead) {
+ Q_ASSERT(quintptr(d) > (1U<<4)); //otherwise that would be the fast case
+ // Just decrease the reader's count.
+ auto val = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(d) - (1U<<4));
+ if (!d_ptr.testAndSetRelease(d, val, d))
+ continue;
+ return;
+ }
+
+ Q_ASSERT(!isUncontendedLocked(d));
- bool unlocked = false;
- if (d->accessCount > 0) {
- // releasing a read lock
if (d->recursive) {
- Qt::HANDLE self = QThread::currentThreadId();
- QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
- if (it != d->currentReaders.end()) {
- if (--it.value() <= 0)
- d->currentReaders.erase(it);
+ d->recursiveUnlock();
+ return;
+ }
+
+ QMutexLocker locker(&d->mutex);
+ if (d->writerCount) {
+ Q_ASSERT(d->writerCount == 1);
+ Q_ASSERT(d->readerCount == 0);
+ d->writerCount = 0;
+ } else {
+ Q_ASSERT(d->readerCount > 0);
+ d->readerCount--;
+ if (d->readerCount > 0)
+ return;
+ }
+
+ if (d->waitingReaders || d->waitingWriters) {
+ d->unlock();
+ } else {
+ Q_ASSERT(d_ptr.load() == d); // should not change when we still hold the mutex
+ d_ptr.storeRelease(nullptr);
+ d->release();
+ }
+ return;
+ }
+}
+
+/*! \internal Helper for QWaitCondition::wait */
+QReadWriteLock::StateForWaitCondition QReadWriteLock::stateForWaitCondition() const
+{
+ QReadWriteLockPrivate *d = d_ptr.load();
+ switch (quintptr(d) & StateMask) {
+ case StateLockedForRead: return LockedForRead;
+ case StateLockedForWrite: return LockedForWrite;
+ }
+
+ if (!d)
+ return Unlocked;
+ if (d->writerCount > 1)
+ return RecursivelyLocked;
+ else if (d->writerCount == 1)
+ return LockedForWrite;
+ return LockedForRead;
+
+}
+
+bool QReadWriteLockPrivate::lockForRead(int timeout)
+{
+ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function
+
+ QElapsedTimer t;
+ if (timeout > 0)
+ t.start();
+
+ while (waitingWriters || writerCount) {
+ if (timeout == 0)
+ return false;
+ if (timeout > 0) {
+ auto elapsed = t.elapsed();
+ if (elapsed > timeout)
+ return false;
+ waitingReaders++;
+ readerCond.wait(&mutex, timeout - elapsed);
+ } else {
+ waitingReaders++;
+ readerCond.wait(&mutex);
+ }
+ waitingReaders--;
+ }
+ readerCount++;
+ Q_ASSERT(writerCount == 0);
+ return true;
+}
+
+bool QReadWriteLockPrivate::lockForWrite(int timeout)
+{
+ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function
+
+ QElapsedTimer t;
+ if (timeout > 0)
+ t.start();
+
+ while (readerCount || writerCount) {
+ if (timeout == 0)
+ return false;
+ if (timeout > 0) {
+ auto elapsed = t.elapsed();
+ if (elapsed > timeout) {
+ if (waitingReaders && !waitingWriters && !writerCount) {
+ // We timed out and now there is no more writers or waiting writers, but some
+ // readers were queueud (probably because of us). Wake the waiting readers.
+ readerCond.wakeAll();
+ }
+ return false;
}
+ waitingWriters++;
+ writerCond.wait(&mutex, timeout - elapsed);
+ } else {
+ waitingWriters++;
+ writerCond.wait(&mutex);
}
+ waitingWriters--;
+ }
+
+ Q_ASSERT(writerCount == 0);
+ Q_ASSERT(readerCount == 0);
+ writerCount = 1;
+ return true;
+}
+
+void QReadWriteLockPrivate::unlock()
+{
+ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function
+ if (waitingWriters)
+ writerCond.wakeOne();
+ else if (waitingReaders)
+ readerCond.wakeAll();
+}
+
+bool QReadWriteLockPrivate::recursiveLockForRead(int timeout)
+{
+ Q_ASSERT(recursive);
+ QMutexLocker lock(&mutex);
+
+ Qt::HANDLE self = QThread::currentThreadId();
+
+ auto it = currentReaders.find(self);
+ if (it != currentReaders.end()) {
+ ++it.value();
+ return true;
+ }
- unlocked = --d->accessCount == 0;
- } else if (d->accessCount < 0 && ++d->accessCount == 0) {
- // released a write lock
- unlocked = true;
- d->currentWriter = 0;
+ if (!lockForRead(timeout))
+ return false;
+
+ currentReaders.insert(self, 1);
+ return true;
+}
+
+bool QReadWriteLockPrivate::recursiveLockForWrite(int timeout)
+{
+ Q_ASSERT(recursive);
+ QMutexLocker lock(&mutex);
+
+ Qt::HANDLE self = QThread::currentThreadId();
+ if (currentWriter == self) {
+ writerCount++;
+ return true;
}
- if (unlocked) {
- if (d->waitingWriters) {
- d->writerWait.wakeOne();
- } else if (d->waitingReaders) {
- d->readerWait.wakeAll();
+ if (!lockForWrite(timeout))
+ return false;
+
+ currentWriter = self;
+ return true;
+}
+
+void QReadWriteLockPrivate::recursiveUnlock()
+{
+ Q_ASSERT(recursive);
+ QMutexLocker lock(&mutex);
+
+ Qt::HANDLE self = QThread::currentThreadId();
+ if (self == currentWriter) {
+ if (--writerCount > 0)
+ return;
+ currentWriter = 0;
+ } else {
+ auto it = currentReaders.find(self);
+ if (it == currentReaders.end()) {
+ qWarning("QReadWriteLock::unlock: unlocking from a thread that did not lock");
+ return;
+ } else {
+ if (--it.value() <= 0) {
+ currentReaders.erase(it);
+ readerCount--;
+ }
+ if (readerCount)
+ return;
}
}
+
+ unlock();
+}
+
+// The freelist management
+namespace {
+struct FreeListConstants : QFreeListDefaultConstants {
+ enum { BlockCount = 4, MaxIndex=0xffff };
+ static const int Sizes[BlockCount];
+};
+const int FreeListConstants::Sizes[FreeListConstants::BlockCount] = {
+ 16,
+ 128,
+ 1024,
+ FreeListConstants::MaxIndex - (16 + 128 + 1024)
+};
+
+typedef QFreeList<QReadWriteLockPrivate, FreeListConstants> FreeList;
+Q_GLOBAL_STATIC(FreeList, freelist);
+}
+
+QReadWriteLockPrivate *QReadWriteLockPrivate::allocate()
+{
+ int i = freelist->next();
+ QReadWriteLockPrivate *d = &(*freelist)[i];
+ d->id = i;
+ Q_ASSERT(!d->recursive);
+ Q_ASSERT(!d->waitingReaders && !d->waitingReaders && !d->readerCount && !d->writerCount);
+ return d;
+}
+
+void QReadWriteLockPrivate::release()
+{
+ Q_ASSERT(!recursive);
+ Q_ASSERT(!waitingReaders && !waitingReaders && !readerCount && !writerCount);
+ freelist->release(id);
}
/*!
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index b7e2092e38..777efdb3bf 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_THREAD
-struct QReadWriteLockPrivate;
+class QReadWriteLockPrivate;
class Q_CORE_EXPORT QReadWriteLock
{
@@ -69,8 +69,10 @@ public:
private:
Q_DISABLE_COPY(QReadWriteLock)
- QReadWriteLockPrivate *d;
+ QAtomicPointer<QReadWriteLockPrivate> d_ptr;
+ enum StateForWaitCondition { LockedForRead, LockedForWrite, Unlocked, RecursivelyLocked };
+ StateForWaitCondition stateForWaitCondition() const;
friend class QWaitCondition;
};
diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h
index 1f6f73c8e3..285f017655 100644
--- a/src/corelib/thread/qreadwritelock_p.h
+++ b/src/corelib/thread/qreadwritelock_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -53,29 +54,47 @@
#include <QtCore/qglobal.h>
#include <QtCore/qhash.h>
+#include <QtCore/QWaitCondition>
#ifndef QT_NO_THREAD
QT_BEGIN_NAMESPACE
-struct QReadWriteLockPrivate
+class QReadWriteLockPrivate
{
- QReadWriteLockPrivate(QReadWriteLock::RecursionMode recursionMode)
- : accessCount(0), waitingReaders(0), waitingWriters(0),
- recursive(recursionMode == QReadWriteLock::Recursive), currentWriter(0)
- { }
+public:
+ QReadWriteLockPrivate(bool isRecursive = false)
+ : readerCount(0), writerCount(0), waitingReaders(0), waitingWriters(0),
+ recursive(isRecursive), id(0) {}
QMutex mutex;
- QWaitCondition readerWait;
- QWaitCondition writerWait;
-
- int accessCount;
+ QWaitCondition writerCond;
+ QWaitCondition readerCond;
+ int readerCount;
+ int writerCount;
int waitingReaders;
int waitingWriters;
-
bool recursive;
+
+ //Called with the mutex locked
+ bool lockForWrite(int timeout);
+ bool lockForRead(int timeout);
+ void unlock();
+
+ //memory management
+ int id;
+ void release();
+ static QReadWriteLockPrivate *allocate();
+
+ // Recusive mutex handling
Qt::HANDLE currentWriter;
QHash<Qt::HANDLE, int> currentReaders;
+
+ // called with the mutex unlocked
+ bool recursiveLockForWrite(int timeout);
+ bool recursiveLockForRead(int timeout);
+ void recursiveUnlock();
+
};
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp
index 2a98fd2897..6adee5412e 100644
--- a/src/corelib/thread/qwaitcondition_unix.cpp
+++ b/src/corelib/thread/qwaitcondition_unix.cpp
@@ -221,9 +221,12 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
{
- if (!readWriteLock || readWriteLock->d->accessCount == 0)
+ if (!readWriteLock)
return false;
- if (readWriteLock->d->accessCount < -1) {
+ auto previousState = readWriteLock->stateForWaitCondition();
+ if (previousState == QReadWriteLock::Unlocked)
+ return false;
+ if (previousState == QReadWriteLock::RecursivelyLocked) {
qWarning("QWaitCondition: cannot wait on QReadWriteLocks with recursive lockForWrite()");
return false;
}
@@ -231,12 +234,11 @@ bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
report_error(pthread_mutex_lock(&d->mutex), "QWaitCondition::wait()", "mutex lock");
++d->waiters;
- int previousAccessCount = readWriteLock->d->accessCount;
readWriteLock->unlock();
bool returnValue = d->wait(time);
- if (previousAccessCount < 0)
+ if (previousState == QReadWriteLock::LockedForWrite)
readWriteLock->lockForWrite();
else
readWriteLock->lockForRead();
diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp
index 246e45a54c..f3a645c504 100644
--- a/src/corelib/thread/qwaitcondition_win.cpp
+++ b/src/corelib/thread/qwaitcondition_win.cpp
@@ -191,20 +191,22 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
{
- if (!readWriteLock || readWriteLock->d->accessCount == 0)
+ if (!readWriteLock)
return false;
- if (readWriteLock->d->accessCount < -1) {
+ auto previousState = readWriteLock->stateForWaitCondition();
+ if (previousState == QReadWriteLock::Unlocked)
+ return false;
+ if (previousState == QReadWriteLock::RecursivelyLocked) {
qWarning("QWaitCondition: cannot wait on QReadWriteLocks with recursive lockForWrite()");
return false;
}
QWaitConditionEvent *wce = d->pre();
- int previousAccessCount = readWriteLock->d->accessCount;
readWriteLock->unlock();
bool returnValue = d->wait(wce, time);
- if (previousAccessCount < 0)
+ if (previousState == QReadWriteLock::LockedForWrite)
readWriteLock->lockForWrite();
else
readWriteLock->lockForRead();
diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp
index 207b5bb2b1..b4d93e58d4 100644
--- a/src/corelib/tools/qcollator_macx.cpp
+++ b/src/corelib/tools/qcollator_macx.cpp
@@ -55,7 +55,7 @@ void QCollatorPrivate::init()
LocaleRef localeRef;
int rc = LocaleRefFromLocaleString(locale.bcp47Name().toLocal8Bit(), &localeRef);
if (rc != 0)
- qWarning() << "couldn't initialize the locale";
+ qWarning("couldn't initialize the locale");
UInt32 options = 0;
@@ -73,7 +73,7 @@ void QCollatorPrivate::init()
&collator
);
if (status != 0)
- qWarning() << "Couldn't initialize the collator";
+ qWarning("Couldn't initialize the collator");
dirty = false;
}
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index 30e358c3f9..fcd8d069eb 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -73,7 +73,7 @@ void QCollatorPrivate::init()
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7)
collator |= SORT_DIGITSASNUMBERS;
else
- qWarning() << "Numeric sorting unsupported on Windows versions older than Windows 7.";
+ qWarning("Numeric sorting unsupported on Windows versions older than Windows 7.");
}
if (ignorePunctuation)
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 7eec281957..9801878bdc 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -909,7 +909,7 @@ template <class Key, class T>
void QMap<Key, T>::dump() const
{
const_iterator it = begin();
- qDebug() << "map dump:";
+ qDebug("map dump:");
while (it != end()) {
const QMapNodeBase *n = it.i;
int depth = 0;
@@ -922,7 +922,7 @@ void QMap<Key, T>::dump() const
<< it.key() << it.value();
++it;
}
- qDebug() << "---------";
+ qDebug("---------");
}
#endif
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index dd6a4dbc56..adbc2900e3 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -131,7 +131,7 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
const int transitionframe = (direction == QTimeLine::Forward ? endFrame : startFrame);
if (looping && !finished && transitionframe != currentFrame) {
#ifdef QTIMELINE_DEBUG
- qDebug() << "QTimeLinePrivate::setCurrentTime: transitionframe";
+ qDebug("QTimeLinePrivate::setCurrentTime: transitionframe");
#endif
emit q->frameChanged(transitionframe, QTimeLine::QPrivateSignal());
}
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 25678a56a9..94b91865ab 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1796,7 +1796,7 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
if (e)
connection->postEventToThread(MessageResultReceivedAction, call->receiver, e);
else
- qDBusDebug() << "Deliver failed!";
+ qDBusDebug("Deliver failed!");
}
if (call->pending) {
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 364dfaeaee..eb3a9d5545 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -474,8 +474,9 @@ QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window
QVector<T> pointValues;
pointValues.reserve(pixelValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pixelValue : pixelValues)
- pointValues.append(pixelValue / QHighDpiScaling::factor(window));
+ pointValues.append(pixelValue / factor);
return pointValues;
}
@@ -488,8 +489,9 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
QVector<T> pixelValues;
pixelValues.reserve(pointValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pointValue : pointValues)
- pixelValues.append(pointValue * QHighDpiScaling::factor(window));
+ pixelValues.append(pointValue * factor);
return pixelValues;
}
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 37db608430..8ab5c08442 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -252,9 +252,10 @@ void QOpenGLWindowPrivate::beginPaint(const QRegion &region)
if (!fbo || fbo->size() != deviceSize) {
QOpenGLFramebufferObjectFormat fboFormat;
fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- if (q->requestedFormat().samples() > 0) {
+ const int samples = q->requestedFormat().samples();
+ if (samples > 0) {
if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
- fboFormat.setSamples(q->requestedFormat().samples());
+ fboFormat.setSamples(samples);
else
qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
}
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 347d02d616..e45a1d61ba 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -499,9 +499,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
const auto screens = currentScreen->virtualSiblings();
for (QPlatformScreen *screen : screens) {
- if (screen->geometry().contains(center))
+ const QRect screenGeometry = screen->geometry();
+ if (screenGeometry.contains(center))
return screen;
- if (screen->geometry().intersects(newGeometry))
+ if (screenGeometry.intersects(newGeometry))
fallback = screen;
}
}
diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp
index 947f2bb6a8..d8d448249e 100644
--- a/src/gui/kernel/qrasterwindow.cpp
+++ b/src/gui/kernel/qrasterwindow.cpp
@@ -73,8 +73,9 @@ public:
void beginPaint(const QRegion &region) Q_DECL_OVERRIDE
{
Q_Q(QRasterWindow);
- if (backingstore->size() != q->size()) {
- backingstore->resize(q->size());
+ const QSize size = q->size();
+ if (backingstore->size() != size) {
+ backingstore->resize(size);
markWindowAsDirty();
}
backingstore->beginPaint(region);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 3f430be579..107ea73a56 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1469,9 +1469,9 @@ void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
d->positionAutomatic = false;
- if (rect == geometry())
+ const QRect oldRect = geometry();
+ if (rect == oldRect)
return;
- QRect oldRect = geometry();
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) {
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index bb60139ed6..4134513210 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -1050,9 +1050,9 @@ bool QOpenGLShaderProgram::link()
if (!d->linked) {
QString name = objectName();
if (name.isEmpty())
- qWarning() << "QOpenGLShader::link:" << d->log;
+ qWarning("QOpenGLShader::link: %ls", qUtf16Printable(d->log));
else
- qWarning() << "QOpenGLShader::link[" << name << "]:" << d->log;
+ qWarning("QOpenGLShader::link[%ls]: %ls", qUtf16Printable(name), qUtf16Printable(d->log));
}
delete [] logbuf;
}
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index e42c268493..5178f5a9a8 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -824,14 +824,15 @@ QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode)
QScopedPointer<QFile> f(new QFile(archive));
f->open(mode);
QZipReader::Status status;
- if (f->error() == QFile::NoError)
+ const QFileDevice::FileError error = f->error();
+ if (error == QFile::NoError)
status = NoError;
else {
- if (f->error() == QFile::ReadError)
+ if (error == QFile::ReadError)
status = FileReadError;
- else if (f->error() == QFile::OpenError)
+ else if (error == QFile::OpenError)
status = FileOpenError;
- else if (f->error() == QFile::PermissionsError)
+ else if (error == QFile::PermissionsError)
status = FilePermissionsError;
else
status = FileError;
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 1cfea8634a..085c073bb1 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -328,17 +328,17 @@ QString QDesktopServices::storageLocationImpl(QStandardPaths::StandardLocation t
// * Unix data location is under the "data/" subdirectory
const QString compatAppName = qt_applicationName_noFallback();
const QString baseDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+ const QString organizationName = QCoreApplication::organizationName();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
QString result = baseDir;
- if (!QCoreApplication::organizationName().isEmpty())
- result += QLatin1Char('/') + QCoreApplication::organizationName();
+ if (!organizationName.isEmpty())
+ result += QLatin1Char('/') + organizationName;
if (!compatAppName.isEmpty())
result += QLatin1Char('/') + compatAppName;
return result;
#elif defined(Q_OS_UNIX)
return baseDir + QLatin1String("/data/")
- + QCoreApplication::organizationName() + QLatin1Char('/')
- + compatAppName;
+ + organizationName + QLatin1Char('/') + compatAppName;
#endif
}
return QStandardPaths::writableLocation(type);
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 8f16780925..69687b5ab8 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -1190,7 +1190,7 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info)
#endif // QT_NO_SSL
else {
// Should not happen
- qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not dequeu request");
+ qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not de-queue request");
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
}
}
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index cba0ab65b6..293633d6bc 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -49,6 +49,8 @@
#include <qurl.h>
#include <private/qnetworksession_p.h>
+#include <algorithm>
+
#ifdef Q_OS_UNIX
# include <unistd.h>
#endif
@@ -59,6 +61,26 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager)
+namespace {
+struct ToBeLookedUpEquals {
+ typedef bool result_type;
+ explicit ToBeLookedUpEquals(const QString &toBeLookedUp) Q_DECL_NOTHROW : m_toBeLookedUp(toBeLookedUp) {}
+ result_type operator()(QHostInfoRunnable* lookup) const Q_DECL_NOTHROW
+ {
+ return m_toBeLookedUp == lookup->toBeLookedUp;
+ }
+private:
+ QString m_toBeLookedUp;
+};
+
+// ### C++11: remove once we can use std::any_of()
+template<class InputIt, class UnaryPredicate>
+bool any_of(InputIt first, InputIt last, UnaryPredicate p)
+{
+ return std::find_if(first, last, p) != last;
+}
+}
+
/*!
\class QHostInfo
\brief The QHostInfo class provides static functions for host name lookups.
@@ -496,17 +518,17 @@ void QHostInfoRunnable::run()
// now also iterate through the postponed ones
{
QMutexLocker locker(&manager->mutex);
- QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups);
- while (iterator.hasNext()) {
- QHostInfoRunnable* postponed = iterator.next();
- if (toBeLookedUp == postponed->toBeLookedUp) {
- // we can now emit
- iterator.remove();
- hostInfo.setLookupId(postponed->id);
- postponed->resultEmitter.emitResultsReady(hostInfo);
- delete postponed;
- }
+ const auto partitionBegin = std::stable_partition(manager->postponedLookups.rbegin(), manager->postponedLookups.rend(),
+ ToBeLookedUpEquals(toBeLookedUp)).base();
+ const auto partitionEnd = manager->postponedLookups.end();
+ for (auto it = partitionBegin; it != partitionEnd; ++it) {
+ QHostInfoRunnable* postponed = *it;
+ // we can now emit
+ hostInfo.setLookupId(postponed->id);
+ postponed->resultEmitter.emitResultsReady(hostInfo);
+ delete postponed;
}
+ manager->postponedLookups.erase(partitionBegin, partitionEnd);
}
manager->lookupFinished(this);
@@ -573,13 +595,7 @@ void QHostInfoLookupManager::work()
QHostInfoRunnable* postponed = iterator.next();
// check if none of the postponed hostnames is currently running
- bool alreadyRunning = false;
- for (int i = 0; i < currentLookups.length(); i++) {
- if (currentLookups.at(i)->toBeLookedUp == postponed->toBeLookedUp) {
- alreadyRunning = true;
- break;
- }
- }
+ const bool alreadyRunning = any_of(currentLookups.cbegin(), currentLookups.cend(), ToBeLookedUpEquals(postponed->toBeLookedUp));
if (!alreadyRunning) {
iterator.remove();
scheduledLookups.prepend(postponed); // prepend! we want to finish it ASAP
@@ -594,13 +610,11 @@ void QHostInfoLookupManager::work()
QHostInfoRunnable *scheduled = iterator.next();
// check if a lookup for this host is already running, then postpone
- for (int i = 0; i < currentLookups.size(); i++) {
- if (currentLookups.at(i)->toBeLookedUp == scheduled->toBeLookedUp) {
- iterator.remove();
- postponedLookups.append(scheduled);
- scheduled = 0;
- break;
- }
+ const bool alreadyRunning = any_of(currentLookups.cbegin(), currentLookups.cend(), ToBeLookedUpEquals(scheduled->toBeLookedUp));
+ if (alreadyRunning) {
+ iterator.remove();
+ postponedLookups.append(scheduled);
+ scheduled = 0;
}
if (scheduled && currentLookups.size() < threadPool.maxThreadCount()) {
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 77fc3e58f2..545df8fa44 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -688,7 +688,7 @@ bool QGLShaderProgram::init()
if (d->glfuncs->hasOpenGLFeature(QOpenGLFunctions::Shaders)) {
GLuint program = d->glfuncs->glCreateProgram();
if (!program) {
- qWarning() << "QGLShaderProgram: could not create shader program";
+ qWarning("QGLShaderProgram: could not create shader program");
return false;
}
if (d->programGuard)
@@ -696,7 +696,7 @@ bool QGLShaderProgram::init()
d->programGuard = createSharedResourceGuard(context, program, freeProgramFunc);
return true;
} else {
- qWarning() << "QGLShaderProgram: shader programs are not supported";
+ qWarning("QGLShaderProgram: shader programs are not supported");
return false;
}
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index d7020092b5..f5372151b7 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -997,7 +997,7 @@ QFontEngine *QCoreTextFontDatabase::freeTypeFontEngine(const QFontDef &fontDef,
}
if (!engine->init(faceId, antialias, format, fontData) || engine->invalid()) {
- qWarning() << "QCoreTextFontDatabase::freeTypefontEngine Failed to create engine";
+ qWarning("QCoreTextFontDatabase::freeTypefontEngine Failed to create engine");
return Q_NULLPTR;
}
engine->setQtDefaultHintStyle(static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index d982c5afff..2b81de43a7 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -783,7 +783,7 @@ void AtSpiAdaptor::updateEventListeners()
}
m_applicationAdaptor->sendEvents(!evList.isEmpty());
} else {
- qAtspiDebug() << "Could not query active accessibility event listeners.";
+ qAtspiDebug("Could not query active accessibility event listeners.");
}
}
@@ -944,7 +944,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
if (sendObject || sendObject_text_changed) {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface || !iface->textInterface()) {
- qAtspiDebug() << "Received text event for invalid interface.";
+ qAtspiDebug("Received text event for invalid interface.");
return;
}
QString path = pathForInterface(iface);
@@ -1030,7 +1030,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface) {
- qWarning() << "ValueChanged event from invalid accessible.";
+ qWarning("ValueChanged event from invalid accessible.");
return;
}
if (iface->valueInterface()) {
@@ -1059,7 +1059,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::Selection: {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface) {
- qWarning() << "Selection event from invalid accessible.";
+ qWarning("Selection event from invalid accessible.");
return;
}
QString path = pathForInterface(iface);
@@ -1076,7 +1076,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
if (stateChange.checked) {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface) {
- qWarning() << "StateChanged event from invalid accessible.";
+ qWarning("StateChanged event from invalid accessible.");
return;
}
int checked = iface->state().checked;
@@ -1481,7 +1481,7 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface)
}
#ifdef ACCESSIBLE_CREATION_DEBUG
else {
- qAtspiDebug() << " IS NOT a component";
+ qAtspiDebug(" IS NOT a component");
}
#endif
if (interface->role() == QAccessible::Application)
@@ -1538,7 +1538,7 @@ QString AtSpiAdaptor::pathForObject(QObject *object) const
Q_ASSERT(object);
if (inheritsQAction(object)) {
- qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
+ qAtspiDebug("AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.");
}
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(object);
@@ -1669,18 +1669,18 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt
// int width = message.arguments().at(2).toInt();
// int height = message.arguments().at(3).toInt();
// uint coordinateType = message.arguments().at(4).toUInt();
- qAtspiDebug() << "SetExtents is not implemented.";
+ qAtspiDebug("SetExtents is not implemented.");
sendReply(connection, message, false);
} else if (function == QLatin1String("SetPosition")) {
// int x = message.arguments().at(0).toInt();
// int y = message.arguments().at(1).toInt();
// uint coordinateType = message.arguments().at(2).toUInt();
- qAtspiDebug() << "SetPosition is not implemented.";
+ qAtspiDebug("SetPosition is not implemented.");
sendReply(connection, message, false);
} else if (function == QLatin1String("SetSize")) {
// int width = message.arguments().at(0).toInt();
// int height = message.arguments().at(1).toInt();
- qAtspiDebug() << "SetSize is not implemented.";
+ qAtspiDebug("SetSize is not implemented.");
sendReply(connection, message, false);
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::componentInterface does not implement " << function << message.path();
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 901af8dece..135aad4dec 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -162,7 +162,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
QLatin1String(CONNMAN_MANAGER_INTERFACE),
QLatin1String("PropertyChanged"),
this,SIGNAL(propertyChanged(QString,QDBusVariant)))) {
- qWarning() << "PropertyChanged not connected";
+ qWarning("PropertyChanged not connected");
}
}
@@ -173,7 +173,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
QLatin1String(CONNMAN_MANAGER_INTERFACE),
QLatin1String("ServicesChanged"),
this,SLOT(onServicesChanged(ConnmanMapList, QList<QDBusObjectPath>)))) {
- qWarning() << "servicesChanged not connected";
+ qWarning("servicesChanged not connected");
}
}
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 8eebf86d67..6c3c661db6 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -136,7 +136,7 @@ bool QNetworkManagerInterface::setConnections()
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
{
if (devicesPathList.isEmpty()) {
- //qWarning() << "using blocking call!";
+ //qWarning("using blocking call!");
QDBusReply<QList<QDBusObjectPath> > reply = call(QLatin1String("GetDevices"));
devicesPathList = reply.value();
}
@@ -639,7 +639,7 @@ void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCa
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
{
if (accessPointsList.isEmpty()) {
- //qWarning() << "Using blocking call!";
+ //qWarning("Using blocking call!");
QDBusReply<QList<QDBusObjectPath> > reply
= call(QLatin1String("GetAccessPoints"));
accessPointsList = reply.value();
@@ -802,7 +802,7 @@ bool QNetworkManagerSettings::setConnections()
QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
{
if (connectionsList.isEmpty()) {
- //qWarning() << "Using blocking call!";
+ //qWarning("Using blocking call!");
QDBusReply<QList<QDBusObjectPath> > reply
= call(QLatin1String("ListConnections"));
connectionsList = reply.value();
@@ -874,7 +874,7 @@ void QNetworkManagerSettingsConnection::slotSettingsRemoved()
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
{
if (settingsMap.isEmpty()) {
- //qWarning() << "Using blocking call!";
+ //qWarning("Using blocking call!");
QDBusReply<QNmSettingsMap> reply = call(QLatin1String("GetSettings"));
settingsMap = reply.value();
}
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index 0b765a8485..726e1efb92 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -110,10 +110,10 @@ static void printBlob(NLA_BLOB *blob)
<< "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName;
break;
default:
- qDebug() << "UNKNOWN BLOB TYPE";
+ qDebug("UNKNOWN BLOB TYPE");
}
- qDebug() << "===== END NLA_BLOB =====";
+ qDebug("===== END NLA_BLOB =====");
}
#endif
diff --git a/src/plugins/generic/tuiotouch/qoscbundle.cpp b/src/plugins/generic/tuiotouch/qoscbundle.cpp
index ef5ca5b5f1..26dabebd23 100644
--- a/src/plugins/generic/tuiotouch/qoscbundle.cpp
+++ b/src/plugins/generic/tuiotouch/qoscbundle.cpp
@@ -122,7 +122,7 @@ QOscBundle::QOscBundle(const QByteArray &data)
if (size == 0) {
// empty bundle; these are valid, but should they be allowed? the
// spec is unclear on this...
- qWarning() << "Empty bundle?";
+ qWarning("Empty bundle?");
m_isValid = true;
m_immediate = isImmediate;
m_timeEpoch = oscTimeEpoch;
@@ -152,7 +152,7 @@ QOscBundle::QOscBundle(const QByteArray &data)
m_timePico = oscTimePico;
m_messages.append(subMessage);
} else {
- qWarning() << "Invalid sub-message";
+ qWarning("Invalid sub-message");
return;
}
} else if (subdata.startsWith(bundleIdentifier)) {
@@ -166,7 +166,7 @@ QOscBundle::QOscBundle(const QByteArray &data)
m_bundles.append(subBundle);
}
} else {
- qWarning() << "Malformed sub-data!";
+ qWarning("Malformed sub-data!");
return;
}
}
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index e2c4bf9dc4..6026e06b55 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -165,7 +165,7 @@ void QTuioHandler::processPackets()
QList<QVariant> arguments = message.arguments();
if (arguments.count() == 0) {
- qWarning() << "Ignoring TUIO message with no arguments";
+ qWarning("Ignoring TUIO message with no arguments");
continue;
}
@@ -195,7 +195,7 @@ void QTuioHandler::process2DCurSource(const QOscMessage &message)
}
if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) {
- qWarning() << "Ignoring malformed TUIO source message (bad argument type)";
+ qWarning("Ignoring malformed TUIO source message (bad argument type)");
return;
}
diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp
index b47c0b40de..2846f52c8c 100644
--- a/src/plugins/platforminputcontexts/ibus/main.cpp
+++ b/src/plugins/platforminputcontexts/ibus/main.cpp
@@ -59,7 +59,6 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString
Q_UNUSED(paramList);
if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) {
- qDBusRegisterMetaType<QIBusSerializable>();
qDBusRegisterMetaType<QIBusAttribute>();
qDBusRegisterMetaType<QIBusAttributeList>();
qDBusRegisterMetaType<QIBusText>();
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 60ca07fbe1..200d5789a8 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -289,7 +289,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint
void QIBusPlatformInputContext::surroundingTextRequired()
{
if (debug)
- qDebug() << "surroundingTextRequired";
+ qDebug("surroundingTextRequired");
d->needsSurroundingText = true;
update(Qt::ImSurroundingText);
}
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index a168836a06..ac82fa3931 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -50,13 +50,9 @@ QIBusSerializable::QIBusSerializable()
{
}
-QIBusSerializable::~QIBusSerializable()
+void QIBusSerializable::deserializeFrom(const QDBusArgument &argument)
{
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object)
-{
- argument >> object.name;
+ argument >> name;
argument.beginMap();
while (!argument.atEnd()) {
@@ -66,19 +62,18 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable
argument >> key;
argument >> value;
argument.endMapEntry();
- object.attachments[key] = value.variant().value<QDBusArgument>();
+ attachments[key] = value.variant().value<QDBusArgument>();
}
argument.endMap();
- return argument;
}
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object)
+void QIBusSerializable::serializeTo(QDBusArgument &argument) const
{
- argument << object.name;
+ argument << name;
argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>());
- QHashIterator<QString, QDBusArgument> i(object.attachments);
+ QHashIterator<QString, QDBusArgument> i(attachments);
while (i.hasNext()) {
i.next();
@@ -91,7 +86,6 @@ QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &obje
argument.endMapEntry();
}
argument.endMap();
- return argument;
}
QIBusAttribute::QIBusAttribute()
@@ -103,43 +97,35 @@ QIBusAttribute::QIBusAttribute()
name = "IBusAttribute";
}
-QIBusAttribute::~QIBusAttribute()
-{
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute)
+void QIBusAttribute::serializeTo(QDBusArgument &argument) const
{
argument.beginStructure();
- argument << static_cast<const QIBusSerializable &>(attribute);
+ QIBusSerializable::serializeTo(argument);
- quint32 t = (quint32) attribute.type;
+ quint32 t = (quint32) type;
argument << t;
- argument << attribute.value;
- argument << attribute.start;
- argument << attribute.end;
+ argument << value;
+ argument << start;
+ argument << end;
argument.endStructure();
-
- return argument;
}
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute)
+void QIBusAttribute::deserializeFrom(const QDBusArgument &argument)
{
argument.beginStructure();
- argument >> static_cast<QIBusSerializable &>(attribute);
+ QIBusSerializable::deserializeFrom(argument);
quint32 t;
argument >> t;
- attribute.type = (QIBusAttribute::Type) t;
- argument >> attribute.value;
- argument >> attribute.start;
- argument >> attribute.end;
+ type = (QIBusAttribute::Type) t;
+ argument >> value;
+ argument >> start;
+ argument >> end;
argument.endStructure();
-
- return argument;
}
QTextCharFormat QIBusAttribute::format() const
@@ -187,34 +173,30 @@ QIBusAttributeList::QIBusAttributeList()
name = "IBusAttrList";
}
-QIBusAttributeList::~QIBusAttributeList()
-{
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attrList)
+void QIBusAttributeList::serializeTo(QDBusArgument &argument) const
{
argument.beginStructure();
- argument << static_cast<const QIBusSerializable &>(attrList);
+ QIBusSerializable::serializeTo(argument);
argument.beginArray(qMetaTypeId<QDBusVariant>());
- for (int i = 0; i < attrList.attributes.size(); ++i) {
+ for (int i = 0; i < attributes.size(); ++i) {
QVariant variant;
- variant.setValue(attrList.attributes.at(i));
+ variant.setValue(attributes.at(i));
argument << QDBusVariant (variant);
}
argument.endArray();
argument.endStructure();
- return argument;
}
-const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList)
+void QIBusAttributeList::deserializeFrom(const QDBusArgument &arg)
{
qCDebug(qtQpaInputMethodsSerialize) << "QIBusAttributeList::fromDBusArgument()" << arg.currentSignature();
+
arg.beginStructure();
- arg >> static_cast<QIBusSerializable &>(attrList);
+ QIBusSerializable::deserializeFrom(arg);
arg.beginArray();
while (!arg.atEnd()) {
@@ -223,12 +205,11 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &at
QIBusAttribute attr;
var.variant().value<QDBusArgument>() >> attr;
- attrList.attributes.append(attr);
+ attributes.append(std::move(attr));
}
arg.endArray();
arg.endStructure();
- return arg;
}
QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
@@ -269,138 +250,115 @@ QIBusText::QIBusText()
name = "IBusText";
}
-QIBusText::~QIBusText()
-{
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text)
+void QIBusText::serializeTo(QDBusArgument &argument) const
{
argument.beginStructure();
- argument << static_cast<const QIBusSerializable &>(text);
+ QIBusSerializable::serializeTo(argument);
- argument << text.text << text.attributes;
+ argument << text << attributes;
argument.endStructure();
- return argument;
}
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text)
+void QIBusText::deserializeFrom(const QDBusArgument &argument)
{
qCDebug(qtQpaInputMethodsSerialize) << "QIBusText::fromDBusArgument()" << argument.currentSignature();
+
argument.beginStructure();
- argument >> static_cast<QIBusSerializable &>(text);
+ QIBusSerializable::deserializeFrom(argument);
- argument >> text.text;
+ argument >> text;
QDBusVariant variant;
argument >> variant;
- variant.variant().value<QDBusArgument>() >> text.attributes;
+ variant.variant().value<QDBusArgument>() >> attributes;
argument.endStructure();
- return argument;
}
QIBusEngineDesc::QIBusEngineDesc()
- : engine_name(""),
- longname(""),
- description(""),
- language(""),
- license(""),
- author(""),
- icon(""),
- layout(""),
- rank(0),
- hotkeys(""),
- symbol(""),
- setup(""),
- layout_variant(""),
- layout_option(""),
- version(""),
- textdomain(""),
- iconpropkey("")
+ : rank(0)
{
name = "IBusEngineDesc";
}
-QIBusEngineDesc::~QIBusEngineDesc()
-{
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc)
+void QIBusEngineDesc::serializeTo(QDBusArgument &argument) const
{
argument.beginStructure();
- argument << static_cast<const QIBusSerializable &>(desc);
-
- argument << desc.engine_name;
- argument << desc.longname;
- argument << desc.description;
- argument << desc.language;
- argument << desc.license;
- argument << desc.author;
- argument << desc.icon;
- argument << desc.layout;
- argument << desc.rank;
- argument << desc.hotkeys;
- argument << desc.symbol;
- argument << desc.setup;
- argument << desc.layout_variant;
- argument << desc.layout_option;
- argument << desc.version;
- argument << desc.textdomain;
- argument << desc.iconpropkey;
+ QIBusSerializable::serializeTo(argument);
+
+ argument << engine_name;
+ argument << longname;
+ argument << description;
+ argument << language;
+ argument << license;
+ argument << author;
+ argument << icon;
+ argument << layout;
+ argument << rank;
+ argument << hotkeys;
+ argument << symbol;
+ argument << setup;
+ argument << layout_variant;
+ argument << layout_option;
+ argument << version;
+ argument << textdomain;
+ argument << iconpropkey;
argument.endStructure();
- return argument;
}
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc)
+void QIBusEngineDesc::deserializeFrom(const QDBusArgument &argument)
{
qCDebug(qtQpaInputMethodsSerialize) << "QIBusEngineDesc::fromDBusArgument()" << argument.currentSignature();
argument.beginStructure();
- argument >> static_cast<QIBusSerializable &>(desc);
-
- argument >> desc.engine_name;
- argument >> desc.longname;
- argument >> desc.description;
- argument >> desc.language;
- argument >> desc.license;
- argument >> desc.author;
- argument >> desc.icon;
- argument >> desc.layout;
- argument >> desc.rank;
- argument >> desc.hotkeys;
- argument >> desc.symbol;
- argument >> desc.setup;
+ QIBusSerializable::deserializeFrom(argument);
+
+ argument >> engine_name;
+ argument >> longname;
+ argument >> description;
+ argument >> language;
+ argument >> license;
+ argument >> author;
+ argument >> icon;
+ argument >> layout;
+ argument >> rank;
+ argument >> hotkeys;
+ argument >> symbol;
+ argument >> setup;
// Previous IBusEngineDesc supports the arguments between engine_name
// and setup.
- if (argument.currentSignature() == "") {
- argument.endStructure();
- return argument;
- }
- argument >> desc.layout_variant;
- argument >> desc.layout_option;
+ if (argument.currentSignature() == "")
+ goto olderThanV2;
+ argument >> layout_variant;
+ argument >> layout_option;
// Previous IBusEngineDesc supports the arguments between engine_name
// and layout_option.
- if (argument.currentSignature() == "") {
- argument.endStructure();
- return argument;
- }
- argument >> desc.version;
- if (argument.currentSignature() == "") {
- argument.endStructure();
- return argument;
- }
- argument >> desc.textdomain;
- if (argument.currentSignature() == "") {
- argument.endStructure();
- return argument;
- }
- argument >> desc.iconpropkey;
-
+ if (argument.currentSignature() == "")
+ goto olderThanV3;
+ argument >> version;
+ if (argument.currentSignature() == "")
+ goto olderThanV4;
+ argument >> textdomain;
+ if (argument.currentSignature() == "")
+ goto olderThanV5;
+ argument >> iconpropkey;
+ // <-- insert new member streaming here (1/2)
+ goto newest;
+olderThanV2:
+ layout_variant.clear();
+ layout_option.clear();
+olderThanV3:
+ version.clear();
+olderThanV4:
+ textdomain.clear();
+olderThanV5:
+ iconpropkey.clear();
+ // <-- insert new members here (2/2)
+newest:
argument.endStructure();
- return argument;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h
index 9dca7e3903..217cd836fc 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.h
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h
@@ -54,13 +54,15 @@ class QIBusSerializable
{
public:
QIBusSerializable();
- virtual ~QIBusSerializable();
+
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
QString name;
QHash<QString, QDBusArgument> attachments;
};
-class QIBusAttribute : public QIBusSerializable
+class QIBusAttribute : private QIBusSerializable
{
public:
enum Type {
@@ -79,42 +81,53 @@ public:
};
QIBusAttribute();
- ~QIBusAttribute();
QTextCharFormat format() const;
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
+
Type type;
quint32 value;
quint32 start;
quint32 end;
};
+Q_DECLARE_TYPEINFO(QIBusAttribute, Q_MOVABLE_TYPE);
-class QIBusAttributeList : public QIBusSerializable
+class QIBusAttributeList : private QIBusSerializable
{
public:
QIBusAttributeList();
- ~QIBusAttributeList();
QList<QInputMethodEvent::Attribute> imAttributes() const;
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
+
QVector<QIBusAttribute> attributes;
};
+Q_DECLARE_TYPEINFO(QIBusAttributeList, Q_MOVABLE_TYPE);
-class QIBusText : public QIBusSerializable
+class QIBusText : private QIBusSerializable
{
public:
QIBusText();
- ~QIBusText();
+
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
QString text;
QIBusAttributeList attributes;
};
+Q_DECLARE_TYPEINFO(QIBusText, Q_MOVABLE_TYPE);
-class QIBusEngineDesc : public QIBusSerializable
+class QIBusEngineDesc : private QIBusSerializable
{
public:
QIBusEngineDesc();
- ~QIBusEngineDesc();
+
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
QString engine_name;
QString longname;
@@ -134,25 +147,30 @@ public:
QString textdomain;
QString iconpropkey;
};
+Q_DECLARE_TYPEINFO(QIBusEngineDesc, Q_MOVABLE_TYPE);
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object);
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object);
-
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute);
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute);
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute)
+{ attribute.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute)
+{ attribute.deserializeFrom(argument); return argument; }
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList);
-const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList);
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList)
+{ attributeList.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttributeList &attributeList)
+{ attributeList.deserializeFrom(argument); return argument; }
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text);
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text);
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text)
+{ text.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text)
+{ text.deserializeFrom(argument); return argument; }
-QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc);
-const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc);
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc)
+{ desc.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc)
+{ desc.deserializeFrom(argument); return argument; }
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QIBusSerializable)
Q_DECLARE_METATYPE(QIBusAttribute)
Q_DECLARE_METATYPE(QIBusAttributeList)
Q_DECLARE_METATYPE(QIBusText)
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index e680a0ed34..064a0c095c 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -98,7 +98,7 @@ namespace QtAndroidInput
{
QJNIObjectPrivate::callStaticMethod<void>(applicationClass(), "resetSoftwareKeyboard");
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ RESETSOFTWAREKEYBOARD";
+ qDebug("@@@ RESETSOFTWAREKEYBOARD");
#endif
}
@@ -106,7 +106,7 @@ namespace QtAndroidInput
{
QJNIObjectPrivate::callStaticMethod<void>(applicationClass(), "hideSoftwareKeyboard");
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ HIDESOFTWAREKEYBOARD";
+ qDebug("@@@ HIDESOFTWAREKEYBOARD");
#endif
}
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 6340d47c18..516fe60c8c 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -521,7 +521,7 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
}
m_main = (Main)dlsym(m_mainLibraryHnd, "main");
} else {
- qWarning() << "No main library was specified; searching entire process (this is slow!)";
+ qWarning("No main library was specified; searching entire process (this is slow!)");
m_main = (Main)dlsym(RTLD_DEFAULT, "main");
}
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index ddf806a68f..eb9e95508c 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -78,7 +78,7 @@ static jboolean beginBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ BEGINBATCH";
+ qDebug("@@@ BEGINBATCH");
#endif
return m_androidInputContext->beginBatchEdit();
@@ -92,7 +92,7 @@ static jboolean endBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ ENDBATCH";
+ qDebug("@@@ ENDBATCH");
#endif
return m_androidInputContext->endBatchEdit();
@@ -134,7 +134,7 @@ static jboolean finishComposingText(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ FINISH";
+ qDebug("@@@ FINISH");
#endif
return m_androidInputContext->finishComposingText();
}
@@ -256,7 +256,7 @@ static jboolean selectAll(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SELALL";
+ qDebug("@@@ SELALL");
#endif
return m_androidInputContext->selectAll();
}
@@ -267,7 +267,7 @@ static jboolean cut(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
+ qDebug("@@@");
#endif
return m_androidInputContext->cut();
}
@@ -278,7 +278,7 @@ static jboolean copy(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
+ qDebug("@@@");
#endif
return m_androidInputContext->copy();
}
@@ -289,7 +289,7 @@ static jboolean copyURL(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
+ qDebug("@@@");
#endif
return m_androidInputContext->copyURL();
}
@@ -300,7 +300,7 @@ static jboolean paste(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
+ qDebug("@@@");
#endif
return m_androidInputContext->paste();
}
@@ -311,7 +311,7 @@ static jboolean updateCursorPosition(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ UPDATECURSORPOS";
+ qDebug("@@@ UPDATECURSORPOS");
#endif
m_androidInputContext->updateCursorPosition();
return true;
@@ -371,43 +371,43 @@ QAndroidInputContext::QAndroidInputContext()
m_extractedTextClass = static_cast<jclass>(env->NewGlobalRef(clazz));
m_classConstructorMethodID = env->GetMethodID(m_extractedTextClass, "<init>", "()V");
if (Q_UNLIKELY(!m_classConstructorMethodID)) {
- qCritical() << "GetMethodID failed";
+ qCritical("GetMethodID failed");
return;
}
m_partialEndOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialEndOffset", "I");
if (Q_UNLIKELY(!m_partialEndOffsetFieldID)) {
- qCritical() << "Can't find field partialEndOffset";
+ qCritical("Can't find field partialEndOffset");
return;
}
m_partialStartOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialStartOffset", "I");
if (Q_UNLIKELY(!m_partialStartOffsetFieldID)) {
- qCritical() << "Can't find field partialStartOffset";
+ qCritical("Can't find field partialStartOffset");
return;
}
m_selectionEndFieldID = env->GetFieldID(m_extractedTextClass, "selectionEnd", "I");
if (Q_UNLIKELY(!m_selectionEndFieldID)) {
- qCritical() << "Can't find field selectionEnd";
+ qCritical("Can't find field selectionEnd");
return;
}
m_selectionStartFieldID = env->GetFieldID(m_extractedTextClass, "selectionStart", "I");
if (Q_UNLIKELY(!m_selectionStartFieldID)) {
- qCritical() << "Can't find field selectionStart";
+ qCritical("Can't find field selectionStart");
return;
}
m_startOffsetFieldID = env->GetFieldID(m_extractedTextClass, "startOffset", "I");
if (Q_UNLIKELY(!m_startOffsetFieldID)) {
- qCritical() << "Can't find field startOffset";
+ qCritical("Can't find field startOffset");
return;
}
m_textFieldID = env->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;");
if (Q_UNLIKELY(!m_textFieldID)) {
- qCritical() << "Can't find field text";
+ qCritical("Can't find field text");
return;
}
qRegisterMetaType<QInputMethodEvent *>("QInputMethodEvent*");
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index 7bed4a739a..f8d0b9c8ba 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -216,7 +216,7 @@ QJsonObject AndroidStyle::loadStyleData()
}
if (Q_UNLIKELY(!document.isObject())) {
- qCritical() << "Style.json does not contain a valid style.";
+ qCritical("Style.json does not contain a valid style.");
return QJsonObject();
}
return document.object();
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index bc4cb227a8..1faa806480 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -63,7 +63,7 @@ void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
return;
QMacAccessibilityElement *element = [QMacAccessibilityElement elementWithId: event->uniqueId()];
if (!element) {
- qWarning() << "QCocoaAccessibility::notifyAccessibilityUpdate: invalid element";
+ qWarning("QCocoaAccessibility::notifyAccessibilityUpdate: invalid element");
return;
}
@@ -277,7 +277,7 @@ NSArray *unignoredChildren(QAccessibleInterface *interface)
if (element)
[kids addObject: element];
else
- qWarning() << "QCocoaAccessibility: invalid child";
+ qWarning("QCocoaAccessibility: invalid child");
}
return NSAccessibilityUnignoredChildren(kids);
}
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 0f8081715b..7128fb72c3 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -555,7 +555,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
- (id)accessibilityHitTest:(NSPoint)point {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface || !iface->isValid()) {
-// qDebug() << "Hit test: INVALID";
+// qDebug("Hit test: INVALID");
return NSAccessibilityUnignoredAncestor(self);
}
@@ -585,7 +585,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface || !iface->isValid()) {
- qWarning() << "FocusedUIElement for INVALID";
+ qWarning("FocusedUIElement for INVALID");
return nil;
}
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 25fc9f0d5e..204f2440d9 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -772,11 +772,11 @@ CGContextRef qt_mac_cg_context(QPaintDevice *pdev)
if (data && data->classId() == QPlatformPixmap::RasterClass) {
image = data->buffer();
} else {
- qDebug() << "qt_mac_cg_context: Unsupported pixmap class";
+ qDebug("qt_mac_cg_context: Unsupported pixmap class");
}
} else if (pdev->devType() == QInternal::Widget) {
// TODO test: image = static_cast<QImage *>(static_cast<const QWidget *>(pdev)->backingStore()->paintDevice());
- qDebug() << "qt_mac_cg_context: not implemented: Widget class";
+ qDebug("qt_mac_cg_context: not implemented: Widget class");
}
if (!image)
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
index 847435d96e..8018433fb6 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
@@ -93,7 +93,7 @@ QFunctionPointer QDirectFbGLContext::getProcAddress(const char *procName)
void QDirectFbGLContext::swapBuffers()
{
// m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent()
- qDebug() << "Swap buffers";
+ qDebug("Swap buffers");
}
QPlatformWindowFormat QDirectFbGLContext::platformWindowFormat() const
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index 4a39c4d7ab..3887596a9b 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -169,7 +169,7 @@ void QIOSBackingStore::resize(const QSize &size, const QRegion &staticContents)
// size in beginPaint().
if (size != window()->size() && !window()->inherits("QWidgetWindow"))
- qWarning() << "QIOSBackingStore needs to have the same size as its window";
+ qWarning("QIOSBackingStore needs to have the same size as its window");
return;
}
diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h
index 06ebf4809c..0fe81ceb91 100644
--- a/src/plugins/platforms/ios/qiosglobal.h
+++ b/src/plugins/platforms/ios/qiosglobal.h
@@ -50,11 +50,11 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods);
#if !defined(QT_NO_DEBUG)
-#define qImDebug(...) \
+#define qImDebug \
for (bool qt_category_enabled = lcQpaInputMethods().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, lcQpaInputMethods().categoryName()).debug(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, lcQpaInputMethods().categoryName()).debug
#else
-#define qImDebug() QT_NO_QDEBUG_MACRO()
+#define qImDebug QT_NO_QDEBUG_MACRO
#endif
class QPlatformScreen;
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index 4dd66388ad..c2f3d6b9e1 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -93,7 +93,7 @@ Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientat
break;
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationFaceDown:
- qWarning() << "Falling back to Qt::PortraitOrientation for UIDeviceOrientationFaceUp/UIDeviceOrientationFaceDown";
+ qWarning("Falling back to Qt::PortraitOrientation for UIDeviceOrientationFaceUp/UIDeviceOrientationFaceDown");
qtOrientation = Qt::PortraitOrientation;
break;
default:
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index f2292ad0ab..d553d16698 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -227,7 +227,7 @@ static QUIView *focusView()
Q_UNUSED(sender);
if (self.state == UIGestureRecognizerStateBegan) {
- qImDebug() << "hide keyboard gesture was triggered";
+ qImDebug("hide keyboard gesture was triggered");
UIResponder *firstResponder = [UIResponder currentFirstResponder];
Q_ASSERT([firstResponder isKindOfClass:[QIOSTextInputResponder class]]);
[firstResponder resignFirstResponder];
@@ -239,12 +239,12 @@ static QUIView *focusView()
[super reset];
if (!m_context->isInputPanelVisible()) {
- qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture";
+ qImDebug("keyboard was hidden, disabling hide-keyboard gesture");
self.enabled = NO;
} else {
- qImDebug() << "gesture completed without triggering";
+ qImDebug("gesture completed without triggering");
if (self.hasDeferredScrollToCursor) {
- qImDebug() << "applying deferred scroll to cursor";
+ qImDebug("applying deferred scroll to cursor");
m_context->scrollToCursor();
}
}
@@ -313,22 +313,22 @@ QIOSInputContext::~QIOSInputContext()
void QIOSInputContext::showInputPanel()
{
// No-op, keyboard controlled fully by platform based on focus
- qImDebug() << "can't show virtual keyboard without a focus object, ignoring";
+ qImDebug("can't show virtual keyboard without a focus object, ignoring");
}
void QIOSInputContext::hideInputPanel()
{
if (![m_textResponder isFirstResponder]) {
- qImDebug() << "QIOSTextInputResponder is not first responder, ignoring";
+ qImDebug("QIOSTextInputResponder is not first responder, ignoring");
return;
}
if (qGuiApp->focusObject() != m_imeState.focusObject) {
- qImDebug() << "current focus object does not match IM state, likely hiding from focusOut event, so ignoring";
+ qImDebug("current focus object does not match IM state, likely hiding from focusOut event, so ignoring");
return;
}
- qImDebug() << "hiding VKB as requested by QInputMethod::hide()";
+ qImDebug("hiding VKB as requested by QInputMethod::hide()");
[m_textResponder resignFirstResponder];
}
@@ -380,7 +380,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification)
qImDebug() << qPrintable(QString::fromNSString(notification.name)) << "from" << fromCGRect(frameBegin) << "to" << fromCGRect(frameEnd)
<< "(curve =" << m_keyboardState.animationCurve << "duration =" << m_keyboardState.animationDuration << "s)";
} else {
- qImDebug() << "No notification to update keyboard state based on, just updating keyboard rect";
+ qImDebug("No notification to update keyboard state based on, just updating keyboard rect");
}
if (!focusView() || CGRectIsEmpty(currentKeyboardRect))
@@ -434,7 +434,7 @@ void QIOSInputContext::scrollToCursor()
if (m_keyboardHideGesture.state == UIGestureRecognizerStatePossible && m_keyboardHideGesture.numberOfTouches == 1) {
// Don't scroll to the cursor if the user is touching the screen and possibly
// trying to trigger the hide-keyboard gesture.
- qImDebug() << "deferring scrolling to cursor as we're still waiting for a possible gesture";
+ qImDebug("deferring scrolling to cursor as we're still waiting for a possible gesture");
m_keyboardHideGesture.hasDeferredScrollToCursor = YES;
return;
}
@@ -451,7 +451,7 @@ void QIOSInputContext::scrollToCursor()
// We only support auto-scroll for docked keyboards for now, so make sure that's the case
if (CGRectGetMaxY(m_keyboardState.keyboardEndRect) != CGRectGetMaxY([UIScreen mainScreen].bounds)) {
- qImDebug() << "Keyboard not docked, ignoring request to scroll to reveal cursor";
+ qImDebug("Keyboard not docked, ignoring request to scroll to reveal cursor");
return;
}
@@ -550,7 +550,7 @@ void QIOSInputContext::setFocusObject(QObject *focusObject)
clearCurrentFocusObject();
return;
} else if (focusObject == m_imeState.focusObject) {
- qImDebug() << "same focus object as last update, skipping reset";
+ qImDebug("same focus object as last update, skipping reset");
return;
}
@@ -594,23 +594,23 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
if (inputMethodAccepted()) {
if (!m_textResponder || [m_textResponder needsKeyboardReconfigure:changedProperties]) {
- qImDebug() << "creating new text responder";
+ qImDebug("creating new text responder");
[m_textResponder autorelease];
m_textResponder = [[QIOSTextInputResponder alloc] initWithInputContext:this];
} else {
- qImDebug() << "no need to reconfigure keyboard, just notifying input delegate";
+ qImDebug("no need to reconfigure keyboard, just notifying input delegate");
[m_textResponder notifyInputDelegate:changedProperties];
}
if (![m_textResponder isFirstResponder]) {
- qImDebug() << "IM enabled, making text responder first responder";
+ qImDebug("IM enabled, making text responder first responder");
[m_textResponder becomeFirstResponder];
}
if (changedProperties & Qt::ImCursorRectangle)
scrollToCursor();
} else if ([m_textResponder isFirstResponder]) {
- qImDebug() << "IM not enabled, resigning text responder as first responder";
+ qImDebug("IM not enabled, resigning text responder as first responder");
[m_textResponder resignFirstResponder];
}
}
@@ -640,7 +640,7 @@ bool QIOSInputContext::inputMethodAccepted() const
*/
void QIOSInputContext::reset()
{
- qImDebug() << "updating Qt::ImQueryAll and unmarking text";
+ qImDebug("updating Qt::ImQueryAll and unmarking text");
update(Qt::ImQueryAll);
@@ -658,7 +658,7 @@ void QIOSInputContext::reset()
*/
void QIOSInputContext::commit()
{
- qImDebug() << "unmarking text";
+ qImDebug("unmarking text");
[m_textResponder unmarkText];
[m_textResponder notifyInputDelegate:Qt::ImSurroundingText];
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index a894963bbe..6a66bf213e 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -261,7 +261,7 @@
// as well, as the IM state that we were based on may have been invalidated when
// IM was switched off.
- qImDebug() << "IM was turned on, we need to check hints and platform data as well";
+ qImDebug("IM was turned on, we need to check hints and platform data as well");
updatedProperties |= (Qt::ImHints | Qt::ImPlatformData);
}
@@ -311,7 +311,7 @@
// Don't allow activation events of the window that we're doing text on behalf on
// to steal responder.
if (FirstResponderCandidate::currentCandidate() == [self nextResponder]) {
- qImDebug() << "not allowing parent window to steal responder";
+ qImDebug("not allowing parent window to steal responder");
return NO;
}
@@ -334,7 +334,7 @@
if ([self currentImeState:Qt::ImEnabled].toBool()) {
// The current focus object expects text input, but there
// is no keyboard to get input from. So we clear focus.
- qImDebug() << "no keyboard available, clearing focus object";
+ qImDebug("no keyboard available, clearing focus object");
m_inputContext->clearCurrentFocusObject();
}
} else {
@@ -342,7 +342,7 @@
// another QIOSTextResponder was made first-responder, another UIView was
// made first-responder, or the first-responder was cleared globally. In
// either of these cases we don't have to do anything.
- qImDebug() << "lost first responder, but not clearing focus object";
+ qImDebug("lost first responder, but not clearing focus object");
}
return YES;
diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp
index 19a581625a..402ee7e2dd 100644
--- a/src/plugins/platforms/minimal/qminimalbackingstore.cpp
+++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp
@@ -62,7 +62,7 @@ QMinimalBackingStore::~QMinimalBackingStore()
QPaintDevice *QMinimalBackingStore::paintDevice()
{
if (mDebug)
- qDebug() << "QMinimalBackingStore::paintDevice";
+ qDebug("QMinimalBackingStore::paintDevice");
return &mImage;
}
diff --git a/src/plugins/platforms/mirclient/qmirclientinput.cpp b/src/plugins/platforms/mirclient/qmirclientinput.cpp
index addeda634c..3af714465b 100644
--- a/src/plugins/platforms/mirclient/qmirclientinput.cpp
+++ b/src/plugins/platforms/mirclient/qmirclientinput.cpp
@@ -214,7 +214,7 @@ void QMirClientInput::customEvent(QEvent* event)
const MirEvent *nativeEvent = ubuntuEvent->nativeEvent;
if ((ubuntuEvent->window == nullptr) || (ubuntuEvent->window->window() == nullptr)) {
- qWarning() << "Attempted to deliver an event to a non-existent window, ignoring.";
+ qWarning("Attempted to deliver an event to a non-existent window, ignoring.");
return;
}
diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
index 1a4ba59817..7a9d22e74d 100644
--- a/src/plugins/platforms/openwfd/qopenwfddevice.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
@@ -55,11 +55,11 @@ QOpenWFDDevice::QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint device_e
{
mDevice = wfdCreateDevice(WFD_DEFAULT_DEVICE_ID,WFD_NONE);
if (mDevice == WFD_INVALID_HANDLE)
- qDebug() << "failed to create device";
+ qDebug("failed to create device");
mEvent = wfdCreateEvent(mDevice,0);
if (mEvent == WFD_INVALID_HANDLE)
- qDebug() << "failed to create event handle";
+ qDebug("failed to create event handle");
//initialize pipelines for device.
wfdEnumeratePipelines(mDevice,WFD_NONE,0,WFD_NONE);
@@ -181,22 +181,22 @@ void QOpenWFDDevice::readEvents(WFDtime wait)
case WFD_EVENT_NONE:
return;
case WFD_EVENT_DESTROYED:
- qDebug() << "Event or Device destoryed!";
+ qDebug("Event or Device destoryed!");
return;
case WFD_EVENT_PORT_ATTACH_DETACH:
handlePortAttachDetach();
break;
case WFD_EVENT_PORT_PROTECTION_FAILURE:
- qDebug() << "Port protection event handling not implemented";
+ qDebug("Port protection event handling not implemented");
break;
case WFD_EVENT_PIPELINE_BIND_SOURCE_COMPLETE:
handlePipelineBindSourceComplete();
break;
case WFD_EVENT_PIPELINE_BIND_MASK_COMPLETE:
- qDebug() << "Pipeline bind mask event handling not implemented";
+ qDebug("Pipeline bind mask event handling not implemented");
break;
default:
- qDebug() << "Not recognised event type";
+ qDebug("Unrecognized event type: %lu", static_cast<long unsigned int>(type));
break;
}
@@ -206,10 +206,10 @@ void QOpenWFDDevice::readEvents(WFDtime wait)
void QOpenWFDDevice::initializeGbmAndEgl()
{
- qDebug() << "initializing GBM and EGL";
+ qDebug("initializing GBM and EGL");
int fd = wfdGetDeviceAttribi(mDevice,WFD_DEVICE_ID);
if (fd < 0) {
- qDebug() << "failed to get WFD_DEVICE_ID";
+ qDebug("failed to get WFD_DEVICE_ID");
}
mGbmDevice = gbm_create_device(fd);
@@ -221,12 +221,12 @@ void QOpenWFDDevice::initializeGbmAndEgl()
EGLint minor, major;
if (!eglInitialize(mEglDisplay,&major,&minor)) {
- qDebug() << "failed to initialize egl";
+ qDebug("failed to initialize egl");
}
QByteArray eglExtensions = eglQueryString(mEglDisplay, EGL_EXTENSIONS);
if (!eglExtensions.contains("EGL_KHR_surfaceless_opengl")) {
- qDebug() << "This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl";
+ qDebug("This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl");
}
eglBindAPI(EGL_OPENGL_ES_API);
@@ -238,7 +238,7 @@ void QOpenWFDDevice::initializeGbmAndEgl()
mEglContext = eglCreateContext(mEglDisplay,NULL,EGL_NO_CONTEXT,contextAttribs);
if (mEglContext == EGL_NO_CONTEXT) {
- qDebug() << "Failed to create EGL context";
+ qDebug("Failed to create EGL context");
}
eglCreateImage = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
@@ -269,7 +269,7 @@ void QOpenWFDDevice::handlePortAttachDetach()
for (int i = 0; i < mPorts.size(); i++) {
if (mPorts.at(i)->portId() == id) {
indexToAdd = i;
- qDebug() << "found index to attach";
+ qDebug("found index to attach");
break;
}
}
@@ -301,7 +301,7 @@ void QOpenWFDDevice::handlePipelineBindSourceComplete()
WFDint overflow = wfdGetEventAttribi(mDevice,mEvent, WFD_EVENT_PIPELINE_BIND_QUEUE_OVERFLOW);
if (overflow == WFD_TRUE) {
- qDebug() << "PIPELINE_BIND_QUEUE_OVERFLOW event occurred";
+ qDebug("PIPELINE_BIND_QUEUE_OVERFLOW event occurred");
}
WFDint pipelineId = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PIPELINE_BIND_PIPELINE_ID);
diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
index 31d369ae00..cf267ea203 100644
--- a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
@@ -61,7 +61,7 @@ bool QOpenWFDGLContext::makeCurrent(QPlatformSurface *surface)
EGLDisplay display = mWfdDevice->eglDisplay();
EGLContext context = mWfdDevice->eglContext();
if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) {
- qDebug() << "GLContext: eglMakeCurrent FAILED!";
+ qDebug("GLContext: eglMakeCurrent FAILED!");
}
QPlatformWindow *window = static_cast<QPlatformWindow *>(surface);
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
index 26fc93fc11..71e2b381fc 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
@@ -79,7 +79,7 @@ QOpenWFDIntegration::QOpenWFDIntegration()
QOpenWFDIntegration::~QOpenWFDIntegration()
{
//don't delete screens since they are deleted by the devices
- qDebug() << "deleting platform integration";
+ qDebug("deleting platform integration");
for (int i = 0; i < mDevices.size(); i++) {
delete mDevices[i];
}
diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
index dc560b98da..4d0de7b0d4 100644
--- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
@@ -69,7 +69,7 @@ QOpenWFDOutputBuffer::~QOpenWFDOutputBuffer()
{
wfdDestroySource(mPort->device()->handle(),mWfdSource);
if (!mPort->device()->eglDestroyImage(mPort->device()->eglDisplay(),mEglImage)) {
- qDebug() << "could not delete eglImage";
+ qDebug("could not delete eglImage");
}
gbm_bo_destroy(mGbm_buffer);
@@ -83,6 +83,6 @@ void QOpenWFDOutputBuffer::bindToCurrentFbo()
GL_RENDERBUFFER,
mRbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
- qDebug() << "framebuffer not ready!";
+ qDebug("framebuffer not ready!");
}
}
diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp
index 73d1fb99e7..33254fe83c 100644
--- a/src/plugins/platforms/openwfd/qopenwfdport.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp
@@ -80,7 +80,7 @@ void QOpenWFDPort::attach()
Q_ASSERT(actualNumberOfPortModes == numberOfPortModes);
if (!actualNumberOfPortModes) {
- qDebug() << "didn't find any available port modes";
+ qDebug("didn't find any available port modes");
return;
}
@@ -94,7 +94,7 @@ void QOpenWFDPort::attach()
mPixelSize = setNativeResolutionMode();
if (mPixelSize.isEmpty()) {
- qDebug() << "Could not set native resolution mode in QOpenWFPort";
+ qDebug("Could not set native resolution mode in QOpenWFPort");
}
WFDfloat physicalWFDSize[2];
diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
index f8a61dbb68..ab394fa594 100644
--- a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
@@ -65,7 +65,7 @@ QOpenWFDScreen::QOpenWFDScreen(QOpenWFDPort *port)
EGLContext context = mPort->device()->eglContext();
if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) {
- qDebug() << "screen: eglMakeCurrent FAILED";
+ qDebug("screen: eglMakeCurrent FAILED");
}
glGenFramebuffers(1,&mFbo);
diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
index d07c619752..a08ac2b839 100644
--- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
@@ -162,7 +162,7 @@ void QQnxButtonEventNotifier::updateButtonStates()
break;
default:
- qButtonDebug() << "Unknown hardware button";
+ qButtonDebug("Unknown hardware button");
continue;
}
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index 64f38265f6..79ff74b113 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -385,7 +385,7 @@ static int32_t ic_perform_editor_action(input_session_t *ic, int32_t editor_acti
Q_UNUSED(ic);
Q_UNUSED(editor_action);
- qCritical() << "ic_perform_editor_action not implemented";
+ qCritical("ic_perform_editor_action not implemented");
return 0;
}
@@ -395,7 +395,7 @@ static int32_t ic_report_fullscreen_mode(input_session_t *ic, int32_t enabled)
Q_UNUSED(ic);
Q_UNUSED(enabled);
- qCritical() << "ic_report_fullscreen_mode not implemented";
+ qCritical("ic_report_fullscreen_mode not implemented");
return 0;
}
@@ -406,7 +406,7 @@ static extracted_text_t *ic_get_extracted_text(input_session_t *ic, extracted_te
Q_UNUSED(request);
Q_UNUSED(flags);
- qCritical() << "ic_get_extracted_text not implemented";
+ qCritical("ic_get_extracted_text not implemented");
return 0;
}
@@ -416,7 +416,7 @@ static spannable_string_t *ic_get_selected_text(input_session_t *ic, int32_t fla
Q_UNUSED(ic);
Q_UNUSED(flags);
- qCritical() << "ic_get_selected_text not implemented";
+ qCritical("ic_get_selected_text not implemented");
return 0;
}
@@ -426,7 +426,7 @@ static int32_t ic_get_cursor_caps_mode(input_session_t *ic, int32_t req_modes)
Q_UNUSED(ic);
Q_UNUSED(req_modes);
- qCritical() << "ic_get_cursor_caps_mode not implemented";
+ qCritical("ic_get_cursor_caps_mode not implemented");
return 0;
}
@@ -436,7 +436,7 @@ static int32_t ic_clear_meta_key_states(input_session_t *ic, int32_t states)
Q_UNUSED(ic);
Q_UNUSED(states);
- qCritical() << "ic_clear_meta_key_states not implemented";
+ qCritical("ic_clear_meta_key_states not implemented");
return 0;
}
@@ -447,7 +447,7 @@ static int32_t ic_set_selection(input_session_t *ic, int32_t start, int32_t end)
Q_UNUSED(start);
Q_UNUSED(end);
- qCritical() << "ic_set_selection not implemented";
+ qCritical("ic_set_selection not implemented");
return 0;
}
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 261c8e8773..599d43a8c8 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -553,7 +553,7 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
if (val[0] == 0 && val[1] == 0) //If screen size is invalid, wait for the next event
return;
- qScreenEventDebug() << "creating new QQnxScreen for newly attached display";
+ qScreenEventDebug("creating new QQnxScreen for newly attached display");
m_qnxIntegration->createDisplay(nativeDisplay, false /* not primary, we assume */);
}
} else if (!isAttached) {
@@ -566,7 +566,7 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
if (!screen->isPrimaryScreen()) {
// libscreen display is deactivated, let's remove the QQnxScreen / QScreen
- qScreenEventDebug() << "removing display";
+ qScreenEventDebug("removing display");
m_qnxIntegration->removeDisplay(screen);
}
}
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 9d591286c0..e04f16db92 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -475,7 +475,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window)
return;
if (screen()->rootWindow() == this) {
- qWarning() << "Application window cannot be reparented";
+ qWarning("Application window cannot be reparented");
return;
}
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 8db6895999..3689978b41 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -208,7 +208,7 @@ QWindowsTabletSupport *QWindowsTabletSupport::create()
if (currentQueueSize != TabletPacketQSize) {
if (!QWindowsTabletSupport::m_winTab32DLL.wTQueueSizeSet(context, TabletPacketQSize)) {
if (!QWindowsTabletSupport::m_winTab32DLL.wTQueueSizeSet(context, currentQueueSize)) {
- qWarning() << "Unable to set queue size on tablet. The tablet will not work.";
+ qWarning("Unable to set queue size on tablet. The tablet will not work.");
QWindowsTabletSupport::m_winTab32DLL.wTClose(context);
DestroyWindow(window);
return 0;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 1d43533052..79f41bb6ec 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -700,7 +700,7 @@ void WindowCreationData::initialize(const QWindow *w, HWND hwnd, bool frameChang
if ((flags & Qt::WindowStaysOnTopHint) || (type == Qt::ToolTip)) {
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, swpFlags);
if (flags & Qt::WindowStaysOnBottomHint)
- qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time";
+ qWarning("QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time");
} else if (flags & Qt::WindowStaysOnBottomHint) {
SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, swpFlags);
} else if (frameChange) { // Force WM_NCCALCSIZE with wParam=1 in case of custom margins.
@@ -2213,7 +2213,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
mmi->ptMaxPosition.x = availableGeometry.x();
mmi->ptMaxPosition.y = availableGeometry.y();
} else if (!screen){
- qWarning() << "window()->screen() returned a null screen";
+ qWarning("window()->screen() returned a null screen");
}
}
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 2e04799998..896eb61970 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -187,7 +187,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI
m_xcb_image->data = (uint8_t *)malloc(segmentSize);
} else {
if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1)
- qWarning() << "QXcbBackingStore: Error while marking the shared memory segment to be destroyed";
+ qWarning("QXcbBackingStore: Error while marking the shared memory segment to be destroyed");
}
m_hasAlpha = QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 5c6db2797f..4fee772cd6 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -2175,7 +2175,7 @@ void QXcbConnection::initializeXKB()
#ifndef QT_NO_XKB
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id);
if (!reply || !reply->present) {
- qWarning() << "Qt: XKEYBOARD extension not present on the X server.";
+ qWarning("Qt: XKEYBOARD extension not present on the X server.");
xkb_first_event = 0;
return;
}
@@ -2229,7 +2229,7 @@ void QXcbConnection::initializeXKB()
xcb_generic_error_t *error = xcb_request_check(c, select);
if (error) {
free(error);
- qWarning() << "Qt: failed to select notify events from xcb-xkb";
+ qWarning("Qt: failed to select notify events from xcb-xkb");
return;
}
#endif
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index a141882fc4..b5e03e68fe 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -164,7 +164,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
bool underDebugger = runningUnderDebugger();
if (noGrabArg && doGrabArg && underDebugger) {
- qWarning() << "Both -nograb and -dograb command line arguments specified. Please pick one. -nograb takes prcedence";
+ qWarning("Both -nograb and -dograb command line arguments specified. Please pick one. -nograb takes prcedence");
doGrabArg = false;
}
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 4de7716703..a16e24061c 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -676,13 +676,13 @@ void QXcbKeyboard::printKeymapError(const char *error) const
{
qWarning() << error;
if (xkb_context) {
- qWarning() << "Current XKB configuration data search paths are: ";
+ qWarning("Current XKB configuration data search paths are: ");
for (unsigned int i = 0; i < xkb_context_num_include_paths(xkb_context); ++i)
qWarning() << xkb_context_include_path_get(xkb_context, i);
}
- qWarning() << "Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, "
- "add ':' as separator to provide several search paths and/or make sure that XKB configuration data "
- "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .";
+ qWarning("Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, "
+ "add ':' as separator to provide several search paths and/or make sure that XKB configuration data "
+ "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .");
}
void QXcbKeyboard::updateKeymap()
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index a59b5ab23f..a8d401e15b 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -204,7 +204,7 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt
void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen)
{
if (!screen) {
- qWarning() << "nativeResourceForScreen: null screen";
+ qWarning("nativeResourceForScreen: null screen");
return Q_NULLPTR;
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 8baad5090d..42e7d5da2c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -373,7 +373,7 @@ void QXcbWindow::create()
if (visual)
m_visualId = connection()->defaultVisualId();
if (!visual)
- qWarning() << "Could not use default visual id. Falling back to root_visual for screen.";
+ qWarning("Could not use default visual id. Falling back to root_visual for screen.");
}
if (!visual)
visual = platformScreen->visualForId(m_visualId);
diff --git a/src/plugins/platforms/xcb/qxcbwmsupport.cpp b/src/plugins/platforms/xcb/qxcbwmsupport.cpp
index 38116ac239..470f021314 100644
--- a/src/plugins/platforms/xcb/qxcbwmsupport.cpp
+++ b/src/plugins/platforms/xcb/qxcbwmsupport.cpp
@@ -122,10 +122,10 @@ void QXcbWMSupport::updateVirtualRoots()
} while (remaining > 0);
#ifdef Q_XCB_DEBUG
- qDebug() << "======== updateVirtualRoots";
+ qDebug("======== updateVirtualRoots");
for (int i = 0; i < net_virtual_roots.size(); ++i)
qDebug() << connection()->atomName(net_virtual_roots.at(i));
- qDebug() << "======== updateVirtualRoots";
+ qDebug("======== updateVirtualRoots");
#endif
}
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 387dfca9c6..edf4dcb164 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -169,7 +169,7 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
cleanUp();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::begin()";
+ qDebug("QWin32PrintEngine::begin()");
d->debugMetrics();
#endif // QT_DEBUG_METRICS
@@ -236,7 +236,7 @@ bool QWin32PrintEngine::newPage()
SetBkMode(d->hdc, TRANSPARENT);
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::newPage()";
+ qDebug("QWin32PrintEngine::newPage()");
d->debugMetrics();
#endif // QT_DEBUG_METRICS
@@ -930,7 +930,7 @@ void QWin32PrintEnginePrivate::initialize()
initHDC();
#if defined QT_DEBUG_DRAW || defined QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::initialize()";
+ qDebug("QWin32PrintEngine::initialize()");
debugMetrics();
#endif // QT_DEBUG_DRAW || QT_DEBUG_METRICS
}
@@ -1007,7 +1007,7 @@ void QWin32PrintEnginePrivate::doReinit()
bool QWin32PrintEnginePrivate::resetDC()
{
if (!hdc) {
- qWarning() << "ResetDC() called with null hdc.";
+ qWarning("ResetDC() called with null hdc.");
return false;
}
const HDC oldHdc = hdc;
@@ -1593,7 +1593,7 @@ void QWin32PrintEngine::setGlobalDevMode(HGLOBAL globalDevNames, HGLOBAL globalD
d->initHDC();
#if defined QT_DEBUG_DRAW || defined QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setGlobalDevMode()";
+ qDebug("QWin32PrintEngine::setGlobalDevMode()");
debugMetrics();
#endif // QT_DEBUG_DRAW || QT_DEBUG_METRICS
}
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index cbab151ea0..584be11199 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -2135,7 +2135,7 @@ int QPrinter::toPage() const
void QPrinter::setFromTo(int from, int to)
{
if (from > to) {
- qWarning() << "QPrinter::setFromTo: 'from' must be less than or equal to 'to'";
+ qWarning("QPrinter::setFromTo: 'from' must be less than or equal to 'to'");
from = to;
}
d->fromPage = from;
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index ae48fdb90a..6fd91b6b76 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1297,7 +1297,7 @@ int QIBaseResult::size()
if (ct == isc_info_req_select_count)
return val;
}
- //qDebug() << "size -1";
+ //qDebug("size -1");
return -1;
unsigned int i, result_size;
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 29b7b20d85..59ef42d609 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -2200,7 +2200,7 @@ void QODBCDriverPrivate::checkHasSQLFetchScroll()
SQLRETURN r = SQLGetFunctions(hDbc, SQL_API_SQLFETCHSCROLL, &sup);
if ((r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) || sup != SQL_TRUE) {
hasSQLFetchScroll = false;
- qWarning() << "QODBCDriver::checkHasSQLFetchScroll: Warning - Driver doesn't support scrollable result sets, use forward only mode for queries";
+ qWarning("QODBCDriver::checkHasSQLFetchScroll: Warning - Driver doesn't support scrollable result sets, use forward only mode for queries");
}
}
@@ -2249,7 +2249,7 @@ bool QODBCDriver::beginTransaction()
{
Q_D(QODBCDriver);
if (!isOpen()) {
- qWarning() << "QODBCDriver::beginTransaction: Database not open";
+ qWarning("QODBCDriver::beginTransaction: Database not open");
return false;
}
SQLUINTEGER ac(SQL_AUTOCOMMIT_OFF);
@@ -2269,7 +2269,7 @@ bool QODBCDriver::commitTransaction()
{
Q_D(QODBCDriver);
if (!isOpen()) {
- qWarning() << "QODBCDriver::commitTransaction: Database not open";
+ qWarning("QODBCDriver::commitTransaction: Database not open");
return false;
}
SQLRETURN r = SQLEndTran(SQL_HANDLE_DBC,
@@ -2287,7 +2287,7 @@ bool QODBCDriver::rollbackTransaction()
{
Q_D(QODBCDriver);
if (!isOpen()) {
- qWarning() << "QODBCDriver::rollbackTransaction: Database not open";
+ qWarning("QODBCDriver::rollbackTransaction: Database not open");
return false;
}
SQLRETURN r = SQLEndTran(SQL_HANDLE_DBC,