summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-167-6623/+6791
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I0cdb390124e783dc9cd832a9954baa76a0e9eb6b
| * Fix QStringView::mid() to behave as documented when passed -1 for lengthAndy Shaw2021-05-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | With 84b53a4514c the behaviour was documented to be the same as QString::mid(), however this did not account for when -1 is passed for the length when it should get the rest of the string. So this ensures this behavior is put in place. Fixes: QTBUG-93677 Change-Id: Id41e136d78a13ff369508e37e6c679c76c6ae399 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Update CLDR-derived data to newly-released v39Edward Welbourne2021-05-042-330/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Routine update with minor changes to locale data, no new languages, territories or scripts. Various Spanish locales change m_grouping_top from 1 to 2, reversing a change to a test of Costa Rica's currency formatting made in commit bb6a73260ec8272647265f42180963604ad0f755. Includes updates to time-zone IDs. Regenerated on 5.15 as the cherry-pick from dev has quite different data. Fixes: QTBUG-91478 Change-Id: I78ee161275b3c456c5800a7317a96947c932cf8e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6235893d54b8fbf5c8bd54e33cd82b55042555f1) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Fix build with GCC 11: include <limits>Jarek Kobus2021-04-291-0/+2
| | | | | | | | | | | | | | | | Amends: 0afad46bb71b106780dd641de768a81d9f6c6a51 Task-number: QTBUG-90395 Change-Id: I396a9f0cee270054c93b2636ebf3e1494f590953 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * Unicode: fix the extended grapheme cluster algorithmGiuseppe D'Angelo2021-04-223-6292/+6464
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UAX #29 in Unicode 11 changed the EGC algorithm to its current form. Although Qt has upgraded the Unicode tables all the way up to Unicode 13, the algorithm has never been adapted; in other words, it has been working by chance for years. Luckily, MOST of the cases were dealt with correctly, but emoji handling actually manages to break it. This commit: * Adds parsing of emoji-data.txt into the unicode table generator. That is necessary to extract the Extended_Pictographic property, which is used by the EGC algorithm. * Regenerates the tables. * Removes some obsoleted grapheme cluster break properties, and adds the ones added in the meanwhile. * Rewrites the EGC algorithm according to Unicode 13. This is done by simplifying a lot the lookup table. Some rules (GB11, GB12, GB13) can't be done by the table alone so some hand-rolled code is necessary in that case. * Thanks to these fixes, the complete upstream GraphemeBreakTest now passes. Remove the "edited" version that ignored some rows (because they were failing). Change-Id: Iaa07cb2e6d0ab9deac28397f46d9af189d2edf8b Fixes: QTBUG-92822 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> (cherry picked from commit a794c5e287381bd056008b20ae55f9b1e0acf138) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into ↵Tarja Sundqvist2022-04-072-8/+25
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I3d223d54a832c8365fec4b399550da79f4c1abbb
| * Doc: Improve deprecation messages for functions using QString::SplitBehaviorKai Köhne2021-04-132-8/+21
| | | | | | | | | | | | | | | | | | | | | | Directly link to the recommended replacement. Inspired by forum.qt.io discussion: https://forum.qt.io/topic/125277/multiple-warning-messages-when-using-split-in-qt-5-15-2 Change-Id: Id880e892b90b6e37bc4f7888968a490b634785ce Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * QString: improve lastIndexOf(QRegularExpression) docsGiuseppe D'Angelo2021-04-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Due to how regex matching works, lastIndexOf has to be implemented by matching from the string's beginning until the from position is reached. This might not be obvious for users, so document that. Task-number: QTBUG-89050 Change-Id: I4b69ea753e7d417d980031926f1e01d77e58720d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6f2dc8d7f27419d13bfbb2af272af99c03c66562) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Revert "Update commercial license headers to src/concurrent and src/corelib"Tarja Sundqvist2021-03-2357-1159/+1159
|/ | | | | | | | | | | This reverts commit b98b16de25dd5463342a2165a20b5fdc1cf9c32a. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I51f2e169ec144ab9b902df2cff87eae60df53c57 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Update commercial license headers to src/concurrent and src/corelibTarja Sundqvist2021-01-2857-1159/+1159
| | | | | | | | | | | | | | | | | | | Updated the header.COMM to the files under tqtc-qtbase/src/concurrent and tqtc-qtbase/src/corelib. Note! The following files are not updated: - the .qdoc files with the FDL license headers - the .cpp files with BSD license headers The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and changing the line count would cause test failures. Task-number: QTQAINFRA-4154 Change-Id: I37a4dc8c89b0a84d78ca890a61e212966d8b20b5 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* QString::lastIndexOf: fix off-by-one for zero length matchesGiuseppe D'Angelo2020-12-101-2/+2
| | | | | | | | | | | Otherwise, it would report that lastIndexOf of an empty pattern in an empty string doesn't exist. Next commit adds extensive autotests; for now, disable a broken autotest (which already features a comment about why it's broken). Change-Id: I9a0e5c0142007f81f5cf93e356c8bd82f00066f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit be83ff65c424cff1036e7da19d6175826d9f7ed9)
* QString: fix count(QRegularExpression)Giuseppe D'Angelo2020-12-101-3/+9
| | | | | | | | | | | | | | | | | There is an off by one in the implementation of count(): a match must be attempted even at the very end of the string, because a 0-length match can happen there. While at it, improve the documentation on the counter-intuitive behavior of count(), which doesn't merely count how many times a regexp matches into a string using ordinary global matching. [ChangeLog][QtCore][QString] Fixed a corner case when using QString::count(QRegularExpression), causing an empty in the last position not to be accounted for in the returned result. Change-Id: I064497839a96979abfbac2d0a96546ce160bbc46 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7c3208c97d2ad2c046908e144325c4ddb1e54876)
* QStringView: operator==(), operator<(), operator>() currently Qt6 onlyAhmad Samir2020-12-041-4/+0
| | | | | | | These operators don't exist in Qt5. Change-Id: I3cb21521bd3e3f11e217cf901940320f0f1aa0b3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Improve *_CAST_FROM_ASCII documentationKai Koehne2020-12-041-14/+9
| | | | | | Change-Id: Iba73c0a38e2c4add740aab20036aa39c56eb4d98 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 50873153a70521e138b590a227902876f998270e)
* Return a more useful date-time on parser failure in spring-forward gapEdward Welbourne2020-11-301-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to 5.15.0, QDateTime::fromString(), when parsing a string that matched the format but represented a date-time in a spring-forward's gap, would return an invalid date-time object that represented a "best shot" date-time, correcting the error in the string as best it could. In 5.15, in order to handle time-spec information correctly, we adapted the date-time parser to have a fromString() variant that parsed a date-time as a whole, rather than as a date and a time; as a result, QDTP::fromString() now returns false and QDT::fromString() returned a default-constructed instance instead of the invalid date-time that QDTP had produced. Amend 76054516047d8efb8529443830bb4d9ddf01010f to restore the prior behavior of returning the invalid date-time object from QDTP instead of a default-constructed invalid date-time. Also document what this implies for the caller's ability to recover from the situation, if a best shot result is better than nothing. [ChangeLog][QtCore][QDateTime] Restored pre-5.15.0 behavior when parsing a date-time from a string (and document what it implies): if the string has the right form but represents a date-time that was skipped by a time-zone transition (e.g. a DST spring-forward), the invalid date-time object returned can, none the less, be used to recover a near-by date-time that may be more useful in some cases. From 5.15.0 to 5.15.2 and in 6.0.0, a default-constructed QDateTime was returned in place of this more informative invalid date-time. Task-number: QTBUG-88633 Change-Id: If0b439038d5fe48eefb951c62f3aae2933bb5651 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3a4115d1236bc78dda078657883283cc92df8e8a) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qstring.h: fix warnings about shortening qsizetype to intThiago Macieira2020-11-301-2/+2
| | | | | | | | | | | QStringView already uses qsizetype in Qt 5, which is 64-bit wide on 64- bit platforms. But QString and its routines still use int. Doesn't apply to Qt 6 since there QString has been updated to qsizetype. Fixes: QTBUG-88952 Change-Id: I00b01c01a66748508ea1fffd164b69eee2079f96 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Consistently use book style capitalization for QStringKai Koehne2020-11-301-1/+1
| | | | | | Change-Id: I2ab64fe58ad737b23f0829ed91591efaa0c22c6f Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit efa05e04176067a2e5b4d133943d854c9c08bbe7)
* Clean up docs of QCalendar-related QLocale::toString() variantsEdward Welbourne2020-11-272-45/+63
| | | | | | | | | | | | | | Some of the new functions were added without documentation, or without updating the docs to mention the optional calendars. Shuffle the methods so that the one with calendar is what the primary documentation comment describes and the one without is documented as an overload. Change-Id: Iee4cdb1d3b0ed21a50e205a5275a0695a2667550 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit f884689d044f03f0e0b9b8fd98b3d1405131ab7c) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix logic error in QString::replace(ch, after, cs)Andreas Buhr2020-11-201-1/+1
| | | | | | | | | | | Coverage analysis showed that an if-branch marked "Q_LIKELY" was never taken. It turns out the code was incorrect, but behaved correctly. This patch fixes the logic and adds a unit test. Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ebaae45ea17efc230209ed90d94596647cf6cb48) Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QCharRef: properly disable assignment from charGiuseppe D'Angelo2020-11-131-0/+4
| | | | | | | | | | | | | | | Under QT_NO_CAST_FROM_ASCII the assignment would fall back to operator=(int) after a promotion. Add a deleted overload to block this. (QChar itself uses a private constructor for the same purpose, but I chose the C++11 solution). Nothing to do in Qt 6, QCharRef is gone. Change-Id: Iba50ad2b6ad95d7c3a5e4920ab03fae5d3db0319 Fixes: QTBUG-88431 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Update CLDR to v38Edward Welbourne2020-11-094-2415/+2404
| | | | | | | | | | | | | | Fresh on the heels of our update to v37, they've released a new version. No new languages to complicate life, fortunately. Updated license (year range) and attribution. One test also needed an update: Catalan's long time format now parenthesizes the zone. Task-number: QTBUG-87925 Change-Id: I54fb9b7f084b5cd019c983c1e3862dc03865a272 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 246ba8ca61a19b586de1750d66422f517149622e) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Deprecate old aliases for two countries and several languagesEdward Welbourne2020-10-283-25/+23
| | | | | | | | | | | [ChangeLog][QtCore][QLocale] Deprecated several Language and Country aliases, ready for removal in Qt 6.0, in favor of their newer names. Task-number: QTBUG-84669 Change-Id: Iebaa0a5a77bfa12f7014de53fab4a25b5f1cc92c Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 2c4874be40aa40b698315cac0ad768e5c650a740) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Deprecate QLocale::Language entries that no locale data relates toEdward Welbourne2020-10-282-86/+132
| | | | | | | | | | | | | | | | | | These are languages for which CLDR does not even recognize the claimed language code (three-letter codes except for bh = Bihari, which might be an old name for bho = Bhojpuri, which CLDR does give, but provides no locale data using it). [ChangeLog][QtCore][QLocale::Language] Many obsolete language names are now deprecated in preparation for removal at Qt 6.0. No data has been available for any locale using these languages since CLDR v29 (at least; Qt now uses v37). Task-number: QTBUG-84669 Change-Id: I2bf2d49211ade7cc511277f35fb1a247e7048b31 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 2575a8ced39b607ed320ed230c83119eaad4b33b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update CLDR to v37, adding Nigerian Pidgin as a new languageEdward Welbourne2020-10-273-1702/+1770
| | | | | | | | | | | | | | | | | | | Routine update by running scripts, ignoring clang-format's extensive grumbles. Added notes to util/locale_database/'s README, on the need for that, and enumdata.py, on when to add entries. As usual, several new locales are also added, for existing languages, territories and scripts. [ChangeLog][QtCore][QLocale] Updated to new version of CLDR (the Unicode Consortium's Common Locale Data Repository) v37. Various Adlam-script locales are dropped due to its use of a number system unsupported by 5.15's QLocale. Support for these locales shall be restored in Qt 6. Task-number: QTBUG-84669 Change-Id: Ib76848bf4bd1219180faf46820077e8d8049a4e3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit cb23d50f38ec9d1daed570aa2b89e6d4b3f45c3f)
* Fix locale look-up when language is unspecifiedEdward Welbourne2020-10-261-5/+15
| | | | | | | | | | | | Looking up a locale with unspecified language got the C locale, due to taking a short-cut that would make sense if no locale were found for a specified language. Stop assuming the language was specified. Task-number: QTBUG-74287 Change-Id: I8b3c232da584fb187ebb6c190729c377d0083808 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit e69b81101c6e09d1c1b81d50ea868a8625c9f248) Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Revert changes in strto(u)ll.c to avoid integer overflowsRobert Loehning2020-10-261-0/+4
| | | | | | | | | Found in oss-fuzz issue 26045. Change-Id: Id9eac1b4f67ad9bbe2d92dd69cd03338a6ced74e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 2096400d6e8249e49df049f9600073fb2219c97a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QLocale's findLocaleDataById(): skip likely sub-tag look-upEdward Welbourne2020-10-231-4/+1
| | | | | | | | | | | | | | It was always called in pairs, first with likely sub-tags added, then with the base that started from. So doing a likely sub-tag lookup inside the function was redundant for the former while making the latter redundant - and it's needed. Task-number: QTBUG-84669 Change-Id: I18bf1d4976a51d9436efd20d1a84a36cfc60f618 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 55e16b25f52fdd1b945d3f94d79ce85d88cb69ec) Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QStringView overloads to QRegularExpression::(global)Match()Lars Knoll2020-10-192-0/+63
| | | | | | | | Add these to simplify porting from Qt 5.15 to Qt 6. Task-number: QTBUG-86516 Change-Id: I39f9c61e66a8084c7a4a6c5424e5b1a0b09beeff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add some missing QStringView overloads to QStringLars Knoll2020-10-152-0/+95
| | | | | | | | | | | | | | | | | | | These are added to aid writing portable code between Qt 5.15 and Qt 6. [ChangeLog][QtCore][QStringView] A couple of methods have been added to QStringView that make it easier to write code that is portable between Qt 5.15 and Qt 6. Those include QStringView::split(), QStringView::count(), number conversion methods (QStringView::toInt() and friends). A couple of overloads taking QStringView have been added to QRegularExpression (match() and globalMatch()) and QString (append(), prepend(), insert() and localeAwareCompare()). Fixes: QTBUG-86516 Change-Id: I98779217c7a4107fbe086f956d24b1ce059194d7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QStringView::count(...)Lars Knoll2020-10-153-0/+43
| | | | | | | | | | | Also this one as a porting aid towards Qt 6. The implementation is using QString to keep things simple. Task-number: QTBUG-86516 Change-Id: Ic033b8678c76a608af8acfc5fab547aeb159933e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QStringView::split()Lars Knoll2020-10-154-0/+70
| | | | | | | | | | The implementation has to live in qstringlist.h and qregularexpression.h, as those classes are only forward declared in qstring.h. Task-number: QTBUG-86516 Change-Id: Ia9b3ff48999d1c2e7df905191ee192764b309d08 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add toInt() and friends to QStringViewLars Knoll2020-10-123-0/+280
| | | | | | | | | | | | | The implementations are not trimmed for efficiency, but as a porting help for Qt 6. Because of that, they simply use the methods available in QString. Task-number: QTBUG-86516 Change-Id: I39ea04a6c96ca43f3a88a9be4e63a5dea4a4e479 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Loosen the API contract for QStringView::left() and friendsLars Knoll2020-10-122-9/+22
| | | | | | | | | | | | | Remove the assertions in QStringView::left() and friends and turn them into runtime bounds checking instead. This changes the behavior to be compatible with what we do in Qt 6 (see change d2833a3ce5af725d66ef9338f2a61b766dd3cb2d) and simplifies porting from QStringRef to QStringView. Task-number: QTBUG-86516 Change-Id: I28e3beb4f42c7b9dfc52813cbcfa322a3df5685a Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Reference proper SplitBehaviour enum in docsNicolas Fella2020-10-021-1/+1
| | | | | | | | | | QString::SkipEmptyParts is Qt::SkipEmptyParts now. Change-Id: Ie351bbe9d2350e771f821a9f0bc9f581be5b0022 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 2d8d8ab8c2a1386878429f57f6069d2f86f7708b) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: fix standaloneMonthName implementation for system localeVolker Hilsheimer2020-08-271-5/+23
| | | | | | | | | | | | | macOS has specific formatters for the standalone month names, so use them. Change-Id: Ic4ad547c7d1c29d71c85f60301acd5a5f0f263d2 Fixes: QTBUG-86191 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 062d2831845eb07518d7c059b155a640bd0300f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Un-deprecate QByteArray's relational operators taking QStringSona Kurazyan2020-08-263-21/+1
| | | | | | | | | | | | QString still has the overloads of relational operators taking QByteArray. Un-deprecate QByteArray's relational operators taking QString for symmetry. See also the comments of d7ccd8cb4565c8643b158891c9de3187c1586dc9 for more details. Change-Id: If3f59376b389fe4cbc2bd649a748bb78378a530c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d8ee1f6385b4dfeb57cb466b6c5f6bcfd3a90dfb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QRegularExpression: do not assume QStringViews are NUL terminatedGiuseppe D'Angelo2020-08-261-3/+18
| | | | | | | | | | | | The convenience API used to look up the index of a named capturing group expects NUL terminated strings. Therefore, we can't just use it together with QStringViews, which may be not. Use the non-convenience API instead. Change-Id: I25ca14de49b13ee1764525f8b19f2550c30c1afa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 049d8892eaa18d71d6edb10752418ad33305f310) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtPrivate::isLatin1: fix SSE2 non-SSE4.1 codeThiago Macieira2020-08-061-20/+1
| | | | | | | | | | | | | | The implementation was broken. The "high" in PUNPCKHBW's "unpack high data" means the high 64-bit of the 128-bit, not the high byte of a 16- bit word. This never worked. It always passed for me because I don't build non-SSE4.2 code (too old, no longer relevant). So just use the working version of simdTestMask. Change-Id: I35a1b4d0a19a43149daefffd16284542f0de3fa3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 9422b5ebc3592f4687650a84131e736219308b9f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qustrlen: Add #warnings to explain how to deal with GCC 7.x's ASanThiago Macieira2020-08-061-0/+7
| | | | | | | | | | | | | | | | The build breaks by disabling ASan in this function because it also removes its ability to emit SSE2 code. That's clearly broken because all x86_64 can use SSE2. So this adds #warnings so people are told how to choose their solution. Clang doesn't currently define __SANITIZE_ADDRESS__ but I added a conditional just in case some future version does. Fixes: QTBUG-84856 Change-Id: I552d244076a447ab92d7fffd1617875fdd8dbe62 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 3caeb0187dec592c78a3bde8d0284475e00e30d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix warning in QStringView::compare(QChar) on qsizetype->intThiago Macieira2020-07-311-1/+4
| | | | | | | | | | | | | | | | | | | size() - 1 is converted to int as the result, but size() is a qsizetype and could be bigger than INT_MAX. So rewrite to not depend on the cast. This was introduced on b2f79cceb11dfd15ac9eea631bc18ad6b036eb91. I could have replaced size() - 1 with int(size() > 1) - 1, but that's even more complex. To simplify, I split the function in two while retaining the C++11 constexpr requirements. Bonus: removes the use of the ambiguously-named "empty()" function that looks like a verb. Fixes: QTBUG-85665 Change-Id: Ieffc3453b88c4517a1dbfffd162338fdb084a376 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 61ccfefb25d61da95a1a1cdf0313da1448dc23c6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Be clearer about the locale-aware comparison QString supportsEdward Welbourne2020-07-301-95/+61
| | | | | | | | | | | | | | | | | The docs didn't make clear that there's a case where a rather poor locale-aware compare may be in use - which turns out to be in use on Android. In the process, stop duplicating (in two slightly different variants) the same paragraph in many places when we can use a \sa to refer to a sub-section of the class doc. Task-number: QTBUG-63518 Change-Id: I5a41b0a269e477e74236131310992e70462734d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit 2ab4fe2ac84d0da84b489f9898d44ab77b78fd6b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocaleData: remove unused internal functionThiago Macieira2020-07-282-13/+0
| | | | | | | Change-Id: Iea47e0f8fc8b40378df7fffd1624bf3469e66c90 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f50945b8fd6f51bf679ef35153915da882f332de) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray::toDouble: fix buffer overflow reads on fromRawData()Thiago Macieira2020-07-281-6/+25
| | | | | | | | | | | | | | If Qt was not compiled with libdouble-conversion, sscanf() requires null-termination, which fromRawData() does not require. This could be fixed by making QByteArray pass a reallocated copy if it is operating on raw data, but fixing qt_asciiToDouble() means we catch all cases and we optimize for the common case of not-horribly-long strings. Fixes: QTBUG-85580 Change-Id: Iea47e0f8fc8b40378df7fffd16246f6163b01442 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit efd3c7bf2427c8237857e56ecd51b8da3ce43a6e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Deprecate QByteArray's methods taking QStringSona Kurazyan2020-06-243-19/+56
| | | | | | | Change-Id: I5aba5a91f288173c2d4f1bd3538191757abd3202 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix Clang 10 warnings about deprecated copy constructorsThiago Macieira2020-06-102-0/+2
| | | | | | | | | qstring.h:1235:22: warning: definition of implicit copy constructor for 'QCharRef' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy] Task-number: QTBUG-83666 Change-Id: I99ab0f318b1c43b89888fffd160b4a12bee11723 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Doc: Improve documentation for QLocale::FormatTypeKai Koehne2020-06-102-21/+33
| | | | | | | | | | | | | | | | | LongFormat and ShortFormat are not limited to day and month names. Different locales might also use numbers for months instead of strings, so the example is a bit misleading. Instead of extending the enum description even more there's now examples in the dateFormat(), timeFormat(), dateTimeFormat() functions. Task-number: QTBUG-83841 Change-Id: Icea2cbce7e9505d706a2171e7d1f4486abdb20be Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 732c670590ae87b549ef0377d918bcb05e25fae4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Create QLocale's default store if missing when setDefault() is calledEdward Welbourne2020-06-051-2/+10
| | | | | | | | | | | | | | | | | | | | A check to prevent crash-on-exit if QLocale::setDefault() was called after the default store was torn down had the side-effect of causing setDefault() to not record data if it was called before the first access to the default store caused it to come into being. Change the check to test that the default store has been destroyed and, if not, create it if it doesn't exist yet. This refines commit 4d6572aac0eb1f75f3c810ce8e92635b956d29fc (as modified by commit 11c5c078c7743050a115a4dcc31f52caaa378e35). Fixes: QTBUG-83016 Fixes: QTBUG-83415 Change-Id: Icbce9bd9c75d0258d403e2f90957561b5a18bdf3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit c7420d9cb8e15d1f094fa92cfab635a86246c670) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: fix some typos in QRegularExpression documentationSamuel Gaist2020-06-031-8/+8
| | | | | | | Change-Id: Ibf96fc775b08df4de0b20d499d8779204ff7df30 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 654a3ad08e52dd84dac3a729e06458cfa568f6bb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArrayLiteral: Remove const temporary that may prevent optimizationAlbert Astals Cid2020-05-211-2/+1
| | | | | | | | | | clang-tidy 10 was complaining about http://clang.llvm.org/extra/clang-tidy/checks/performance-no-automatic-move.html Change-Id: I63ba4111e01bb9d3ee87940253c4a79cc42c0bdf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 4fa94440902d87b41f6cda7e5fd057dc8e79f08d) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QString: fix an aliasing issue in remove(QString)Marc Mutz2020-05-211-1/+9
| | | | | | | | | | | | Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with the advent of substring sharing, this will become even more pronounced. Use the same fix as was already used in QString::insert(). Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b655734965155146290f3f3a9205243af11e42fb) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>