diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:24:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:28:42 +0100 |
commit | a02863234d76abb6c9f289026ae4ea3145924f30 (patch) | |
tree | aef6381d0000a78ba69ac80eb03739b1c8ca5fc3 /src/corelib/tools/qstringbuilder.cpp | |
parent | e77b13621f0057374d83a2b884f03dd2e5b7b88c (diff) | |
parent | e4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
configure
mkspecs/common/wince/qplatformdefs.h
src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
Diffstat (limited to 'src/corelib/tools/qstringbuilder.cpp')
-rw-r--r-- | src/corelib/tools/qstringbuilder.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index eba939a413..de12de19cb 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -39,6 +39,7 @@ #include "qstringbuilder.h" #include <QtCore/qtextcodec.h> +#include <private/qutfcodec_p.h> QT_BEGIN_NAMESPACE @@ -107,29 +108,14 @@ QT_BEGIN_NAMESPACE /*! \internal */ -void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) +void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) Q_DECL_NOTHROW { - if (len == -1) { + if (Q_UNLIKELY(len == -1)) { if (!a) return; - while (*a && uchar(*a) < 0x80U) - *out++ = QLatin1Char(*a++); - if (!*a) - return; - } else { - int i; - for (i = 0; i < len && uchar(a[i]) < 0x80U; ++i) - *out++ = QLatin1Char(a[i]); - if (i == len) - return; - a += i; - len -= i; + len = int(strlen(a)); } - - // we need to complement with UTF-8 appending - QString tmp = QString::fromUtf8(a, len); - memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size()); - out += tmp.size(); + out = QUtf8::convertToUnicode(out, a, len); } QT_END_NAMESPACE |