summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
* Scale seconds by a thousand to get millisecondsEdward Welbourne2018-10-021-2/+2
| | | | | | | | | QTimeZonePrivate::dataForLocalTime()'s handling of times in a spring-forward gap added offsets in seconds to values in milliseconds. Supply the missing factor of a thousand. Change-Id: Ic32d87675f902e1c7fd85025fb70c8272a4f2db2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineParser: Ensure that an option text ends with a newlineAlexander Akulich2018-09-281-1/+5
| | | | | | | | | | | | | | Before this change we inserted newline only if an option has a description and ended up with an arbitrary long line with all options. [ChangeLog][QtCore][QCommandLineParser] Fixed a bug that caused the help output to show two options or more in the same line if the options didn't have a description. Task-number: QTBUG-70174 Change-Id: Id54b9ae13ee596869e4dc14e09301aea19eed2f8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Modernize the "datestring" featureLiang Qi2018-09-246-41/+43
| | | | | | Change-Id: I2236a456fe3758d9054b22e36fe6316f3522d533 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Modernize the "textdate" featureLiang Qi2018-09-243-17/+17
| | | | | | Change-Id: Ic0b6f13e17c301ed66d6a8297c242086c94ac87d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11.2' into 5.11Qt Forward Merge Bot2018-09-091-4/+4
|\ | | | | | | Change-Id: I2fa26fa061cbf5d2bded203a299a19b7d1c31d0a
| * Doc: Fix typos in QRectF documentationPaul Wicking2018-08-271-4/+4
| | | | | | | | | | | | | | | | | | Add missing 's'. Fixes: QTWEBSITE-823 Change-Id: I1acd3b7ae18982248bf3402fa5943ee95c1efdbe Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Doc: Move the literal code blocks to a separate fileVenugopal Shivashankar2018-09-031-13/+4
|/ | | | | | | | It's easier to override the code blocks this way. Change-Id: I98d40626a94fdb70a95c50332c2da141e9277070 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Cast away -Wclass-memaccess warnings in QVarLengthArray methodsEdward Welbourne2018-08-201-3/+3
| | | | | | | | | | | | With g++ 8.2.0, I get warnings when a QVarLengthArray<QString> calls remove() or prepend(), as some tests in tst_QVarLengthArray do, as they call memmove() "writing to an object of type ‘class QString’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead"; which may indeed be a good argument for not using QVarLengthArray<QString>, but its own tests do. Change-Id: I4f8a64948b32a54e67a285df4ec7788f60739ffb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* MSVC: add support for 64-bit POPCNT on 32-bit machinesThiago Macieira2018-08-161-3/+6
| | | | | | | | It's just adding the count of each half. Change-Id: I9868946ceaf74002bde1fffd154b29908319007f Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* [macOS] Fix lower bound when searching for previous transitionsErik Verbruggen2018-08-141-1/+1
| | | | | | | | | The lower bound shouldn't be the smallest (positive) value representable by a double, but the *lowest* (finite) value. Task-number: QTBUG-69862 Change-Id: Ia66610e3c0f8d9643c329714607f5af573206fd8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* 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>
* Improve documentation of QString::indexOf that take QRegExpAlbert Astals Cid2018-08-011-8/+0
| | | | | | | | | | They said "By default, this function is case sensitive" but this makes no sense when you're using a regexp for searching, the regexp is case sensitive or not by itself, QStringList does not influence that. Change-Id: I7446cb52a9f915c6551af6046ce89cbc8bab96ed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Link from QLocale to where date-time formats are explainedEdward Welbourne2018-07-312-0/+16
| | | | | | | | | | | QLocale has various methods that deal in date-time formats, which may be supplied as strings; but does not document the form of a format string. That's documented in QDate, QTime and QDateTime, so link to them for the details. Task-number: QTBUG-23307 Change-Id: I6347d80a87dc03f6a4065e3d5bf4d535f05af93f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean before copying any QCollatorEdward Welbourne2018-07-261-2/+11
| | | | | | | | | This avoids the hazard of both (if on separate threads) trying to init() at the same time, if they were dirty before cloning. Task-number: QTBUG-69361 Change-Id: Iabb06942c074ba073ca58fd0de509d1db15c1093 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Check against copying the husk left by a moveEdward Welbourne2018-07-261-1/+2
| | | | | | | | | | | | | The copy-assign operator tests against other.d being NULL but the copy-constructor didn't. This can only matter if the value being copied has been moved from, so we could probably replace with an assertion in practice, but we should at least be consistent. Amended test to check this case too; and verified new test crashes without this fix. Change-Id: I46872a677775944bbdf6a9112e719873e574ae60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix MSVC builds with /Zc:wchar_t-Timur Pocheptsov2018-07-251-0/+2
| | | | | | | | | | | | 208c71768 introduced a problem for our users, who build on Windows with /Zc:wchar_t-, which makes wchar_t a typedef for the type 'unsigned short', preventing them from switching to more recent versions of Qt. While MSDN recommends against this option, we can add more #if-ery to avoid compiler's bailing out on a constructor's redefinition. Task-number: QTBUG-65101 Change-Id: I62a1d9b2572f3d4b1f70bcbc3e52e795b1944558 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* 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>
* Add missing init()-if-dirty in two of ICU's QCollator::compare()sEdward Welbourne2018-07-121-0/+6
| | | | | | | | | Both delegate to the one that did do the if dirty: init() check, but only after they've tested whether d->collator is set, which it might not be when dirty. Change-Id: I77533d6d32c4a8c9b42797c77003e50f5820775a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix regression in QPointF::operator==Allan Sandfeld Jensen2018-07-091-3/+2
| | | | | | | | | Handle hard zero independently in each coordinate, otherwise hard zero is never equal to anything but itself. Task-number: QTBUG-69368 Change-Id: I8b1131472bb92efc706a04e0b067e2211a5ccb0c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Tidy-up after recent change: combine declaration with initializerEdward Welbourne2018-07-031-2/+1
| | | | | | Change-Id: I94420a3dfa30e4a2a4d8786621bea1dd9309bed8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace LGPL licenses in .qdoc files with FDLKai Koehne2018-06-282-42/+18
| | | | | | | | .qdoc files should only be licensed under FDL (for documentation) or BSD (if they only contain code). Change-Id: I2a8a5b2c7bd3f927b8f71506c3672bc4916aca1e Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Leave m_id clear if the JNI didn't give us a time-zoneEdward Welbourne2018-06-221-1/+18
| | | | | | | | | | | | | QTimeZonePrivate::isValid() just checks m_id is non-empty; so we have to leave m_id clear if we don't get a valid time-zone back when we ask the JNI for one. Unfortunately, JNI gives us a "valid" default zone if it doesn't recognize the given name; so check the known names of this zone (or of zones with its offset); if the given ianaId isn't one of them, assume this is a bogus zone. Task-number: QTBUG-68842 Change-Id: I6245db18c59c4261ed5fcd4d948dd773365ce61d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale/QString/QByteArray: Use nullptr in documentationAndre Hartmann2018-06-223-108/+110
| | | | | | | | 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>
* QLocale: Remove misleading link to QString::toDouble() conversionAndre Hartmann2018-06-221-6/+10
| | | | | | | | While at it, add the comment to the toFloat() functions also. Task-number: QTBUG-55232 Change-Id: I21c06363946f35fb3d89a51e4f75be392b57c0a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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>
* Doc: Add missing full stops in briefsPaul Wicking2018-06-212-4/+4
| | | | | | Task-number: QTBUG-68933 Change-Id: I3f2a9f8c562f9a44bb32bddd31d75abbfe6de04d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Point to the SG-10 SD-6 as a requirement for C++14 featureThiago Macieira2018-06-161-0/+5
| | | | | | | | Task-number: QTBUG-68702 Change-Id: I04b94079b6da48f39a82fffd153568f8dab3ef1b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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>
* Use qFuzzyCompare instead of qFuzzyIsNull in QPointF ==Allan Sandfeld Jensen2018-05-301-2/+10
| | | | | | | | | | | | | qFuzzyIsNull has a fixed range, where qFuzzyCompare can tell if numbers are different in a more relative range. Without it QPointFs that are heavily scaled will be interpreted as identical, when they are quite different at their own scale. Task-number: QTBUG-60359 Task-number: QTBUG-62161 Change-Id: Ic4ba90e9e994aedff5548d690f053eb309b0a60b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Suppress warnings about deprecated QString constructorThiago Macieira2018-05-301-10/+10
| | | | | | | | | They were introduced in commit c416a7f25770563a265cc86e779f2e54c01a85a0. warning: ‘QString::QString(const QByteArray&)’ is deprecated: Use fromUtf8, QStringLiteral, or QLatin1String [-Wdeprecated-declarations] Change-Id: I6a540578e810472bb455fffd1532e31736e1edc9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: only use LANGUAGE if it contradicts LC_ALL/LC_MESSAGES/LANGEdward Welbourne2018-05-231-3/+31
| | | | | | | | | | | | | | | | | | | | | If LANGUAGE specified only the language, without any script or country, and matched the value we'd got from other environment variables, we were throwing away their knowledge of script and country, leading to falling back on the default script and country for that language, which might be at odds with what other environment variables had told us. Changed to only use LANGUAGE if it contradicts (or extends) what we would otherwise have used. Clarified some comments in the process. [ChangeLog][QLocale][Unix] When using LANGUAGE would lose information about script or country, without changing language, use the locale implied by LC_ALL, LC_MESSAGES or LANG. Prompted-by: Safa AlFulaij <safa1996alfulaij@gmail.com> Change-Id: Ie433e57ae6b995abafd05c931136cc9796494895 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qt_is_ascii: improve isAscii a little further (QUrl, QLatin1String)Thiago Macieira2018-05-201-5/+12
| | | | | | | | | Turns out that the non-AVX2 code was beating the performance of the AVX2 because the simdTestMask function did a little too much. So just use the same VPMOVMSKB technique for it. Change-Id: I0825ff5b5f6f4c85939ffffd152f3b636ab998db Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add support for QSharedPointer<cv qualified>::create()Thiago Macieira2018-05-171-4/+7
| | | | | | | | | | [ChangeLog][QtCore][QSharedPointer] Fixed a problem that made create() on a type with const qualification fail to compile. Task-number: QTBUG-68300 Change-Id: I0825ff5b5f6f4c85939ffffd152f3e55e5b9caae Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* ucstrncmp: refactor with 32- and 8-byte loadsThiago Macieira2018-05-151-16/+56
| | | | | | | | | | | | | | | | | First of all, this removes the UB that used to try and calculate the distance between the two strings. That's a valid technique in assembly, but dangerous in C++ and totally unnecessary. The compiler is perfectly able to generate loops with a single induction variable all on its own. Second, this commit makes the main loop use 32-byte comparisons (16 characters at a time), which is a reasonable size for strings. We use AVX2 if that's available, or an unrolled pair of 16-byte loads otherwise. After the existing 16-byte comparison, this commit inserts an 8-byte (4-character) comparison and then reduces the final, unrolled comparison to just 3 characters. Change-Id: Ib48364abee9f464c96c6fffd152e474b39e1f293 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QByteArray::setNum: use the existing latin1 lowercasing tableThiago Macieira2018-05-131-15/+3
| | | | | | | Not sure this makes the code faster, but it removes two functions. Change-Id: I5d0ee9389a794d80983efffd152d830da44b1bfe Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: fix off-by-one errorThiago Macieira2018-05-101-4/+4
| | | | | | | | | The check for having N valid characters is ptr + N <= end, because ptr + N == end indicates that we have exactly N characters in the string. Change-Id: I5d0ee9389a794d80983efffd152d28d5aa485ce4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix build with GCC 8: memset/memcpy/memmove of non-trivialsThiago Macieira2018-05-091-4/+6
| | | | | | | | qarraydataops.h:73:17: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct TCBPoint’; use assignment or value-initialization instead [-Werror=class-memaccess] Change-Id: I5d0ee9389a794d80983efffd152ce10eb557341f Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix build without features.timezoneTasuku Suzuki2018-05-081-0/+2
| | | | | Change-Id: I3f8421103afa61baf415636b4dc8cf93fb477bcc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Fix the enabling of AES with ICC and MSVC on some low-end processorsThiago Macieira2018-05-041-3/+2
| | | | | | | | | | | | | | GCC and Clang assume that all Sandybridge (2nd generation) and newer Intel Core™ processors have AES, which I used as a source of information for this code. However, there are a few low-end parts that miss this feature, like Intel Core™ i3-2350M, i3-3130M, i3-4000M. [1] https://ark.intel.com/products/series/75025/4th-Generation-Intel-Core-i3-Processors Task-number: QTBUG-67705 Change-Id: If90a92b041d3442fa0a4fffd1525b9afbcb6e524 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Advocate use of std::initializer_list constructor in Q[String]ListKai Koehne2018-04-232-6/+22
| | | | | | | | | We're relying on C++11 since a while, so lets not advertise creating lists of strings with operator<<() anymore. Change-Id: I14a3442ff852ac2c106d90c63504eb9ebb737609 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* QByteArray: Use nullptr for "Safe and portable C string functions"Andre Hartmann2018-04-211-22/+23
| | | | | | | | Change the documentation to use nullptr and modify the related code also while at it. Change-Id: I6264a254828159cda54e90393835ea04e131350b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: Add a note regarding overlapping pointers to qstr(n)cpyAndre Hartmann2018-04-211-0/+4
| | | | | | | Stated e.g. in http://en.cppreference.com/w/c/string/byte/strcpy Change-Id: I42fd5a5fa6a63b67a7105aa56e93e3d3f2193cf7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: link to QEnableSharedFromThis from QSharedPointer docsMitch Curtis2018-04-181-1/+1
| | | | | Change-Id: I1c4a168c0581b6273b99a7ea8faa29114bda39e2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix integer overflow (1 << (' ' - 1))Mikhail Svetkin2018-04-101-7/+7
| | | | | | | | | On platforms where integer by default is int32(max is 2147483647) and (1 << (' ' - 1)) will be 2147483648 Change-Id: I790d33bd4e473925d6897dd87cbffdfe8dd7938f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix MSVC2017 compilation with enabled relaxed constexpr on 32-bit targetOlivier Goffart2018-03-281-4/+6
| | | | | | | | | | | | | | | | | | | | The problem is that qCountLeadingZeroBits is calling qPopulationCount which is only conditionally constexpr, so qCountLeadingZeroBits can only be marked constexpr if qPopulationCount is also. On MSVC2017 64bit this is not a problem because it uses builtins function in this case. (which is not constexpr, but it works because the compiler is not forced to diagnose the problem because of the "?:" operator. The error being fixed is: qalgorithms.h(847): error C3615: constexpr function 'qCountLeadingZeroBits' cannot result in a constant expression qalgorithms.h(858): note: failure was caused by call of undefined function or one not declared 'constexpr' qalgorithms.h(858): note: see usage of 'qPopulationCount' Task-number: QTBUG-67259 Change-Id: I65a3dfae12ca49394bec14ffefdd41a07fee1c32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Animation: Fix case where QEasingCurve::valueForProgress returns nanSvenn-Arne Dragly2018-03-261-21/+54
| | | | | | | | | | | | | | | | Previously, we would divide by zero in BezierEase::findTForX if factorT3 was zero when solving the cubic equation. This change fixes the problem by adding solutions for the special cases where the cubic equation can be reduced to a quadratic or linear equation. This change also adds tests that cover cases where the equation becomes quadratic, linear or invalid. Task-number: QTBUG-67061 Change-Id: I2b59f7e0392eb807663c3c8927509fd8b226ebc7 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* fixup oversight in rvalue overloads of operator+=() and operator<<()Eric Lemanissier2018-03-262-4/+4
| | | | | | | ammends 4dee5446bee9c7417bf6f5dc44294a0b7238a9ba Change-Id: Ia0ca27644eb71815a93d6e76681b8a9e61a4e7ab Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Modernize the "regularexpression" featureUlf Hermann2018-03-206-59/+35
| | | | | | | | | | | | | Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QSharedDataPointer: use swap-and-move in the move constructorThiago Macieira2018-03-191-2/+10
| | | | | | | | | | This makes the pointer that was in the moved-into object be destroyed before the return of this function (if the reference count was 1), instead of letting it live in the moved-from object. Task-number: QTBUG-66322 Change-Id: I3debfc11127e4516b505fffd151209292bd3adaa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* q{,Utf8}Printable: avoid creating a copy of a QStringThiago Macieira2018-03-181-0/+6
| | | | | | | | | | | | | | | | | We have this QString() constructor call to permit things that convert to QString but aren't QString to be used in qPrintable, like a QStringBuilder-powered fast operator+ expression, like: qPrintable(string1 + ": " + string2) Unfortunately, it meant that we unnecessarily created a QString copy if the input was already QString. Change-Id: Iecab8770aa5840aba8edfffd1516bc94cec791a9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>