From 774fa4941284f8b9257f9659c8d77e4c10545c4e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 19 Apr 2011 15:42:14 +0200 Subject: [PATCH] Fix more krazy warnings. --- .../editor/abstractliveedittool.cpp | 10 +++++----- .../editor/liveselectionindicator.cpp | 2 +- .../qmljsdebugger/editor/liveselectiontool.cpp | 2 +- .../qmljsdebugger/qdeclarativeviewobserver.cpp | 7 ++++--- share/qtcreator/qml/qmlobserver/main.cpp | 4 ++-- .../qml/qmlobserver/qdeclarativetester.cpp | 5 +++-- share/qtcreator/qml/qmlobserver/qmlruntime.cpp | 8 ++++---- src/libs/cplusplus/Macro.cpp | 2 +- src/libs/cplusplus/pp-engine.cpp | 2 +- src/libs/qmleditorwidgets/colorbox.cpp | 7 ++++--- src/libs/qmleditorwidgets/colorbutton.cpp | 7 ++++--- src/libs/qmljs/qmljscodeformatter.cpp | 2 +- src/libs/qmljs/qmljslineinfo.cpp | 2 +- src/libs/qtcreatorcdbext/containers.cpp | 6 +++--- src/libs/qtcreatorcdbext/gdbmihelpers.cpp | 16 ++++++++-------- src/libs/qtcreatorcdbext/stringutils.cpp | 10 +++++----- src/libs/qtcreatorcdbext/symbolgroup.cpp | 6 +++--- src/libs/qtcreatorcdbext/symbolgroupnode.cpp | 12 ++++++------ src/libs/qtcreatorcdbext/symbolgroupvalue.cpp | 2 +- src/plugins/analyzerbase/analyzersettings.cpp | 6 +++--- src/plugins/analyzerbase/ianalyzertool.h | 2 +- src/plugins/classview/classviewparser.cpp | 2 +- .../coreplugin/actionmanager/actionmanager.cpp | 6 +++--- .../coreplugin/editormanager/editormanager.cpp | 12 ++++++------ src/plugins/cppeditor/cppchecksymbols.cpp | 3 +-- src/plugins/cpptools/cppcodeformatter.cpp | 2 +- src/plugins/debugger/debuggerstreamops.cpp | 6 +++--- src/plugins/debugger/gdb/codagdbadapter.cpp | 2 +- src/plugins/designer/codemodelhelpers.cpp | 2 +- src/plugins/designer/formeditorw.cpp | 4 ++-- src/plugins/designer/qtcreatorintegration.cpp | 4 ++-- src/plugins/find/findplugin.cpp | 2 +- src/plugins/help/centralwidget.cpp | 2 +- src/plugins/help/helpviewer_qwv.cpp | 2 +- src/plugins/macros/macroevent.cpp | 2 +- src/plugins/macros/macromanager.cpp | 2 +- .../projectexplorer/baseprojectwizarddialog.cpp | 2 +- src/plugins/projectexplorer/buildstepspage.cpp | 2 +- src/plugins/projectexplorer/gcctoolchain.cpp | 2 +- src/plugins/projectexplorer/gnumakeparser.cpp | 2 +- src/plugins/projectexplorer/gnumakeparser.h | 2 +- src/plugins/projectexplorer/msvctoolchain.cpp | 4 ++-- src/plugins/projectexplorer/projectexplorer.cpp | 2 +- .../formeditor/anchorlinecontroller.cpp | 4 ++-- .../integration/designdocumentcontrollerview.cpp | 2 +- .../qmldesigner/components/logger/logger.cpp | 4 ++-- .../components/navigator/navigatortreemodel.cpp | 4 ++-- .../designercore/instances/instancecontainer.cpp | 2 +- .../designercore/metainfo/nodemetainfo.cpp | 2 +- .../metainfo/subcomponentmanager.cpp | 8 ++++---- .../designercore/model/qmlobjectnode.cpp | 4 ++-- src/plugins/qmljseditor/qmljsfindreferences.cpp | 4 ++-- src/plugins/qmljsinspector/qmljsinspector.cpp | 4 ++-- .../qmljsinspector/qmljslivetextpreview.cpp | 4 ++-- .../qmljsinspector/qmljspropertyinspector.cpp | 2 +- src/plugins/qmljstools/qmljsmodelmanager.cpp | 4 ++-- src/plugins/qt4projectmanager/qmakestep.cpp | 2 +- .../qt-maemo/qt4maemotarget.cpp | 2 +- .../qt4projectmanager/qt-s60/s60publisherovi.cpp | 8 ++++---- .../qt4projectmanager/qt4buildconfiguration.cpp | 2 +- src/plugins/qt4projectmanager/qt4nodes.cpp | 2 +- .../wizards/consoleappwizard.cpp | 2 +- .../qt4projectmanager/wizards/librarywizard.cpp | 2 +- .../generichighlighter/highlighter.cpp | 6 +++--- src/tools/gen-cpp-ast/generate-ast.cpp | 8 +++----- src/tools/qtcreatorwidgets/customwidgets.cpp | 2 +- 66 files changed, 137 insertions(+), 136 deletions(-) diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp index 1d7dc5d3fe8..c9b52babb0e 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp @@ -165,10 +165,10 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) if (gfxObject) { className = gfxObject->metaObject()->className(); - className.replace(QRegExp("_QMLTYPE_\\d+"), ""); - className.replace(QRegExp("_QML_\\d+"), ""); + className.remove(QRegExp("_QMLTYPE_\\d+")); + className.remove(QRegExp("_QML_\\d+")); if (className.startsWith(QLatin1String("QDeclarative"))) - className = className.replace(QLatin1String("QDeclarative"), ""); + className = className.remove(QLatin1String("QDeclarative")); QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject); if (declarativeItem) { @@ -176,10 +176,10 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) } if (!objectStringId.isEmpty()) { - constructedName = objectStringId + " (" + className + ")"; + constructedName = objectStringId + " (" + className + QLatin1Char(')'); } else { if (!gfxObject->objectName().isEmpty()) { - constructedName = gfxObject->objectName() + " (" + className + ")"; + constructedName = gfxObject->objectName() + " (" + className + QLatin1Char(')'); } else { constructedName = className; } diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp index 8f8fc5ab278..fcbd38131ab 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp @@ -105,7 +105,7 @@ void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> // set selections to also all children if they are not editor items - foreach (QWeakPointer<QGraphicsObject> object, itemList) { + foreach (const QWeakPointer<QGraphicsObject> &object, itemList) { if (object.isNull()) continue; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp index e34274a7eba..603cf0b6e8c 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp @@ -382,7 +382,7 @@ void LiveSelectionTool::clear() void LiveSelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList) { - foreach (QWeakPointer<QGraphicsObject> obj, m_selectedItemList) { + foreach (const QWeakPointer<QGraphicsObject> &obj, m_selectedItemList) { if (!obj.isNull()) { disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp index 49f6b79695b..0818f78bb75 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp @@ -407,7 +407,8 @@ void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QOb QString imports; foreach (const QString &s, importList) { - imports += s + "\n"; + imports += s; + imports += QLatin1Char('\n'); } QDeclarativeContext *parentContext = view->engine()->contextForObject(parent); @@ -574,7 +575,7 @@ void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) { - foreach (QWeakPointer<QGraphicsObject> obj, currentSelection) { + foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { if (QGraphicsItem *item = obj.data()) { if (!items.contains(item)) { QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)), @@ -603,7 +604,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> it setSelectedItemsForTools(items); if (oldList != currentSelection) { QList<QObject*> objectList; - foreach (QWeakPointer<QGraphicsObject> graphicsObject, currentSelection) { + foreach (const QWeakPointer<QGraphicsObject> &graphicsObject, currentSelection) { if (graphicsObject) objectList << graphicsObject.data(); } diff --git a/share/qtcreator/qml/qmlobserver/main.cpp b/share/qtcreator/qml/qmlobserver/main.cpp index 63225e59af9..d678e816c39 100644 --- a/share/qtcreator/qml/qmlobserver/main.cpp +++ b/share/qtcreator/qml/qmlobserver/main.cpp @@ -477,10 +477,10 @@ static QDeclarativeViewer *createViewer() if (opts.experimentalGestures) viewer->enableExperimentalGestures(); - foreach (QString lib, opts.imports) + foreach (const QString &lib, opts.imports) viewer->addLibraryPath(lib); - foreach (QString plugin, opts.plugins) + foreach (const QString &plugin, opts.plugins) viewer->addPluginPath(plugin); viewer->setNetworkCacheSize(opts.cache); diff --git a/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp b/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp index 01fed6b0962..aeb57d2a22a 100644 --- a/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp +++ b/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp @@ -217,8 +217,9 @@ void QDeclarativeTester::save() if (!fe.hash.isEmpty()) { ts << " hash: \"" << fe.hash.toHex() << "\"\n"; } else if (!fe.image.isNull()) { - QString filename = filenameInfo.baseName() + "." + QString::number(imgCount) + ".png"; - fe.image.save(m_script + "." + QString::number(imgCount) + ".png"); + QString filename = filenameInfo.baseName() + QLatin1Char('.') + + QString::number(imgCount) + ".png"; + fe.image.save(m_script + QLatin1Char('.') + QString::number(imgCount) + ".png"); imgCount++; ts << " image: \"" << filename << "\"\n"; } diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp index 56a308eba34..ef6542ca246 100644 --- a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp @@ -459,10 +459,10 @@ private: QMutexLocker lock(&mutex); QList<QNetworkCookie> list = allCookies(); QByteArray data; - foreach (QNetworkCookie cookie, list) { + foreach (const QNetworkCookie &cookie, list) { if (!cookie.isSessionCookie()) { data.append(cookie.toRawForm()); - data.append("\n"); + data.append('\n'); } } QSettings settings; @@ -1036,7 +1036,7 @@ void QDeclarativeViewer::chooseRecordingOptions() // Rate record_rate = recdlg->videoRate(); // Profile - record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts); + record_args = recdlg->arguments().split(QLatin1Char(' '),QString::SkipEmptyParts); } } @@ -1458,7 +1458,7 @@ void QDeclarativeViewer::setRecording(bool on) } progress.setValue(progress.maximum()-1); - foreach (QString name, inputs) + foreach (const QString &name, inputs) QFile::remove(name); frames.clear(); diff --git a/src/libs/cplusplus/Macro.cpp b/src/libs/cplusplus/Macro.cpp index 410d38ef38f..08942765eb6 100644 --- a/src/libs/cplusplus/Macro.cpp +++ b/src/libs/cplusplus/Macro.cpp @@ -73,7 +73,7 @@ QString Macro::toString() const if (f._functionLike) { text += QLatin1Char('('); bool first = true; - foreach (const QByteArray formal, _formals) { + foreach (const QByteArray &formal, _formals) { if (! first) text += QLatin1String(", "); else diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 4b6741041ea..0cb5dea4dbb 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1168,7 +1168,7 @@ void Preprocessor::processDefine(TokenIterator firstToken, TokenIterator lastTok if (macro.isFunctionLike()) { macroId += '('; bool fst = true; - foreach (const QByteArray formal, macro.formals()) { + foreach (const QByteArray &formal, macro.formals()) { if (! fst) macroId += ", "; fst = false; diff --git a/src/libs/qmleditorwidgets/colorbox.cpp b/src/libs/qmleditorwidgets/colorbox.cpp index 4a47c67d262..ef7fa23e3c3 100644 --- a/src/libs/qmleditorwidgets/colorbox.cpp +++ b/src/libs/qmleditorwidgets/colorbox.cpp @@ -50,11 +50,12 @@ static inline QColor properColor(const QString &str) return QColor(); int lalpha = 255; QString lcolorStr = str; - if (lcolorStr.at(0) == '#' && lcolorStr.length() == 9) { + const QChar hash = QLatin1Char('#'); + if (lcolorStr.at(0) == hash && lcolorStr.length() == 9) { QString alphaStr = lcolorStr; alphaStr.truncate(3); lcolorStr.remove(0, 3); - lcolorStr = "#" + lcolorStr; + lcolorStr = hash + lcolorStr; alphaStr.remove(0,1); bool v; lalpha = alphaStr.toInt(&v, 16); @@ -62,7 +63,7 @@ static inline QColor properColor(const QString &str) lalpha = 255; } QColor lcolor(lcolorStr); - if (lcolorStr.contains('#')) + if (lcolorStr.contains(hash)) lcolor.setAlpha(lalpha); return lcolor; } diff --git a/src/libs/qmleditorwidgets/colorbutton.cpp b/src/libs/qmleditorwidgets/colorbutton.cpp index a1ed4812131..3c1a897c9f9 100644 --- a/src/libs/qmleditorwidgets/colorbutton.cpp +++ b/src/libs/qmleditorwidgets/colorbutton.cpp @@ -72,11 +72,12 @@ static inline QColor properColor(const QString &str) return QColor(); int lalpha = 255; QString lcolorStr = str; - if (lcolorStr.at(0) == '#' && lcolorStr.length() == 9) { + const QChar hash = QLatin1Char('#'); + if (lcolorStr.at(0) == hash && lcolorStr.length() == 9) { QString alphaStr = lcolorStr; alphaStr.truncate(3); lcolorStr.remove(0, 3); - lcolorStr = "#" + lcolorStr; + lcolorStr = hash + lcolorStr; alphaStr.remove(0,1); bool v; lalpha = alphaStr.toInt(&v, 16); @@ -84,7 +85,7 @@ static inline QColor properColor(const QString &str) lalpha = 255; } QColor lcolor(lcolorStr); - if (lcolorStr.contains('#')) + if (lcolorStr.contains(hash)) lcolor.setAlpha(lalpha); return lcolor; } diff --git a/src/libs/qmljs/qmljscodeformatter.cpp b/src/libs/qmljs/qmljscodeformatter.cpp index c0049ec3073..3055ac9f334 100644 --- a/src/libs/qmljs/qmljscodeformatter.cpp +++ b/src/libs/qmljs/qmljscodeformatter.cpp @@ -940,7 +940,7 @@ void CodeFormatter::dump() const qDebug() << "Current token index" << m_tokenIndex; qDebug() << "Current state:"; - foreach (State s, m_currentState) { + foreach (const State &s, m_currentState) { qDebug() << metaEnum.valueToKey(s.type) << s.savedIndentDepth; } qDebug() << "Current indent depth:" << m_indentDepth; diff --git a/src/libs/qmljs/qmljslineinfo.cpp b/src/libs/qmljs/qmljslineinfo.cpp index 089cbf8c404..05c4d96209e 100644 --- a/src/libs/qmljs/qmljslineinfo.cpp +++ b/src/libs/qmljs/qmljslineinfo.cpp @@ -204,7 +204,7 @@ QString LineInfo::trimmedCodeLine(const QString &t) if (yyLinizerState.leftBraceFollows && !text.isEmpty() && text.at(0).isUpper()) { int i = index; - // skip any preceeding 'identifier.'; these could appear in both cases + // skip any preceding 'identifier.'; these could appear in both cases while (i >= 2) { const Token &prev = yyLinizerState.tokens.at(i-1); const Token &prevPrev = yyLinizerState.tokens.at(i-2); diff --git a/src/libs/qtcreatorcdbext/containers.cpp b/src/libs/qtcreatorcdbext/containers.cpp index 88229af8fc3..c70c3772009 100644 --- a/src/libs/qtcreatorcdbext/containers.cpp +++ b/src/libs/qtcreatorcdbext/containers.cpp @@ -534,7 +534,7 @@ StdMapNode *StdMapNode::buildMap(const SymbolGroupValue &n) static inline void indentStream(std::ostream &os, unsigned indent) { - for (unsigned i = 0; i < indent; i++) + for (unsigned i = 0; i < indent; ++i) os << ' '; } @@ -923,7 +923,7 @@ static inline SymbolGroupValueVector qMapNodes(const SymbolGroupValue &v, Vector SymbolGroupValueVector rc; rc.reserve(count); SymbolGroupValue n = e["forward"][unsigned(0)]; - for (VectorIndexType i = 0; i < count && n && n.pointerValue() != ePtr; i++) { + for (VectorIndexType i = 0; i < count && n && n.pointerValue() != ePtr; ++i) { rc.push_back(n); n = n["forward"][unsigned(0)]; } @@ -986,7 +986,7 @@ static inline AbstractSymbolGroupNodePtrVector rc.reserve(count); std::string errorMessage; SymbolGroup *sg = v.node()->symbolGroup(); - for (VectorIndexType i = 0; i < count ; i++) { + for (VectorIndexType i = 0; i < count ; ++i) { const ULONG64 nodePtr = childNodes.at(i).pointerValue(); if (!nodePtr) return AbstractSymbolGroupNodePtrVector(); diff --git a/src/libs/qtcreatorcdbext/gdbmihelpers.cpp b/src/libs/qtcreatorcdbext/gdbmihelpers.cpp index 1b0ebafb093..b4725327868 100644 --- a/src/libs/qtcreatorcdbext/gdbmihelpers.cpp +++ b/src/libs/qtcreatorcdbext/gdbmihelpers.cpp @@ -215,7 +215,7 @@ bool threadList(CIDebugSystemObjects *debugSystemObjects, } // Create entries static WCHAR name[256]; - for (ULONG i= 0; i < threadCount ; i++) { + for (ULONG i= 0; i < threadCount ; ++i) { const ULONG id = ids[i]; Thread thread(id, systemIds[i]); // Thread name @@ -296,7 +296,7 @@ Modules getModules(CIDebugSymbols *syms, std::string *errorMessage) return Modules(); } - for (ULONG m = 0; m < count; m++) { + for (ULONG m = 0; m < count; ++m) { Module module; module.base = parameters[m].Base; module.size = parameters[m].Size; @@ -321,7 +321,7 @@ std::string gdbmiModules(CIDebugSymbols *syms, bool humanReadable, std::string * std::ostringstream str; str << '[' << std::hex << std::showbase; const Modules::size_type size = modules.size(); - for (Modules::size_type m = 0; m < size; m++) { + for (Modules::size_type m = 0; m < size; ++m) { const Module &module = modules.at(m); if (m) str << ','; @@ -465,7 +465,7 @@ Registers getRegisters(CIDebugRegisters *regs, // Standard registers DEBUG_REGISTER_DESCRIPTION description; DEBUG_VALUE value; - for (ULONG r = 0; r < registerCount; r++) { + for (ULONG r = 0; r < registerCount; ++r) { hr = regs->GetDescriptionWide(r, buf, bufSize, NULL, &description); if (FAILED(hr)) { *errorMessage = msgDebugEngineComFailed("GetDescription", hr); @@ -488,7 +488,7 @@ Registers getRegisters(CIDebugRegisters *regs, } // Pseudo - for (ULONG r = 0; r < pseudoRegisterCount; r++) { + for (ULONG r = 0; r < pseudoRegisterCount; ++r) { ULONG type; hr = regs->GetPseudoDescriptionWide(r, buf, bufSize, NULL, NULL, &type); if (FAILED(hr)) @@ -526,7 +526,7 @@ std::string gdbmiRegisters(CIDebugRegisters *regs, if (humanReadable) str << '\n'; const Registers::size_type size = registers.size(); - for (Registers::size_type r = 0; r < size; r++) { + for (Registers::size_type r = 0; r < size; ++r) { const Register ® = registers.at(r); if (r) str << ','; @@ -589,7 +589,7 @@ static StackFrames getStackTrace(CIDebugControl *debugControl, *errorMessage = msgDebugEngineComFailed("GetStackTrace", hr); } StackFrames rc(frameCount, StackFrame()); - for (ULONG f = 0; f < frameCount; f++) + for (ULONG f = 0; f < frameCount; ++f) getFrame(debugSymbols, frames[f], &(rc[f])); delete [] frames; return rc; @@ -608,7 +608,7 @@ std::string gdbmiStack(CIDebugControl *debugControl, std::ostringstream str; str << '['; const StackFrames::size_type size = frames.size(); - for (StackFrames::size_type i = 0; i < size; i++) { + for (StackFrames::size_type i = 0; i < size; ++i) { if (i) str << ','; frames.at(i).formatGDBMI(str, (int)i); diff --git a/src/libs/qtcreatorcdbext/stringutils.cpp b/src/libs/qtcreatorcdbext/stringutils.cpp index ad87fb41972..c8f5e06ab28 100644 --- a/src/libs/qtcreatorcdbext/stringutils.cpp +++ b/src/libs/qtcreatorcdbext/stringutils.cpp @@ -95,7 +95,7 @@ void simplify(std::string &s) void replace(std::wstring &s, wchar_t before, wchar_t after) { const std::wstring::size_type size = s.size(); - for (std::wstring::size_type i = 0; i < size; i++) + for (std::wstring::size_type i = 0; i < size; ++i) if (s.at(i) == before) s[i] = after; } @@ -146,14 +146,14 @@ static inline void formatGdbmiChar(std::ostream &str, wchar_t c) void gdbmiStringFormat::format(std::ostream &str) const { const std::string::size_type size = m_s.size(); - for (std::string::size_type i = 0; i < size; i++) + for (std::string::size_type i = 0; i < size; ++i) formatGdbmiChar(str, wchar_t(m_s.at(i))); } void gdbmiWStringFormat::format(std::ostream &str) const { const std::wstring::size_type size = m_w.size(); - for (std::wstring::size_type i = 0; i < size; i++) + for (std::wstring::size_type i = 0; i < size; ++i) formatGdbmiChar(str, m_w.at(i)); } @@ -171,7 +171,7 @@ std::string wStringToString(const std::wstring &w) const std::string::size_type size = w.size(); std::string rc; rc.reserve(size); - for (std::string::size_type i = 0; i < size; i++) + for (std::string::size_type i = 0; i < size; ++i) rc.push_back(char(w.at(i))); return rc; } @@ -183,7 +183,7 @@ std::wstring stringToWString(const std::string &w) const std::wstring::size_type size = w.size(); std::wstring rc; rc.reserve(size); - for (std::wstring::size_type i = 0; i < size; i++) + for (std::wstring::size_type i = 0; i < size; ++i) rc.push_back(w.at(i)); return rc; } diff --git a/src/libs/qtcreatorcdbext/symbolgroup.cpp b/src/libs/qtcreatorcdbext/symbolgroup.cpp index afdf16048e0..fede88a6caa 100644 --- a/src/libs/qtcreatorcdbext/symbolgroup.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroup.cpp @@ -278,12 +278,12 @@ static inline InamePathEntrySet expandEntrySet(const std::vector<std::string> &n InamePathEntrySet pathEntries; const std::string::size_type rootSize = root.size(); const VectorIndexType nodeCount = nodes.size(); - for (VectorIndexType i= 0; i < nodeCount; i++) { + for (VectorIndexType i= 0; i < nodeCount; ++i) { const std::string &iname = nodes.at(i); // Silently skip items of another group if (iname.size() >= rootSize && iname.compare(0, rootSize, root) == 0) { std::string::size_type pos = 0; // Split a path 'local.foo' and insert (0,'local'), (1,'local.foo') (see above) - for (unsigned level = 0; pos < iname.size(); level++) { + for (unsigned level = 0; pos < iname.size(); ++level) { std::string::size_type dotPos = iname.find(SymbolGroupNodeVisitor::iNamePathSeparator, pos); if (dotPos == std::string::npos) dotPos = iname.size(); @@ -797,7 +797,7 @@ WatchesSymbolGroup::InameExpressionMap // Skip additional, expanded nodes InameExpressionMap rc; if (unsigned size = unsigned(root()->children().size())) { - for (unsigned i = 0; i < size; i++) { + for (unsigned i = 0; i < size; ++i) { const AbstractSymbolGroupNode *n = root()->childAt(i); if (n->testFlags(SymbolGroupNode::WatchNode)) rc.insert(InameExpressionMap::value_type(n->iName(), n->name())); diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp index 32d97fdabde..285be1dbc3a 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp @@ -47,7 +47,7 @@ enum { BufSize = 2048 }; static inline void indentStream(std::ostream &str, unsigned depth) { - for (unsigned d = 0; d < depth; d++) + for (unsigned d = 0; d < depth; ++d) str << " "; } @@ -126,7 +126,7 @@ unsigned AbstractSymbolGroupNode::indexByIName(const char *n) const { const AbstractSymbolGroupNodePtrVector &c = children(); const VectorIndexType size = c.size(); - for (VectorIndexType i = 0; i < size; i++) + for (VectorIndexType i = 0; i < size; ++i) if ( c.at(i)->iName() == n ) return unsigned(i); return unsigned(-1); @@ -170,7 +170,7 @@ bool AbstractSymbolGroupNode::accept(SymbolGroupNodeVisitor &visitor, case SymbolGroupNodeVisitor::VisitContinue: { const AbstractSymbolGroupNodePtrVector &c = children(); const unsigned childCount = unsigned(c.size()); - for (unsigned i = 0; i < childCount; i++) + for (unsigned i = 0; i < childCount; ++i) if (c.at(i)->accept(visitor, fullIname, i, childDepth)) return true; if (!invisibleRoot) @@ -698,7 +698,7 @@ void SymbolGroupNode::parseParameters(VectorIndexType index, names.reserve(size); // Pass 1) Determine names. We need the complete set first in order to do some corrections. const VectorIndexType startIndex = isTopLevel ? 0 : index + 1; - for (VectorIndexType pos = startIndex - parameterOffset; pos < size ; pos++ ) { + for (VectorIndexType pos = startIndex - parameterOffset; pos < size ; ++pos) { if (vec.at(pos).ParentSymbol == index) { const VectorIndexType symbolGroupIndex = pos + parameterOffset; if (FAILED(m_symbolGroup->debugSymbolGroup()->GetSymbolName(ULONG(symbolGroupIndex), buf, BufSize, &obtainedSize))) @@ -711,7 +711,7 @@ void SymbolGroupNode::parseParameters(VectorIndexType index, fixNames(isTopLevel, &names, &inames); // Pass 3): Add nodes with fixed names StringVector::size_type nameIndex = 0; - for (VectorIndexType pos = startIndex - parameterOffset; pos < size ; pos++ ) { + for (VectorIndexType pos = startIndex - parameterOffset; pos < size ; ++pos) { if (vec.at(pos).ParentSymbol == index) { const VectorIndexType symbolGroupIndex = pos + parameterOffset; SymbolGroupNode *child = new SymbolGroupNode(m_symbolGroup, @@ -1173,7 +1173,7 @@ ULONG SymbolGroupNode::nextSymbolIndex() const const AbstractSymbolGroupNodePtrVector &siblings = sParent->children(); // Find any 'real' SymbolGroupNode to our right. const unsigned size = unsigned(siblings.size()); - for (unsigned i = myIndex + 1; i < size; i++) + for (unsigned i = myIndex + 1; i < size; ++i) if (const SymbolGroupNode *s = siblings.at(i)->asSymbolGroupNode()) return s->index(); return sParent->nextSymbolIndex(); diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index bd1c22a600f..eccf4beea02 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -99,7 +99,7 @@ static void formatNodeError(const AbstractSymbolGroupNode *n, std::ostream &os) } if (size) { os << "children (" << size << "): ["; - for (VectorIndexType i = 0; i < size; i++) + for (VectorIndexType i = 0; i < size; ++i) os << ' ' << children.at(i)->name(); os << ']'; } else { diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp index 3e2c1eb42a5..130afc66165 100644 --- a/src/plugins/analyzerbase/analyzersettings.cpp +++ b/src/plugins/analyzerbase/analyzersettings.cpp @@ -48,7 +48,7 @@ using namespace Analyzer; using namespace Analyzer::Internal; -static const QLatin1String groupC("Analyzer"); +static const char groupC[] = "Analyzer"; AnalyzerGlobalSettings *AnalyzerGlobalSettings::m_instance = 0; @@ -125,7 +125,7 @@ void AnalyzerGlobalSettings::readSettings() QVariantMap map; - settings->beginGroup(groupC); + settings->beginGroup(QLatin1String(groupC)); // read the values from config, using the keys from the defaults value map const QVariantMap def = defaults(); for (QVariantMap::ConstIterator it = def.constBegin(); it != def.constEnd(); ++it) @@ -139,7 +139,7 @@ void AnalyzerGlobalSettings::readSettings() void AnalyzerGlobalSettings::writeSettings() const { QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(groupC); + settings->beginGroup(QLatin1String(groupC)); const QVariantMap map = toMap(); for (QVariantMap::ConstIterator it = map.begin(); it != map.end(); ++it) settings->setValue(it.key(), it.value()); diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index 8524c535f29..d58e196f51f 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -75,7 +75,7 @@ public: virtual QString displayName() const = 0; /** - * The mode in which this tool should be run preferrably + * The mode in which this tool should preferably be run * * memcheck, for example, requires debug symbols, hence DebugMode is preferred. * otoh callgrind should look at optimized code, hence ReleaseMode. diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index a451e2ad5da..6896dd20ede 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -436,7 +436,7 @@ ParserTreeItem::ConstPtr Parser::getParseDocumentTree(const CPlusPlus::Document: ParserTreeItem::Ptr itemPtr(new ParserTreeItem()); unsigned total = doc->globalSymbolCount(); - for (unsigned i = 0; i < total; i++) + for (unsigned i = 0; i < total; ++i) addSymbol(itemPtr, doc->globalSymbolAt(i)); QWriteLocker locker(&d_ptr->docLocker); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 5f802dc268d..48c46a8e7d2 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -484,9 +484,9 @@ ActionContainer *ActionManagerPrivate::actionContainer(int uid) const return it.value(); } -static const char *settingsGroup = "KeyBindings"; -static const char *idKey = "ID"; -static const char *sequenceKey = "Keysequence"; +static const char settingsGroup[] = "KeyBindings"; +static const char idKey[] = "ID"; +static const char sequenceKey[] = "Keysequence"; void ActionManagerPrivate::initialize() { diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index c73262dc609..b2004b9892a 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -85,10 +85,10 @@ enum { debugEditorManager=0 }; -static const char * const kCurrentDocumentFilePath = "CurrentDocument:FilePath"; -static const char * const kCurrentDocumentPath = "CurrentDocument:Path"; -static const char * const kCurrentDocumentXPos = "CurrentDocument:XPos"; -static const char * const kCurrentDocumentYPos = "CurrentDocument:YPos"; +static const char kCurrentDocumentFilePath[] = "CurrentDocument:FilePath"; +static const char kCurrentDocumentPath[] = "CurrentDocument:Path"; +static const char kCurrentDocumentXPos[] = "CurrentDocument:XPos"; +static const char kCurrentDocumentYPos[] = "CurrentDocument:YPos"; static inline ExtensionSystem::PluginManager *pluginManager() { @@ -1794,8 +1794,8 @@ bool EditorManager::restoreState(const QByteArray &state) return true; } -static const char * const documentStatesKey = "EditorManager/DocumentStates"; -static const char * const reloadBehaviorKey = "EditorManager/ReloadBehavior"; +static const char documentStatesKey[] = "EditorManager/DocumentStates"; +static const char reloadBehaviorKey[] = "EditorManager/ReloadBehavior"; void EditorManager::saveSettings() { diff --git a/src/plugins/cppeditor/cppchecksymbols.cpp b/src/plugins/cppeditor/cppchecksymbols.cpp index b3c99c5a92a..3846e49cffb 100644 --- a/src/plugins/cppeditor/cppchecksymbols.cpp +++ b/src/plugins/cppeditor/cppchecksymbols.cpp @@ -787,8 +787,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast) accept(ast->function_body); const LocalSymbols locals(_doc, ast); - QList<SemanticInfo::Use> uses; - foreach (uses, locals.uses) { + foreach (const QList<SemanticInfo::Use> &uses, locals.uses) { foreach (const SemanticInfo::Use &u, uses) addUse(u); } diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index f7b12393b9f..46dcba57aba 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -937,7 +937,7 @@ void CodeFormatter::dump() const qDebug() << "Current token index" << m_tokenIndex; qDebug() << "Current state:"; - foreach (State s, m_currentState) { + foreach (const State &s, m_currentState) { qDebug() << metaEnum.valueToKey(s.type) << s.savedIndentDepth << s.savedPaddingDepth; } qDebug() << "Current indent depth:" << m_indentDepth; diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp index d691189cdbf..d8f585c3614 100644 --- a/src/plugins/debugger/debuggerstreamops.cpp +++ b/src/plugins/debugger/debuggerstreamops.cpp @@ -83,7 +83,7 @@ QDataStream &operator>>(QDataStream &stream, Threads &threads) quint64 count; stream >> count; threads.clear(); - for (quint64 i = 0; i < count; i++) + for (quint64 i = 0; i < count; ++i) { ThreadData d; stream >> d; @@ -136,7 +136,7 @@ QDataStream &operator>>(QDataStream &stream, StackFrames &frames) quint64 count; stream >> count; frames.clear(); - for (quint64 i = 0; i < count; i++) + for (quint64 i = 0; i < count; ++i) { StackFrame s; stream >> s; @@ -284,7 +284,7 @@ QDataStream &operator>>(QDataStream& stream, DisassemblerLine &o) QDataStream &operator<<(QDataStream& stream, const DisassemblerLines &o) { stream << quint64(o.size()); - for (int i = 0; i < o.size(); i++) + for (int i = 0; i < o.size(); ++i) { stream << o.at(i); } diff --git a/src/plugins/debugger/gdb/codagdbadapter.cpp b/src/plugins/debugger/gdb/codagdbadapter.cpp index 6e1caaa0ece..b55d8572248 100644 --- a/src/plugins/debugger/gdb/codagdbadapter.cpp +++ b/src/plugins/debugger/gdb/codagdbadapter.cpp @@ -1117,7 +1117,7 @@ void CodaGdbAdapter::setupInferior() // Compile additional libraries. QStringList libraries; const unsigned libraryCount = sizeof(librariesC)/sizeof(char *); - for (unsigned i = 0; i < libraryCount; i++) + for (unsigned i = 0; i < libraryCount; ++i) libraries.push_back(QString::fromAscii(librariesC[i])); m_codaDevice->sendProcessStartCommand( diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp index 81f06902c5a..8037a899ee7 100644 --- a/src/plugins/designer/codemodelhelpers.cpp +++ b/src/plugins/designer/codemodelhelpers.cpp @@ -97,7 +97,7 @@ SearchFunction::FunctionList SearchFunction::operator()(const DocumentPtr &doc) { m_matches.clear(); const unsigned globalSymbolCount = doc->globalSymbolCount(); - for (unsigned i = 0; i < globalSymbolCount; i++) + for (unsigned i = 0; i < globalSymbolCount; ++i) accept(doc->globalSymbolAt(i)); return m_matches; } diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 94a19008d0c..763197343c7 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -845,8 +845,8 @@ void FormEditorW::print() const double maxScaling = qMin(page.size().width() / pixmapSize.width(), page.size().height() / pixmapSize.height()); const double scaling = qMin(suggestedScaling, maxScaling); - const double xOffset = page.left() + qMax(0.0, (page.size().width() - scaling * pixmapSize.width()) / 2.0); - const double yOffset = page.top() + qMax(0.0, (page.size().height() - scaling * pixmapSize.height()) / 2.0); + const double xOffset = page.left() + qMax(qreal(0.0), (page.size().width() - scaling * pixmapSize.width()) / 2.0); + const double yOffset = page.top() + qMax(qreal(0.0), (page.size().height() - scaling * pixmapSize.height()) / 2.0); // Draw. painter.translate(xOffset, yOffset); diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 368dcdc381c..3a38e099c56 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -182,13 +182,13 @@ static const Class *findClass(const Namespace *parentNameSpace, const QString &c const Overview o; const unsigned namespaceMemberCount = parentNameSpace->memberCount(); - for (unsigned i = 0; i < namespaceMemberCount; i++) { // we go through all namespace members + for (unsigned i = 0; i < namespaceMemberCount; ++i) { // we go through all namespace members const Symbol *sym = parentNameSpace->memberAt(i); // we have found a class - we are interested in classes only if (const Class *cl = sym->asClass()) { // 1) we go through class members const unsigned classMemberCount = cl->memberCount(); - for (unsigned j = 0; j < classMemberCount; j++) + for (unsigned j = 0; j < classMemberCount; ++j) if (const Declaration *decl = cl->memberAt(j)->asDeclaration()) { // we want to know if the class contains a member (so we look into // a declaration) of uiClassName type diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index ce717d13acc..c294be06597 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -164,7 +164,7 @@ void FindPlugin::filterChanged() QTC_ASSERT(action, return); action->setEnabled(changedFilter->isEnabled()); bool haveEnabledFilters = false; - foreach (IFindFilter *filter, d->m_filterActions.keys()) { + foreach (const IFindFilter *filter, d->m_filterActions.keys()) { if (filter->isEnabled()) { haveEnabledFilters = true; break; diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index 65a13b09585..d871502eeec 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -327,7 +327,7 @@ void CentralWidget::highlightSearchTerms() case QHelpSearchQuery::DEFAULT: case QHelpSearchQuery::ATLEAST: foreach (QString term, query.wordList) - terms.append(term.remove(QLatin1String("\""))); + terms.append(term.remove(QLatin1Char('"'))); } } } diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp index 87fa2ff6090..31fee84e276 100644 --- a/src/plugins/help/helpviewer_qwv.cpp +++ b/src/plugins/help/helpviewer_qwv.cpp @@ -294,7 +294,7 @@ void HelpViewer::scaleUp() void HelpViewer::scaleDown() { - setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - 0.1)); + setTextSizeMultiplier(qMax(qreal(0.0), textSizeMultiplier() - 0.1)); } void HelpViewer::resetScale() diff --git a/src/plugins/macros/macroevent.cpp b/src/plugins/macros/macroevent.cpp index de9c35566a4..baac189915a 100644 --- a/src/plugins/macros/macroevent.cpp +++ b/src/plugins/macros/macroevent.cpp @@ -42,7 +42,7 @@ using namespace Macros; \class Macros::MacroEvent \brief Represents an event in a macro - An event stores informations so it can be replayed. An event can be: + An event stores information so it can be replayed. An event can be: \list \o menu action \o key event on an editor diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index a801478d865..ebe5b8c1ef4 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -224,7 +224,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro) if (error) { QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Playing Macro"), - tr("An error occured while replaying the macro, execution stopped.")); + tr("An error occurred while replaying the macro, execution stopped.")); } // Set the focus back to the editor diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp index a936d84aa54..6a22c574ad1 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp @@ -153,7 +153,7 @@ QString BaseProjectWizardDialog::uniqueProjectName(const QString &path) //: File path suggestion for a new project. If you choose //: to translate it, make sure it is a valid path name without blanks. const QString prefix = tr("untitled"); - for (unsigned i = 0; ; i++) { + for (unsigned i = 0; ; ++i) { QString name = prefix; if (i) name += QString::number(i); diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index ccd04a68bc0..b3f06b82726 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -93,7 +93,7 @@ void BuildStepListWidget::init(BuildStepList *bsl) setupUi(); - foreach(BuildStepsWidgetStruct s, m_buildSteps) { + foreach (const BuildStepsWidgetStruct &s, m_buildSteps) { delete s.widget; delete s.detailsWidget; } diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 04f62d16edd..25578eeb410 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -87,7 +87,7 @@ static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const return QByteArray(); } - return cpp.readAllStandardOutput() + "\n" + cpp.readAllStandardError(); + return cpp.readAllStandardOutput() + '\n' + cpp.readAllStandardError(); } static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env) diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp index 9900ea59010..90927f09f27 100644 --- a/src/plugins/projectexplorer/gnumakeparser.cpp +++ b/src/plugins/projectexplorer/gnumakeparser.cpp @@ -41,7 +41,7 @@ using namespace ProjectExplorer; namespace { - // optional full path, make executable name, optional exe extention, optional number in square brackets, colon space + // optional full path, make executable name, optional exe extension, optional number in square brackets, colon space const char * const MAKE_PATTERN("^(([A-Za-z]:)?[/\\\\][^:]*[/\\\\])?(mingw(32|64)-|g)?make(.exe)?(\\[\\d+\\])?:\\s"); } diff --git a/src/plugins/projectexplorer/gnumakeparser.h b/src/plugins/projectexplorer/gnumakeparser.h index 041c36c95d9..89fea75b6ba 100644 --- a/src/plugins/projectexplorer/gnumakeparser.h +++ b/src/plugins/projectexplorer/gnumakeparser.h @@ -83,7 +83,7 @@ class GnuMakeParserTester : public QObject Q_OBJECT public: - GnuMakeParserTester(GnuMakeParser *parser, QObject *parent = 0); + explicit GnuMakeParserTester(GnuMakeParser *parser, QObject *parent = 0); QStringList directories; GnuMakeParser *parser; diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 8da566198ad..f244de3612d 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -722,7 +722,7 @@ QString MsvcToolChain::autoDetectCdbDebugger(QStringList *checkedDirectories /* // Try the post fixes QString outPath; - for (unsigned i = 0; i < sizeof(postFixes)/sizeof(const char*); i++) { + for (unsigned i = 0; i < sizeof(postFixes)/sizeof(const char*); ++i) { outPath = checkCdbExecutable(programDir, QLatin1String(postFixes[i]), checkedDirectories); if (!outPath.isEmpty()) return outPath; @@ -739,7 +739,7 @@ QString MsvcToolChain::autoDetectCdbDebugger(QStringList *checkedDirectories /* // A 32bit process on 64 bit sees "ProgramFiles\Debg.. (x64)". if (programDir.endsWith(QLatin1String(" (x86)"))) { const QString programDir64 = programDir.left(programDir.size() - 6); - for (unsigned i = 0; i < sizeof(postFixes)/sizeof(const char*); i++) { + for (unsigned i = 0; i < sizeof(postFixes)/sizeof(const char*); ++i) { outPath = checkCdbExecutable(programDir64, QLatin1String(postFixes[i]), checkedDirectories); if (!outPath.isEmpty()) return outPath; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 3be417350d5..f7bf471bd1b 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1669,7 +1669,7 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QStringList stepIds) { if (debug) { QStringList projectNames; - foreach (Project *p, projects) + foreach (const Project *p, projects) projectNames << p->displayName(); qDebug() << "Building" << stepIds << "for projects" << projectNames; } diff --git a/src/plugins/qmldesigner/components/formeditor/anchorlinecontroller.cpp b/src/plugins/qmldesigner/components/formeditor/anchorlinecontroller.cpp index c67194d2e7f..c1ea445c4c4 100644 --- a/src/plugins/qmldesigner/components/formeditor/anchorlinecontroller.cpp +++ b/src/plugins/qmldesigner/components/formeditor/anchorlinecontroller.cpp @@ -170,8 +170,8 @@ void AnchorLineController::updatePosition() rightBoundingRect.adjust(0, 7, 5, -7); } else { - double height = qMin(boundingRect.height() / 4., 10.); - double width = qMin(boundingRect.width() / 4., 10.); + double height = qMin(boundingRect.height() / 4., qreal(10.0)); + double width = qMin(boundingRect.width() / 4., qreal(10.0)); topBoundingRect.setHeight(height); topBoundingRect.adjust(width, -4, -width, -1); diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp index 5bb4daa9e13..d4726e77879 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp @@ -189,7 +189,7 @@ void DesignDocumentControllerView::fromText(QString text) inputModel->setFileUrl(model()->fileUrl()); QPlainTextEdit textEdit; QString imports; - foreach (Import import, model()->imports()) + foreach (const Import &import, model()->imports()) imports += import.toString() + ";\n"; textEdit.setPlainText(imports + text); diff --git a/src/plugins/qmldesigner/components/logger/logger.cpp b/src/plugins/qmldesigner/components/logger/logger.cpp index 80961fac95b..5b3a331ae66 100644 --- a/src/plugins/qmldesigner/components/logger/logger.cpp +++ b/src/plugins/qmldesigner/components/logger/logger.cpp @@ -106,13 +106,13 @@ void QLogger::flush() instance()->m_lastFlush = QTime::currentTime().elapsed(); if (instance()->m_file) { foreach (QString s, instance()->m_buffer) { - s += QLatin1String("\n"); + s += QLatin1Char('\n'); instance()->m_file->write (s.toAscii()); } instance()->m_file->flush(); } else { foreach ( QString s, instance()->m_buffer) { - s += QLatin1String("\n"); + s += QLatin1Char('\n'); #ifdef Q_OS_WIN OutputDebugStringW((TCHAR*)s.utf16()); #else diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index d071176da9b..98bdec42f9a 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -221,7 +221,7 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n } QMap<QString, QStandardItem *> propertyItems; - foreach (QString propertyName, visibleProperties(node)) { + foreach (const QString &propertyName, visibleProperties(node)) { QStandardItem *propertyItem = new QStandardItem; propertyItem->setSelectable(false); propertyItem->setDragEnabled(false); @@ -572,7 +572,7 @@ QList<ModelNode> NavigatorTreeModel::modelNodeChildren(const ModelNode &parentNo properties << visibleProperties(parentNode); - foreach (QString propertyName, properties) { + foreach (const QString &propertyName, properties) { AbstractProperty property(parentNode.property(propertyName)); if (property.isNodeProperty()) children << property.toNodeProperty().modelNode(); diff --git a/src/plugins/qmldesigner/designercore/instances/instancecontainer.cpp b/src/plugins/qmldesigner/designercore/instances/instancecontainer.cpp index eda8282da5c..c1ba4fb24dd 100644 --- a/src/plugins/qmldesigner/designercore/instances/instancecontainer.cpp +++ b/src/plugins/qmldesigner/designercore/instances/instancecontainer.cpp @@ -42,7 +42,7 @@ InstanceContainer::InstanceContainer() InstanceContainer::InstanceContainer(qint32 instanceId, const QString &type, int majorNumber, int minorNumber, const QString &componentPath) : m_instanceId(instanceId), m_type(type), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath) { - m_type.replace(".", "/"); + m_type.replace(QLatin1Char('.'), QLatin1Char('/')); } qint32 InstanceContainer::instanceId() const diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index f393dbd095d..c5e44e7de66 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -161,7 +161,7 @@ QStringList prototypes(const Interpreter::ObjectValue *ov, LookupContext::Ptr co ' ' + QString::number(qmlValue->version().majorVersion()) + '.' + QString::number(qmlValue->version().minorVersion()); } else { - list << qmlValue->packageName() + "." + qmlValue->className(); + list << qmlValue->packageName() + QLatin1Char('.') + qmlValue->className(); } } else { if (versions) { diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index eb950f721af..85b5e2ef836 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -135,8 +135,8 @@ void SubComponentManagerPrivate::addImport(int pos, const Import &import) url.replace(QLatin1Char('.'), QLatin1Char('/')); - foreach(const QString path, importPaths()) { - url = path + QLatin1String("/") + url; + foreach (const QString &path, importPaths()) { + url = path + QLatin1Char('/') + url; QFileInfo dirInfo = QFileInfo(url); if (dirInfo.exists() && dirInfo.isDir()) { const QString canonicalDirPath = dirInfo.canonicalFilePath(); @@ -189,9 +189,9 @@ void SubComponentManagerPrivate::parseDirectories() } } else { QString url = import.url(); - foreach(const QString path, importPaths()) { + foreach (const QString &path, importPaths()) { url.replace(QLatin1Char('.'), QLatin1Char('/')); - url = path + QLatin1String("/") + url; + url = path + QLatin1Char('/') + url; QFileInfo dirInfo = QFileInfo(url); if (dirInfo.exists() && dirInfo.isDir()) { //### todo full qualified names QString nameSpace = import.uri(); diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 76ef2d624f1..f61f970edc3 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -231,7 +231,7 @@ QmlPropertyChanges QmlObjectNode::propertyChangeForCurrentState() const static void removeStateOperationsForChildren(const QmlObjectNode &node) { if (node.isValid()) { - foreach (QmlModelStateOperation stateOperation, node.allAffectingStatesOperations()) { + foreach (const QmlModelStateOperation &stateOperation, node.allAffectingStatesOperations()) { stateOperation.modelNode().destroy(); //remove of belonging StatesOperations } @@ -252,7 +252,7 @@ void QmlObjectNode::destroy() if (!isValid()) throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - foreach (QmlModelStateOperation stateOperation, allAffectingStatesOperations()) { + foreach (const QmlModelStateOperation &stateOperation, allAffectingStatesOperations()) { stateOperation.modelNode().destroy(); //remove of belonging StatesOperations } removeStateOperationsForChildren(modelNode()); diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index f64cd8c4155..437aa726766 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -369,7 +369,7 @@ public: void operator()(quint32 offset) { - _name = QString::null; + _name.clear(); _scope = 0; _objectNode = 0; _offset = offset; @@ -551,7 +551,7 @@ public: // find all idenfifier expressions, try to resolve them and check if the result is in scope FindUsages findUsages(doc, snapshot, &contextCopy); FindUsages::Result results = findUsages(name, scope); - foreach (AST::SourceLocation loc, results) + foreach (const AST::SourceLocation &loc, results) usages.append(Usage(fileName, matchingLine(loc.offset, doc->source()), loc.startLine, loc.startColumn - 1, loc.length)); return usages; diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index 2eb8aa6b1e5..522d231055d 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -245,7 +245,7 @@ void InspectorUi::showDebuggerTooltip(const QPoint &mousePos, TextEditor::ITextE if ((qmlNode->kind == QmlJS::AST::Node::Kind_IdentifierExpression) && (m_clientProxy->objectReferenceForId(refToLook).debugId() == -1)) { query = doubleQuote + QString("local: ") + refToLook + doubleQuote; - foreach (QDeclarativeDebugPropertyReference property, ref.properties()) { + foreach (const QDeclarativeDebugPropertyReference &property, ref.properties()) { if (property.name() == wordAtCursor && !property.valueTypeName().isEmpty()) { query = doubleQuote + property.name() + QLatin1Char(':') @@ -259,7 +259,7 @@ void InspectorUi::showDebuggerTooltip(const QPoint &mousePos, TextEditor::ITextE + QLatin1Char('+') + refToLook; } else { // show properties - foreach (QDeclarativeDebugPropertyReference property, ref.properties()) { + foreach (const QDeclarativeDebugPropertyReference &property, ref.properties()) { if (property.name() == wordAtCursor && !property.valueTypeName().isEmpty()) { query = doubleQuote + property.name() + QLatin1Char(':') + doubleQuote + QLatin1Char('+') + property.name(); diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp index d8e9d8251e5..bbf995006e1 100644 --- a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp +++ b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp @@ -638,12 +638,12 @@ void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy) connect(m_clientProxy.data(), SIGNAL(objectTreeUpdated()), SLOT(updateDebugIds())); - foreach(QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> qmlEditor, m_editors) { + foreach (const QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> &qmlEditor, m_editors) { if (qmlEditor) qmlEditor.data()->setUpdateSelectedElements(true); } } else { - foreach(QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> qmlEditor, m_editors) { + foreach (const QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> &qmlEditor, m_editors) { if (qmlEditor) qmlEditor.data()->setUpdateSelectedElements(false); } diff --git a/src/plugins/qmljsinspector/qmljspropertyinspector.cpp b/src/plugins/qmljsinspector/qmljspropertyinspector.cpp index f1bb48ca642..51ba7866378 100644 --- a/src/plugins/qmljsinspector/qmljspropertyinspector.cpp +++ b/src/plugins/qmljsinspector/qmljspropertyinspector.cpp @@ -278,7 +278,7 @@ void QmlJSPropertyInspector::setCurrentObjects(const QList<QDeclarativeDebugObje clear(); - foreach ( QDeclarativeDebugObjectReference obj, objectList) { + foreach (const QDeclarativeDebugObjectReference &obj, objectList) { m_currentObjects << obj.debugId(); buildPropertyTree(obj); } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 08f943e0554..0b1ba21c26c 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -181,7 +181,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles, m_synchronizer.clearFutures(); - foreach (QFuture<void> future, futures) { + foreach (const QFuture<void> &future, futures) { if (! (future.isFinished() || future.isCanceled())) m_synchronizer.addFuture(future); } @@ -526,7 +526,7 @@ bool ModelManager::matchesMimeType(const Core::MimeType &fileMimeType, const Cor const QStringList knownTypeNames = QStringList(knownMimeType.type()) + knownMimeType.aliases(); - foreach (const QString knownTypeName, knownTypeNames) + foreach (const QString &knownTypeName, knownTypeNames) if (fileMimeType.matchesType(knownTypeName)) return true; diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index ae6d1399995..d2763af08e2 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -336,7 +336,7 @@ bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const if (abi.os() == ProjectExplorer::Abi::SymbianOS || abi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor) { if (reason) - *reason = QString(); + reason->clear(); // *reason = tr("Qml debugging on device not yet supported."); return false; } diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp index 554ffddf920..7cfe40f2070 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp @@ -84,7 +84,7 @@ bool adaptTagValue(QByteArray &document, const QByteArray &fieldName, const QByteArray &newFieldValue, bool caseSensitive) { QByteArray adaptedLine = fieldName + ": " + newFieldValue; - const QByteArray completeTag = fieldName + ":"; + const QByteArray completeTag = fieldName + ':'; const int lineOffset = caseSensitive ? document.indexOf(completeTag) : document.toLower().indexOf(completeTag.toLower()); if (lineOffset == -1) { diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp index eea0141e312..57331e17ab8 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp @@ -164,11 +164,11 @@ void S60PublisherOvi::completeCreation() QStringList vendorInfoVars; QStringList valueLevelVars; - foreach (QString deploymentLevelVar, deploymentLevelVars) { + foreach (const QString &deploymentLevelVar, deploymentLevelVars) { vendorInfoVars = m_reader->values(deploymentLevelVar+".pkg_prerules"); - foreach(QString vendorInfoVar, vendorInfoVars) { + foreach (const QString &vendorInfoVar, vendorInfoVars) { valueLevelVars = m_reader->values(vendorInfoVar); - foreach(QString valueLevelVar, valueLevelVars) { + foreach (const QString &valueLevelVar, valueLevelVars) { if (valueLevelVar.startsWith("%{\"")) { m_vendorInfoVariable = vendorInfoVar; break; @@ -184,7 +184,7 @@ QString S60PublisherOvi::globalVendorName() const foreach (QString vendorinfo, vendorinfos) { if (vendorinfo.startsWith(':')) { - return vendorinfo.remove(':').remove("\"").trimmed(); + return vendorinfo.remove(':').remove('"').trimmed(); } } return QString(); diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 9066ec1b125..6aed969e18a 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -466,7 +466,7 @@ void Qt4BuildConfiguration::qtVersionsChanged(const QList<int> &changedVersions) return; if (!qtVersion()->isValid()) pickValidQtVersion(); - emit environmentChanged(); // Our qt version changed, that might have changed the environemnt + emit environmentChanged(); // Our qt version changed, that might have changed the environment } // returns true if both are equal diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index f0336ec5e64..552c34e5ee3 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -130,7 +130,7 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(Qt4NodeStaticData, qt4NodeStaticData, { // Overlay the SP_DirIcon with the custom icons const QSize desiredSize = QSize(16, 16); - for (unsigned i = 0 ; i < count; i++) { + for (unsigned i = 0 ; i < count; ++i) { const QIcon overlayIcon = QIcon(QLatin1String(fileTypeDataStorage[i].icon)); const QPixmap folderPixmap = Core::FileIconProvider::overlayIcon(QStyle::SP_DirIcon, diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp index 0eab5637d2b..415294e0e37 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp @@ -50,7 +50,7 @@ static const char *mainCppC = " return a.exec();\n" "}\n"; -static const char *mainSourceFileC = "main"; +static const char mainSourceFileC[] = "main"; namespace Qt4ProjectManager { namespace Internal { diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp index 653395af2b8..2f8e7a87e32 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp @@ -45,7 +45,7 @@ #include <QtCore/QTextStream> #include <QtGui/QIcon> -static const char *sharedHeaderPostfixC = "_global"; +static const char sharedHeaderPostfixC[] = "_global"; namespace Qt4ProjectManager { diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp index 3b89785a09b..6f5ab47f959 100644 --- a/src/plugins/texteditor/generichighlighter/highlighter.cpp +++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp @@ -390,12 +390,12 @@ void Highlighter::applyFormat(int offset, if (cit != m_creatorFormats.constEnd()) { QTextCharFormat format = cit.value(); if (itemData->isCustomized()) { - // Please notice that the following are applied every time for item datas which have + // Please notice that the following are applied every time for item data which have // customizations. The configureFormats method could be used to provide a "one time" - // configuration, but it would probably require to traverse all item datas from all + // configuration, but it would probably require to traverse all item data from all // definitions available/loaded (either to set the values or for some "notifying" // strategy). This is because the highlighter does not really know on which - // definition(s) it is working. Since not many item datas specify customizations I + // definition(s) it is working. Since not many item data specify customizations I // think this approach would fit better. If there are other ideas... if (itemData->color().isValid()) format.setForeground(itemData->color()); diff --git a/src/tools/gen-cpp-ast/generate-ast.cpp b/src/tools/gen-cpp-ast/generate-ast.cpp index c59bda9a2ce..7d51a82b147 100644 --- a/src/tools/gen-cpp-ast/generate-ast.cpp +++ b/src/tools/gen-cpp-ast/generate-ast.cpp @@ -1505,13 +1505,11 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir) out << ")" << endl << " {" << endl - << " " << className << " *__ast = new (&pool) " << className << ";" << endl; + << " " << className << " *__ast = new (&pool) " << className << ';' << endl; - QPair<QString, QString> p; - foreach (p, args) { - out - << " __ast->" << p.second << " = " << p.second << ";" << endl; + foreach (const QPair<QString, QString> &p, args) { + out << " __ast->" << p.second << " = " << p.second << ';' << endl; } out diff --git a/src/tools/qtcreatorwidgets/customwidgets.cpp b/src/tools/qtcreatorwidgets/customwidgets.cpp index a9f6768074a..266ef52345b 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.cpp +++ b/src/tools/qtcreatorwidgets/customwidgets.cpp @@ -37,7 +37,7 @@ #include <QtDesigner/QExtensionManager> #include <QtDesigner/QDesignerFormEditorInterface> -static const char *groupC = "QtCreator"; +static const char groupC[] = "QtCreator"; NewClassCustomWidget::NewClassCustomWidget(QObject *parent) : QObject(parent), -- GitLab