aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-09-12 11:06:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-13 01:10:37 +0200
commit4df73e62a70b73d955ab53faef4615ea03a21a4d (patch)
tree00acf9163a0447da03298659bc47d2de9da509f7 /src
parentc1821de0e6ef21f86623572fd54f5cc5451b6077 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4compileddata.cpp4
-rw-r--r--src/qml/compiler/qv4regalloc.cpp16
-rw-r--r--src/qml/compiler/qv4ssa.cpp5
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp4
-rw-r--r--src/qml/jsruntime/qv4mm.cpp3
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp6
-rw-r--r--src/qml/qml/qqmlimport.cpp4
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp5
-rw-r--r--src/qmltest/quicktestresult.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp12
-rw-r--r--src/quick/util/qquicktimeline.cpp4
11 files changed, 43 insertions, 24 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index efe9d70964..d4004ab7f7 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -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];
diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp
index 3b0ea8b171..3fb0d22e66 100644
--- a/src/qml/compiler/qv4regalloc.cpp
+++ b/src/qml/compiler/qv4regalloc.cpp
@@ -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);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 098f6eef10..541793f6ae 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -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);
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index 10f22a11b8..6879e432e8 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -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());
}
}
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 874c349c42..67ae5d6888 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -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());
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index d07277aa5d..058964969c 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -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)
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 85c6a4246a..e970ffec59 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -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) {
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index a1385e06fc..e498ca5dee 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -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;
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index 0385389628..67e80e7a0d 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -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;
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index cf71489f88..e9d9249bf5 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -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);
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index f1d7e19dc2..4667a5856c 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -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;