Remove qSort usages from declarative
QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I8fa7d0186cc8f0ba562695974829e37f1eb87f2f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
c1821de0e6
commit
4df73e62a7
|
@ -48,6 +48,8 @@
|
|||
#include <private/qv4regexpobject_p.h>
|
||||
#include <private/qv4unwindhelper_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QV4 {
|
||||
|
@ -137,7 +139,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
|
|||
#if 0
|
||||
runtimeFunctionsSortedByAddress.resize(runtimeFunctions.size());
|
||||
memcpy(runtimeFunctionsSortedByAddress.data(), runtimeFunctions.data(), runtimeFunctions.size() * sizeof(QV4::Function*));
|
||||
qSort(runtimeFunctionsSortedByAddress.begin(), runtimeFunctionsSortedByAddress.end(), functionSortHelper);
|
||||
std::sort(runtimeFunctionsSortedByAddress.begin(), runtimeFunctionsSortedByAddress.end(), functionSortHelper);
|
||||
#endif
|
||||
|
||||
return runtimeFunctions[data->indexOfRootFunction];
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include "qv4regalloc_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//#define DEBUG_REGALLOC
|
||||
|
||||
namespace {
|
||||
|
@ -137,7 +139,7 @@ public:
|
|||
|
||||
qout << "RegAllocInfo:" << endl << "Defs/uses:" << endl;
|
||||
QList<Temp> temps = _defs.keys();
|
||||
qSort(temps);
|
||||
std::sort(temps.begin(), temps.end());
|
||||
foreach (const Temp &t, temps) {
|
||||
t.dump(qout);
|
||||
qout << " def at " << _defs[t].defStmt << " ("
|
||||
|
@ -165,7 +167,7 @@ public:
|
|||
QList<Temp> hinted = _hints.keys();
|
||||
if (hinted.isEmpty())
|
||||
qout << "\t(none)" << endl;
|
||||
qSort(hinted);
|
||||
std::sort(hinted.begin(), hinted.end());
|
||||
foreach (const Temp &t, hinted) {
|
||||
qout << "\t";
|
||||
t.dump(qout);
|
||||
|
@ -1127,7 +1129,7 @@ void RegisterAllocator::run(Function *function, const Optimizer &opt)
|
|||
QTextStream qout(stdout, QIODevice::WriteOnly);
|
||||
qout << "Ranges:" << endl;
|
||||
QList<LifeTimeInterval> handled = _unhandled;
|
||||
qSort(handled.begin(), handled.end(), LifeTimeInterval::lessThanForTemp);
|
||||
std::sort(handled.begin(), handled.end(), LifeTimeInterval::lessThanForTemp);
|
||||
foreach (const LifeTimeInterval &r, handled) {
|
||||
r.dump(qout);
|
||||
qout << endl;
|
||||
|
@ -1150,7 +1152,7 @@ void RegisterAllocator::run(Function *function, const Optimizer &opt)
|
|||
dump();
|
||||
#endif // DEBUG_REGALLOC
|
||||
|
||||
qSort(_handled.begin(), _handled.end(), LifeTimeInterval::lessThan);
|
||||
std::sort(_handled.begin(), _handled.end(), LifeTimeInterval::lessThan);
|
||||
ResolutionPhase(_handled, function, _info.data(), _assignedSpillSlots, _normalRegisters, _fpRegisters).run();
|
||||
|
||||
function->tempCount = QSet<int>::fromList(_assignedSpillSlots.values()).size();
|
||||
|
@ -1199,7 +1201,7 @@ void RegisterAllocator::prepareRanges()
|
|||
if (_fixedFPRegisterRanges[fpReg].isValid())
|
||||
_active.append(_fixedFPRegisterRanges[fpReg]);
|
||||
|
||||
qSort(_active.begin(), _active.end(), LifeTimeInterval::lessThan);
|
||||
std::sort(_active.begin(), _active.end(), LifeTimeInterval::lessThan);
|
||||
}
|
||||
|
||||
void RegisterAllocator::linearScan()
|
||||
|
@ -1621,7 +1623,7 @@ void RegisterAllocator::dump() const
|
|||
{
|
||||
qout << "Ranges:" << endl;
|
||||
QList<LifeTimeInterval> handled = _handled;
|
||||
qSort(handled.begin(), handled.end(), LifeTimeInterval::lessThanForTemp);
|
||||
std::sort(handled.begin(), handled.end(), LifeTimeInterval::lessThanForTemp);
|
||||
foreach (const LifeTimeInterval &r, handled) {
|
||||
r.dump(qout);
|
||||
qout << endl;
|
||||
|
@ -1633,7 +1635,7 @@ void RegisterAllocator::dump() const
|
|||
QList<Temp> temps = _assignedSpillSlots.keys();
|
||||
if (temps.isEmpty())
|
||||
qout << "\t(none)" << endl;
|
||||
qSort(temps);
|
||||
std::sort(temps.begin(), temps.end());
|
||||
foreach (const Temp &t, temps) {
|
||||
qout << "\t";
|
||||
t.dump(qout);
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef CONST
|
||||
#undef CONST
|
||||
|
@ -2576,7 +2577,7 @@ public:
|
|||
range.setTemp(i.key());
|
||||
_sortedRanges.append(range);
|
||||
}
|
||||
qSort(_sortedRanges.begin(), _sortedRanges.end(), LifeTimeInterval::lessThan);
|
||||
std::sort(_sortedRanges.begin(), _sortedRanges.end(), LifeTimeInterval::lessThan);
|
||||
}
|
||||
|
||||
QList<LifeTimeInterval> ranges() const { return _sortedRanges; }
|
||||
|
@ -2593,7 +2594,7 @@ public:
|
|||
foreach (BasicBlock *bb, _liveIn.keys()) {
|
||||
qout << "L" << bb->index <<" live-in: ";
|
||||
QList<Temp> live = QList<Temp>::fromSet(_liveIn.value(bb));
|
||||
qSort(live);
|
||||
std::sort(live.begin(), live.end());
|
||||
for (int i = 0; i < live.size(); ++i) {
|
||||
if (i > 0) qout << ", ";
|
||||
live[i].dump(qout);
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "qv4instr_moth_p.h"
|
||||
#include <iostream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace QV4;
|
||||
using namespace QV4::Debugging;
|
||||
|
||||
|
@ -331,7 +333,7 @@ void Debugger::BreakPoints::add(const QString &fileName, int lineNumber)
|
|||
QList<int> &lines = (*this)[fileName];
|
||||
if (!lines.contains(lineNumber)) {
|
||||
lines.append(lineNumber);
|
||||
qSort(lines);
|
||||
std::sort(lines.begin(), lines.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include "qv4alloca_p.h"
|
||||
|
||||
#ifdef V4_USE_VALGRIND
|
||||
|
@ -215,7 +216,7 @@ Managed *MemoryManager::alloc(std::size_t size)
|
|||
allocation.memory = PageAllocation::allocate(allocSize, OSAllocator::JSGCHeapPages);
|
||||
allocation.chunkSize = size;
|
||||
m_d->heapChunks.append(allocation);
|
||||
qSort(m_d->heapChunks);
|
||||
std::sort(m_d->heapChunks.begin(), m_d->heapChunks.end());
|
||||
char *chunk = (char *)allocation.memory.base();
|
||||
char *end = chunk + allocation.memory.size() - size;
|
||||
memset(chunk, 0, allocation.memory.size());
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include <private/qqmlengine_p.h>
|
||||
#include <private/qv4scopedvalue_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QV4;
|
||||
|
@ -376,10 +378,10 @@ public:
|
|||
if (ctx->argumentCount == 1 && ctx->arguments[0].asFunctionObject()) {
|
||||
QV4::Value compareFn = ctx->arguments[0];
|
||||
CompareFunctor cf(ctx, compareFn);
|
||||
qSort(m_container.begin(), m_container.end(), cf);
|
||||
std::sort(m_container.begin(), m_container.end(), cf);
|
||||
} else {
|
||||
DefaultCompareFunctor cf;
|
||||
qSort(m_container.begin(), m_container.end(), cf);
|
||||
std::sort(m_container.begin(), m_container.end(), cf);
|
||||
}
|
||||
|
||||
if (m_isReference)
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#include <private/qqmlengine_p.h>
|
||||
#include <private/qfieldlist_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
|
||||
|
@ -835,7 +837,7 @@ QString QQmlImportsPrivate::resolvedUri(const QString &dir_arg, QQmlImportDataba
|
|||
dir.chop(1);
|
||||
|
||||
QStringList paths = database->fileImportPath;
|
||||
qSort(paths.begin(), paths.end(), I::greaterThan); // Ensure subdirs preceed their parents.
|
||||
std::sort(paths.begin(), paths.end(), I::greaterThan); // Ensure subdirs preceed their parents.
|
||||
|
||||
QString stableRelativePath = dir;
|
||||
foreach(const QString &path, paths) {
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
#include <ctype.h> // for toupper
|
||||
#include <limits.h>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
// nonstandard extension used : zero-sized array in struct/union.
|
||||
|
@ -1507,8 +1508,8 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder)
|
|||
Q_ASSERT(properties.count() == propertyIndexCache.count());
|
||||
Q_ASSERT(methods.count() == methodIndexCache.count());
|
||||
|
||||
qSort(properties.begin(), properties.end(), Sort::lt);
|
||||
qSort(methods.begin(), methods.end(), Sort::lt);
|
||||
std::sort(properties.begin(), properties.end(), Sort::lt);
|
||||
std::sort(methods.begin(), methods.end(), Sort::lt);
|
||||
|
||||
for (int ii = 0; ii < properties.count(); ++ii) {
|
||||
QQmlPropertyData *data = properties.at(ii).second;
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
#include <QtGui/qvector3d.h>
|
||||
#include <QtQml/private/qqmlglobal_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const char *globalProgramName = 0;
|
||||
|
@ -625,7 +627,7 @@ static QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
|
|||
return container.at(0);
|
||||
|
||||
QList<QBenchmarkResult> containerCopy = container;
|
||||
qSort(containerCopy);
|
||||
std::sort(containerCopy.begin(), containerCopy.end());
|
||||
|
||||
const int middle = count / 2;
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QOpenGLFramebufferObject>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef GL_DOUBLE
|
||||
#define GL_DOUBLE 0x140A
|
||||
#endif
|
||||
|
@ -1256,9 +1258,9 @@ void Renderer::buildRenderListsForTaggedRoots()
|
|||
qsg_addBackOrphanedElements(m_tmpAlphaElements, m_alphaRenderList);
|
||||
|
||||
if (m_opaqueRenderList.size())
|
||||
qSort(&m_opaqueRenderList.first(), &m_opaqueRenderList.last() + 1, qsg_sort_element_decreasing_order);
|
||||
std::sort(&m_opaqueRenderList.first(), &m_opaqueRenderList.last() + 1, qsg_sort_element_decreasing_order);
|
||||
if (m_alphaRenderList.size())
|
||||
qSort(&m_alphaRenderList.first(), &m_alphaRenderList.last() + 1, qsg_sort_element_increasing_order);
|
||||
std::sort(&m_alphaRenderList.first(), &m_alphaRenderList.last() + 1, qsg_sort_element_increasing_order);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1286,7 @@ void Renderer::buildRenderListsFromScratch()
|
|||
*/
|
||||
void Renderer::cleanupBatches(QDataBuffer<Batch *> *batches) {
|
||||
if (batches->size()) {
|
||||
qSort(&batches->first(), &batches->last() + 1, qsg_sort_batch_is_valid);
|
||||
std::sort(&batches->first(), &batches->last() + 1, qsg_sort_batch_is_valid);
|
||||
int count = 0;
|
||||
while (count < batches->size() && batches->at(count)->first)
|
||||
++count;
|
||||
|
@ -2149,11 +2151,11 @@ void Renderer::render()
|
|||
// Then sort opaque batches so that we're drawing the batches with the highest
|
||||
// order first, maximizing the benefit of front-to-back z-ordering.
|
||||
if (m_opaqueBatches.size())
|
||||
qSort(&m_opaqueBatches.first(), &m_opaqueBatches.last() + 1, qsg_sort_batch_decreasing_order);
|
||||
std::sort(&m_opaqueBatches.first(), &m_opaqueBatches.last() + 1, qsg_sort_batch_decreasing_order);
|
||||
|
||||
// Sort alpha batches back to front so that they render correctly.
|
||||
if (m_alphaBatches.size())
|
||||
qSort(&m_alphaBatches.first(), &m_alphaBatches.last() + 1, qsg_sort_batch_increasing_order);
|
||||
std::sort(&m_alphaBatches.first(), &m_alphaBatches.last() + 1, qsg_sort_batch_increasing_order);
|
||||
|
||||
m_zRange = 1.0 / (m_nextRenderOrder);
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <QTime>
|
||||
#include <QtNumeric>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
struct Update {
|
||||
|
@ -808,7 +810,7 @@ int QQuickTimeLinePrivate::advance(int t)
|
|||
length -= qMin(length, advanceTime);
|
||||
syncPoint -= advanceTime;
|
||||
|
||||
qSort(updates.begin(), updates.end());
|
||||
std::sort(updates.begin(), updates.end());
|
||||
updateQueue = &updates;
|
||||
for (int ii = 0; ii < updates.count(); ++ii) {
|
||||
const Update &v = updates.at(ii).second;
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include <private/qqmldirparser_p.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Test the parsing of qmldir files
|
||||
|
||||
class tst_qqmldirparser : public QQmlDataTest
|
||||
|
@ -104,7 +106,7 @@ namespace {
|
|||
foreach (const QQmlDirParser::Component &c, components.values())
|
||||
rv.append(toString(c));
|
||||
|
||||
qSort(rv);
|
||||
std::sort(rv.begin(), rv.end());
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include <QtQml/qqmlcomponent.h>
|
||||
#include "../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
typedef QPair<int, int> QQuickXmlListRange;
|
||||
typedef QList<QVariantList> QQmlXmlModelData;
|
||||
|
||||
|
@ -608,7 +610,7 @@ void tst_qquickxmllistmodel::useKeys()
|
|||
}
|
||||
|
||||
QList<int> roles = model->roleNames().keys();
|
||||
qSort(roles);
|
||||
std::sort(roles.begin(), roles.end());
|
||||
for (int i=0; i<model->rowCount(); i++) {
|
||||
QModelIndex index = model->index(i, 0);
|
||||
for (int j=0; j<roles.count(); j++)
|
||||
|
@ -759,7 +761,7 @@ void tst_qquickxmllistmodel::noKeysValueChanges()
|
|||
model->setProperty("xml",xml);
|
||||
|
||||
QList<int> roles = model->roleNames().keys();
|
||||
qSort(roles);
|
||||
std::sort(roles.begin(), roles.end());
|
||||
// wait for the new xml data to be set, and verify no signals were emitted
|
||||
QTRY_VERIFY(model->data(model->index(0, 0), roles.at(2)).toString() != QLatin1String("Football"));
|
||||
QCOMPARE(model->data(model->index(0, 0), roles.at(2)).toString(), QLatin1String("AussieRules"));
|
||||
|
@ -860,21 +862,21 @@ void tst_qquickxmllistmodel::threading()
|
|||
for (int i=0; i<dataCount; i++) {
|
||||
QModelIndex index = m1->index(i, 0);
|
||||
QList<int> roles = m1->roleNames().keys();
|
||||
qSort(roles);
|
||||
std::sort(roles.begin(), roles.end());
|
||||
QCOMPARE(m1->data(index, roles.at(0)).toString(), QString("A" + QString::number(i)));
|
||||
QCOMPARE(m1->data(index, roles.at(1)).toString(), QString("1" + QString::number(i)));
|
||||
QCOMPARE(m1->data(index, roles.at(2)).toString(), QString("Football"));
|
||||
|
||||
index = m2->index(i, 0);
|
||||
roles = m2->roleNames().keys();
|
||||
qSort(roles);
|
||||
std::sort(roles.begin(), roles.end());
|
||||
QCOMPARE(m2->data(index, roles.at(0)).toString(), QString("B" + QString::number(i)));
|
||||
QCOMPARE(m2->data(index, roles.at(1)).toString(), QString("2" + QString::number(i)));
|
||||
QCOMPARE(m2->data(index, roles.at(2)).toString(), QString("Athletics"));
|
||||
|
||||
index = m3->index(i, 0);
|
||||
roles = m3->roleNames().keys();
|
||||
qSort(roles);
|
||||
std::sort(roles.begin(), roles.end());
|
||||
QCOMPARE(m3->data(index, roles.at(0)).toString(), QString("C" + QString::number(i)));
|
||||
QCOMPARE(m3->data(index, roles.at(1)).toString(), QString("3" + QString::number(i)));
|
||||
QCOMPARE(m3->data(index, roles.at(2)).toString(), QString("Curling"));
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <QtCore/QProcess>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QString blockify(const QByteArray& s)
|
||||
{
|
||||
|
@ -167,7 +168,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter)
|
|||
}
|
||||
}
|
||||
|
||||
qSort(itemFiles);
|
||||
std::sort(itemFiles.begin(), itemFiles.end());
|
||||
foreach (const QString &filePath, itemFiles) {
|
||||
QByteArray itemName = filePath.mid(testSuitePath.length() + 1).toLatin1();
|
||||
QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath;
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <QtCore/private/qmetaobject_p.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "qmlstreamwriter.h"
|
||||
|
||||
|
@ -330,7 +331,7 @@ public:
|
|||
|
||||
// ensure exports are sorted and don't change order when the plugin is dumped again
|
||||
QStringList exportStrings = exports.keys();
|
||||
qSort(exportStrings);
|
||||
std::sort(exportStrings.begin(), exportStrings.end());
|
||||
qml->writeArrayBinding(QLatin1String("exports"), exportStrings);
|
||||
|
||||
// write meta object revisions
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include <QFile>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Constants {
|
||||
const char TYPE_PAINTING_STR[] = "Painting";
|
||||
const char TYPE_COMPILING_STR[] = "Compiling";
|
||||
|
@ -437,9 +439,9 @@ void QmlProfilerData::sortStartTimes()
|
|||
itFrom--;
|
||||
|
||||
if (itTo->startTime <= itFrom->startTime)
|
||||
qSort(itFrom, itTo + 1, compareStartTimes);
|
||||
std::sort(itFrom, itTo + 1, compareStartTimes);
|
||||
else
|
||||
qSort(itFrom + 1, itTo + 1, compareStartTimes);
|
||||
std::sort(itFrom + 1, itTo + 1, compareStartTimes);
|
||||
|
||||
// move to next block
|
||||
itTo = itFrom;
|
||||
|
|
Loading…
Reference in New Issue