From bc2b8411c9e510a1101ed09b627317854c6e7d45 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 17 Aug 2022 17:58:42 +0200 Subject: QDebug: finish porting put{String,ByteArray} to qsizetype MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The underlying QTextStream seems to support qsizetype-sized data and the private API of QDebug that is under consideration in this patch takes size_t, but, as so often, there're int/uint casts in-between that break things. Widen the int/uint casts to qsizetype/size_t, respectively. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-103525 Change-Id: I10bca093dc2d6f136871c94ca43f5b42fd1c8971 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/io/qdebug.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib/io/qdebug.cpp') diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 1c6ffa57c3c..0afbb374fae 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -320,7 +320,7 @@ void QDebug::putString(const QChar *begin, size_t length) if (stream->noQuotes) { // no quotes, write the string directly too (no pretty-printing) // this respects the QTextStream state, though - stream->ts.d_ptr->putString(begin, int(length)); + stream->ts.d_ptr->putString(begin, qsizetype(length)); } else { // we'll reset the QTextStream formatting mechanisms, so save the state QDebugStateSaver saver(*this); @@ -338,7 +338,8 @@ void QDebug::putByteArray(const char *begin, size_t length, Latin1Content conten if (stream->noQuotes) { // no quotes, write the string directly too (no pretty-printing) // this respects the QTextStream state, though - QString string = content == ContainsLatin1 ? QString::fromLatin1(begin, int(length)) : QString::fromUtf8(begin, int(length)); + QString string = content == ContainsLatin1 ? QString::fromLatin1(begin, qsizetype(length)) + : QString::fromUtf8(begin, qsizetype(length)); stream->ts.d_ptr->putString(string); } else { // we'll reset the QTextStream formatting mechanisms, so save the state -- cgit v1.2.3