summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-24 22:31:27 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-05-03 04:35:06 +0000
commit5a76a3fb03f8d1dc8cb367de1a1dc6a37048376a (patch)
tree2328d894da121bd0912cb9777f6254cc62296946 /src/corelib/io
parent0eaac0a3a95f8a74c06d062d3aa7928cbb09d493 (diff)
QtBase: use printf-style qWarning/qDebug where possible (II)
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 second part, replace qWarning() << "" << non-QString with qWarning("..%.", non-QString). QString (and QUrl etc) have special escaping handling when streamed into QDebug, so leave those alone. They also seem to expand to less code than the qPrintable() alternative, so there's no reason to replace them. Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui, Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds. Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qlockfile_win.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 7a04939cdb..098bc49468 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -545,7 +545,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
} else {
// Unbuffered stdio mode.
if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) {
- qWarning() << "QFile::at: Cannot set file position" << pos;
+ qWarning("QFile::at: Cannot set file position %lld", pos);
q->setError(QFile::PositionError, qt_error_string(errno));
return false;
}
diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp
index 261363f320..ba4a091965 100644
--- a/src/corelib/io/qlockfile_win.cpp
+++ b/src/corelib/io/qlockfile_win.cpp
@@ -100,7 +100,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
? QLockFile::LockFailedError
: QLockFile::PermissionError;
default:
- qWarning() << "Got unexpected locking error" << lastError;
+ qWarning("Got unexpected locking error %llu", quint64(lastError));
return QLockFile::UnknownError;
}
}