summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Wasm: Support event loop wakeup from secondary threadsMorten Johan Sørvig2020-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | Minimal fix for the missing wakeup issue, in leu of a new event loop implementation. So far, emscripten_async_run_in_main_runtime_thread_ looks to be our option for scheduling calls on the main thread. This function is available on emsdk 1.38.22 and higher. Requires making from QEventDispatcherUNIX::wakeUp() non-final. The future event dispatcher implementation will not inherit QEventDispatcherUNIX, so this is a temporary change. Fixes: QTBUG-75793 Task-number: QTBUG-76007 Change-Id: Ie6f6ee6f7674206fc0673a4fe866ac614432ab65 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QRegularExpression: minor doc fixesGiuseppe D'Angelo2020-01-121-2/+2
| | | | | | | Amends d24a1d4323e73400ef4ecca99e03ff0f41c60389 Change-Id: I108f85b174e21ef71bf269fb9f6725972e76f107 Reviewed-by: David Faure <david.faure@kdab.com>
* QString::isLower/isUpper: redo the implementationGiuseppe D'Angelo2020-01-111-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QStringIterator rather than indexed loops. This fixes handling of non-BMP code points (which may be lower or uppercase, see the test). Change also the semantics of the functions, adopting Unicode §3.13 definitions: a string is lowercase/uppercase if it's equal to its own toLower/toUpper folding. As a side effect, empty strings are now correctly reported to be lowercase AND uppercase. [ChangeLog][Important Behavior Changes] The semantics of QString::isLower() and QString::isUpper() have been changed to match the Unicode specification. Now lowercase (resp. uppercase) strings are allowed to contain any character; a string is considered lowercase (resp. uppercase) if it's equal to its own toLower() (resp. toUpper()) folding. Previously, a non-letter character would make the string not lowercase nor uppercase, and the mere presence of an uppercase (resp. lowercase) letter would make isLower() (resp. isUpper()) return false, even if the letter wouldn't change under case folding. As a consequence, now empty strings are lowercase and uppercase. [ChangeLog][QtCore][QString] Fixed a number of bugs of QString::isLower() and QString::isUpper(). Empty strings are now correctly reported to be lowercase (resp. uppercase), and strings containing code points outside the BMP are now correctly handled. Note that the behavior of these functions has also been changed. Change-Id: Iba1398279a072399a9f21295fe75f6e414f3f813 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSystemWatcher/win: watch also for attribute changes of directoriesChristian Ehrlicher2020-01-101-0/+1
| | | | | | | | | | | | | | | | The windows filesystemwatcher did not watch for attribute changes for directories (e.g. hidden flag) so it was not in sync with other backends. Fix it by adding FILE_NOTIFY_CHANGE_ATTRIBUTES to the watch flags when watching a directory. [ChangeLog][QtCore][QFileSystemWatcher] Fixed a bug that caused QFSW not to watch for attribute changes on Windows. Now it will correctly report when files and directories become hidden or unhidden, for example. Fixes: QTBUG-80545 Change-Id: I31767a0da899963e3940b4f5b36d1d581e6aa57c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Eliminate QLocale's default_number_options global staticEdward Welbourne2020-01-091-8/+5
| | | | | | | | | | | | It had create()'s default number options when passed to create, so wasn't useful then; and otherwise shadowed the value held by the cached private for the default locale. Noticed in the course of adding an analogous global for the system locale. Drive-by - eliminated a redundant language != C check. Change-Id: I5601dc09188804c11dede5be460bfdd12b8152ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve QLocale method documentationEdward Welbourne2020-01-091-5/+25
| | | | | | | | | Add missing \sa lines, clarify what the exponential character is and mention that C is an exception to the "no number options set". Change-Id: I13ca483a07738908640408e0ca512de31586cec9 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add advance warning of change of return types coming in Qt6Edward Welbourne2020-01-092-4/+32
| | | | | | | | | | | | | | | | | | The QLocale methods that report the fragments used in making up numbers all return QChar. A note dating from before Qt5 times warned that we need to change these to return QString (since we might need a surrogate pair to represent the relevant characters). Give advance warning in the documentation that this shall happen at Qt 6. [ChangeLog][QtCore][QLocale] decimalPoint(), groupSeparator(), percent(), zeroDigit(), negativeSign(), positiveSign() and exponential() still return QChar but shall be changed to return QString in Qt 6. Callers are encouraged to switch to QString early, exploiting the QString(QChar) constructor. Task-number: QTBUG-81053 Change-Id: Ia802c7665676ecf13669c6a6f173f2e70eac578e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Change getMacLocaleName() to return a QStringEdward Welbourne2020-01-091-7/+7
| | | | | | | | | | | | Returning a QByteArray required doing a toUtf8() to a QString on one of its paths, which was promptly undone by its caller using fromUTf8(), since a QString was needed anyway. Drive-by - remove spurious default for parameter in method definition. Change-Id: I45f553d74cd0ba9dab25c439ba8291c00b7ceb5b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: Replace more 0 and NULL with nullptrAndre Hartmann2020-01-092-46/+46
| | | | | | | | ... in docs, comments, and warnings. Also adopt some occurrences around there and in the snippets. Change-Id: Icc0aa0868cadd8ec2270dda794bf83cd7ab84160 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Resolve a build error for ICC 19Inho Lee2020-01-091-2/+2
| | | | | | | This argument name makes an error with "line 302:Type t = Undefined;" Change-Id: I5488ff02ab7c9f9391c17361da5e2aac2727a6a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* ucstrncmp: Fix UBSan report of array overflowingThiago Macieira2020-01-091-4/+4
| | | | | | | | | | | | | | | The expression "a + offset + N" will eventually calculate an address past the end of a, since we are comparing to end. That's undefined behavior. Instead, calculate end - a and compare that to offset + N. This commit subtracts "a" from both sides of the inequalities and swaps the two sides to make them obey Qt coding style. Testing with GCC 9 (which is the only one I care about) shows the compiler generates the same code. Fixes: QTBUG-81218 Change-Id: Id84da383373844f3a4b0fffd15e7c1ab904daccd Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* GCC: revoke constexpr before 5.0Giuseppe D'Angelo2020-01-091-2/+5
| | | | | | | | | | | | It's causing build failures on GCC 4.9 due to our code hitting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 (at least since de82d239f814cf2a717bea0defeee3732384e271). Task-number: QTBUG-80997 Change-Id: I80a9d1fcbf26d8c0bf514ddc7bdb86eb7173360f Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix some issues of a clang-cl developer buildFriedemann Kleint2020-01-061-1/+1
| | | | | | | | | | | | | | - qeasingcurve.cpp: Add a cast, fixing: qeasingcurve.cpp(1515,25): error: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Werror,-Wmicrosoft-cast] - Disable copy and move of QMainWindowLayoutSeparatorHelper, fixing: qbasictimer.h(59,5): note: 'QBasicTimer' has been explicitly marked deprecated here QT_DEPRECATED_X("copy-construction is unsupported; use move-construction instead") Task-number: QTBUG-63512 Change-Id: I4d12a29cb1dcd68da9f9316c9e42992f218e6045 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Note that zh's "Chinese" is in fact MandarinEdward Welbourne2020-01-041-1/+1
| | | | | | | Task-number: QTBUG-63457 Change-Id: If1e36c3b2230d8c45311add26c976843eb5b3d36 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QVariant: Prefer direct conversion to QVariant{List,Map,Hash}Fabian Kosmale2020-01-031-6/+5
| | | | | | | | | | | | | | | If a type has both a converter to QVariantList and to QSequentialIterableImpl registered, we would have chosen the QSequentialIterableImpl version. In the case of types like QJSValue, this is more costly. With this change we therefore uses the direct conversion if it has been registered. The same applies to QAssociativeIterableImpl and QVariantHash/QVariantMap. Change-Id: I9c0b5068efe4bfbc5e0598a200e6db59201e9974 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix some qdoc warningsFriedemann Kleint2020-01-024-14/+6
| | | | | | | | | | | | | | | | | | | | | | src/corelib/tools/qhash.cpp:2596: (qdoc) warning: clang found diagnostics parsing \fn template <class Key, class T> template <class InputIterator> QMultiHash::QMultiHash(InputIterator begin, InputIterator end) error: 'QMultiHash' is not a class, namespace, or enumeration src/corelib/kernel/qobject.cpp:4593: (qdoc) warning: Undocumented parameter 'EXPORT_MACRO' in QObject::Q_NAMESPACE_EXPORT src/corelib/global/qfloat16.cpp:129: (qdoc) warning: Cannot tie this documentation to anything src/corelib/text/qlocale.qdoc:1204: (qdoc) warning: Overrides a previous doc src/corelib/text/qlocale.qdoc:1187: (qdoc) warning: (The previous doc is here) src/network/kernel/qhostinfo.cpp:597: (qdoc) warning: clang found diagnostics parsing \fn QHostInfo(QHostInfo &&other) src/printsupport/dialogs/qabstractprintdialog.cpp:346: (qdoc) warning: clang found diagnostics parsing \fn int QAbstractPrintDialog::exec(): error: out-of-line definition of 'exec' does not match any declaration in 'QAbstractPrintDialog' src/testlib/qsignalspy.qdoc:101: (qdoc) warning: clang found diagnostics parsing \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal): error: expected unqualified-id src/testlib/doc/src/qttest-best-practices.qdoc:28: (qdoc) warning: Can't link to 'Q_VERIFY2()' src/widgets/kernel/qactiongroup.cpp:291: (qdoc) warning: Undocumented parameter 'b' in QActionGroup::setExclusive() src/widgets/kernel/qactiongroup.cpp:305: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'minimumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'maximumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'less' in QDateTimeEdit::setTimeRange() Change-Id: I9799b5135e84c4d811674b2d114ef27315bc12df Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QLocale: Support Indian number formattingTuomas Heimonen2019-12-302-12/+36
| | | | | | | | | | | When QLocale::Country is set to QLocale::India numbers are written so that after first three from the right and then after every second will be comma. E.g. 10000000 is written as 1,00,00,000 Task-number: QTBUG-24301 Change-Id: Ic06241c127b0af1824104f94f7e2ce6e2058a070 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
* QRegularExpression: adjust the error codes matching PCRE2 10.34Giuseppe D'Angelo2019-12-281-25/+40
| | | | | | Change-Id: I78ecda1bdc784b8d7a69a4927dbe3b0f08c1d907 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QRegularExpression: improve docs about porting from QRegExpGiuseppe D'Angelo2019-12-241-0/+32
| | | | | Change-Id: Ie5d737188977b0e4dc1070c2d7329d0ecb6a9308 Reviewed-by: David Faure <david.faure@kdab.com>
* Unbreak developer build with clang-clFriedemann Kleint2019-12-201-6/+7
| | | | | | | | | | | | | | | | | | | | | Move the macro definitions for Q_DECL_UNUSED_MEMBER along with a definition for Q_DECL_UNUSED from the scope excluding icc and cl into a separate one for plain clang and cl since the attributes work with clang-cl as well. Remove the check introduced in 9782938045c33b37fe0bbb6cdf00e406cd3d837e since it is assumed that all clang versions have the attribute now. Fixes: include\QtCore/../../src/corelib/io/qloggingcategory.h(87,32): error: private field 'd' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER void *d; // reserved for future use ^ include\QtCore/../../src/corelib/io/qloggingcategory.h(108,31): error: private field 'placeholder' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER bool placeholder[4]; // reserved for future use Task-number: QTBUG-63512 Change-Id: I651771b085408443bb02e96698a980170fcaeb6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't have a "see also qrand" from qrandAlbert Astals Cid2019-12-191-1/+1
| | | | | | | I guess what we wanted there was qsrand Change-Id: I8e18e76ae65abf9de231d51faa61cc9142ea2b98 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add since versionPaul Wicking2019-12-191-0/+2
| | | | | | | | | | for QCursor::swap and QOperatingSystemVersion::currentType. Fixes: QTBUG-80854 Fixes: QTBUG-80891 Change-Id: Ia256fa0d3ad4665f44b933f5a4a8d4ee87e9fc13 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Doc: Add since Qt 5.8 info for QResource::lastModified()Leena Miettinen2019-12-181-0/+2
| | | | | | Fixes: QTBUG-80856 Change-Id: I2f2b562ad2b262c6dfa236a43589129186589ed7 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: remove documented macros which were removed in Qt5Christian Ehrlicher2019-12-171-30/+0
| | | | | | | | Remove documentation about QMIN, QMAX and QABS - they were removed during Qt4 -> 5 porting. Change-Id: I24e12e4f2bba635ff412e73dd1d0134bbab5247a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Let QItemSelectionModel::columnIntersectsSelection honor the parentChristian Ehrlicher2019-12-141-8/+9
| | | | | | | | | | | | | QItemSelectionModel::columnIntersectsSelection() should honor the parent according to the docs. For rowIntersectsSelection() this was fixed a long time ago but columnIntersectsSelection() was forgotten. Sync the both functions and use range-based for loops as a drive-by. Fixes: QTBUG-80644 Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.14.0' into 5.14Qt Forward Merge Bot2019-12-132-5/+35
|\ | | | | | | Change-Id: I03927d2ef75514e4f2633839387806125d8954f1
| * QCalendar: Optimize std::vector accessv5.14.0-rc2v5.14.0Ulf Hermann2019-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | As we assert on the size of the vector before accessing it, there is no point in using the checked at() method over operator[]. Besides, if at() throws, what are we going to do with the exception anyway. Incidentally, this also works around a compiler bug causing binary incompatibility in QtQml. Change-Id: I460e7514429daecabc304eb2c5f96ed715008b0a Fixes: QTBUG-80535 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| * Fix prefix determination for windeployqt'ed MinGW applicationsJoerg Bornemann2019-11-281-3/+11
| | | | | | | | | | | | | | | | | | | | | | We hard-coded the assumption the import lib naming scheme is always basename + ".lib" which is wrong for MinGW. This amends commit a131d610. Fixes: QTBUG-80366 Change-Id: Ibefb8a54483cc62743b8783530644b03e720262c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Fix prefix determination for windeployqt'ed applicationsJoerg Bornemann2019-11-221-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt5Core.dll of windeployqt'ed applications is right next to the executable, and the prefix is considered the directory where the application is located. QLibraryInfo of a relocatable Qt5Core.dll would return a wrong prefix (by default <app dir>/..), because it determines the prefix with QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH (by default ".."). We now detect whether the executable was windeployqt'ed by checking whether Qt5Core.dll is next to the executable. However, we must not do that for applications in QT_HOST_BINS, because they are not windeployqt'ed and must still use the standard prefix. We detect this case by checking whether for Qt5Core.dll exists a corresponding Qt5Core.lib in the libdir below the detected prefix. Fixes: QTBUG-79318 Change-Id: I1c9b971b282c6b9b19a93f1819ba8aee74be5be4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | qSwap: suppress pedantic warning about noexcept being falseThiago Macieira2019-12-121-0/+6
| | | | | | | | | | | | | | | | | | | | This warning is not in -Wall or -Wextra, but it happens in a single place, so we can reasonably suppress it. Fixes: QTBUG-79138 Change-Id: Ib5d667bf77a740c28d2efffd15ccb3f62cf8f431 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Doc: Fix qdoc compilation errors qtbaseNico Vertriest2019-12-126-76/+150
| | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | QVariant: introduce ShouldDeleteVariantData flagFabian Kosmale2019-12-112-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag is used in QSequentialIterable and QAssociativeIterable to indicate that the data pointer in VariantData should be deleted after the variant has been constructed. The use case for this is https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have a proxy iterator and cannot easily return a pointer to already owned data, as it is hard to manage its lifetime in the iterator. In contrast, it is clear that we can release the memory in the QSequentialIterable functions, as it has already been copied into the QVariant there. Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Doc: remove the claim that zero timers execute after GUI eventsThiago Macieira2019-12-101-4/+4
| | | | | | | | | | | | | | | | | | This ties our hands on what we can do in our implementations. I don't care if you've depended on this in your code. It was wrong. Fixes: QTBUG-80600 Change-Id: I568dea4813b448fe9ba6fffd15de8865a27f0a35 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Fix more mis-handling of spaces in ISO date format stringsEdward Welbourne2019-12-101-35/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO date format doesn't allow spaces within a date, although 3339 does allow a space to replace the T between date and time. Sixteen tests added to check this all failed. So clean up the handling of spaces in the parsing of ISO date-time strings. [ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires a punctuator as separator (it previously allowed any non-digit; officially only a dash should be allowed) and parsing of date-times no longer tolerates spaces in the numeric fields: an internal space is only allowed in an ISO 8601 date-time as replacement for the T between date and time. Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-1026-87/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Convert some uses of QStringRef to QStringViewEdward Welbourne2019-12-091-25/+26
| | | | | | | | | | | | | | | | | | There remain QStringRef uses where QString::splitRef() is used. Requires converting some .count()s to .size()s, as QStringView lacks count(); and some .toInt()s need to be handled by QLocale::c(). Change-Id: If9a49e063d217671ea9335a82e4bf977b7b48be0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Prefer QDate::startOfDay() over QDateTime(const QDate &)Edward Welbourne2019-12-091-1/+1
| | | | | | | | | | | | | | The latter can be invalid if midnight is skipped by a spring-forward. Change-Id: Ibf98d165557229f19622774ebf9a27bb0911c7a7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Allow lower-case for the T and Z in ISO 8601 date formatEdward Welbourne2019-12-061-4/+6
| | | | | | | | | | | | | | | | | | Cite RFC 3339 as basis for allowing a space in place of the T, too. The RFC mentions that ISO 8601 accepts t and z for T and Z, so test for them case-insensitively. Add a test for this. Change-Id: Iba700c8d74d485df154d27300aab7b1958e1ccef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix handling of trailing space at the end of an ISO date-timeEdward Welbourne2019-12-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If milliseconds were followed by a space, the space was included in the count of "digits" read as the fractional part; since we read (up to) four digits (so that we round correctly if extras are given), a harmless apce could cause scaling down by too large a power of ten. Since QString::toInt() ignores leading space, we were also allowing interior space at the start of the milliseconds, which we should not, so catch that at the same time. Added tests, including one for the rounding that's the reason for reading the extra digit, when present. Fixes: QTBUG-80445 Change-Id: I606b29a94818a101f45c8b59a0f5d1f78893d78f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QTimeZonePrivate: remove some Q_LIKELY markersEdward Welbourne2019-12-061-8/+5
| | | | | | | | | | | | | | | | | | Although the relevant conditions are indeed likely, we don't want to push the less likely branch into hard-to-load pages; they're not anomalous conditions, merely ones with lower probability. Change-Id: Icc12a921d38d8c398cd832964e9d57d7648698b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix crash when a date-time has an invalid time-zoneEdward Welbourne2019-12-062-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDateTime is a friend of QTimeZone, so can access its internals; but it must check the zone is valid before doing so. Expanded tst_QDateTime::invalid() and made it data-driven to catch the failure cases. Commented on a test-case that caught a mistake in my first attempt at this, and on QDateTimeParser's surprising reliance on a quirk of QDateTime::toMSecsSinceEpoch()'s behavior. Fixes: QTBUG-80146 Change-Id: I24856e19ff9bf402152d17d71f83be84e366faad Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | QCborValue: fix replacing of elements with byte data with ones withoutThiago Macieira2019-12-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | We forgot to reset the flags when replacing the element, so we ended up with an integer with HasByteData after: testMap[0] = QStringLiteral("value"); testMap[0] = 42; Fixes: QTBUG-80342 Change-Id: Ia2aa807ffa8a4c798425fffd15dabfa066ea84b0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Optimize qLastIndexOf<QString> to not detach the QStringDavid Faure2019-12-051-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The call to data() on a non-const QString led to a detach(), which is unexpected and unwanted from QString::lastIndexOf() const. Found by looking at why QFileSystemEntry::fileName() was expensive, in the hotspot profiler. The solution is to instanciate QLastIndexOf with QStringView() rather than QString(). I added a deleted QString overload to make sure nobody ever instanciates it with a QString argument again. Change-Id: I06a1b2f937425e83f0779eb215e099aef78c50a7 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QMacTimeZonePrivate: use .member rather than [- member] notationEdward Welbourne2019-12-031-12/+11
| | | | | | | | | | | | | | | | Apparently this is our preferred style for Objective C member references. Change-Id: I8b2bbaabadbea2cfa74f209372e77cee79e3c895 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Make QMacTimeZonePrivate default constructor more efficientEdward Welbourne2019-12-031-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | Inline systemTimeZoneId() in it to save the need for init(). We thus save the lookup by name for a time-zone object, when that object is what we took the name from anyway. Do some minor tidy-up in the other constructors and add an assert to systemTimeZoneId() to match the new one in the default constructor. Change-Id: Ib70acf31bdb4a4fa1306eebd1fd5f00ad6b89bcc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Relocate a comment that had become detached from its codeEdward Welbourne2019-12-031-7/+5
| | | | | | | | | | | | | | | | Two little tool functions had come between it and the function it actually describes. Change-Id: Ib49d1623833275ea79c7916fece29aed9503aa40 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Fix serializing QUuid with QDataStream with Qt 4 stream versionsJoni Poikelin2019-12-031-2/+2
| | | | | | | | | | | | | | Fixes: QTBUG-76103 Change-Id: Iac92c33539940f5f67d014db5240c6dc14bfb772 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Silence intel compiler warning about float comparisonOlivier Goffart2019-11-283-0/+3
| | | | | | | | | | | | | | | | Add the equivalent intel warning macro in public header where there was already the macro for -Wfloat-equal Change-Id: I8f20400f0b95c8f3857fa7a0a33464c8c34d5c0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Work around macOS's inconsistency in naming of India's time-zoneEdward Welbourne2019-11-281-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | macOS fails to create a zone for the name its own systemTimeZone claims to have (see new comment). So make sure we do consistently recognize the name systemTimeZoneId() returns, using systemTimeZone from which we got its name. Add minimal testing of system time-zone. Fixes: QTBUG-80173 Change-Id: I42f21efbd7c439158fee954d555414bb180e7f8f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Fix mis-guided init() in default QAndroidTimeZonePrivate constructorEdward Welbourne2019-11-271-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | It set the time-zone member sensibly to the default zone, but then called init("UTC"), which over-wrote that default with UTC. This had no visible effect (as the default-constructed object is only used to access methods that (though virtual) are effectively static), but was needlessly complicated. Tidied up systemTimeZoneId() at the same time. Change-Id: I897aff16855c28487a1029bef50c75ebc1ff5b55 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>