summaryrefslogtreecommitdiffstats
path: root/src/plugins/generic
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-17 17:48:34 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-03-12 17:29:36 +0000
commit6417bbde8565e0be2d049426b71e6fda538e4440 (patch)
tree8e60f1edf1f8e0f07fc1e6eed23e44389bdb9a67 /src/plugins/generic
parent8c0ae00dd603bfe5aa99b5b2db8c1ffdaa6cd45e (diff)
QtBase (remainder): use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/plugins/generic')
-rw-r--r--src/plugins/generic/tuiotouch/qoscbundle.cpp6
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp4
2 files changed, 5 insertions, 5 deletions
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;
}