From 4724d017ef2ff84e71fac3d0d04bd25373140c09 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 6 Jan 2021 12:27:40 +0100 Subject: [PATCH] Minor tidy-up: two sizetype fixes, two \nullptr uses Change-Id: I6c4a1296350ecaf9a661dba22670fbb2ad23bd77 Reviewed-by: Lars Knoll --- src/corelib/text/qstring.cpp | 4 ++-- src/corelib/text/qstring.h | 4 ++-- src/network/kernel/qauthenticator.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 85ee6710a08..da212ac2919 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5432,7 +5432,7 @@ QString QString::fromUcs4(const char32_t *unicode, qsizetype size) Resizes the string to \a size characters and copies \a unicode into the string. - If \a unicode is 0, nothing is copied, but the string is still + If \a unicode is \nullptr, nothing is copied, but the string is still resized to \a size. \sa unicode(), setUtf16() @@ -5451,7 +5451,7 @@ QString& QString::setUnicode(const QChar *unicode, qsizetype size) Resizes the string to \a size characters and copies \a unicode into the string. - If \a unicode is 0, nothing is copied, but the string is still + If \a unicode is \nullptr, nothing is copied, but the string is still resized to \a size. Note that unlike fromUtf16(), this function does not consider BOMs and diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 86f6d829d43..8926f6f3af3 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1448,8 +1448,8 @@ inline QString QString::fromStdU32String(const std::u32string &s) inline std::u32string QString::toStdU32String() const { std::u32string u32str(length(), char32_t(0)); - int len = toUcs4_helper(reinterpret_cast(constData()), length(), - reinterpret_cast(&u32str[0])); + qsizetype len = toUcs4_helper(reinterpret_cast(constData()), + length(), reinterpret_cast(&u32str[0])); u32str.resize(len); return u32str; } diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index c433b700ea3..a8777962eea 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -1442,7 +1442,7 @@ static bool qNtlmDecodePhase2(const QByteArray& data, QNtlmPhase2Block& ch) ds >> ch.targetInfo; if (ch.targetName.len > 0) { - if (ch.targetName.len + ch.targetName.offset > (unsigned)data.size()) + if (qsizetype(ch.targetName.len + ch.targetName.offset) > data.size()) return false; ch.targetNameStr = qStringFromUcs2Le(data.mid(ch.targetName.offset, ch.targetName.len));