diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-17 13:26:01 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-14 07:47:13 +0200 |
commit | d9870dc233208e2bc233d95955e9b4384d4a707d (patch) | |
tree | cda861711794b43c4f7e8cc21bb37b025d9117cb /src | |
parent | 2c7f9565ed152c742d360955d3237764998ab1f6 (diff) |
Remove QTextCodec dependency from QString
Change-Id: I34cc24c263684f7c04ee49205f9181476bc16c34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qstring.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 68a0f757c8..21ca6f5eb2 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -45,9 +45,6 @@ #include "qregularexpression.h" #endif #include "qunicodetables_p.h" -#if QT_CONFIG(textcodec) -#include <qtextcodec.h> -#endif #include <private/qstringconverter_p.h> #include "qlocale_tools_p.h" #include "private/qsimd_p.h" @@ -5209,12 +5206,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string) { if (string.isNull()) return QByteArray(); -#if QT_CONFIG(textcodec) - QTextCodec *localeCodec = QTextCodec::codecForLocale(); - if (localeCodec) - return localeCodec->fromUnicode(string); -#endif // textcodec - return string.toUtf8(); + return QLocal8Bit::convertFromUnicode(string.data(), string.length(), nullptr); } /*! @@ -5399,14 +5391,7 @@ QString QString::fromLocal8Bit_helper(const char *str, int size) QString::DataPointer empty = { pair.first, pair.second, 0 }; return QString(empty); } -#if QT_CONFIG(textcodec) - if (size < 0) - size = qstrlen(str); - QTextCodec *codec = QTextCodec::codecForLocale(); - if (codec) - return codec->toUnicode(str, size); -#endif // textcodec - return fromUtf8(str, size); + return QLocal8Bit::convertToUnicode(str, size, nullptr); } /*! \fn QString QString::fromUtf8(const char *str, int size) |