summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove handling of missing very old compiler feature checkAllan Sandfeld Jensen2019-04-061-2/+2
| | | | | | | | | | | Removes handling of missing Q_COMPILER_NULLPTR, Q_COMPILER_AUTODECL, Q_COMPILER_LAMBDA, Q_COMPILER_VARIADIC_MACROS and Q_COMPILER_AUTO_FUNCTION. We haven't supported any compilers without these for a long time. Change-Id: I3df88206516a25763e2c28b083733780f35a8764 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace qMove with std::moveAllan Sandfeld Jensen2019-04-061-6/+6
| | | | | | Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-50/+50
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qstringalgorithms: add find methodsAnton Kudryavtsev2019-03-221-182/+183
| | | | | | | | | Also add qsizetype support. It's needed to add find methods to QStringView Change-Id: I45eac082924e27778c24eebbb19d694221c28978 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-141-15/+11
|\ | | | | | | | | | | | | Conflicts: src/corelib/tools/qcollator_win.cpp Change-Id: I6d806d7c58b2057ebde3ad915bb5551f34b700e5
| * Doc: Unify terminology for '\0'-terminated stringsChristian Ehrlicher2019-03-131-15/+11
| | | | | | | | | | | | | | | | | | | | The documentation for QByteArray and QString is using different notations for '\0'-terminated strings. Unify them by using '\0'-terminated everywhere. Change-Id: Ia26ec5c50635bebba1b54b7fe227ff0bcca4f2ad Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* | Add QStringView::toWCharArray() to match QStringEdward Welbourne2019-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | QCollator needs it to add support for QStringView. In any case, it extends the mirror of QString's API. Naturally, we can reimplement QString's version using it. Change-Id: I5a23a3f2a98c7d59597b5e935542a93764b5e350 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | QString: mark obsolete functions as deprecatedChristian Ehrlicher2019-03-041-0/+4
|/ | | | | | | | | | Mark obsolete functions in QString as deprecated so they can be removed with Qt6: - QString::sprintf() - QString::vsprintf() Change-Id: I9b7748db95291c34b95ff3ad3e3aabc8215aeaae Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-261-0/+2
|\ | | | | | | Change-Id: Id511850002d9274d17891c063376ac4b3ff939dd
| * Fix build for size with gccKirill Burtsev2019-02-231-0/+2
| | | | | | | | | | | | | | | | Fixes the error: variable 'isDifferent' set but not used Change-Id: Ibd60b17126057da64a41d325b7ef548316f27c4b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtCore: replace null and nullptr with \nullptr in documentationChristian Ehrlicher2019-02-181-22/+22
| | | | | | | | | | | | | | Replace null and '\c nullptr' with \nullptr in the documentation. Change-Id: Ib9e0cfc2eb2830b213e6523773603d56180b0998 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-041-46/+160
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also blacklist tst_QRawFont::unsupportedWritingSystem() and tst_QGlyphRun::mixedScripts() on windows for now. Conflicts: qmake/generators/makefile.cpp src/corelib/itemmodels/qstringlistmodel.cpp src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp tests/auto/gui/text/qglyphrun/BLACKLIST tests/auto/gui/text/qrawfont/BLACKLIST Task-number: QTBUG-72836 Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
| * Doc: Consistently mark QT_XYZ_CAST_FROM_ASCII with \cKai Koehne2018-12-221-7/+89
| | | | | | | | | | | | | | | | | | | | | | Otherwise it gets linkified, which looks inconsistent. Instead, use \sa for functions where QT_NO_CAST_FROM_ASCII or QT_RESTRICTED_CAST_FROM_ASCII is referenced. Change-Id: Ic3933d8c4c81c963215de7f3aac4d0a11e61cbc2 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Add an AVX2 code path to qustrchrThiago Macieira2018-12-181-0/+23
| | | | | | | | | | | | | | The new loop does 32 bytes (16 code units) at a time Change-Id: I8f261579aad648fdb4f0fffd155412a4d77428e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * Merge some code to simplify maintenanceThiago Macieira2018-12-181-40/+49
| | | | | | | | | | | | Change-Id: I8f261579aad648fdb4f0fffd15541369e3625461 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-091-4/+17
|\| | | | | | | Change-Id: I10ae61ec6867b38601d85d6fc34e1f6a6ba0cc11
| * Optimize further the loading of 8 Latin 1 charactersThiago Macieira2018-12-081-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is important when AVX is enabled, which makes the VMOVQ load and the VPMOVZXBW instruction be combined into a single VPMOVZXBW with direct memory access. This is guaranteed to only read 8 bytes, so it's safe even close to the end of a page. Clang and ICC do combine the instructions like we want and I have filed a request for GCC to do so too[1]. AVX was first introduced in 2011, so plenty of computers today would benefit from this. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87317 Change-Id: I8f261579aad648fdb4f0fffd1553e08e90df3171 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-041-4/+8
|\| | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
| * Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-11-271-4/+8
| |\ | | | | | | | | | Change-Id: I12bcee17e349edd0dd4fd08da76361d1ffb1a727
| | * Fix toFloat()s between float and double ranges and documentEdward Welbourne2018-11-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised some toFloat()s to be consistent with the matching toDouble()s; previously, they would return infinity if toDouble() did but return 0 if toDouble() got a finite value outside float's range. That also applied to values that underflowed float's range, succeeding and returning 0 as long as they were within double's range but failing if toDouble() underflowed. Now float-underflow also fails. Amended their documentation to reflect this more consistent reality. Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned an infinity on double-overflow (since 5.7) but returned 0 on a finite double outside float's range, while setting ok to false; this was at odds with their documented behavior of returning 0 on any failure. They also succeeded, returning zero, on underflow of float's range, unless double underflowed, where they failed. Changed the handling of values outside float's range to match that of values outside double's range: fail, returning an infinity on overflow or zero on underflow. The documentation now reflects the revised behavior, which matches toDouble(). Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Change documentation of some toDouble()s to reflect realityEdward Welbourne2018-11-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They actually return infinity if conversion overflows, while still setting ok to false; they were documented to return 0 on failure, with no mention of this special handling of overflow. Documented reality rather than changing the behavior. Gave underflow as an example of failure other than overflow (toDouble()s do indeed fail on it). Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toDouble] QString, QByteArray and QLocale return an infinity on overflow (since 5.7), while setting ok to false; this was at odds with their documented behavior of returning 0 on failure. The documentation now reflects the actual behavior. Fixes: QTBUG-71256 Change-Id: I8d7e80ba1f06091cf0f1480c341553381103703b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-221-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qdir.cpp src/corelib/kernel/qtimer.cpp src/corelib/kernel/qtimer.h Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I683d897760ec06593136d77955f8bc87fdef3f9f
| * | Merge remote-tracking branch 'origin/5.12.0' into 5.12Liang Qi2018-11-161-1/+1
| |\ \ | | | | | | | | | | | | Change-Id: Ic1dd39044e19f50e1068d4ac70dacaad6440e570
| | * | Doc: Fix various documentation warningsTopi Reinio2018-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These include typos, marking functions as \internal, documenting trivial things, and fixing the function signatures passed to the \fn command. Task-number: QTBUG-71502 Change-Id: I24a9e1f7e1cdb39e5c31b99202bdd593c6b789ff Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-101-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/serialization/qcborcommon.h src/corelib/tools/qlocale_data_p.h tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: Ibed987f6d77a0294f78f67d78625237616082416
| * | | Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-11-091-5/+5
| |\ \ \ | | |/ / | |/| / | | |/ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf qmake/Makefile.unix src/gui/text/qtextdocument.cpp src/gui/text/qtextdocument.h Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
| | * Modernize the "textcodec" featureLiang Qi2018-11-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also clean up QTextCodec usage in qmake build and some includes of qtextcodec.h. Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-10-251-14/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/animation/qpropertyanimation.cpp src/gui/image/qicon.cpp tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp Change-Id: I3698172b7b44ebb487cb38f50fd2c4a9f8a35b21
| * | Fix QString latin1 conversion and comparison for -optimize-size buildKirill Burtsev2018-10-181-0/+8
| | | | | | | | | | | | | | | Change-Id: I5f0ae946151e9733cbe21cb24387636ba68bc177 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-151-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to override this snippet for the documentation we generate for Qt for Python, and it is easier to have it on a separate file. Task-number: PYSIDE-801 Task-number: PYSIDE-691 Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | QString: documentation fixesSamuel Gaist2018-10-081-15/+15
|/ / | | | | | | | | Change-Id: I01cb7502514224cfb340bf8b8982340c29027689 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QString::compare(QStringView, CaseSensitivity)Albert Astals Cid2018-09-031-0/+13
| | | | | | | | | | | | | | | | There was a QStringView::compare(QString, CaseSensitivity) but it's good that the symmetric also exists Change-Id: Ic789f11d41eb8cfa393cb51c19bd1f89bb87d912 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-08-071-2/+2
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| | * QString: Fix documentation for toDouble() and toFloat()Andre Hartmann2018-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The character 'g' is only a valid format when converting numbers to strings, but not other way round. Change-Id: Ie772886e7a45a5067c0a3e4eaa3a6ccef8e69426 Reviewed-by: Martin Smith <martin.smith@qt.io>
* | | Fix possible heap-buffer-overflow in qt_string_normalizeErik Verbruggen2018-08-071-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When starting further into the string than index 0, do correct the length too. This shows up in tst_qurl and tst_qurlinternal. Kindly pointed out by ASAN: ==5513==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600002bf27 at pc 0x000100654de3 bp 0x7ffeefbfad10 sp 0x7ffeefbfad08 READ of size 16 at 0x60600002bf27 thread T0 #0 0x100654de2 in QtNS::simdTestMask(char const*&, char const*, unsigned int) qstring.cpp:395 #1 0x1005f9777 in QtNS::isAscii(QtNS::QChar const*&, QtNS::QChar const*) qstring.cpp:491 #2 0x100638642 in QtNS::qt_string_normalize(QtNS::QString*, QtNS::QString::NormalizationForm, QtNS::QChar::UnicodeVersion, int) qstring.cpp:7999 Change-Id: I44ad65b47eb98c6085c77b56dc2da50ef5659d25 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QUrl: Add qustrchr() and use it to speed up the fast URL full decodingThiago Macieira2018-08-031-57/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | The character search in the findChar() static function in qstring.cpp is more efficient than what we had in qurlrecode.cpp and there's no point in duplicating it. It also has a Neon implementation. So make the implementation available for use in QtPrivate::qustrchr(). This also simplifies the implementation. Change-Id: Ib48364abee9f464c96c6fffd152eedd0cd8ad7f8 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| * Doc: Remove reference to Unicode 4.0Kai Koehne2018-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's unclear when the reference to Unicode 4.0 standard got added - it certainly predates the qt 4 git repository. Anyhow, nowadays we're using later versions, and it doesn't make much sense to highlight one specific version here. Instead, use the correct technical term - UTF-16 code unit. Also I added a 'correspond _to_', which sounds more common to me. Task-number: QTBUG-56699 Change-Id: I4bdcd9060cb2b11521638019c15ef7ab67aa768b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Fix Windows+ICU buildThiago Macieira2018-07-141-12/+13
| | | | | | | | | | | | | | qstring.cpp(6655): error C2065: 'lhs': undeclared identifier Change-Id: Id59bdd8f1a804b809e22fffd15405ed7607bdaca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix QString::localeAwareCompare with composed/decomposed strings on macOSSimon Hausmann2018-07-061-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to commit cd64a96b31f57e522ab8d29c8357acf384012ebe we also need to normalize the strings before comparison in order to be compliant with the ECMAScript test suite. This patch also adds the remaining test cases from built-ins/String/prototype/localeCompare/15.5.4.9_CE. Since the same tests are also failing with strcoll/qt_compare_strings, this simplifies the code to always normalize except when using ICU (which gets it right by default). Change-Id: I16b32da7fc70dc7e6725c49f66fe9941d0bf3a47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add qbswap for a memory regionThiago Macieira2018-07-041-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | The compiler was generating some vectorized code for qresource.cpp but it wasn't very efficient. So improve upon it and make use in other places where we read UTF-16BE strings. [ChangeLog][QtCore] Added an overload of q{To,From}{Big,Little}Endian that operates on a memory region. Change-Id: I6a540578e810472bb455fffd1531fa2f1d724dfc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-021-50/+59
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * QLocale/QString/QByteArray: Use nullptr in documentationAndre Hartmann2018-06-221-40/+42
| | | | | | | | | | | | | | | | While at it, fix some more issues in the sentences to harmonize the description between the different classes. Change-Id: Iee1c3ffe6fd71e82504bfb003d927c4db3b2a065 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * QString: Harmonize the toFloat() and toDouble() documentationAndre Hartmann2018-06-221-3/+12
| | | | | | | | | | | | | | | | Both use QLocale::toDouble behind the scenes, so the same limitations apply. Document them for toFloat() also. Change-Id: I954362a0db203630685c034df6a921fa6447a509 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Make QString's formatting of doubles be consistent with other placesEdward Welbourne2018-06-141-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::sprintf(), like the C printf-family, always includes two digits in any exponent it outputs. Up to 5.6, number() and arg() taking a double did the same; but changes at 5.7 to enable opting out of the leading zero this implies for a single-digit exponent accidentally opted out of it in args() and number(). This commit fixes number() and arg() to include QLocaleData::ZeroPadExponent in the flags they pass down to the C locale's doubleToString(), restoring the prior behavior, including consistency with sprintf(). [ChangeLog][QtCore][QString] Formatting of doubles with single-digit exponent, by number() or args(), now includes a leading zero in that exponent, consistently with sprintf(), as it did up to 5.6. Task-number: QTBUG-63620 Change-Id: I10c491902b8556e9f19e605177ead8d9fd32abd9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Fix QString::localeAwareCompare with composed/decomposed strings on WindowsSimon Hausmann2018-06-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With ICU and on macOS it appears that the comparison is done on a canonical form, while CompareString(Ex) does not do that, as the added test verifies. Explicit normalization fixes that. As a bonus, this also unifies the code path between regular Windows and UWP by unconditionally using CompareStringEx (which requires Vista or later). This issue surfaced while running the ECMASCript 6 Conformance Test Suite in QtQml. This re-uses the existing test for localeAwareCompare, which was disabled on Windows, macOS and Linux with ICU (the common case). Change-Id: I52440fce60b54745ead1eff005ec51e98e2a79ec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QByteArray: add compare() with case sensitivity optionsThiago Macieira2018-06-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Need to do the same for startsWith() and endsWith(). indexOf() is a lot harder. [ChangeLog][QtCore][QByteArray] Added compare(), which takes Qt::CaseSensitivity as one of the parameters. This function is more efficient than using toLower() or toUpper() and then comparing. Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Fix build with SSE 4.1 but not AVX2Thiago Macieira2018-06-161-1/+1
| | | | | | | | | | | | | | | | | | Failed on my Sandybridge Mac with -march=native: qstring.cpp:363:19: error: redefinition of 'mask' with a different type: 'const __m128i' Change-Id: I6efb28c3145047559ec0fffd15386aeb8d36d681 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Remove unused QString::toLatin1_helper overloadThiago Macieira2018-06-161-5/+0
| | | | | | | | | | | | | | | | | | Commit 5dc1e08c8c602738f6a827cea0de44683c7bbd0b changed QString::toLocal8Bit_helper to use qt_convert_to_latin1 so it became unused. It was never used in inline functions in the headers. Change-Id: I6efb28c3145047559ec0fffd15382f9d08efdfeb Reviewed-by: Lars Knoll <lars.knoll@qt.io>