From f5d8e81c7922ddda17a4115f2bac16c6bdb2b783 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 1 Nov 2022 00:12:59 +0200 Subject: [PATCH] inline toLocal8Bit_helper() function and use it in QString::toLocal8Bit() Signed-off-by: Ivailo Monev --- src/core/tools/qstring.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/tools/qstring.cpp b/src/core/tools/qstring.cpp index f28d0abea..9bf926810 100644 --- a/src/core/tools/qstring.cpp +++ b/src/core/tools/qstring.cpp @@ -3179,7 +3179,7 @@ QByteArray QString::toAscii() const return QTextCodecPrivate::convertFrom(constData(), length(), "US-ASCII"); } -static QByteArray toLocal8Bit_helper(const QChar *data, int length) +static inline QByteArray toLocal8Bit_helper(const QChar *data, int length) { const QByteArray localecodec = QTextCodecPrivate::localeCodec(); return QTextCodecPrivate::convertFrom(data, length, localecodec.constData()); @@ -3202,11 +3202,7 @@ static QByteArray toLocal8Bit_helper(const QChar *data, int length) */ QByteArray QString::toLocal8Bit() const { -#ifndef QT_NO_TEXTCODEC - return QTextCodec::codecForLocale()->fromUnicode(unicode(), length()); -#else - return toLatin1(); -#endif // QT_NO_TEXTCODEC + return toLocal8Bit_helper(unicode(), length()); } /*!