diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-10-17 17:48:34 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-03-04 10:29:19 +0000 |
commit | 5cd455dca309d0d031057ab40ff607d144683d43 (patch) | |
tree | 6c939ceeb02e415f8035753e46d7465e26db2fad /src/network/access/qnetworkdiskcache.cpp | |
parent | 600529e07a46d8e20f4302dc988125f3fee36ec4 (diff) |
QtNetwork: 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("...").
Saves ~850b in text size on optimized GCC 5.3 AMD64 builds.
Change-Id: Ib1a087795a03b2a6b432e2c499968df779aaea37
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/network/access/qnetworkdiskcache.cpp')
-rw-r--r-- | src/network/access/qnetworkdiskcache.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 5d38ebcd86..99e67cb463 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -160,7 +160,7 @@ void QNetworkDiskCache::setCacheDirectory(const QString &cacheDir) qint64 QNetworkDiskCache::cacheSize() const { #if defined(QNETWORKDISKCACHE_DEBUG) - qDebug() << "QNetworkDiskCache::cacheSize()"; + qDebug("QNetworkDiskCache::cacheSize()"); #endif Q_D(const QNetworkDiskCache); if (d->cacheDirectory.isEmpty()) @@ -185,7 +185,7 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) return 0; if (d->cacheDirectory.isEmpty()) { - qWarning() << "QNetworkDiskCache::prepare() The cache directory is not set"; + qWarning("QNetworkDiskCache::prepare() The cache directory is not set"); return 0; } @@ -212,7 +212,7 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) cacheItem->file = 0; } if (!cacheItem->file || !cacheItem->file->open()) { - qWarning() << "QNetworkDiskCache::prepare() unable to open temporary file"; + qWarning("QNetworkDiskCache::prepare() unable to open temporary file"); cacheItem.reset(); return 0; } @@ -448,7 +448,7 @@ void QNetworkDiskCache::updateMetaData(const QNetworkCacheMetaData &metaData) QIODevice *oldDevice = data(url); if (!oldDevice) { #if defined(QNETWORKDISKCACHE_DEBUG) - qDebug() << "QNetworkDiskCache::updateMetaData(), no device!"; + qDebug("QNetworkDiskCache::updateMetaData(), no device!"); #endif return; } @@ -521,7 +521,7 @@ qint64 QNetworkDiskCache::expire() return d->currentCacheSize; if (cacheDirectory().isEmpty()) { - qWarning() << "QNetworkDiskCache::expire() The cache directory is not set"; + qWarning("QNetworkDiskCache::expire() The cache directory is not set"); return 0; } @@ -584,7 +584,7 @@ qint64 QNetworkDiskCache::expire() void QNetworkDiskCache::clear() { #if defined(QNETWORKDISKCACHE_DEBUG) - qDebug() << "QNetworkDiskCache::clear()"; + qDebug("QNetworkDiskCache::clear()"); #endif Q_D(QNetworkDiskCache); qint64 size = d->maximumCacheSize; |