build fixes for the QT_STRICT_ITERATORS conditional

the only thing left to fix is the dbus component which requires the
pointer operator backported from 9c5a77f0ef
but it messes up the erase and insert templates and causes source
incompatibilities so it has to investigated further.

upstream commits:
fad1fa65ed
7c1e0fef8e
c4fbe872be
0412ad3513

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-06-04 14:15:26 +00:00
parent 42ab80dc7d
commit 48a45d0cd4
17 changed files with 52 additions and 96 deletions

View file

@ -704,7 +704,7 @@ QString QCommandLineParser::value(const QString &optionName) const
QStringList QCommandLineParser::values(const QString &optionName) const
{
d->checkParsed("values");
const NameHash_t::const_iterator it = d->nameHash.find(optionName);
const NameHash_t::const_iterator it = d->nameHash.constFind(optionName);
if (it != d->nameHash.constEnd()) {
const int optionOffset = *it;
QStringList values = d->optionValuesHash.value(optionOffset);

View file

@ -1546,7 +1546,7 @@ void QDBusActivateObjectEvent::placeMetaCall(QObject *)
void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage& msg)
{
SignalHookHash::const_iterator it = signalHooks.find(key);
SignalHookHash::const_iterator it = signalHooks.constFind(key);
SignalHookHash::const_iterator end = signalHooks.constEnd();
//qDebug("looking for: %s", path.toLocal8Bit().constData());
//qDBusDebug() << signalHooks.keys();
@ -2077,7 +2077,7 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service,
return false; // don't connect
// avoid duplicating:
QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.find(key);
QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.constFind(key);
QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd();
for ( ; it != end && it.key() == key; ++it) {
const QDBusConnectionPrivate::SignalHook &entry = it.value();
@ -2272,7 +2272,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service,
// add it to our list:
QDBusWriteLocker locker(ConnectRelayAction, this);
SignalHookHash::ConstIterator it = signalHooks.find(key);
SignalHookHash::ConstIterator it = signalHooks.constFind(key);
SignalHookHash::ConstIterator end = signalHooks.constEnd();
for ( ; it != end && it.key() == key; ++it) {
const SignalHook &entry = it.value();

View file

@ -501,7 +501,7 @@ QStringList QtResourceModel::loadedQrcFiles() const
bool QtResourceModel::isModified(const QString &path) const
{
QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.find(path);
QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.constFind(path);
if (it != d_ptr->m_pathToModified.constEnd())
return it.value();
return true;
@ -509,7 +509,7 @@ bool QtResourceModel::isModified(const QString &path) const
void QtResourceModel::setModified(const QString &path)
{
QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.find(path);
QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.constFind(path);
if (itMod == d_ptr->m_pathToModified.constEnd())
return;

View file

@ -673,7 +673,7 @@ void QtResourceView::selectResource(const QString &resource)
dir = QDir(resource);
QString dirPath = dir.absolutePath();
QMap<QString, QTreeWidgetItem *>::const_iterator it;
while ((it = d_ptr->m_pathToItem.find(dirPath)) == d_ptr->m_pathToItem.constEnd()) {
while ((it = d_ptr->m_pathToItem.constFind(dirPath)) == d_ptr->m_pathToItem.constEnd()) {
if (!dir.cdUp())
break;
dirPath = dir.absolutePath();

View file

@ -1124,7 +1124,7 @@ void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent
QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > values;
QHash<QString, QFileSystemNode *>::const_iterator iterator;
int i = 0;
for(iterator = indexNode->children.begin() ; iterator != indexNode->children.end() ; ++iterator) {
for(iterator = indexNode->children.constBegin() ; iterator != indexNode->children.constEnd() ; ++iterator) {
if (filtersAcceptsNode(iterator.value())) {
values.append(QPair<QFileSystemModelPrivate::QFileSystemNode*, int>((iterator.value()), i));
} else {

View file

@ -4186,8 +4186,8 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
// Find the first popup under the mouse (including the popup's descendants) starting from the last.
// Remove all popups after the one found, or all or them if no popup is under the mouse.
// Then continue with the event.
QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.end();
while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) {
QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd();
while (--iter >= d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) {
if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first()))
break;
d->removePopup(*iter);
@ -6116,8 +6116,8 @@ void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &ges
if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it =
d->gestureContext.find(gestureType);
if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) {
d->gestureContext.constFind(gestureType);
if (it != d->gestureContext.constEnd() && (!flag || (it.value() & flag))) {
if (normalGestures.contains(gesture)) {
normalGestures.remove(gesture);
if (conflicts)

View file

@ -1119,7 +1119,7 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
if (!source_top_left.isValid() || !source_bottom_right.isValid())
return;
QModelIndex source_parent = source_top_left.parent();
IndexMap::const_iterator it = source_index_mapping.find(source_parent);
IndexMap::const_iterator it = source_index_mapping.constFind(source_parent);
if (it == source_index_mapping.constEnd()) {
// Don't care, since we don't have mapping for this index
return;

View file

@ -2011,14 +2011,14 @@ void QTreeView::doItemsLayout()
//clean the QSet that may contains old (and this invalid) indexes
d->hasRemovedItems = false;
QSet<QPersistentModelIndex>::iterator it = d->expandedIndexes.begin();
while (it != d->expandedIndexes.constEnd()) {
while (it != d->expandedIndexes.end()) {
if (!it->isValid())
it = d->expandedIndexes.erase(it);
else
++it;
}
it = d->hiddenIndexes.begin();
while (it != d->hiddenIndexes.constEnd()) {
while (it != d->hiddenIndexes.end()) {
if (!it->isValid())
it = d->hiddenIndexes.erase(it);
else

View file

@ -3111,7 +3111,7 @@ void qPRCleanup(QWidget *widget)
if (!(wPRmapper && widget->testAttribute(Qt::WA_WState_Reparented)))
return; // not a reparented widget
QWidgetMapper::Iterator it = wPRmapper->begin();
while (it != wPRmapper->constEnd()) {
while (it != wPRmapper->end()) {
QWidget *w = *it;
if (w == etw) { // found widget
etw->setAttribute(Qt::WA_WState_Reparented, false); // clear flag

View file

@ -142,8 +142,8 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
}
}
QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin();
while (iter != m_objectGestures.end()) {
QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();
while (iter != m_objectGestures.constEnd()) {
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type) {
foreach (QGesture *g, iter.value()) {
@ -250,9 +250,10 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
ContextIterator contextEnd = contexts.end();
for (ContextIterator context = contexts.begin(); context != contextEnd; ++context) {
Qt::GestureType gestureType = context.value();
const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;
QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
typeToRecognizerIterator = m_recognizers.lowerBound(gestureType),
typeToRecognizerEnd = m_recognizers.upperBound(gestureType);
typeToRecognizerIterator = const_recognizers.lowerBound(gestureType),
typeToRecognizerEnd = const_recognizers.upperBound(gestureType);
for (; typeToRecognizerIterator != typeToRecognizerEnd; ++typeToRecognizerIterator) {
QGestureRecognizer *recognizer = typeToRecognizerIterator.value();
QObject *target = context.key();
@ -470,8 +471,8 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
QWidget *w = receiver;
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
for(ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
for(ContextIterator it = w->d_func()->gestureContext.constBegin(),
e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
@ -480,8 +481,8 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
w = w->isWindow() ? 0 : w->parentWidget();
while (w)
{
for (ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key(), 0);
@ -504,8 +505,8 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
@ -515,8 +516,8 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
while (item)
{
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key(), 0);
@ -561,8 +562,8 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
QWidget *w = widget->parentWidget();
while (w) {
QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
= w->d_func()->gestureContext.find(type);
if (it != w->d_func()->gestureContext.end()) {
= w->d_func()->gestureContext.constFind(type);
if (it != w->d_func()->gestureContext.constEnd()) {
// i.e. 'w' listens to gesture 'type'
if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
// conflicting gesture!
@ -644,8 +645,8 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
<< "\n";
// if there are conflicting gestures, send the GestureOverride event
for (GesturesPerWidget::const_iterator it = conflictedGestures.begin(),
e = conflictedGestures.end(); it != e; ++it) {
for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(),
e = conflictedGestures.constEnd(); it != e; ++it) {
QWidget *receiver = it.key();
QList<QGesture *> gestures = it.value();
DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
@ -678,8 +679,8 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
}
// delivering gestures that are not in conflicted state
for (GesturesPerWidget::const_iterator it = normalStartedGestures.begin(),
e = normalStartedGestures.end(); it != e; ++it) {
for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
e = normalStartedGestures.constEnd(); it != e; ++it) {
if (!it.value().isEmpty()) {
DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key()
<< "gestures:" << it.value();

View file

@ -2647,61 +2647,17 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
return layoutData->string;
}
namespace {
struct QScriptItemComparator {
bool operator()(const QScriptItem &a, const QScriptItem &b) { return a.position < b.position; }
bool operator()(int p, const QScriptItem &b) { return p < b.position; }
//bool operator()(const QScriptItem &a, int p) { return a.position < p; }
};
}
void QTextEngine::setBoundary(int strPos) const
{
if (strPos <= 0 || strPos >= layoutData->string.length())
const int item = findItem(strPos);
if (item < 0)
return;
const QScriptItem* it = qUpperBound(layoutData->items.constBegin(), layoutData->items.constEnd(),
strPos, QScriptItemComparator());
Q_ASSERT(it > layoutData->items.constBegin());
--it;
if (it->position == strPos) {
// already a split at the requested position
return;
QScriptItem newItem = layoutData->items.at(item);
if (newItem.position != strPos) {
newItem.position = strPos;
layoutData->items.insert(item + 1, newItem);
}
splitItem(it - layoutData->items.constBegin(), strPos - it->position);
}
void QTextEngine::splitItem(int item, int pos) const
{
if (pos <= 0)
return;
layoutData->items.insert(item + 1, layoutData->items[item]);
QScriptItem &oldItem = layoutData->items[item];
QScriptItem &newItem = layoutData->items[item+1];
newItem.position += pos;
if (oldItem.num_glyphs) {
// already shaped, break glyphs aswell
int breakGlyph = logClusters(&oldItem)[pos];
newItem.num_glyphs = oldItem.num_glyphs - breakGlyph;
oldItem.num_glyphs = breakGlyph;
newItem.glyph_data_offset = oldItem.glyph_data_offset + breakGlyph;
for (int i = 0; i < newItem.num_glyphs; i++)
logClusters(&newItem)[i] -= breakGlyph;
QFixed w = 0;
const QGlyphLayout g = shapedGlyphs(&oldItem);
for(int j = 0; j < breakGlyph; ++j)
w += g.advances_x[j] * !g.attributes[j].dontPrint;
newItem.width = oldItem.width - w;
oldItem.width = w;
}
// qDebug("split at position %d itempos=%d", pos, item);
}
QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const

View file

@ -618,7 +618,6 @@ private:
#if defined(Q_WS_MAC)
void shapeTextMac(int item) const;
#endif
void splitItem(int item, int pos) const;
void resolveAdditionalFormats() const;
int endOfLine(int lineNum);

View file

@ -3233,8 +3233,8 @@ QTextFormatCollection::~QTextFormatCollection()
int QTextFormatCollection::indexForFormat(const QTextFormat &format)
{
uint hash = getHash(format.d, format.format_type);
QMultiHash<uint, int>::const_iterator i = hashes.find(hash);
while (i != hashes.end() && i.key() == hash) {
QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);
while (i != hashes.constEnd() && i.key() == hash) {
if (formats.value(i.value()) == format) {
return i.value();
}

View file

@ -733,8 +733,8 @@ bool QHelpGenerator::insertKeywords(const QList<QHelpDataIndexItem> &keywords,
if (fName.startsWith(QLatin1String("./")))
fName = fName.mid(2);
QMap<QString, int>::ConstIterator it = d->fileMap.find(fName);
if (it != d->fileMap.end())
QMap<QString, int>::ConstIterator it = d->fileMap.constFind(fName);
if (it != d->fileMap.constEnd())
fileId = it.value();
else
fileId = 1;

View file

@ -294,7 +294,7 @@ void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern)
const QString &path = dir.canonicalPath();
// QDir::entryList() is expensive, so we cache the results.
QMap<QString, QStringList>::ConstIterator it = dirEntriesCache.find(path);
QMap<QString, QStringList>::ConstIterator it = dirEntriesCache.constFind(path);
const QStringList &entries = it != dirEntriesCache.constEnd() ?
it.value() : dir.entryList(QDir::Files);
if (it == dirEntriesCache.constEnd())

View file

@ -161,7 +161,7 @@ void Reader::setIndexPath(const QString &path)
void Reader::filterFilesForAttributes(const QStringList &attributes)
{
searchIndexTable.clear();
for(IndexTable::ConstIterator it = indexTable.begin(); it != indexTable.end(); ++it) {
for(IndexTable::ConstIterator it = indexTable.constBegin(); it != indexTable.constEnd(); ++it) {
const QString fileName = it.key();
bool containsAll = true;
QStringList split = fileName.split(QLatin1String("@"));
@ -237,8 +237,8 @@ void Reader::searchInIndex(const QStringList &terms)
foreach (const QString &term, terms) {
QVector<Document> documents;
for(IndexTable::ConstIterator it = searchIndexTable.begin();
it != searchIndexTable.end(); ++it) {
for(IndexTable::ConstIterator it = searchIndexTable.constBegin();
it != searchIndexTable.constEnd(); ++it) {
EntryTable entryTable = it.value().first;
DocumentList documentList = it.value().second;
@ -318,7 +318,7 @@ bool Reader::searchForPattern(const QStringList &patterns, const QStringList &wo
return false;
for(QHash<QString, PosEntry*>::ConstIterator mit =
miniIndex.begin(); mit != miniIndex.end(); ++mit) {
miniIndex.constBegin(); mit != miniIndex.constEnd(); ++mit) {
delete mit.value();
}
miniIndex.clear();
@ -483,7 +483,7 @@ void Reader::reset()
void Reader::cleanupIndex(EntryTable &entryTable)
{
for(EntryTable::ConstIterator it =
entryTable.begin(); it != entryTable.end(); ++it) {
entryTable.constBegin(); it != entryTable.constEnd(); ++it) {
delete it.value();
}

View file

@ -74,7 +74,7 @@ Writer::~Writer()
void Writer::reset()
{
for(QHash<QString, Entry*>::ConstIterator it =
index.begin(); it != index.end(); ++it) {
index.constBegin(); it != index.constEnd(); ++it) {
delete it.value();
}