summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-215-60/+86
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Make some initializers be declarations.Edward Welbourne2016-01-201-10/+10
| | | | | | | | | | | | | | | | | | | | This shortens an earlier over-long line of declarations and makes visible that these are declare-and-initialize. Change-Id: I39fa9613196c34f7e2b2da04da729324d7f83a55 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| * Avoid shadowing a name (and use the outer variable an extra time)Edward Welbourne2016-01-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | QDateTimeParser::parseFormat()'s top-level scope has a const int max; this was shadowed by a short-lived max in an inner scope; and the outer scope's max could be re-used one more time after that to save re-evaluating the same unchanged expression it held. Change-Id: I9f07452bb0b4e5ff4bcf6396d42d1419de6276fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| * Avoid dereferencing before the start of a string.Edward Welbourne2016-01-201-1/+1
| | | | | | | | | | | | | | | | A check for a backslash before a quote neglected to pretest that the quote wasn't the first character in its string. Change-Id: Ib5226836d1111e37bed984938f7c667be59eb1c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Make it clearer what's happening with a fall-through.Edward Welbourne2016-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | An if () {...}'s close-brace was hiding on the end of a break; line, an idiom used in several places for braces that existed to contain a case (for the sake of local declarations). This made it hard to see that there was an if() whose else was the resulting (commented) fall-through. So put that close-brace on the comment's line and make the comment clearly indicate it's an else. Change-Id: Ie7e7c7063bef96536d6231297b083fc384f2363e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Doc: Fix return type of QWeakPointer assignment operatorsTopi Reinio2016-01-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Imprementation of QWeakPointer assign operators have return types that are references. However, in qsharedpointer.h where separate declarations are held for documentation purposes, the reference qualifiers were missing. This led to incorrect documentation being generated. Task-number: QTBUG-49862 Change-Id: I32727762826feb15a3f4f22446e51d2df16e605f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| * Haiku: Fix compilation of corelibTobias Koenig2016-01-181-1/+1
| | | | | | | | | | | | Change-Id: I8f962ac7ee85af50a573a451f54931d6c0dd67eb Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Correct floordiv() to cope with implementation-defined division.Edward Welbourne2016-01-131-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | Irrelevant once we get to C++11 (so we can revert this in 5.7), but division's rounding direction is implementation defined when either operand is negative [0]. The prior code assumed C++11's truncation (a.k.a. round towards zero), but rounding may be downwards instead. [0] http://en.cppreference.com/w/cpp/language/operator_arithmetic#Multiplicative_operators Change-Id: I2b6b27e1cf629def48b25433e81b9ed8230d8795 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * [Android]: Java uses some deprecated locale codes so account for theseAndy Shaw2016-01-131-0/+7
| | | | | | | | | | | | | | | | | | | | There are three deprecated language codes that Java still uses for the locale so we need to account for these inside QLocale by mapping them to the right language. Task-number: QTBUG-49632 Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * Don't pretend we know what DST to use for an offset date.Edward Welbourne2016-01-121-30/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QDateTime::addDate() and friends sanitize their end-state, they were using the DST status of their start-state (if known) to control it. This lead to misguided results and, in particular, inconsistent results given that a raw-constructed QDateTime comes into being ignorant of its DST, while a .toLocalTime() one knows its DST. Furthermore, the code to do this was triplicated, tricky and poorly explained. So pull it out into a local static function and explain what it's doing, and why, more clearly and only once. Task-number: QTBUG-49008 Change-Id: Ia4bb3c5e9267fff8bb963ea705267998218ed623 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| * Revert "QString: preserve embedded NULs when converting from QByteArray"Marc Mutz2016-01-121-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit e486d69133178ccce7c75cf48201ab28efb20e44. It broke too many users, even though all of them deserved to be broken. The new functionality will be provided by differently-named functions, where possible (problem: equality operators). I did not revert the fix for the off-by-one error in tst_qtextdocumentfragment.cpp. I also didn't revert the change in the inequality relational operators, since for all strings s1, s2 and s2' where s2' is s2 truncated at the first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and, trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course, since "foo\0bar" ≠ "foo". [ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All conversions from QByteArray to QString now preserve embedded NULs... Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Replace ffsll with new qCountTrailingZeroBitsTobias Koenig2016-01-191-32/+2
| | | | | | | | | | Change-Id: I44898909181e25247bf96cf4462971ac23c2a3ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Updated license headersJani Heikkinen2016-01-15153-2117/+3035
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | ARMv8: Update qHash for strings to use the CRC32 instructionErik Verbruggen2016-01-131-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | Same as the SSE4.2 implementation: use the (optional) ARMv8 crc32[bhwd] instruction to calculate hashes for strings. For Aarch64, support for the instruction is dynamically detected. For a 32bit ARM binary, dynamic detection is only done when the compiler is explicitly told to target ARMv8. When telling the compiler to target an other/older version, the crc32 code is not compiled. Change-Id: I51ebc1a4545dede4988247e75043f29a64c2a6c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | ARMv8: add crc32 feature detection.Erik Verbruggen2016-01-132-7/+63
| | | | | | | | | | Change-Id: I3cfac90dfa137d0bf3d124d87262eb2dbb56459c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/devSimon Hausmann2016-01-131-1/+1
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-121-1/+1
| |\| | | | | | | | | | Change-Id: I5839bded07e23af65ced9491c4f50242f964dd31
| | * QDate: fix calculation of the week number for the last days of 2020Thiago Macieira2016-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Off-by-one error: we should have calculated whether the current year is leap, not the next year. This affected any 53-week leap years. Task-number: QTBUG-50273 Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd Reviewed-by: Martin Klapetek <mklapetek@kde.org> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Add ability to specify precision of float/double currency stringsDan Cape2016-01-132-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new overload function that allows the developer to specify the desired precision. Until 6.0, it will require the symbol and precision to be passed to it. Once Qt is at version 6.0, it will replace the overload function that requires a value and optionally a symbol. [ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString() that allows the decimal precision to be specified. Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef Task-number: QTBUG-46595 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Allow to use QRingBuffer in containersAlex Trotsenko2016-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | Make a private member mutable to enable default assignment operator. Change-Id: I1216875c186ed800e07c6b41a5bae18c3b71b2fa Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Mark QLocale as sharedMarc Mutz2016-01-122-2/+14
|/ / | | | | | | | | | | | | | | It was already movable, so it's BC. Only needed to add nothrow member-swap and nothrow move assignment. Change-Id: Iefedb877078da8ee075eb67185eef221143ddec1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QSize: use qSwap in transpose()Anton Kudryavtsev2016-01-121-6/+2
| | | | | | | | | | | | | | ... because that's what it does. Change-Id: Ia3d4eefe2e675e4b2c2a4f01b8339ba69a40a5e9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devFrederik Gladhorn2016-01-082-16/+13
|\| | | | | | | | | | | Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
| * QString: prevent resize() from shedding capacityMarc Mutz2016-01-061-14/+5
| | | | | | | | | | | | | | | | | | | | ...even if reserve() hasn't been called before. [ChangeLog][QtCore][QString] resize() will no longer shrink the capacity. That means resize(0) now reliably preserves capacity(). Change-Id: If499a20990bbf3a20553da14e50a42918d310c9f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * Winrt: Show message when command line processing fails/usage should be shownOliver Wolff2016-01-051-2/+8
| | | | | | | | | | Change-Id: If8f69906beb22f632ccbde92aab5caf914dcb31b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | QLocale: Accept trailing junk in qstrtod()Ulf Hermann2016-01-052-8/+18
| | | | | | | | | | | | | | | | | | | | | | qstrtod() used to accept trailing junk until libdouble-conversion was introduced and we need this behavior in order to implement EcmaScript's parseFloat() correctly. The QString and QByteArray methods should not accept trailing junk, though. Task-number: QTBUG-50131 Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | [docs] Gently steer people away from QPairMarc Mutz2016-01-051-0/+12
| | | | | | | | | | | | Change-Id: Ib0fb69f856606612d516426732f619422630c93f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QtCore: eradicate all Q_FOREACH loops [tools]Marc Mutz2016-01-046-25/+24
| | | | | | | | | | | | | | | | Saves just under 5.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I6d868a7d2e469cf0564127b0e66cd7b272a0c9cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QTimeZone: replace a Q_FOREACH loop with QList::op+=Marc Mutz2015-12-311-2/+1
| | | | | | | | | | Change-Id: I6d2cede8126346f7cd4425dafc07c794c2a7bc1d Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add qHash(std::pair)Marc Mutz2015-12-302-0/+26
| | | | | | | | | | | | | | | | | | | | | | We already include <utility> in <qglobal.h>, so we might as well provide a qHash() overload for std::pair. [ChangeLog][QtCore] Added qHash(std::pair), defined in <QHashFunctions>. Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Optimize string building in QCommandLineParserPrivate::helpText()Marc Mutz2015-12-291-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't detach QCoreApplication::arguments() by calling first(), call constFirst() - Use QString foo; foo += initial; instead of QString foo = initial; where 'foo' receives more appends later (does not force an initial capacity that is known to be too small). - Use QStringBuilder more - Don't use QStringLiteral in QStringBuilder expressions - Reserve optionNameList. Its max. size is known ahead of time. - Don't create optionNameStrings for hidden options. The result was never used, they just served as placeholders for the lock-step iteration that followed and wrapped the text. - Don't create a QStringList to join(), append to the result string directly. - Cache the return value of option.valueName(). Not only is this faster, it also saves more than 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Id1d88f3c36a521ac71f3a7436810ed31319077ae Reviewed-by: David Faure <david.faure@kdab.com>
* | QTimeZone: don't iterate over QHash::keys()Marc Mutz2015-12-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | ... iterate over the hash directly. Prevents hash lookups and the creation of a temporary QList. Saves over 376b in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I7f1a22da33b94bc91bec89f62c471f8279a5d702 Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* | QString: add resize(int, QChar)Marc Mutz2015-12-282-3/+21
| | | | | | | | | | | | | | | | | | | | This will be used in QTextStream to speed up padding processing. [ChangeLog][QtCore][QString] Added resize(int, QChar) overload. Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Make use of new QHash::erase(const_iterator) overloadMarc Mutz2015-12-191-4/+4
| | | | | | | | | | | | | | | | | | | | Drive-by changes: - use auto for iterators - add Q_UNLIKELY for conditions leading to a qWarning etc Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* | QHash/QSet: add erase(const_iterator)Marc Mutz2015-12-194-14/+43
| | | | | | | | | | | | | | | | | | | | | | | | This is the signature the functions have in C++11. For the std containers, this is just convenience, but for Qt containers with their implicit sharing problem, the combination of erase() with constFind() can delay a detach until absolutely necessary. [ChangeLog][QtCore][QHash/QSet] Added erase(const_iterator). Change-Id: I2fc841c664cd7515b0f56fd7210fcd17c37f9014 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-184-9/+29
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * Clarify what time-zone "transitions" are.Edward Welbourne2015-12-091-0/+5
| | | | | | | | | | Change-Id: Idad5b841c3c693e2040ca606894187988615c9b0 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
| * Doc: Circumvented qdoc parsing by removing '!'Nico Vertriest2015-12-091-1/+1
| | | | | | | | | | | | | | | | | | Qdoc gave warning "Cannot link this to anything" Task-number: QTBUG-43810 Change-Id: Id903040ed7b2860a2ec64a52f7fbe8269c6927b0 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
| * QString: where possible, re-use existing capacity in op(QChar/QL1S)Marc Mutz2015-12-082-7/+22
| | | | | | | | | | | | | | | | | | If the LHS is detached and has existing capacity that is large enough to hold the RHS, re-use the memory instead of allocating a new buffer and throwing away the old. Change-Id: I53d42825da92c264c7301e8e771cba9fb35c321b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix constructing a QSharedPointer<const> of a QEnableSharedFromThis typeThiago Macieira2015-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It should compile, since the std::shared_ptr does. [ChangeLog][QtCore][QSharedPointer] Fixed a problem that would cause a compilation error when constructing a QSharedPointer of a const type when the type derives from QEnableSharedFromThis. Task-number: QTBUG-49748 Change-Id: I8de47ed6c7be4847b99bffff141c84f5e0b6bea8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QString: mark relational operators (and compare()) nothrowMarc Mutz2015-12-132-62/+63
| | | | | | | | | | | | | | Saves ~3K in QtCore text size on GCC 4.9 Linux AMD64 relase builds. Change-Id: I74171ba5499de200b9584660241ca1fae4bcad79 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QChar: mark remaining relational operators nothrowMarc Mutz2015-12-131-4/+4
| | | | | | | | | | | | | | | | | | | | Equality and inequality were already marked nothrow, but less/greater than (or equal) were not. Fixed. Change-Id: I3f7a3388b31fcaa2535353f357b5bd1fc86f261d Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Don't allocate memory when creating an invalid QDateTimeSérgio Martins2015-12-101-1/+3
| | | | | | | | | | | | Task-Id: QTBUG-47779 Change-Id: I5aad835c9fbf50962d64d14519ec31cf38cf9e3b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QString::vasprintf: Extract Method parse_length_modifierMarc Mutz2015-12-081-47/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and simplify it: De-duplicate ++c by moving it from every case into the switch statement, undoing it only in the default case. Introduce a small helper function can_consume() for dealing with the two-letter length modifiers. Also return the result from each case instead of storing it in a temp variable. Change-Id: I28a527920aabba067ebb2152a67995c8f2ec7ae7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2015-12-082-2/+9
|\| | | | | | | Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
| * Don't treat "/etc/localtime" in TZ env var as a valid timezone idMartin Klapetek2015-12-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | On some Debian distros, the TZ environment variable can be set to ":/etc/localtime", which libc defines as "default value". If this is set, the current QTimeZone parsing code will return "/etc/localtime" as the system timezone id, which is clearly wrong. So in that case, just unset the ianaId variable and let the other blocks look for the timezone. Change-Id: I3f5795d0a05f4974a60556387a07a1e2e1e7aa30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Doc: corrected statement about QByteArray::clearNico Vertriest2015-12-031-2/+2
| | | | | | | | | | | | Task-number: QTBUG-45096 Change-Id: I30a49044690c2f0ef5bf6ee80712e1395c60ac77 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | qCount{Leading,Trailing}ZeroBits: Use __builtin_clzs for 16-bitThiago Macieira2015-12-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If possible. The BSF/BSR/TZCNT/LZCNT Intel instruction does not exist for 8-bit. And it's a good idea to use the 32-bit instruction instead of the 16-bit one for that case, to avoid the Length Changing Prefix (LCP). GCC doesn't allow us to use __builtin_cl[tz]s unless BMI is active, while ICC generates the same code either way (Clang understands __has_builtin). Change-Id: I8de47ed6c7be4847b99bffff141c91603c7024dc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* | QEasingCurve: mark nothrow move constructible/assignable and nothrow swappableMarc Mutz2015-12-041-3/+3
| | | | | | | | | | Change-Id: Ib81e6f2278608e102ed7bfc799525777737a4e87 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Use intrinsics for GHS toolchain for CPU feature detection.Rolland Dudemaine2015-12-041-1/+26
| | | | | | | | | | | | | | | | cpuid and cpuidex are available as intrinsics, but the GNU-style assembly is needed for xgetbv. Change-Id: Ib9f280ac6b69b7ffb9c39289b52fa4af5e2de9ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>