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>
This commit is contained in:
Marc Mutz 2021-07-06 09:21:54 +02:00
parent e52c9d560c
commit e54faee178

View File

@ -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++ = '"';