Commit 056e8aa4 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Fix some Krazy warnings about non-const ref iterator.



Change-Id: I1c78f5f5a7174002cd25bea109d5fe795530cdb5
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 28413a81
......@@ -258,7 +258,7 @@ QString Environment::searchInPath(const QString &executable,
}
}
foreach (QString dir, additionalDirs) {
foreach (const QString &dir, additionalDirs) {
QString tmp = searchInDirectory(execs, dir);
if (!tmp.isEmpty())
return tmp;
......
......@@ -87,7 +87,7 @@ JsonValue *JsonValue::build(const QVariant &variant)
case QVariant::List: {
JsonArrayValue *newValue = new JsonArrayValue;
foreach (const QVariant element, variant.toList())
foreach (const QVariant &element, variant.toList())
newValue->addElement(build(element));
return newValue;
}
......
......@@ -74,7 +74,7 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca
foreach (ProjectExplorer::Project *p, projects) {
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
if (cmakeProject) {
foreach (CMakeBuildTarget ct, cmakeProject->buildTargets()) {
foreach (const CMakeBuildTarget &ct, cmakeProject->buildTargets()) {
if (ct.title.contains(entry)) {
Locator::FilterEntry entry(this, ct.title, cmakeProject->document()->fileName());
entry.extraInfo = FileUtils::shortNativePath(
......
......@@ -2675,7 +2675,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
BreakpointResponseId rid(nr);
if (!isHiddenBreakpoint(rid)) {
BreakpointResponse br = handler->response(id);
foreach (const GdbMi bkpt, response.data.children()) {
foreach (const GdbMi &bkpt, response.data.children()) {
nr = bkpt.findChild("number").data();
rid = BreakpointResponseId(nr);
QTC_ASSERT(rid.isValid(), continue);
......@@ -3518,7 +3518,7 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
void GdbEngine::examineModules()
{
ModulesHandler *handler = modulesHandler();
foreach (Module module, handler->modules()) {
foreach (const Module &module, handler->modules()) {
if (module.elfData.symbolsType == UnknownSymbols)
handler->updateModule(module);
}
......
......@@ -467,7 +467,7 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
m_objectTreeQueryIds.removeOne(queryId);
if (value.type() == QVariant::List) {
QVariantList objList = value.toList();
foreach (QVariant var, objList) {
foreach (const QVariant &var, objList) {
// TODO: check which among the list is the actual
// object that needs to be selected.
verifyAndInsertObjectInTree(qvariant_cast<ObjectReference>(var));
......
......@@ -77,7 +77,7 @@ static inline void getProperties(const ModelNode node, QHash<PropertyName, QVari
static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash)
{
QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData();
foreach (const PropertyName propertyName, auxiliaryData.keys()) {
foreach (const PropertyName &propertyName, auxiliaryData.keys()) {
node.setAuxiliaryData(propertyName, QVariant());
}
......
......@@ -212,7 +212,7 @@ void SubComponentManager::parseDirectories()
if (dirInfo.exists() && dirInfo.isDir())
parseDirectory(dirInfo.canonicalFilePath());
foreach (const QString subDir, QDir(QFileInfo(file).path()).entryList(QDir::Dirs | QDir::NoDot | QDir::NoDotDot)) {
foreach (const QString &subDir, QDir(QFileInfo(file).path()).entryList(QDir::Dirs | QDir::NoDot | QDir::NoDotDot)) {
parseDirectory(dirInfo.canonicalFilePath() + "/" + subDir, true, subDir.toUtf8());
}
}
......
......@@ -717,7 +717,7 @@ QString RewriterView::pathForImport(const Import &import)
QmlJS::ImportInfo importInfo;
foreach (QmlJS::Import qmljsImport, imports->all()) {
foreach (const QmlJS::Import &qmljsImport, imports->all()) {
if (qmljsImport.info.name() == importStr)
importInfo = qmljsImport.info;
}
......
......@@ -668,7 +668,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
QStringList nCompletions;
QString prefix(libVersion.left(toSkip));
nCompletions.reserve(completions.size());
foreach (QString completion, completions)
foreach (const QString &completion, completions)
if (completion.startsWith(prefix))
nCompletions.append(completion.right(completion.size()-toSkip));
completions = nCompletions;
......
......@@ -135,7 +135,7 @@ void BlackBerryConfiguration::loadCertificates()
settings->beginGroup(SettingsGroup);
settings->beginGroup(CertificateGroup);
foreach (QString certificateId, settings->childGroups()) {
foreach (const QString &certificateId, settings->childGroups()) {
settings->beginGroup(certificateId);
BlackBerryCertificate *cert =
......
......@@ -382,8 +382,9 @@ void RefactoringFile::indentOrReindent(void (RefactoringChangesData::*mf)(const
const BaseTextEditorWidget *) const,
const QList<QPair<QTextCursor, QTextCursor> > &ranges)
{
QPair<QTextCursor, QTextCursor> p;
foreach (p, ranges) {
typedef QPair<QTextCursor, QTextCursor> CursorPair;
foreach (const CursorPair &p, ranges) {
QTextCursor selection(p.first.document());
selection.setPosition(p.first.position());
selection.setPosition(p.second.position(), QTextCursor::KeepAnchor);
......
......@@ -1562,6 +1562,8 @@ void generateASTFwd_h(const Snapshot &snapshot, const QDir &cplusplusDir, const
void generateASTPatternBuilder_h(const QDir &cplusplusDir)
{
typedef QPair<QString, QString> StringPair;
QFileInfo fileInfo(cplusplusDir, QLatin1String("ASTPatternBuilder.h"));
QFile file(fileInfo.absoluteFilePath());
if (! file.open(QFile::WriteOnly))
......@@ -1619,7 +1621,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
out
<< " " << className << " *" << methodName << "(";
QList<QPair<QString, QString> > args;
QList<StringPair> args;
bool first = true;
for (unsigned index = 0; index < klass->memberCount(); ++index) {
......@@ -1652,8 +1654,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
<< " " << className << " *__ast = new (&pool) " << className << ';' << endl;
QPair<QString, QString> p;
foreach (p, args) {
foreach (const StringPair &p, args) {
out << " __ast->" << p.second << " = " << p.second << ';' << endl;
}
......
......@@ -355,7 +355,7 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map,
// Sanity check: Make sure displayName is unique.
QStringList nameKeys = FindKeyOperation::findKey(map, QLatin1String(DISPLAYNAME));
QStringList nameList;
foreach (const QString nameKey, nameKeys)
foreach (const QString &nameKey, nameKeys)
nameList << GetOperation::get(map, nameKey).toString();
const QString uniqueName = makeUnique(displayName, nameList);
......
......@@ -285,7 +285,7 @@ QVariantMap AddQtOperation::addQt(const QVariantMap &map,
// Sanity check: Make sure displayName is unique.
QStringList nameKeys = FindKeyOperation::findKey(map, QLatin1String(DISPLAYNAME));
QStringList nameList;
foreach (const QString nameKey, nameKeys)
foreach (const QString &nameKey, nameKeys)
nameList << GetOperation::get(map, nameKey).toString();
const QString uniqueName = makeUnique(displayName, nameList);
......
......@@ -249,7 +249,7 @@ QVariantMap AddToolChainOperation::addToolChain(const QVariantMap &map,
// Sanity check: Make sure displayName is unique.
QStringList nameKeys = FindKeyOperation::findKey(map, QLatin1String(DISPLAYNAME));
QStringList nameList;
foreach (const QString nameKey, nameKeys)
foreach (const QString &nameKey, nameKeys)
nameList << GetOperation::get(map, nameKey).toString();
const QString uniqueName = makeUnique(displayName, nameList);
......
......@@ -74,7 +74,7 @@ int FindKeyOperation::execute() const
foreach (const QString &k, m_keys) {
const QStringList result = findKey(map, k);
foreach (const QString r, result)
foreach (const QString &r, result)
std::cout << qPrintable(r) << std::endl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment