diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-07-06 09:21:54 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-07 19:32:52 +0200 |
commit | e54faee178ef5a4437ac1cfa6fd13d5ce0fb18c0 (patch) | |
tree | fec13cd101616a14726bfaba06688d8188e5e770 /src/testlib/qtestcase.cpp | |
parent | e52c9d560c78ee742699ca3dd0aaaa0b881f0947 (diff) |
QTest: remove unneeded cast in toPrettyUnicode()
char16_t, as returned from QStringView::utf16(), is guaranteed to be
unsigned, so there's no need to reinterpret_cast to ushort.
Change-Id: I7432dd26b4814c61fe70cc33ed307097ef46ce4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 47f75fcc5b..63c6ef92af 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1424,12 +1424,12 @@ char *toPrettyUnicode(const ushort *p, int length) */ char *toPrettyUnicode(QStringView string) { - auto p = reinterpret_cast<const ushort *>(string.utf16()); + auto p = string.utf16(); auto length = string.size(); // keep it simple for the vast majority of cases bool trimmed = false; QScopedArrayPointer<char> buffer(new char[256]); - const ushort *end = p + length; + const auto end = p + length; char *dst = buffer.data(); *dst++ = '"'; |