Fix Krazy warnings about values or keys iteration in various places.

Change-Id: Iced108cc7fc74f6ce5501c59db7090fea21cb87a
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Friedemann Kleint
2013-03-14 14:19:23 +01:00
parent 9b89cad5fe
commit efe98de840
5 changed files with 24 additions and 15 deletions

View File

@@ -252,13 +252,15 @@ void JsonSchema::enterNestedTypeSchema()
QStringList JsonSchema::properties(JsonObjectValue *v) const
{
typedef QHash<QString, JsonValue *>::ConstIterator MemberConstIterator;
QStringList all;
if (JsonObjectValue *ov = getObjectValue(kProperties, v)) {
foreach (const QString &property, ov->members().keys()) {
if (hasPropertySchema(property))
all.append(property);
}
const MemberConstIterator cend = ov->members().constEnd();
for (MemberConstIterator it = ov->members().constBegin(); it != cend; ++it)
if (hasPropertySchema(it.key()))
all.append(it.key());
}
if (JsonObjectValue *base = resolveBase(v))

View File

@@ -459,8 +459,8 @@ ActionManagerPrivate::~ActionManagerPrivate()
// first delete containers to avoid them reacting to command deletion
foreach (ActionContainerPrivate *container, m_idContainerMap)
disconnect(container, SIGNAL(destroyed()), this, SLOT(containerDestroyed()));
qDeleteAll(m_idContainerMap.values());
qDeleteAll(m_idCmdMap.values());
qDeleteAll(m_idContainerMap);
qDeleteAll(m_idCmdMap);
}
QDebug operator<<(QDebug d, const Context &context)

View File

@@ -130,9 +130,9 @@ void DocSettingsPage::addDocumentation()
if (!docsUnableToRegister.isEmpty()) {
formatedFail += QString::fromLatin1("<ul><li><b>%1</b>").arg(tr("Namespace already registered:"));
foreach (const QString &key, docsUnableToRegister.keys()) {
formatedFail += QString::fromLatin1("<ul><li>%1 - %2</li></ul>").arg(key, docsUnableToRegister
.value(key));
const NameSpaceToPathHash::ConstIterator cend = docsUnableToRegister.constEnd();
for (NameSpaceToPathHash::ConstIterator it = docsUnableToRegister.constBegin(); it != cend; ++it) {
formatedFail += QString::fromLatin1("<ul><li>%1 - %2</li></ul>").arg(it.key(), it.value());
}
formatedFail += QLatin1String("</li></ul>");
}

View File

@@ -312,10 +312,12 @@ void LocatorWidget::setPlaceholderText(const QString &text)
void LocatorWidget::updateFilterList()
{
typedef QMap<Id, QAction *> IdActionMap;
m_filterMenu->clear();
// update actions and menu
QMap<Id, QAction *> actionCopy = m_filterActionMap;
IdActionMap actionCopy = m_filterActionMap;
m_filterActionMap.clear();
// register new actions, update existent
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
@@ -343,9 +345,11 @@ void LocatorWidget::updateFilterList()
}
// unregister actions that are deleted now
foreach (const Id id, actionCopy.keys())
ActionManager::unregisterAction(actionCopy.value(id), id.withPrefix("Locator."));
qDeleteAll(actionCopy);
const IdActionMap::Iterator end = actionCopy.end();
for (IdActionMap::Iterator it = actionCopy.begin(); it != end; ++it) {
ActionManager::unregisterAction(it.value(), it.key().withPrefix("Locator."));
delete it.value();
}
m_filterMenu->addSeparator();
m_filterMenu->addAction(m_refreshAction);

View File

@@ -52,11 +52,14 @@ ScreenShotCropperWindow::~ScreenShotCropperWindow()
void ScreenShotCropperWindow::loadData(const QString &areasXmlFile, const QString &imagesFolder)
{
typedef QMap<QString, QRect>::ConstIterator StringRectConstIt;
m_areasOfInterestFile = areasXmlFile;
m_areasOfInterest = ScreenshotCropper::loadAreasOfInterest(m_areasOfInterestFile);
m_imagesFolder = imagesFolder;
foreach (const QString &pngFile, m_areasOfInterest.keys())
ui->m_filenamesList->addItem(pngFile);
const StringRectConstIt cend = m_areasOfInterest.constEnd();
for (StringRectConstIt it = m_areasOfInterest.constBegin(); it != cend; ++it)
ui->m_filenamesList->addItem(it.key());
}
void ScreenShotCropperWindow::selectImage(int index)