diff options
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r-- | src/corelib/text/qstring.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 450ea484f6..291e2c37ab 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5462,11 +5462,8 @@ QString QString::fromUtf16(const char16_t *unicode, qsizetype size) { if (!unicode) return QString(); - if (size < 0) { - size = 0; - while (unicode[size] != 0) - ++size; - } + if (size < 0) + size = QtPrivate::qustrlen(unicode); QStringDecoder toUtf16(QStringDecoder::Utf16, QStringDecoder::Flag::Stateless); return toUtf16(QByteArrayView(reinterpret_cast<const char *>(unicode), size * 2)); } |