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 diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 62999d80117..40f65fd29b3 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -106,7 +106,7 @@ public: inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); } inline QDebug &operator<<(const char16_t *t) { stream->ts << QStringView(t); return maybeSpace(); } - inline QDebug &operator<<(const QString & t) { putString(t.constData(), uint(t.length())); return maybeSpace(); } + inline QDebug &operator<<(const QString & t) { putString(t.constData(), size_t(t.length())); return maybeSpace(); } inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); } inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast(s.data()), s.size(), ContainsBinary); return maybeSpace(); } inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); }