From d8561b1dea4a4cabebcba38ddf2d5b67afa5826e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 17 Aug 2022 18:15:46 +0200 Subject: QDebug: finish porting to qsizetype/size_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port two variables from int/uint to qsizetype/size_t. These don't cause problems, because their possible ranges are limited, however, int/uint variables are a code smell these days, so replace them nonetheless. [ChangeLog][QtCore][QDebug] Fixed issues on 64-bit platforms when streaming containers (incl. strings) of more than 2Gi elements. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-103525 Change-Id: Ica6c5a6a062990306280fb713c47adb2053b752d Reviewed-by: MÃ¥rten Nordheim --- src/corelib/io/qdebug.cpp | 2 +- src/corelib/io/qdebug.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 0afbb374fa..f07bb05c5b 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -239,7 +239,7 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, si } // print as an escape sequence (maybe, see below for surrogate pairs) - int buflen = 2; + qsizetype buflen = 2; ushort buf[sizeof "\\U12345678" - 1]; buf[0] = '\\'; diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 3cd8384e3d..c95c03f0d1 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -383,7 +383,7 @@ void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value) debug.resetFormat(); debug.nospace() << "QFlags(" << Qt::hex << Qt::showbase; bool needSeparator = false; - for (uint i = 0; i < sizeofT * 8; ++i) { + for (size_t i = 0; i < sizeofT * 8; ++i) { if (value & (Int(1) << i)) { if (needSeparator) debug << '|'; -- cgit v1.2.1