summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp10
-rw-r--r--src/corelib/tools/qstring.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 2552ddebe9..7e3e629c47 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -993,6 +993,8 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
return c->toUnicode(chars, len, &state);
}
+// in qstring.cpp:
+void qt_from_latin1(ushort *dst, const char *str, size_t size);
/*! \overload
@@ -1005,12 +1007,10 @@ void QTextDecoder::toUnicode(QString *target, const char *chars, int len)
case 106: // utf8
static_cast<const QUtf8Codec*>(c)->convertToUnicode(target, chars, len, &state);
break;
- case 4: { // latin1
+ case 4: // latin1
target->resize(len);
- ushort *data = (ushort*)target->data();
- for (int i = len; i >=0; --i)
- data[i] = (uchar) chars[i];
- } break;
+ qt_from_latin1((ushort*)target->data(), chars, len);
+ break;
default:
*target = c->toUnicode(chars, len, &state);
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 50f616a010..2b58100baa 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -210,7 +210,7 @@ inline RetType UnrollTailLoop<0>::exec(int, RetType returnIfExited, Functor1, Fu
#endif
// conversion between Latin 1 and UTF-16
-static void qt_from_latin1(ushort *dst, const char *str, size_t size)
+void qt_from_latin1(ushort *dst, const char *str, size_t size)
{
/* SIMD:
* Unpacking with SSE has been shown to improve performance on recent CPUs