summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-062-2/+6
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
| * Fix build with MSVC 2015 Update 2 if constexpr is enabledThiago Macieira2017-07-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This compiler seems to require explicit initialization of all member variables in a constexpr constructor, even if they have an implicit default constructor of their own. We probably fixed the rest of Qt a couple of years ago, but not these two places because they were arrays and those require the C++11 syntax for uniform initialization. All compilers that support constexpr do support uniform initialization. MSVC 2015 fixed our issues with it on the same update. Change-Id: Ibc1eb23e3ae093f5c6928ded3a041be35eb9baae Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix parsing of 0E+1 and 0E-1 (capital 'E')Thiago Macieira2017-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | Since the result is an actual zero, this section of code looking for underflows kicks in. But we forgot to take the capital letter into account when parsing the number. Task-number: QTBUG-61350 Change-Id: Ia53158e207a94bf49489fffd14c6abbd21f0bac0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-042-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * actually make use of the detected ICUOswald Buddenhagen2017-07-021-1/+1
| | | | | | | | | | | | Task-number: QTBUG-58012 Change-Id: I7a3d99277daa6566811b24111205548b89e77c53 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Doc: Add note about fromPercentEncoding's behavior on invalid inputMårten Nordheim2017-06-291-0/+4
| | | | | | | | | | | | | | | | | | Add a note saying that invalid input to QByteArray::fromPercentEncoding and QUrl::fromPercentEncoding will produce invalid output, and provide an example. Change-Id: Icc68f59c23cf199640b646cd4a6ca8e4808a3f71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Improve rounding of QRect::toRectAllan Sandfeld Jensen2017-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | Avoid the dimensions of the rounded QRect being off by more than one pixel. This ensures the aligned containing rect also contains the rounded rect. Task-number: QTBUG-56420 Change-Id: Ib79110e51ab80de2dc83d01ea83fc5fbf3852e75 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDate::shortMonthName: remove faulty month testThiago Macieira2017-06-201-28/+20
| | | | | | | | | | | | | | | | | | | | | | | | QLocale already takes care of validating the month inputs, so no need to spend cycles and binary size for the invalid case. This commit also removes the check from QDate::longMonthName and the day name functions so that all functions remain similar. Task-number: QTBUG-61399 Change-Id: Ia53158e207a94bf49489fffd14c7bd8b121dd132 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Eliminate in/out arguments from QDateTimeParser::parse()Edward Welbourne2017-06-202-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its first two arguments were non-const references that it modified. A copy of the first was already being passed back in the returned struct; and the one caller that wanted the modified value was in fact copying this copy back over the QString it had passed in (that was thus equal already). So passing by value is fine. The second's only change was increment by a field I've just added to StateNode in refactoring parse(); so we can let the caller do that adding, instead. Change-Id: I05abb644f3e5a60f94b03292302dd1bbe996cce9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: partial break-up of long method to eliminate gotoEdward Welbourne2017-06-202-284/+290
| | | | | | | | | | | | | | | | | | | | | | | | Method parse() was very long, had an inner block purely to isolate many variables and had a clean-up block at the end to which it would goto from within that 300-line block. Split out that block as a separate function, turn goto into premature return, clean up the result. Change-Id: I63ded0c0afacf4a1972a3a62c2d81834950ab729 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Eliminate out-parameters from QDateTimeParser::parseSection()Edward Welbourne2017-06-202-107/+91
| | | | | | | | | | | | | | | | | | | | | | | | Return a struct instead. This frees parse() of an assumption that -1 is an error value and leaves one in/out argument. Made this last an actual pointer argument instead of a non-const ref. Shuffled the remaining arguments so that this in/out is last and the offset into it at which it gets modified is immediately before it. Removed a spurious qdoc comment in the process. Change-Id: I7d980e70a7711b1d706151eedce956fe2093e48e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: consolidate #if-ery around QT_NO_DATESTRINGEdward Welbourne2017-06-202-14/+8
| | | | | | | | | | | | | | | | | | | | Some private methods were conditioned on QT_NO_TEXTDATE but called (without #if-ery) by methods conditioned on QT_NO_DATESTRING; and various private methods without #if-ery were only called by methods within. Consolidate to #if methods all on QT_NO_DATESTRING. Change-Id: I1dd18037e4e7407c07041036cc5b871b7d693016 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: implement parsing of time-zone specifiersEdward Welbourne2017-06-203-31/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serialization of date-times understood time-zones (indicated by a 't' in a format string) but the parsing didn't (so viewed the 't' as a literal element in the format string, not matched by the actual zone it needs to parse), although some tests expected it to. This made round-trip testing fail. Implemented parsing of time-zones. Re-enabled the formerly failing tests. [ChangeLog][QtCore][QDateTime] Added support for parsing of time-zones. Task-number: QTBUG-22833 Change-Id: Iddba7dca14cf9399587078d4cea19f9b95a65cf7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update CLDR to v31.0.1Edward Welbourne2017-06-202-4568/+4614
| | | | | | | | | | | | | | | | | | | | The formatting of times in Norwegian has changed to use colon rather than dot between hours, minutes and seconds: http://cldr.unicode.org/index/downloads/cldr-30#TOC-Other tst_QLocale gets a matching revision. Change-Id: I35a16080def5fbadd62144a0b44be8110b9be29b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add QLocale::formattedDataSize and consolidate use casesShawn Rutledge2017-06-202-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be easier to translate sizes in bytes to human-readable strings consistently rather than having to repeat this code (and the string translations) in various places. The FileDialog in QtQuick.Controls has a use for this, too. [ChangeLog][QtCore][QLocale] Added QLocale::formattedDataSize() for formatting quantities of bytes as kB, MB, GB etc. Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I27bca146c3eba90fa7a5d52ef6626ce85723e3f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix some qdoc warnings for 5.10Friedemann Kleint2017-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix comments for QRandomGenerator. src/corelib/io/qprocess.cpp:453: warning: Cannot find 'startDetached(...)' in '\fn' bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) src/corelib/tools/qstringiterator.qdoc:122: warning: Cannot find 'QStringIterator(...)' in '\fn' QStringIterator::QStringIterator(QStringView string, QStringView::size_type idx) src/corelib/global/qrandom.cpp:902: warning: Can't link to 'QRandomGenerator' src/sql/kernel/qsqlerror.cpp:123: warning: Unknown command '\other' src/network/kernel/qhostinfo.cpp:296: warning: Unknown command '\other' src/gui/kernel/qplatformcursor.cpp:97: warning: Cannot find 'QPlatformCursor::OverrideCursor' specified with '\enum' in any header file src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkAccessManager::setRedirectsPolicy()' src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::RedirectsPolicyAttribute' Change-Id: Ibc2455b1b657716dfb6192615738dc7f924dbab3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devLiang Qi2017-06-207-8/+22
|\ \
| * | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-197-8/+22
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/windows/qwindowscontext.cpp src/plugins/platforms/windows/windows.pri src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/doc/src/widgets-and-layouts/gallery.qdoc Change-Id: I8d0834c77f350ea7540140c2c7f372814afc2d0f
| | * Add warning about missing but required CPU featuresThiago Macieira2017-06-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Useful to debug why you're getting SIGILL, like running under Valgrind: Processor features: sse3[required] sse2[required] ssse3[required] fma cmpxchg16b sse4.1[required] sse4.2[required] movbe popcnt[required] aes[required] avx[required] f16c[required] bmi[required] avx2[required] bmi2[required] !!!!!!!!!!!!!!!!!!!! !!! Missing required features: rdrand rdseed !!! Applications will likely crash with "Invalid Instruction" !!!!!!!!!!!!!!!!!!!! Change-Id: Ia3e896da908f42939148fffd14c556557419b091 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| | * macOS/iOS: Correctly ignore punctuation in QCollatorAndy Shaw2017-06-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When punctuation is ignored then the kUCCollatePunctionSignificantMask should not be set. This was originally thought to not be working due to a bug on the Apple platforms, but this is not the case. [ChangeLog][Platform Specific Changes][macOS][iOS] QCollator now respects the ignorePunctuation property on Apple based platforms correctly. Task-number: QTBUG-41978 Change-Id: I62044076387d6e4479f4aaef3c2f48f49dbd160e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * qsimd_p.h: Don't set the __xxx__ variables with Clang and GCCThiago Macieira2017-06-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 418184c2a0ad97cce12717a43f84fa6f12ece189 set some extra defines that Clang and GCC do set so that MSVC and ICC builds would properly get the features detected. But that meant we set them with Clang and GCC (technically, set them again, but to the same value so no warning was printed). Don't do that. This commit allows me to use "-march=native -mno-rdrnd" to disable the unconditional use of RDRAND instruction. That's required to valgrind any applications, as the current version (3.12) does not have support for that instruction. vex amd64->IR: unhandled instruction bytes: 0x48 0xF 0xC7 0xF0 0x48 0x8B 0x55 0xE8 0x48 0x89 vex amd64->IR: REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 ==78321== valgrind: Unrecognised instruction at address 0x4ef159c. ==78321== at 0x4EF159C: _rdrand64_step (immintrin.h:208) ==78321== by 0x4EF159C: qt_random_cpu(void*, long long) (qrandom.cpp:95) Change-Id: Ia3e896da908f42939148fffd14c6884501de4fa4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| | * Fix sending UTC-offset QTimeZones through QDataStreamChris Wilson2017-06-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTimeZone("UTC") should be valid, as "UTC" appears in the list of availableTimeZoneIds(), and tst_QTimeZone::dataStreamTest() constructs timezones like this, which are considered valid. The internal representation of a QTimeZone("UTC") as created by QTimeZone::QTimeZone(const QByteArray &ianaId) is a QUtcTimeZonePrivate which isValid(), so the containing QTimeZone isValid() too. When QTimeZone is serialized into a QDataStream, it calls tz.d->serialize(ds) which is QUtcTimeZonePrivate::serialize. This writes QStringLiteral("OffsetFromUtc") followed by the IANA ID and the offset (etc.) to the datastream. When QTimeZone is deserialized it looks for this marker string, and if present, it passed all of the parameters to the QTimeZone constructor (not just the name). However, that constructor does not support standard IANA timezones (only custom ones), and when it detects that the supplied IANA ID is actually listed in availableTimeZoneIds(), it leaves the pointer to the QTimeZonePrivate uninitialized (NULL), which leaves the QTimeZone invalid (isValid() returns false). Thus, a valid timezone which was serialized and then deserialized has become invalid. This also affects serialization of QDateTimes with timezones. Fixed by calling the name-only constructor first, which works (only) for IANA standard timezones and leaves the QTimeZone invalid (isValid() returns false) otherwise. In which case, we can call the many-argument contructor to create a custom timezone with the same offset as the one which was originally serialized. [ChangeLog][QtCore][QTimeZone] Fixed sending IANA standard UTC-offset QTimeZones through QDataStream, which previously came out invalid after deserialization. Task-number: QTBUG-60595 Change-Id: Id9c47e8bda701faae4d800e012afb6db545b2fe9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * Use the C++ [[nodiscard]] attributeThiago Macieira2017-06-072-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: I7814054a102a407d876ffffd14b6a285c70b21de Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-06-202-9/+9
|/ / | | | | | | | | | | | | | | This commit complements commit 3dcc075f4a5efce348a6fa00cf5a0adef97b1089 for Qt 5.10. Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add byte-based units to CLDR dataEdward Welbourne2017-06-132-555/+610
| | | | | | | | | | | | | | | | | | | | | | | | Scan CLDR for {,kilo,mega,giga,tera,peta,exa}byte forms and their IEC equivalents, providing SI and IEC defaults when missing (which all of IEC are) in addition to the usual numeric data. Extrapolate from any present data (e.g. French's ko, Mo, Go, To imply Po, Eo and, for IEC, Kio, Mio, etc.), since CLDR only goes up to tera. Propagate this data to QLocale's database ready for use by QLocale::formattedDataSize(). Change-Id: Ie6ee978948c68be9f71ab784a128cbfae3d80ee1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QTimeZone: make UTC offset range available for other code to reuseEdward Welbourne2017-06-133-5/+12
| | | | | | | | | | | | | | | | When QDateTimeParser learns to parse zones, it'll need to know the valid range of offsets. Change-Id: I44cd88a140ebaf6a2b98b0f9a1be0cbc7a35bae4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Tidy implementation and use of QDateTimeParser::setDigit()Edward Welbourne2017-06-131-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation did a validity check on data it then gave to constructors that repeat the validity checks; so do the construction first and use the cheaper instance isValid() methods instead. Fixed local callers (but not QDateTimeEditPrivate::stepBy, the only other caller) to actually attend to the return value; if the attempt to set a field fails, it probably means the min is too low, or max too high; and comparing the modified date-time against global min and max makes no sense if it hasn't been revised anyway. Change-Id: If4505c43c92e247445dcd10ac436b775c3ead4da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add proper detection of x86 RDRAND instructionThiago Macieira2017-06-121-5/+3
| | | | | | | | | | | | | | | | | | The instruction is "RDRAND", but the feature name, according to GCC, is RDRND, so I had to change some macros in qsimd_p.h. Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5166779137e63 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QUuid, QHttpMultipart and QHash: use QRandomGeneratorThiago Macieira2017-06-121-38/+2
| | | | | | | | | | | | | | | | | | QRandomGenerator can produce more than 31 bits of data. And it uses /dev/urandom for us on Unix, so QHash does not need to duplicate that part. Change-Id: Icd0e0d4b27cb4e5eb892fffd14b52a0d91f179eb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Reduce code duplication in writing of string data for localesEdward Welbourne2017-06-091-1/+2
| | | | | | | | | | | | | | | | | | | | Each StringData object got its own block, of common form, to output its C array; give each object a name so that we can automate this as an iteration over StringData objects. One (endonyms_data) gains a blank line that the others all had but it lacked. Change-Id: I96c014728a58343c82304c5117b474fee980d9c7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Clean up the output code for the big table of CLDR dataEdward Welbourne2017-06-081-554/+554
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include headers for all fields (several were missing). Make field widths explicit to headers can line up with content. Use the same format for the (common part of the) all-zeros line. Document and lay-out headers and format string, to make them easier to keep in sync. Make a pair of comments clearer. Re-ran the script to regenerate the table: the result is best viewed with git show -w, to ignore the spacing changes (or git show -b to notice only the one harmless discrepancy exposed in old all-zeros data). Aside from spacing, locale_data[] has gained some missing columns in its header comment, which now lines headings up properly above actual data. Change-Id: I44242f38391353f2ec8e144cb7e8b54b0a359341 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Made the "do not edit generated code" notice clearerEdward Welbourne2017-06-082-3/+5
| | | | | | | | | | | | | | | | | | Say where to find the scripts and make clear what to update to get changes. Change-Id: I424b7fdf846f7141c6df81eef90eb1ca0378bcf8 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Use python more competently in CLDR/qLocaleXML scriptsEdward Welbourne2017-06-082-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the python2 dependency explicit (sooner or later, python3 shall be the default /bin/env python), make time-zone script executable (it had a shebang). Use triple-quoted strings, or single quotes, to avoid extra backslashes, remove some simply spurious backslashes. Use generators rather than map or filter with lambdas and iterate rather than duplicating code. Clarify some comments. Regenerated headers: this upates the date of generation, cuts back a double-blank-line to single and skips a spurious trailing comma-newline on an array's data. Change-Id: I54439f0dec132865991fe5147d509cea0f9419a0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-073-30/+53
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmenu.cpp Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
| * Disable bogus GCC 7 warning about string op overflowThiago Macieira2017-06-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | Analysis proves this is a false positive: qarraydataops.h:69:17: error: ‘void* memset(void*, int, size_t)’: specified size between 18446744056529682436 and 18446744065119617024 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] Change-Id: I7814054a102a407d876ffffd14b6ab0be9e222fc Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QStringLiteral/QByteArrayLiteral: fix/add documentationGiuseppe D'Angelo2017-06-012-30/+47
| | | | | | | | | | | | | | | | | | Various editorial fixes. Also, in 5.9 QStringLiteral does not fall back to fromUtf8 any longer, but guarantees a compile-time construction. Change-Id: Ida4698cf8e32a6e3de97b2c16b997fc9630c9db9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QScopedArrayPointer: document the most important ctorMarc Mutz2017-06-062-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | The ctor that everyone would want to use was marked as \internal, probably because of the SFINAE expression appearing in its signature. Move the SFINAE to the template argument list, which QDoc hides from the user, and drop the \internal. While at it, drop the home-grown std::is_same re-implementation and use the real deal. Change-Id: Ia357fe65f94e10ac9eeccb3490aa8b3e68114cbb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-291-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/win32-g++/qmake.conf mkspecs/win32-icc/qmake.conf src/platformsupport/fontdatabases/mac/coretext.pri src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
| * Doc: fix grammar in QScopedPointer's detailed descriptionMitch Curtis2017-05-231-1/+1
| | | | | | | | | | Change-Id: I3ce9650d62f3b53683c6b6f210c1413e94ae006c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Qt containers: use std::move in take*() methodsMarc Mutz2017-05-235-10/+10
| | | | | | | | | | | | | | Move the objects out of the data structure to avoid needless copies. Change-Id: I1a69fccc431e040b229d6ea9ded0e041c208c861 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QDateTimeParser: pass down an actual current value where expectedEdward Welbourne2017-05-221-1/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Method parse() was passing down its default value argument to various methods that expected an argument reflecting what's been parsed thus far. Pass them what they expected ! Most are fairly insensitive to the details at present, but the zone parsing I intend to add needs to know the right date to compute its offset. This makes it necessary to work out a sensible date and time to use, from the fragments seen so far, using the default value to fill in gaps but deviating from it wherever it conflicts with the actual values seen. Change-Id: I76750fcd92c1bdcad15c7dd4d8002cb90cec94ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QStringView/QLatin1String: add trimmed()Marc Mutz2017-05-165-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've been using for all other out-of-line string-view member functions to avoid forcing string-view objects onto the stack for the passing of 'this'. In the test, had to fix nullness not being propagated from a QByteArray to the QLatin1String constructed from it. Probably worth fixing in QLatin1String(QByteArray), too. [ChangeLog][QtCore] Added qTrimmed() free functions. [ChangeLog][QtCore][QLatin1String] Added trimmed() function. Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QLatin1String: add constructor from pointer pairMarc Mutz2017-05-162-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This is often more natural than (ptr, len), and I need it in the implementation of QLatin1String::trimmed(). [ChangeLog][QtCore][QLatin1String] Added a constructor taking two pointers, complementing the constructor that takes a pointer and a length. Change-Id: I0606fa0e3f820af1c3c1e261a340e5a941443e4f Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QStringView: add constructor from pointer pairMarc Mutz2017-05-162-0/+24
| | | | | | | | | | | | | | | | | | This is often more natural than (ptr, len), and I need it in the implementation of QStringView::trimmed(). Change-Id: I1d99b5ddaf76eee0582150b0233ef6ce9c37d25d Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Move Q_REQUIRED_RESULT to first in line in qstringalgorithms.hMarc Mutz2017-05-161-8/+8
| | | | | | | | | | | | | | | | Necessary to support C++17's [[nodiscard]] attribute, which needs to be placed at the beginning of a function declaration. Change-Id: I31494d13c7be558e86378782ab8684ef2956730b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-079-16/+43
|\| | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * Prevent 2 unnecessary QString allocations for QString::number(0u)Erik Verbruggen2017-05-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | QLocaleData::unsLongLongToString uses qulltoa, which will allocate a zero-length QArrayData. Then with padding a single 0 was put in a QString, which gets prepended to the result. By taking care of this special case, we can now also fast-path the common case where base=10 and no flags nor precision was provided. Change-Id: Ia893b0ea4c77634c24e7cef5aafb06d0ef44c507 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QHash/QMultiHash: fix operator==Giuseppe D'Angelo2017-05-051-10/+18
| | | | | | | | | | | | | | | | | | | | | | The existing QHash::operator== does not work when the same keys appear in different order between the two hashes being compared. However, relying on iteration order on a QHash is (as usual) a bad idea and one should never do it. Task-number: QTBUG-60395 Change-Id: Ifb39a6779230e26bbd6fdba82ccc0247b9cdc6ed Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * QtCore: include mocsThiago Macieira2017-05-054-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * [doc] QSet: fix return type of insert()Marc Mutz2017-05-031-1/+1
| | | | | | | | | | | | | | It's an iterator, not a const_iterator. Let QDoc figure out the correct one. Change-Id: I7ddd1568adbf811b801c170794465ba14ceed05e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>