diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-04-09 18:14:42 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-04-15 01:09:44 +0200 |
commit | 86ad338aa4a6d60ae6b98c62bb2259cf36afee3e (patch) | |
tree | 79ffcbf71ab1dd9de21f2f57b2c8d44b1e55b088 /src/corelib/global/qlogging.cpp | |
parent | 1d59fe368a0bd0c04264618e3e6f09d7ce289d33 (diff) |
Q{*String,ByteArray}View::length(): use qsizetype, not int
Looks like these ones have been forgotten in the Qt 5 -> 6 upgrade
to qsizetype. Change them to return qsizetype as well,
and fix the docs. Being entirely inline, non-exported classes, we
should be able to get away with it without affecting binary
compatibility. Moreover, there's no reason for keeping them
deprecated.
Requires some minor adjustments, just like the ones done for
size()'s changes.
[ChangeLog][QtCore][QStringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.
[ChangeLog][QtCore][QAnyStringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.
[ChangeLog][QtCore][QUtf8StringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.
[ChangeLog][QtCore][QByteArrayView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.
Fixes: QTBUG-92496
Change-Id: Ie0f4939d1083884e95d4725f891b6c6764532cb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 748ca60661..f4fac3f35e 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1667,7 +1667,7 @@ static bool android_default_message_handler(QtMsgType type, #ifdef Q_OS_WIN static void win_outputDebugString_helper(QStringView message) { - const int maxOutputStringLength = 32766; + const qsizetype maxOutputStringLength = 32766; static QBasicMutex m; auto locker = qt_unique_lock(m); // fast path: Avoid string copies if one output is enough @@ -1675,9 +1675,9 @@ static void win_outputDebugString_helper(QStringView message) OutputDebugString(reinterpret_cast<const wchar_t *>(message.utf16())); } else { wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1]; - for (int i = 0; i < message.length(); i += maxOutputStringLength) { - const int length = std::min(message.length() - i, maxOutputStringLength); - const int len = message.mid(i, length).toWCharArray(messagePart); + for (qsizetype i = 0; i < message.length(); i += maxOutputStringLength) { + const qsizetype length = std::min(message.length() - i, maxOutputStringLength); + const qsizetype len = message.mid(i, length).toWCharArray(messagePart); Q_ASSERT(len == length); messagePart[len] = 0; OutputDebugString(messagePart); |