Fix more krazy warnings.

This commit is contained in:
Friedemann Kleint
2011-04-19 15:42:14 +02:00
parent cca52b6d30
commit 774fa49412
66 changed files with 137 additions and 136 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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()));

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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";
}

View File

@@ -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();

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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();

View File

@@ -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 &reg = 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);

View File

@@ -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;
}

View File

@@ -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()));

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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());

View File

@@ -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.

View File

@@ -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);

View File

@@ -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()
{

View File

@@ -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()
{

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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(

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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('"')));
}
}
}

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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");
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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();

View File

@@ -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

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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());

View File

@@ -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;

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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

View File

@@ -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,

View File

@@ -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 {

View File

@@ -45,7 +45,7 @@
#include <QtCore/QTextStream>
#include <QtGui/QIcon>
static const char *sharedHeaderPostfixC = "_global";
static const char sharedHeaderPostfixC[] = "_global";
namespace Qt4ProjectManager {

View File

@@ -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());

View File

@@ -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

View File

@@ -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),