diff options
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp | 6 | ||||
-rw-r--r-- | src/plugins/codecs/jp/qsjiscodec.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qtextcodec/tst_qtextcodec.cpp | 15 |
3 files changed, 24 insertions, 1 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp index fcb8d86..1015923 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp @@ -1312,6 +1312,9 @@ class RegexGenerator : private MacroAssembler { push(ARMRegisters::r4); push(ARMRegisters::r5); push(ARMRegisters::r6); +#if CPU(ARM_TRADITIONAL) + push(ARMRegisters::r8); // scratch register +#endif move(ARMRegisters::r3, output); #endif } @@ -1327,6 +1330,9 @@ class RegexGenerator : private MacroAssembler { pop(X86Registers::ebx); pop(X86Registers::ebp); #elif CPU(ARM) +#if CPU(ARM_TRADITIONAL) + pop(ARMRegisters::r8); // scratch register +#endif pop(ARMRegisters::r6); pop(ARMRegisters::r5); pop(ARMRegisters::r4); diff --git a/src/plugins/codecs/jp/qsjiscodec.cpp b/src/plugins/codecs/jp/qsjiscodec.cpp index 49190d3..3ea5300 100644 --- a/src/plugins/codecs/jp/qsjiscodec.cpp +++ b/src/plugins/codecs/jp/qsjiscodec.cpp @@ -155,7 +155,9 @@ QString QSjisCodec::convertToUnicode(const char* chars, int len, ConverterState uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80 || IsKana(ch)) { + if (ch < 0x80) { + result += QValidChar(ch); + } else if (IsKana(ch)) { // JIS X 0201 Latin or JIS X 0201 Kana u = conv->jisx0201ToUnicode(ch); result += QValidChar(u); diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index d122b0b..34d34fa 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -106,6 +106,8 @@ private slots: void moreToFromUnicode_data(); void moreToFromUnicode(); + + void shiftJis(); }; void tst_QTextCodec::toUnicode_data() @@ -2236,6 +2238,19 @@ void tst_QTextCodec::moreToFromUnicode() QCOMPARE(testData, cStr); } +void tst_QTextCodec::shiftJis() +{ + QByteArray backslashTilde("\\~"); + QTextCodec* codec = QTextCodec::codecForName("shift_jis"); + QString string = codec->toUnicode(backslashTilde); + QCOMPARE(string.length(), 2); + QCOMPARE(string.at(0), QChar(QLatin1Char('\\'))); + QCOMPARE(string.at(1), QChar(QLatin1Char('~'))); + + QByteArray encoded = codec->fromUnicode(string); + QCOMPARE(encoded, backslashTilde); +} + struct DontCrashAtExit { ~DontCrashAtExit() { QTextCodec *c = QTextCodec::codecForName("utf8"); |