diff options
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
-rw-r--r-- | src/corelib/io/qdebug.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 524a04456a..54b2d605e6 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -24,15 +24,16 @@ using QtMiscUtils::fromHex; /* Returns a human readable representation of the first \a maxSize - characters in \a data. + characters in \a data. The size, \a len, is a 64-bit quantity to + avoid truncation due to implicit conversions in callers. */ -QByteArray QtDebugUtils::toPrintable(const char *data, int len, int maxSize) +QByteArray QtDebugUtils::toPrintable(const char *data, qint64 len, qsizetype maxSize) { if (!data) return "(null)"; QByteArray out; - for (int i = 0; i < qMin(len, maxSize); ++i) { + for (qsizetype i = 0; i < qMin(len, maxSize); ++i) { char c = data[i]; if (isprint(c)) { out += c; |