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:
parent
e52c9d560c
commit
e54faee178
@ -1424,12 +1424,12 @@ char *toPrettyUnicode(const ushort *p, int length)
|
|||||||
*/
|
*/
|
||||||
char *toPrettyUnicode(QStringView string)
|
char *toPrettyUnicode(QStringView string)
|
||||||
{
|
{
|
||||||
auto p = reinterpret_cast<const ushort *>(string.utf16());
|
auto p = string.utf16();
|
||||||
auto length = string.size();
|
auto length = string.size();
|
||||||
// keep it simple for the vast majority of cases
|
// keep it simple for the vast majority of cases
|
||||||
bool trimmed = false;
|
bool trimmed = false;
|
||||||
QScopedArrayPointer<char> buffer(new char[256]);
|
QScopedArrayPointer<char> buffer(new char[256]);
|
||||||
const ushort *end = p + length;
|
const auto end = p + length;
|
||||||
char *dst = buffer.data();
|
char *dst = buffer.data();
|
||||||
|
|
||||||
*dst++ = '"';
|
*dst++ = '"';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user