summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
* Make QDateTime's default constructor not allocate memory on 32-bitThiago Macieira2016-07-092-27/+46
| | | | | | | | | | | | | | | | | Commit fb498a651990df5e04c75a9076da28e875c43f73 introduced the short datetime optimization, but it accidentally removed the optimization from Qt 5.7 that made QDateTime's default constructor not allocate memory. Instead of bringing back the Q_GLOBAL_STATIC that was used, let's use the short date time optimization on 32-bit too. The CanBeSmall constant remains false on 32-bit systems, but judicious non-use of that constant in a few functions allows 32-bit systems to use the optimization. We still say that any date/time value is "unsmall", as there's no sense in calculating whether the date is between 1970-01-01 and July 14 of the same year. Change-Id: I413d458307aa46469b80fffd145a9db0325c08cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStringRef: add chop()Anton Kudryavtsev2016-07-072-1/+19
| | | | | | | chop() was missing in the API. Change-Id: I15af86c8f218cf159b8ce19bbeb2ffa6201f98cf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move QElapsedTimer to src/corelib/kernelThiago Macieira2016-07-027-1139/+6
| | | | | | | | | | | | It's really a kernel functionality, as it implements really low-level functionality and it's used by the event dispatcher. It was in tools/ only because QTime is. QDeadlineTimer is also coming to kernel/. Change-Id: Ifea6e497f11a461db432ffff14491c6d9b839eb0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: add some missing overloaded operator+Anton Kudryavtsev2016-06-291-0/+17
| | | | | | | | to keep compatibility with and without using QT_USE_QSTRINGBUILDER. Change-Id: If8218fe0693cdb7ad1250beb272e0e7c356bbf4a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix some qdoc-warnings for Qt 5.8.Friedemann Kleint2016-06-283-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/tools/qstring.cpp:8341: warning: Unknown command '\length' qtbase/src/corelib/tools/qstring.cpp:8354: warning: Unknown command '\length' qtbase/src/corelib/tools/qstring.cpp:8366: warning: Unknown command '\length' qtbase/src/corelib/doc/src/animation.qdoc:38: warning: Can't link to 'QAbstractAnimation::updateCurrentValue()' qtbase/src/corelib/io/qdatastream.cpp:529: warning: Undocumented enum item 'Qt_5_8' in QDataStream::Version qtbase/src/corelib/tools/qdatetime.cpp:4377: warning: No documentation for 'QDateTime::currentSecsSinceEpoch()' qtbase/src/corelib/tools/qcommandlineoption.cpp:435: warning: Undocumented parameter 'flags' in QCommandLineOption::setFlags() qtbase/src/network/ssl/qsslconfiguration.cpp:857: warning: Undocumented parameter 'dhparams' in QSslConfiguration::setDiffieHellmanParameters() qtbase/src/network/ssl/qsslconfiguration.cpp:830: warning: Undocumented parameter 'hint' in QSslConfiguration::setPreSharedKeyIdentityHint() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorUnsafeParameters' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorInvalidInputData' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'UnsafeParametersError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'NoError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'InvalidInputDataError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:105: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:129: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:208: warning: Can't link to 'clear()' qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: Undocumented parameter 'dhparam' in operator<<() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: No such parameter 'dhparm' in operator<<() qtbase/src/widgets/kernel/qapplication.cpp:999: warning: Cannot find 'QApplication::autoMaximizeThreshold' specified with '\property' in any header file Change-Id: I4ac00f0fc0dbc4d421cf7c0273635d9681962645 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Make sure all private headers in Qt Core include qglobal_p.hThiago Macieira2016-06-2517-2/+22
| | | | | | | | | | | | The rule was: - if the header included qglobal.h, turn that into qglobal_p.h - otherwise, insert the #include after the "We mean it" warning qglobal_p.h currently only includes qglobal.h. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-231-2/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/mac.conf mkspecs/features/configure_base.prf mkspecs/features/configure.prf mkspecs/macx-clang-32/qmake.conf mkspecs/macx-clang/qmake.conf mkspecs/macx-ios-clang/qmake.conf src/network/ssl/qsslsocket_openssl_symbols_p.h Change-Id: I768b592e8e589662b1fdb9b8cbd633fef26845b6
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-231-2/+0
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/angle/src/libGLESv2/libGLESv2.pro src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp Change-Id: If8da4cfe8f57fea9f78e7239f378a6302c01674e
| | * Win: Get rid of unused variables un QDateTime::currentMSecsSinceEpochThiago Macieira2016-06-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | The compiler didn't complain that they were unused or -Werror / -WX was not active. Change-Id: Ib57b52598e2f452985e9fffd145a7b63a32189fd Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* | | QDateTime: introduce {to,from,set,current}SecsSinceEpochThiago Macieira2016-06-222-19/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These new functions use a 64-bit integer in the API, instead of the broken 32-bit unsigned integer that the previous xxxTime_t functions used. That was a design flaw when the API was introduced back in Qt 4.2, so I'm deprecating the API and slating it for removal in 6.0. The changes to qfilesystemmetadata_p.h and quuid.cpp are necessary to build the bootstrap library. The rest of the adaptation to the new API will come in the next commit. [ChangeLog][QtCore][QDateTime] Introduced toSecsSinceEpoch, fromSecsSinceEpoch and setSecsSinceEpoch functions, which use 64-bit integers to represent the number of seconds. [ChangeLog][QtCore][QDateTime] The toTime_t, fromTime_t and setTime_t functions are deprecated and will be removed in Qt 6.0. For new code, use the equivalent functions with "SecsSinceEpoch" in the name, or the equivalent ones with millisecond accurancy that have existed since Qt 4.7. Change-Id: Ib57b52598e2f452985e9fffd145a355d0e7ff48d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-211-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qsysinfo.h src/corelib/kernel/qcoreapplication_win.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/plugins/platforms/windows/qwindowsglcontext.cpp src/plugins/platforms/windows/qwindowsglcontext.h Change-Id: Ib3500acc2b28553bde06758cd9a2e19eb7fe2978
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-0/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
| | * Fix warning when compiling x86 with SSE2 but no AVX2Thiago Macieira2016-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | qstring.cpp:595:13: error: unused variable ‘nullmask’ [-Werror=unused-variable] Change-Id: I1cc7601489634e96833cfffd1456474a529a79ed Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix MSVC warning about casting to pointer of different sizeThiago Macieira2016-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | qdatetime.cpp(2834): warning C4312: 'reinterpret_cast': conversion from 'int' to 'QDateTimePrivate *' of greater size Change-Id: Ib57b52598e2f452985e9fffd1458fe3ba3fcfb48 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Forward declarations for platform specific types should also be done with Q_QDOCOlivier Goffart2016-06-173-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang based qdoc need to be able to parse properly anything that is in #ifdef Q_QDOC The #if for the forward declararion now match the one in which it is used. Change-Id: Ia6cf84dd07a979b4e7aa8da764d9fb2fce74baa1 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-172-30/+6
|\| | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If899cda251b4dc8b8a7c6764520e88ab719737cd
| * | Merge "Merge remote-tracking branch 'origin/5.7.0' into 5.7" into ↵Liang Qi2016-06-161-27/+1
| |\ \ | | | | | | | | | | | | refs/staging/5.7
| | * \ Merge remote-tracking branch 'origin/5.7.0' into 5.7Liang Qi2016-06-161-27/+1
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qsimd_p.h Change-Id: I7c6bfc5873d97ad7f51a540dd9c18b9359dde59f
| | | * \ Merge remote-tracking branch 'origin/5.6.1' into 5.7.0Liang Qi2016-05-265-75/+10
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qsimd_p.h src/network/socket/qnativesocketengine_winrt.cpp Change-Id: I2765b671664c2a84839b2f88ba724fdf0c1fa7c6
| | | * | | Check for CRC32 properlyLaszlo Agocs2016-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just being on ARMv8 does not mean CRC32 (and arm_acle.h) is available. Task-number: QTBUG-53629 Change-Id: I104f643f2d59620e1f4d1ef814a1de71bb484e7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | | | QArrayDataOps: silence Clang warning about memmoveThiago Macieira2016-06-161-3/+5
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same as 9224255f13952e5b4092208c8cae1a31ab5c6a19: some Qt types are polymorphic and are marked as movable, so Clang complains. qarraydataops.h:608:27: error: destination for this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be overwritten [-Werror,-Wdynamic-class-memaccess] qarraydataops.h:608:61: error: source of this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be moved [-Werror,-Wdynamic-class-memaccess] Change-Id: Ib57b52598e2f452985e9fffd145861e025b81550 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | | | darwin: Add Foundation conversion functions for QSize/QSizeFTor Arne Vestbø2016-06-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fromCGPoint function was left out for QSize, as the foundation type is using CGFloats internally. Clients should use an explicit QSizeF::toSize() when potentially throwing away precision. Change-Id: I12d43ae0881f09ad8d79f2caaa000c3983f4ef30 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | | | darwin: Add Foundation conversion functions for QPoint/QPointFTor Arne Vestbø2016-06-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fromCGPoint function was left out for QPoint, as the foundation type is using CGFloats internally. Clients should use an explicit QPointF::toPoint() when potentially throwing away precision. Change-Id: I12a37e8f81c86b7ada56066cc18ee29709cc21e3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-1315-193/+370
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * | | | Replace qAllocMore with a pair of more useful functionsThiago Macieira2016-06-095-57/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first is "exact", not "more": qCalculateBlockSize. It ensures that there's no overflow in multiplying, adding the header size or when converting back to an int. The second is the replacement for qAllocMore: it calculates the block size like the first, but increases the block size to accommodate future appends. The number of elements that fit in the block is also returned. Task-number: QTBUG-41230 Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | | x86: Fix build with BMI but no LZCNT extensionsThiago Macieira2016-06-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GCC builtins for clzs and ctzs are enabled when the x86 extension for LZCNT and TZCNT are enabled. The use of only __BMI__ in commit f5f47987ce369aa3f7553e6c0da509461a1ddf1a was incorrect. But GCC needs both BMI and LZCNT enabled to enable this builtin. Change-Id: I1cc7601489634e96833cfffd145647e9fc9f2f51 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * | | | QString: remove unnecessary copy in replace()Anton Kudryavtsev2016-06-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a copy is needed, replace_helper() takes care of that for us. Change-Id: I9e5c89cb70b2902c96062a9edaf77fedda6ddb2c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | | | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-068-119/+196
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| | * | | Merge remote-tracking branch 'origin/5.6.1' into 5.6Liang Qi2016-06-025-86/+10
| | |\ \ \ | | | | |/ | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This merge also blacklists a flaky tst_QGL::clipTest test on OpenSUSE 13.1. Conflicts: src/network/socket/qnativesocketengine_winrt.cpp tests/auto/opengl/qgl/BLACKLIST Task-number: QTBUG-53133 Change-Id: I14b431aa5a189b7dd1d3e2dfff767d15df20fde3
| | | * | Replace qUnaligned{Load,Store} with the existing q{To,From}Unalignedv5.6.1-1v5.6.1Thiago Macieira2016-05-255-86/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the Q_ALWAYS_INLINE and forcing of __builtin_memcpy to the existing functions. Change-Id: Icaa7fb2a490246bda156ffff143c137e520eea79 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * | | Compile fix: add OpenBSD define for ffsll usageRalf Nolden2016-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On OpenBSD, ffsll needs to be defined to compile. This is the same change as in commit 725a9c27021bef1ac3828a4eafc013a2f50e6f22 for NetBSD. Change-Id: I3060caa10950a9419084a12de8c88a2f98b34d07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | | Use the code we already have for parsing the transition time tooThiago Macieira2016-05-241-28/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's there and it's more efficient anyway. Change-Id: Ie9fd7afe060b4e4a8052fffd144fc40647430268 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * | | Fix parsing of tzfile(5) POSIX rule zone names with bracket quotesThiago Macieira2016-05-241-56/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX.1-2001 allows quoting a zone name so that it can contain other characters besides letters, by enclosing it in angle brackets ('<' and '>'). This hadn't been used until recently (tzdata2016b), when the Asia/Barnaul rule started using a zone name "+07" (the name variable contained the value "<+07>-7"). Thanks to Paul Eggert for reporting and investigating the root cause. Task-number: QTBUG-53071 Change-Id: Id5480807d25e49e78b79ffff1449bc410776cb66 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * | | Compile fix: add NetBSD define for ffsll usageRalf Nolden2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On NetBSD, ffsll needs to be defined to compile. The fix adds the according Q_OS_NETBSD define to the list of operating systems needing the define. Fix obtained from NetBSD port maintainer Kamil Rytarowski <n54@gmx.com> via IRC. Change-Id: I966a7b3fba43fb56e72f19f6b7f7cacc19c3c6cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | | Compile fix: convert argument to long to match parameter comparisonRalf Nolden2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC creates a warning "enumeral and non-enumeral type in conditional expression" as the types of the two arguments don't match. Fix the compile warning by converting the first argument to (long) to match the type of the second parameter. Fix confirmed to work on NetBSD and FreeBSD, obtained from Kamil Rytarowski <n54@gmx.com>, NetBSD qt ports maintainer. Change-Id: I777dd066a0a8cc8a46e34bd39b256882080a7773 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | | Compile fix: undefine types before defining themRalf Nolden2016-05-232-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On NetBSD, the types uint64_t, uint32_t and uint8_t are already defined in sys/types.h which leads to compile errors. Those types need to be properly undefined before defining them with the Qt code. Change-Id: Icd58f421619f15b899cf5c5de1cfb22a519a4e4b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | | QDateTimeParser: adapt to make good use of QStringRef.Anton Kudryavtsev2016-05-302-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid unnecessary allocations. Create QString from QStringRef only where necessary. Change-Id: I8f2a7dce51430162c84328e23ab3cc071227d6ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | | QVector: silence clang warning about memmoveShawn Rutledge2016-05-271-2/+6
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Also made a small comment fix Task-number: QTBUG-53605 Change-Id: Ica9a06fe7a70f92f2a19a6df3ffdeaf1985e2eb6 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | | darwin: Add Foundation conversion functions for QRect/QRectFTor Arne Vestbø2016-06-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fromCGRect function was left out for QRect, as the foundation type is using CGFloats internally. Clients should use an explicit QRectF::toRect() when potentially throwing away precision. Change-Id: I0d4c5c5a4e6a45ea3287e3f37a00b69b0bfdefcf Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | | | Add move constructor to QDateTimeThiago Macieira2016-06-102-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The move constructor is slightly more interesting than the copy constructor because we can reset other to a short data state on 64-bit systems. The assembly of that function is simply: mov (%rsi),%rax mov %rax,(%rdi) movq $0x1,(%rsi) retq The move-assignment operator for QDateTime was already there. There's no need for one for QDateTime::Data since it's never called. Change-Id: I06bae9392f534e45b3f1ffff144dffdd7f23b170 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Allow QDateTime to shrink back to short data mode on copyThiago Macieira2016-06-101-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We won't shrink on manipulation when we have memory allocated, but it's a good idea to create a non-shared copy if we can. It's an unlikely scenario, though, because it requires the QDateTime object to have been set to a large state then manipulated back into a small state. Change-Id: I06bae9392f534e45b3f1ffff144dfee755bafa01 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Move the QDateTime file static functions to their right placeThiago Macieira2016-06-101-178/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file has an organization, so let's follow it. This commit has no other changes besides moving code around. Change-Id: I06bae9392f534e45b3f1ffff144e0b1f6dd72622 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Long live the short QDateTime optimizationThiago Macieira2016-06-103-75/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Well, maybe not for so long: we may want to revisit it for Qt 6. At the very least, we should enlarge the size of QDateTime on 32-bit system so that they too can benefit from the optimization. With this optimization, on 64-bit systems, the most common uses of QDateTime now no longer allocate memory at all. The range is slightly reduced from 584,554,049 years to 2,283,414 years around 1970. The other drawback is that calling QDateTime::offsetFromUtc() on a localtime now needs to recalculate the offset, instead of using the cached offset. (QDateTime::toMSecsSinceEpoch() didn't use the cache). Change-Id: Id5480807d25e49e78b79ffff144a8b2c9af91814 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | QDateTimePrivate refactor: static'fy the date/time manipulatorsThiago Macieira2016-06-102-86/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit moves QDateTimePrivate functions setTimeSpec, setDateTime, getDateTime, checkValidDateTime and refreshDateTime outside the class. Like the previous commit, this is done in preparation for the "Short QDateTime Optimization" as the "msecs" field will be placed in the short data, if possible. By making them file-level static, this also improves code generation, as the compiler doesn't know whether it has to emit the class members for out-of-line use or not. Change-Id: I06bae9392f534e45b3f1ffff144df4d73cbc9184 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | QDateTimePrivate refactor: static'fy access to d->m_statusThiago Macieira2016-06-102-89/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes most accesses to the d->m_status (including d->spec() and d->setSpec() uses) to use new static functions. This is done in preparation to the "Short QDateTime Optimization" as the status byte will be kept in the short data. Change-Id: I06bae9392f534e45b3f1ffff144dbd795d03227a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Refactor & simplify QDateTime::setMSecsSinceEpochThiago Macieira2016-06-101-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I06bae9392f534e45b3f1ffff144df5ce1aa52636 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Refactor & simplify QDateTimePrivate::refreshDateTime()Thiago Macieira2016-06-101-31/+25
| | | | | | | | | | | | | | | | | | | | Change-Id: I06bae9392f534e45b3f1ffff144df51ae6159a97 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Simplify the QDateTimePrivate::setTimeSpec() functionThiago Macieira2016-06-101-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I06bae9392f534e45b3f1ffff144df36cc98b5f3f Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | QDateTime: fix the massageAdjustedDateTime differentlyThiago Macieira2016-06-101-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a macro for maybe passing an extra parameter, pass the d pointer and let the function decide what to use and what not to use. Change-Id: I06bae9392f534e45b3f1ffff144dbeb68a30cb48 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Move QDateTimePrivate::toMSecsSinceEpoch() code into QDateTimeThiago Macieira2016-06-102-35/+27
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I06bae9392f534e45b3f1ffff144dbad485814779 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>