diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-05-10 17:58:59 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-12 05:43:37 +0000 |
commit | 23849826b490c07d9ba656bcb4ac46edd3040c0a (patch) | |
tree | 5a96b82fda56c54b12eb6778839172b4853c2eef /tests/auto/corelib/codecs/qtextcodec | |
parent | b62bff2ef3a6c846462e5381664651f49944261a (diff) |
Sweep of int-ish → char-ish types near calls to QString::fromU*()
The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going
to be deprecated. Use the newer fromUtf16(char16_t*) and
fromUcs4(char32_t*) overloads.
As a drive-by, use std::end()/std::size() where applicable.
Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/codecs/qtextcodec')
-rw-r--r-- | tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index 78b6449a69..799c0bfc77 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -1562,24 +1562,24 @@ void tst_QTextCodec::utf8bom_data() << QString::fromLatin1("\240"); { - static const ushort data[] = { 0x201d }; + static const char16_t data[] = { 0x201d }; QTest::newRow("nobom 2") << QByteArray("\342\200\235", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { - static const ushort data[] = { 0xf000 }; + static const char16_t data[] = { 0xf000 }; QTest::newRow("bom1") << QByteArray("\357\200\200", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { - static const ushort data[] = { 0xfec0 }; + static const char16_t data[] = { 0xfec0 }; QTest::newRow("bom2") << QByteArray("\357\273\200", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { @@ -1589,17 +1589,17 @@ void tst_QTextCodec::utf8bom_data() } { // test the non-SIMD code-path - static const ushort data[] = { 0x61, 0xfeff, 0x62 }; + static const char16_t data[] = { 0x61, 0xfeff, 0x62 }; QTest::newRow("middle-bom (non SIMD)") << QByteArray("a\357\273\277b") - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { // test the SIMD code-path - static const ushort data[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xfeff, 0x6d }; + static const char16_t data[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xfeff, 0x6d }; QTest::newRow("middle-bom (SIMD)") << QByteArray("abcdefghijkl\357\273\277m") - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } } |