summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* QtCore: eradicate all Q_FOREACH loops [tools]Marc Mutz2016-01-046-25/+24
| | | | | | | | Saves just under 5.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I6d868a7d2e469cf0564127b0e66cd7b272a0c9cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: replace a QStack<QString> with std::stack<QString, QStringList>Marc Mutz2016-01-041-6/+6
| | | | | | | | | | | | | | A QStringList is almost as efficient as a QVector<QString>. More importantly, the QStringList case can share code with the myriad of other QStringList users, in particular because std::stack is but the thinnest of wrappers around its underlying container. Saves 1400b in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: If37ed55802aa8a529ca772df465990ded0aaba7f Reviewed-by: David Faure <david.faure@kdab.com>
* QMimeAllGlobPatterns: optimize string handling in matchingGlobs()Marc Mutz2016-01-041-1/+2
| | | | | | | ... by not re-creating the same string in every loop iteration. Change-Id: If17c5980bec8276b531267b309578dac8901c93e Reviewed-by: David Faure <david.faure@kdab.com>
* Make ephemeral server key availableSebastian Lösch2016-01-046-0/+68
| | | | | | | | | | | | | | When using cipher algorithms with forward secrecy an ephemeral key is used to generate the symmetric session key. Beside the SSL certificate's key, this ephemeral key is of cryptographic interest. The ephemeral key is chosen by the server side - currently statically in the Qt implementation - so it is only of interest on the client side to check it. Therefore the ephemeral key is the null key if the connection is set up in server mode or a cipher without forward secrecy is used. Change-Id: If241247dbb8490a91233ae47f2b38952c6591bf4 Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
* Remove Windows-specific handling of the write notifiers on socketsAlex Trotsenko2016-01-041-14/+2
| | | | | | | | | | There is no need in special OS dependent code now, because the socket notifiers got the identical behavior on all platforms. Change-Id: I53ee51cd5eeff328e0b73f7325d2c9e883c5b213 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Print correct OS name if it is a server versionAndré Klitzing2016-01-041-7/+11
| | | | | | | https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833%28v=vs.85%29.aspx Change-Id: I7ee4c78959696ee2b662899a6a1408cfd1ebcacd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Print out "Service Pack" version of underlying WindowsAndré Klitzing2016-01-041-7/+27
| | | | | | Change-Id: I1f7dbf8f1244e8b7bf2f459fdce381838d776dbe Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QtCore: eradicate all Q_FOREACH loops [io]Marc Mutz2016-01-049-20/+19
| | | | | | | | Saves more than 1KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I1a974e903bc8352af800fa26edae0194c1e51705 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWindowsFileSystemWatcher: increase concurrency when canceling threadsMarc Mutz2016-01-041-3/+3
| | | | | | | | | | | | | | | | | | | | | The old code asked each thread to stop, and then waited for that one thread to finish before deleting it and turning to the next thread in line. Split the three actions, ie. first ask all threads to stop, then wait for all threads to finish, and only then delete all of them. Apart from being more icache-friendly, this enables more concurrency, as stopped threads' cleanup work can overlap with other's, thus reducing the wait() time per thread to potentially zero. Did not replicate the inefficient foreach loop, but went with C++11 range-fors directly. Change-Id: I53e598e31999a772c0f81ff5885490216e13d492 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtCore: eradicate all Q_FOREACH loops [itemmodels]Marc Mutz2016-01-045-9/+10
| | | | | | | | Saves more than 4KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Ice3fe915622a399d1ed10e0ce364cf54b4b835fe Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: eradicate all Q_FOREACH loops [statemachine]Marc Mutz2016-01-041-22/+25
| | | | | | | | Saves a bit over 2.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I18a635d65a3c20c4bf5ec2cbfa4ed81a8153cab3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: eradicate all Q_FOREACH loops [threads, plugins]Marc Mutz2016-01-045-7/+8
| | | | | | | | | Saves just shy of 4KiB in text size on optimized GCC 4.9 Linux AMD64 builds, iow: ~0.07% of the total QtCore library size. Change-Id: I87fdcc8ee25c6bb5dabddb9a694ab4496b1538fa Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtCore: eradicate all Q_FOREACH loops [mimetypes]Marc Mutz2016-01-045-25/+24
| | | | | | | | | Saves just shy of 6KiB in text size on optimized GCC 4.9 Linux AMD64 builds, iow: ~0.1% of the total QtCore library size. Change-Id: I087e1e34a64944affb1211e16371e314012c4b2c Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtOpenGL: eradicate all remaining Q_FOREACH loopsMarc Mutz2016-01-041-3/+3
| | | | | | | | | Not many left. Still 344b saved in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I51ba49fe065854f84e26d25d7da5e26427ea2c0b Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QLineEdit: de-inline effective*TextMargin()Marc Mutz2016-01-042-21/+22
| | | | | | | | Saves 327b in text size, but done mainly because such functions shouldn't be inline in the first place. Change-Id: Ieea97f13620e4411dc01cb0d390bd668c13cfa7a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add qAsConstMarc Mutz2016-01-041-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...to turn mutable lvalues into const lvalues. Like the proposed std::as_const, it should not apply to rvalues to avoid lifetime issues in code like for (auto x : qAsConst(someFunc())) // dangling At a more basic level, qAsConst isn't useful for rvalues, because one can always store them in an lvalue first, with no loss in performance (the object is created by the compiler silently anyway). So the correct way to write the above is: const auto funcResult = someFunc(); for (auto e : funcResult) To fail compilation when passing rvalues, I used the const-&& pattern also employed by std::cref(), and the proposed std::as_const. Intended as internal API, but not put into the QtPrivate namespace to make it simpler to use. We could wait for std::as_const, but that is far, far away (just entered the current C++17 draft as of this writing), and the Qt containers with their tendency to detach are a problem _now_. Change-Id: I8824a59d2274de5c5cd642f117212322e4648025 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* qmutex_unix: use a semaphore when availableOlivier Goffart2016-01-042-3/+56
| | | | | | | It makes tst_QMutex::contendedQMutex with no msleep 8 times faster Change-Id: Ic300e7618b4467e4e08b30f0213bd23c06d4d90a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlQuery: remove misleading commentMarc Mutz2016-01-041-1/+0
| | | | | | | The 'itemList' is a QList and is not maintained in sorted order. Change-Id: I8f221281803ff0e9caa054007bee3058214f2f30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTranslator: Extract Method is_readable_file from find_translation()Marc Mutz2016-01-041-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code re-used a QFileInfo object, repeatedly setting new file names with QFileInfo::setFile(QString). But QFileInfo::setFile() simply assigns itself a new QFileInfo object: *this = QFileInfo(...) so it's just as efficient to re-create a new QFIleInfo object for every file name under test. To avoid extra {} for object lifetime scoping, factor the repeated evaluation of isReadable() && isFile() into a small helper function, which also creates and destroys the QFileInfo object. The deeper significance of this change is that it avoids implicit sharing of 'realname', which is permanently modified. A later patch will make changes that make 'realname' re-use its capacity through the lifetime of the find_translation() function, and sharing the variable implicitly will nip any auch attempts in the bud. Force the compiler to not inline the new function. There's really no point in spending ~0.5KiB in text size on inlining the code; the miniscule speed improvement is dwarfed by the memory allocation of the QFileInfo ctor, anyway. As a consequence, this change even saves 96b in text size on optimized GCC 4.9 Linux AMD64 builds, even though that wasn't even the goal. Change-Id: I08c5cbb7b6f1ba59440a1597e28d962ce63a7c65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDBusArgument: remove useless op<< overloadsMarc Mutz2016-01-031-31/+0
| | | | | | | | | | | | | | | | ... and remove misleading comments (these are overloads, not specializations). The QList overloads do nothing different from the generic container overloads. Remove them. Only leave the QVariantList overload, because that converts to QDBusVariant before serializing. Which means that this should probably be templated on the container type, otherwise you get different behavior for QList<QVariant> and, say, QVector<QVariant>, which is surely wrong. Change-Id: I215ba9891235b51304c2ed4041d3dbd003d69581 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUnixPrintWidget: fix some poor uses of the QComboBox APIMarc Mutz2016-01-021-15/+10
| | | | | | | | | | | | | | - populate the widget with addItems(QStringList) instead of looping over addItem(QString) - Use findText() instead of looping over itemText(int). QComboBox::findText() delegates searching to the model (via QAbstractItemModel::match()), so is potentially much faster. I say potentially, because match() isn't properly reimplemented in most models, yet. But that is something to fix in the models. Change-Id: I6e52cf5af810ab7869c0270504a241868a5ca281 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QFileDialog: optimize string handling in qt_tildeExpansionMarc Mutz2016-01-012-41/+43
| | | | | | | | | | | | | | | | | | | | | | | - Instead of QString::split()-ing the path, just to inspect the first item in the list returned, simply find the location of the first separator and work with that. -> saves creating a QList, and its QString elements -> saves attempted detaches of that list when calling first() - When extracting the user name, don't do it in a QString, do it in a QStringRef. - When constructing the result, don't use QString::replace(), use QStringBuilder with a QStringRef into the original string. - Eradicate the out parameter, it is easily calculated from the return value. - Don't calculate userName on VXWORKS and INTEGRITY, where it is not used. Requires a different #ifdef sequence. Fixed preprocessor directives' indention as a drive-by. Costs 84b in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I61f1e8d558db7fb0c5c1170bdfd6f5ac1f1a9e62 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QHeaderView - fix broken stretchLastSectionThorbjørn Martsum2016-01-013-16/+242
| | | | | | | | | | | | | | | | | | | | | | | | | In setStretchLastSection we restore a default section size if we no longer use stretch. That size was however not sufficient - we should restore the actual size. Furthermore we should also always stretch the last section (last visible index) - and not leave a section with a huge size and stretch another. This patch refactors stretch handling and keeps track of the last section and its size in eg. moveSection, swapSection, hideSection, showSection etc. There is an auto test showing and guarding its behavior. [ChangeLog][QtWidgets][QHeaderView] Fixed some issues (e.g QTBUG-39010) with restoring of section size after a section is no longer the last visible section (in stretchLastSection mode). Task-number: QTBUG-39010 Change-Id: Id47075b5a9dfeb250027374ecbd10eb8babbf9ef Reviewed-by: David Faure <david.faure@kdab.com>
* QStateMachine: replace a Q_FOREACH with QSet::op-=Marc Mutz2015-12-311-2/+1
| | | | | | | | | | | | | Both 'configuration' and 'pendingErrorStates' are QSet<QAbstractState*>, so we can use QSet::operator-= to subtract one from the other. No need to loop over QSet::remove() here. Nevermind that QSet::operator-= is really poorly implemented atm. That needs to be fixed in QSet. Change-Id: I3f3172ce9a485c4c2abf7d19b831fb0dc1ea61b1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QAbstractModelPrivate: de-inline functionsMarc Mutz2015-12-312-23/+34
| | | | | | | These functions have no business being inline. Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QTimeZone: replace a Q_FOREACH loop with QList::op+=Marc Mutz2015-12-311-2/+1
| | | | | Change-Id: I6d2cede8126346f7cd4425dafc07c794c2a7bc1d Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QPlatformTheme: Resync StandardPixmap with QStyle::StandardPixmapFrank Richter2015-12-311-0/+1
| | | | | Change-Id: I17a91c378175dbbe8066bccb94cc93f0a1fd3d71 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* QtXml: replace a QStack<QString> with std::stack<QString, QStringList>Marc Mutz2015-12-312-17/+32
| | | | | | | | | | | | | | A QStringList is almost as efficient as a QVector<QString>. More importantly, the QStringList case can share code with the myriad of other QStringList users, in particular because std::stack is but the thinnest of wrappers around its underlying container. Saves more than 1KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Ia9c1f8b8c6d3b619f587a0cc0f662462d1b6bdc5 Reviewed-by: David Faure <david.faure@kdab.com>
* Move the QVariant declaration up in the file.Rolland Dudemaine2015-12-301-1/+1
| | | | | | | | | | | This is especially necessary for the GHS toolchain which otherwise chokes on the lack of some local definitions made by the Q_DECLARE_SHARED macro. Change-Id: Ie4e355226e4a66e1589e1d422d3a622b11bd9aef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* QUrlQuery: fix a very expensive always-true checkMarc Mutz2015-12-301-1/+1
| | | | | | | | | | | | | In a non-const function, if (d), d being a QSharedDataPointer, will resolve to if(d.data()), which detaches and returns a pointer to an unshared copy of the data. Thus, the test if (d) is always true. Fix by explicit use of constData(), as in other QUrlQuery functions. Change-Id: Ib926abdcdb069d69e34c3202c4cf451b7fc6a329 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* moc: replace a QStack<QByteArray> with std::stack<QByteArray, QByteArrayList>Marc Mutz2015-12-301-2/+3
| | | | | | | | | | | | | | | | A QByteArrayList is almost as efficient as a QVector<QByteArray>. More importantly, the QByteArrayList case can share code with the myriad of other QByteArrayList users, in particular because std::stack is but the thinnest of wrappers around its underlying container. For moc, saves almost 1KiB in text size on optimized GCC 4.9 Linux AMD64 builds. For qdbuscpp2xml, which re-uses moc code, saves ~1.6KiB. Change-Id: I861e92b3c79e47e0ce892ccf54c9041182aaf212 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QComboBox: use NRVO from QAIM::match() and prevent a detach attemptMarc Mutz2015-12-301-2/+1
| | | | | | | | | | | | Receiving the QStringList return value through RVO instead of move-assigning it saves 48b in text size on optimized GCC 4.9 Linux AMD 64 builds. Marking the QStringList const saves another 112b because the following first() doesn't need to attempt a detach. Change-Id: If6f25399e80de12114ce41c557bff6ee8c24938b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add qHash(std::pair)Marc Mutz2015-12-303-0/+42
| | | | | | | | | | | We already include <utility> in <qglobal.h>, so we might as well provide a qHash() overload for std::pair. [ChangeLog][QtCore] Added qHash(std::pair), defined in <QHashFunctions>. Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Optimize string building in QCommandLineParserPrivate::helpText()Marc Mutz2015-12-291-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't detach QCoreApplication::arguments() by calling first(), call constFirst() - Use QString foo; foo += initial; instead of QString foo = initial; where 'foo' receives more appends later (does not force an initial capacity that is known to be too small). - Use QStringBuilder more - Don't use QStringLiteral in QStringBuilder expressions - Reserve optionNameList. Its max. size is known ahead of time. - Don't create optionNameStrings for hidden options. The result was never used, they just served as placeholders for the lock-step iteration that followed and wrapped the text. - Don't create a QStringList to join(), append to the result string directly. - Cache the return value of option.valueName(). Not only is this faster, it also saves more than 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Id1d88f3c36a521ac71f3a7436810ed31319077ae Reviewed-by: David Faure <david.faure@kdab.com>
* QTimeZone: don't iterate over QHash::keys()Marc Mutz2015-12-291-3/+3
| | | | | | | | | | | | ... iterate over the hash directly. Prevents hash lookups and the creation of a temporary QList. Saves over 376b in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I7f1a22da33b94bc91bec89f62c471f8279a5d702 Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* QMimeDatabase: return a sorted list from d->mimeTypesForFileName()Marc Mutz2015-12-291-4/+2
| | | | | | | | | | | | All but one of the callers sorted the list in at least one code path, with code paths that use the list unsorted looking suspiciously non-deterministic. The one caller that doesn't sort the list doesn't use it at all (but uses the out parameter, which none of the other callers do, suggesting that the function be split into two at some point). Change-Id: I178c1476919e4877ef4f4a3cc8934dbd04bd7a58 Reviewed-by: David Faure <david.faure@kdab.com>
* QLoggingRegistry: don't iterate over QHash::keys()Marc Mutz2015-12-281-4/+4
| | | | | | | | | | | ... but use the new key_iterators instead. Saves creating a temporary QList just to iterate over it and ~1.3KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Id5223fc5fcb4a4e7c012718c1bb2674b8ea0439d Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* QTextStream: use new QString::resize(int, QChar) for paddingMarc Mutz2015-12-282-20/+26
| | | | | Change-Id: I17c90ea32614c45f038f5f3386749dfa74bad438 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QString: add resize(int, QChar)Marc Mutz2015-12-284-4/+39
| | | | | | | | | | This will be used in QTextStream to speed up padding processing. [ChangeLog][QtCore][QString] Added resize(int, QChar) overload. Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QDBusIntegrator: fix quadratic behaviorMarc Mutz2015-12-271-8/+7
| | | | | | | | | | Calling QVector::erase(it) in a loop consitutes quadratic behavior (O(N) function called O(N) times). Fix by using std::remove_if(), which is linear. Change-Id: I39c11231d604bc2d9506427bc3411b71d71b5569 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix double close.Frank Meerkoetter2015-12-261-3/+1
| | | | | | | | resetTty() already does close the fd. Fixes coverity CID89074. Change-Id: I2d5fe9bf40b03ed5c249713c64f1dc2ae58ea84b Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QGLShaderProgram: replace a Q_FOREACH with qDeleteAll()Marc Mutz2015-12-261-4/+2
| | | | | | Change-Id: I81a7a3accdcbd3229aeb1dc6fcda5b4ae5cd1a7b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QGLShaderProgram: hoist some constant expressions out of a loopMarc Mutz2015-12-261-5/+6
| | | | | | | | | | | d->programGuard and its ID don't change when calling a GL function, so check them only once, before entering the loop, instead of once per iteration. Cache d->programGuard->id(). Change-Id: I398da7a76823b2eb854b7b9d5af512adf9969fc9 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QCommonStyle: Multiple icon sizes for more Windows stock iconsFrank Richter2015-12-241-7/+5
| | | | | Change-Id: I842270b922e019bdef0bb65efaf4a08db10c511e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QWindowsTheme: Preferably obtain stock pixmaps via SHGetStockIconInfoFrank Richter2015-12-241-12/+41
| | | | | Change-Id: I5dd958ce572a34f5ccf0d9df2a93486cc68c527b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QtPrintSupport: eradicate all Q_FOREACH loopsMarc Mutz2015-12-236-16/+21
| | | | | | | | Saves more than 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds, iow: ~0.5% of the total library size. Change-Id: I84e1dc208da13eefdf1573c9b7ac7c9d76a7f5c7 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QGraphicsView: replace some Q_FOREACH loops over const locals with C++11 ↵Marc Mutz2015-12-233-19/+19
| | | | | | | | | | | | | | | | | | | | | range-for This needs to be handled a bit carefully, because Qt containers will detach upon being iterated over using range-for. In the cases of this patch, that cannot happen, because all containers are local and marked as const (either by this patch or before). Separate patches will deal with other situations. Range-for loops are much more efficient than foreach loops. This patch shaves ~1.8KiB of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I5c58658937ac4323594161bf94a2fce3c5667914 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QGraphicsView: replace some Q_FOREACH loops over rvalues with C++11 range-forMarc Mutz2015-12-236-45/+78
| | | | | | | | | | | | | | | | | | | | | This needs to be handled a bit carefully, because Qt containers will detach upon being iterated over using range-for. In the cases of this patch, that trivially cannot happen, because all containers are marked as const when being assigned the rvalues previously found on the rhs of the Q_FOREACH. The new code thus does exactly what the old code did: take a const copy, then iterate over it. Separate patches will deal with other situations. Range-for loops are much more efficient than foreach loops. This patch shaves almost 4K of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: Ida868b77d078cbfa0516d17e98e6f0a86fcdb7a3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* tst_collections: "explicit instantiation of 'NS::QList' must occur in ↵Marc Mutz2015-12-231-0/+2
| | | | | | | | | | | namespace 'NS' Probably correct. The question is just why this code has survived for so many years. Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix resource leak/fix broken file open checkFrank Meerkoetter2015-12-221-2/+4
| | | | | | | | | | | Also marking the error path as unlikely while I am on it. Fixes coverity CID154482. Change-Id: I069fa7753e364ff1b8a4449b7008dfa8aee73de5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>