From f090a4785b99573dd5a506fec655df1abe347e7c Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Tue, 10 Jan 2023 20:53:36 +0200 Subject: QStringConverter: use qt_to_latin1() helper from qstring.cpp This changes the newly-added QLatin1::convertFromUnicode() overload. Change-Id: Ie465f052e711d72e51217b74b5b51a89c5d8b9e7 Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/text/qstring.cpp') diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 5de3043c69..9259d485c1 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5389,6 +5389,12 @@ char16_t *QLatin1::convertToUnicode(char16_t *out, QLatin1StringView in) noexcep return std::next(out, len); } +char *QLatin1::convertFromUnicode(char *out, QStringView in) noexcept +{ + const qsizetype len = in.size(); + qt_to_latin1(reinterpret_cast(out), in.utf16(), len); + return out + len; +} /*! \fn QByteArray QString::toLatin1() const -- cgit v1.2.3