summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
Commit message (Collapse)AuthorAgeFilesLines
* Mark the previously public qstringalgorithms.h functions privateThiago Macieira2017-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | Discussed during Qt Contributor Summit 2017. We concluded that we don't want to make these functions public, as they do not follow Qt coding style API. Specifically, qStartsWith(a, b) is not easily understood which argument is the needle and which argument is the haystack (same problem memcpy() has). Compare that to a.startsWith(b) which can clearly be read in English as a subject-verb-object sentence. This commit removes the unit tests that called compare(). Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-151-14/+23
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenu.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/widgets/styles/qstylehelper_p.h Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
| * Win: Account for when "condition expression is constant" warning occursAndy Shaw2017-08-081-14/+23
| | | | | | | | | | | | | | | | | | | | There is already some case accounting for when this warning appears with warning level 4 and Visual C++ on Windows. However it was not catching all the places it was coming from, so this extends it to cover those places too. Change-Id: I69b21440716361fda1c1ae0be0d9c17ced7f0792 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Qt containers: use std::move in take*() methodsMarc Mutz2017-05-231-3/+3
| | | | | | | | | | | | | | Move the objects out of the data structure to avoid needless copies. Change-Id: I1a69fccc431e040b229d6ea9ded0e041c208c861 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Array-backed containers: add shrink_to_fit for STL compatibilityGiuseppe D'Angelo2017-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Side note: QHash has squeeze(), but there's no shrink_to_fit on std::unordered_map. [ChangeLog][QtCore][QByteArray] Added shrink_to_fit(). [ChangeLog][QtCore][QString] Added shrink_to_fit(). [ChangeLog][QtCore][QVarLengthArray] Added shrink_to_fit(). [ChangeLog][QtCore][QVector] Added shrink_to_fit(). Change-Id: Ifd7d28c9bed70727be6308f0191a188201784f61 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add qConvertTo{Utf8,Latin1,Local8Bit,Ucs4}() and corresponding QStringView ↵Marc Mutz2017-04-071-0/+2
|/ | | | | | | | | | | | | | | | | methods Like the qt_compare_strings()/qCompareStrings() split, distinguish between the internal and exported functions. Because of the circular dependency between qstring.h and qvector.h, the inline toUcs4() function has to be in qvector.h. At some point, we need to refactor the headers so qvector.h is lower in the dependency chain than qstring.h. It's not the first time this bites. Change-Id: Ief9f3bd92c83cdd1f31c51c700f42e146916eefd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-061-0/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/widgets/widgets/qtabbar.cpp Change-Id: Iaa9daee5f7a6490d56257a3824730a35751ceb05
| * Mark to remove const from function parameters in QtCore public headersThiago Macieira2017-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some compilers are known to complain about this with a warning. GCC complains about const on return values on -Wignored-qualifiers (enabled at -Wextra), so it's not too much of a jump to assume that others do too. Besides, this is not Qt Library API policy. As maintainer for QtCore, I'm exercising my prerrogative in specifying certain unspecified parts of the coding style, like I've done for constructor initializer lists. Since all the classes involved are exported (including QVector, through derived classes), we can't remove the qualifier until Qt 6, since there are compilers known to encode the qualifier in the mangled name (suncc). I'm not introducing #ifdef to silence unknown compilers unless we get an actual complaint. Change-Id: I33850dcdb2ce4a47878efffd14a876edef843c46 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-131-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network.pro mkspecs/features/mac/default_post.prf src/corelib/io/qfilesystemengine_win.cpp src/corelib/io/qprocess.cpp src/corelib/io/qprocess.h src/corelib/io/qprocess_p.h src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/corelib/thread/qmutex.cpp src/platformsupport/fontdatabases/windows/windows.pri src/plugins/platforms/eglfs/eglfsdeviceintegration.pro tests/auto/corelib/io/io.pro Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
| * QVector: Avoid implicit conversion warningsStig Bjørlykke2017-03-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes compiling an application using QVector and -Wshorten-64-to-32 on a 64-bit system without getting this warning: ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:695:18: warning: implicit conversion loses integer precision: 'typename iterator_traits<QString *>::difference_type' (aka 'long') to 'int' [-Wshorten-64-to-32] int offset = std::distance(d->begin(), before); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:731:35: warning: implicit conversion loses integer precision: 'long' to 'const int' [-Wshorten-64-to-32] const int itemsToErase = aend - abegin; ~~~~~~~~~~~~ ~~~~~^~~~~~~~ ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:740:39: warning: implicit conversion loses integer precision: 'long' to 'const int' [-Wshorten-64-to-32] const int itemsUntouched = abegin - d->begin(); ~~~~~~~~~~~~~~ ~~~~~~~^~~~~~~~~~~~ Change-Id: I52d85908f4aac20c7e9ac8063ac760ce52f85541 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Do not use QTypeInfo::isStatic anymoreMarc Mutz2017-02-221-4/+4
|/ | | | | | | | | | | | | | | | ... except in QList. When dafa3618 introduced isRelocatable and QTypeInfoQuery, the intention was to decouple the memory layout of QList from the reallocation optimizations in QVector. This never happened, as QVector (and QVarLengthArray) continue to use isStatic to this day. Fix by porting both QVector and QVLA to QTypeInfoQuery and isRelocatable. Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Work around MSVC ABI stupidity in exporting inline members of base classThiago Macieira2017-01-031-0/+2
| | | | | | | | | | | | | In this case, the issue was ICC, when compiling QtQml: qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z) referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z) This applies the same fix as qvector.h has had for ages due to QPolygon. Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-1/+5
|\ | | | | | | | | | | | | | | Conflicts: src/widgets/itemviews/qabstractitemview.cpp src/widgets/itemviews/qabstractitemview_p.h Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
| * QVector: fix crash on reserve(0)David Faure2016-07-281-1/+5
| | | | | | | | | | | | | | | | | | | | It crashed when d was equal to Data::unsharableEmpty(). Task-number: QTBUG-51758 Change-Id: If9f2a7d11892507135f4dc0aeef909f59b7478fc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.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>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTSThiago Macieira2016-05-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C and C++ standards say it's undefined whether the preprocessor supports macros that expand to defined() will operate as an ifdef. Clang 3.9 started complaining about that fact. One solution was to change QT_SUPPORTS to check for zero or one, which means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1. The C standard says we don't need to #define to 0, as an unknown token is interpreted as zero. However, that might produce a warning (GCC with -Wundef), so changing the macro this way is not recommended. Instead, we deprecate the macro and replace the uses with #ifdef/ndef. Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-291-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qml_module.prf mkspecs/features/qt_common.prf src/gui/text/qzip.cpp src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/windows/array.h src/testlib/qtestcase.cpp src/widgets/dialogs/qfilesystemmodel.h Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
| * Silence MSVC warnings when using certain std algorithmsMarc Mutz2016-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSVC STL warns when passing naked pointers as non-bounded iterators to algorithms such as std::equal and std::copy, in an attempt to inform users that the range specified by that iterator has an implicit minimum size that the caller of the algorithm must ensure is met: warning C4996: 'std::_Equal1': Function call with parameters that may be unsafe - \ this call relies on the caller to check that the passed values are correct. To \ disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to \ use Visual C++ 'Checked Iterators' When building Qt, as well as when building user projects with qmake (cf. 0a76b6bc7f98900ea884cd10ccca1a332e5bdba5), we globally disable this warning (with -D_SCL_SECURE_NO_WARNINGS), but since we started using STL algorithms in public headers (e.g. in qvector.h), users get this warning in their own projects now, unless they, too, define said macro. But such a requirement is against the Qt policy to have headers that are warning-free as much as possible. The suggested way of fixing this warning is to wrap the naked pointer in a stdext::unchecked_array_iterator before passing it to the algorithm, cf. examples in https://msdn.microsoft.com/en-us/library/ttcz0bys%28v=vs.120%29.aspx or, together with the capacity-made-explicit, in a stdext::checked_array_iterator. To avoid ifdefs for platforms that don't have these extensions (which, incidentally, for the unchecked case, includes MSVC 2012), wrap the calls in macros. The end game here is to drop -D_SCL_SECURE_NO_WARNINGS, at least for public headers, even though this commit also adds the wrapper to implementation and private header files. An alternative to the wrapper would have been the version of std::equal that takes four iterators. However, that is a C++14 library feature, while this version of Qt still needs to compile with a C++98 compiler, and, more importantly, there isn't, and never will be, a corresponding 4-iterator version of std::copy. Task-number: QTBUG-47948 Done-with: Stephen Kelly <steveire@gmail.com> Change-Id: I1bbab257fb5f1c5042939c382a412b596112ff26 Reviewed-by: Stephen Kelly <ske@ableton.com>
* | Add an early-out to QVector::operator+= and QHash::unite for empty LHSUlf Hermann2016-04-281-16/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | If the container being added to is default constructed and has never been modified, we don't have to do all the checking and iterating. Instead we can just assign with operator=. If the LHS is merely empty, we could lose reserve()d capacity, so only do this for a shared-null LHS. Change-Id: If1e3342662d10833babc7ab847ada0285073723b Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | QVector: preserve capacity in clear()Marc Mutz2016-02-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is what std::vector implementations usually do, because it minimizes memory fragmentation and useless allocations since no user will call clear() unless she intends to append new data afterwards. Fix calls to resize(0) that show how existing code tried to work around the issue. Adjust test. Port from QVERIFY(==) to QCOMPARE as a drive-by. [ChangeLog][QtCore][QVector] clear() now preserves capacity. To shed capacity, call squeeze() or swap with a default-constructed QVector object, see the documentation for an example. Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | 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>
* QVector: prevent resize() from shedding capacityMarc Mutz2015-11-281-3/+0
| | | | | | | | | | | | | | ...even if reserve() hasn't been called before. [ChangeLog][QtCore][QVector] resize() will no longer shrink the capacity. That means resize(0) now reliably preserves capacity(). Task-number: QTBUG-39293 Done-with: Robin Burchell <robin.burchell@viroteck.net> Change-Id: Ie7e4e597126832990b6cfb83bba875c3963b143e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVector: add an rvalue overload of push_back/appendMarc Mutz2015-07-191-0/+22
| | | | | | | | | | This is low-hanging fruit, for two reasons: 1. The implementation is dead-simple (unlike, say, in QList). 2. It's completely transparent to the QVector user (unlike, say, emplace_back, which can only be used inside an ifdef). Change-Id: Iaf750100cf61ced77aa452f0e4e3c4ec36b29639 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QVector: in append(), if we take a copy, then move, not copy from the copyMarc Mutz2015-07-191-3/+3
| | | | | | | Replaces one copy ctor / assignment with a move ctor / assignment. Change-Id: I56768db9904283a9be7c87f624a557a64557bc8f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Containers: destroy previous state on move-assignment immediatelyMarc Mutz2015-07-191-1/+2
| | | | | | | | | | | | | | | | [ChangeLog][QtCore] All generic containers (with the exception of QVarLengthArray, but including QSharedPointer) destroy the previous state as part of a move-assignment now. Previously, they would dump it into the right-hand-side object. Note that this is only true for the generic containers. Other implicitly-shared types, as well as the non-generic containers QString, QByteArray, etc. still just swap the contents with the right-hand-side object when move-assigned into, and, for performance reasons, this will not change in the forseeable future. Change-Id: I1f1c684e85400b77bd2e7fba65bde2dce6c1bdde Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVector: mark const variants of begin()/end() nothrowMarc Mutz2015-07-071-16/+16
| | | | | Change-Id: Id08e692bbfedb43911ffbbfdf09aa6b68a4aa1f9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QVector move assignment to return a referenceMarc Mutz2015-07-041-1/+1
| | | | | | | | | | | | ... instead of a copy. This has been there since before Qt 5.0. A quick grep shows it's the only instance of this mistake in Qt. Change-Id: I341df34f67544b8ed719254bd57237a9599efb46 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtCore: make all Q_DECLARE_SHARED types nothrow move-assignableMarc Mutz2015-06-301-4/+3
| | | | | | | Excepting QDebug, which doesn't have value semantics. Change-Id: I43757ef7bba4c1f5b6de9144f12b38ce840cd9f9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QVector: add move(int,int) for QList compatMarc Mutz2015-06-181-0/+13
| | | | | Change-Id: I67948621313f2e7c69abe7ef95ee82ca64c6512a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QVector: add const first/last gettersGiuseppe D'Angelo2015-05-261-0/+2
| | | | | | | | | | | | Convenience to avoid annoying detaching (instead of using at()), especially on temporary vectors (returned by functions or so). [ChangeLog][QtCore][QVector] Added the convenience constFirst and constLast functions. Change-Id: If61b1f0096f6a7a1c9074340e237cc2376ce3d18 Task-number: QTBUG-46026 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-271-5/+12
|\ | | | | | | | | | | | | | | Conflicts: src/tools/qdoc/tree.cpp tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: Iaa78f601a63191fa643aabf853520f913f2f0fdc
| * QVector: Save one copy-CTOR call if we don't reallocSérgio Martins2015-04-241-5/+12
| | | | | | | | | | Change-Id: Ie0f2eb922500bc3d76852939cf2c5d28d65a43ae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add qHash(QVector)Marc Mutz2015-04-201-0/+8
| | | | | | | | | | | | | | | | | | QVectors can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtCore][QVector] Added qHash(QVector). Change-Id: I2aacce55d416abf2492631a504a02c6e8fc4ff1c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QVector: add {const_,}reverse_iterator, {c,}r{begin,end}()Marc Mutz2015-04-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QVector] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: I8dea52a08e7b1a4442e034c22b83be4d25dc2303 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QVector: add relational operators <,<=,>,>=Marc Mutz2015-04-021-0/+30
| | | | | | | | | | | | | | | | | | | | | | std::vector has them, too. [ChangeLog][QtCore][QVector] Added relational operators <, <=, >, >= if the element type supports operator<. Change-Id: I0bcb22dfcc43cb0362f17b4e06154ce18646580a Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QVector: remove brittle c2m() functionMarc Mutz2015-03-131-1/+0
|/ | | | | | | | | | | | | | | | The c2m() function converts a const_iterator into an iterator, but is a broken concept for an implicitly shared container such as QVector, because the act of calling begin() as the starting point already detaches and invalidates the c2m argument. This could be fixed in c2m, but it's too easy for a caller to cause iterator invalidation even before calling c2m, as QTBUG-44592 showed, so remove the function completely. Task-number: QTBUG-44592 Change-Id: Ibde8cd1d78a412cc9fb621f743e52f74291aff4f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
| * QVector: fix use of invalid iterators in removeAll()Marc Mutz2015-02-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The c2m() function which converts a const_iterator into an iterator is a broken concept for an implicitly shared container such as QVector, because the act of calling begin() as the starting point already detaches and invalidates the c2m argument. This could be fixed in c2m, but the bug wasn't even in c2m, but in removeAll(), which called end() before c2m, so the c2m argument was already invalidated when entering c2m. The solution is to store the positions as indices instead of iterators before calling the first detaching function. Task-number: QTBUG-44592 Change-Id: I66cf4f1277e71148a4d5b5bbfb6a3369ad02db68 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* | QtCore: mark some operations nothrowMarc Mutz2015-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add a inline QVector::append(const QVector &) overloadhjk2014-11-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is present in QList already and its lack is a nuisance when switching from QList based code to QVector (which makes sense e.g. if the item size exceeds sizeof(void*)) Also, albeit operator+=() and operator<<() exist, some people simply prefer functions with real function names. [ChangeLog][QtCore][QVector] Added QVector::append(const QVector &) overload Change-Id: I9aae8223b086765625f2f3071fab5da0780f8a43 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Do Q_CHECK_PTR on all results of QArrayData::allocate()Ulf Hermann2014-10-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | QArrayData::allocate() uses malloc() which can return 0. We need to check for that when using it inside other containers. The containers might otherwise return a seemingly valid result from some allocating operation which is actually corrupt. Task-number: QTBUG-41231 Change-Id: I16cc6035e4f495f519bd38bf29cee080ee0637f6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Prepare QVector::operator==() for sharing with QList::operator==()Marc Mutz2014-10-031-7/+4
| | | | | | | | | | | | | | | | | | | | ...by implementing it via std::equal(). This might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I1347a7f365b3d2947f19a81b95aa8d89b8ad303d Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Prepare QVector::contains() for sharing with QList::contains()Marc Mutz2014-10-031-6/+3
| | | | | | | | | | | | | | | | | | | | ...by implementing it via std::find(). This might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I86e94d63ff58332f2fa6eafb3c1baccd125a6f34 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QList: iterate forward in contains()Marc Mutz2014-10-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | After much head-scratching, we found no reason for the backwards iteration. Indeed, forward iteration should be slightly faster than backwards, because it operates in the direction in which cache-lines are filled, usually. This is in preparation of using std algorithms instead of hand-written loops. It avoids having to use std::reverse_iterator. Change-Id: Id2388eab2339c24deb93095495d87056a9c57133 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QVector: iterate forward in operator==Marc Mutz2014-10-011-5/+5
|/ | | | | | | | | | | | After much head-scratching, we found no reason for the backwards iteration. Indeed, forward iteration should be slightly faster than backwards, because it operates in the direction in which cache-lines are filled, usually. This is in preparation of using std algorithms instead of hand-written loops. It avoids having to use std::reverse_iterator. Change-Id: I180c52e0bb90e823216b77d3f49f2a3fd395567d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Micro-optimize QVector::count()Marc Mutz2014-08-281-1/+3
| | | | | | | | | | | ...by instantiating std::count() not with QVector::const_iterator, which is a class, but with const T*, thus increasing the chance that the instantiation can be shared with other instantiations in the executable. It might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I93df4e58f76838d98b565f229c19e317774b7b4c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QVector: check d for equality before d->size for inequalityMarc Mutz2014-08-281-2/+2
| | | | | | | | | | | | | | | | Assuming the CPU has already loaded 'this', the value of 'd' is just an indirect load away. The value of d->size, however, is two indirect loads away, one of which is the load of 'd'. So it makes more sense to check for d-pointer equality first, as that can proceed in parallel with the fetch for d->size, which the CPU may speculatively trigger. In addition, at least GCC in release mode after this change doesn't set up the stack frame if the d-pointer check succeeds. Change-Id: I61f9b245070dd1742fca6ccb8d4936a0b1aa7c07 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>