Commit 88f33326 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Fix Krazy code scanning tool warnings (QString, loops, spelling).

parent 49311aa3
......@@ -127,7 +127,7 @@ static const CommandDescription commandDescriptions[] = {
"Prints local variables of symbol group in GDBMI or debug format",
"[-t token] [-v] [T formats] [-I formats] [-f debugfilter] [-c] [-h] [-d]\n[-e expand-list] [-u uninitialized-list]\n"
"[-W] [-w watch-iname watch-expression] <frame-number> [iname]\n"
"-h human-readable ouput\n"
"-h human-readable output\n"
"-v increase verboseness of dumping\n"
"-d debug output\n"
"-f debug_filter\n"
......@@ -142,7 +142,7 @@ static const CommandDescription commandDescriptions[] = {
{"watches",
"Prints watches variables of symbol group in GDBMI or debug format",
"[-t token] [-v] [T formats] [-I formats] [-f debugfilter] [-c] [-h] [-d] <iname>\n"
"-h human-readable ouput\n"
"-h human-readable output\n"
"-v increase verboseness of dumping\n"
"-d debug output\n"
"-f debug_filter\n"
......
......@@ -610,7 +610,7 @@ std::string SymbolGroupValue::resolveType(const std::string &typeIn,
// Use the module of the current symbol group for templates.
// This is because resolving some template types (std::list<> has been
// observed to result in 'QtGui4d!std::list', which subseqently fails.
// observed to result in 'QtGui4d!std::list', which subsequently fails.
if (!currentModule.empty() && stripped.find('<') != std::string::npos) {
std::string trc = currentModule;
trc.push_back('!');
......
......@@ -59,7 +59,7 @@ static QString quoteWinCommand(const QString &program)
{
const QChar doubleQuote = QLatin1Char('"');
// add the programm as the first arg ... it works better
// add the program as the first arg ... it works better
QString programName = program;
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
......
......@@ -325,7 +325,7 @@ void EnvironmentModel::unsetVariable(const QString &name)
int pos = m_d->findInChanges(name);
if (pos != -1) {
m_d->m_items[pos].unset = true;
m_d->m_items[pos].value = QString();
m_d->m_items[pos].value.clear();
m_d->updateResultEnvironment();
emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
emit userChangesChanged();
......
......@@ -500,7 +500,7 @@ bool ExternalTool::save(QString *errorMessage) const
return true;
}
bool ExternalTool::operator==(const ExternalTool &other)
bool ExternalTool::operator==(const ExternalTool &other) const
{
return m_id == other.m_id
&& m_description == other.m_description
......@@ -537,9 +537,9 @@ bool ExternalToolRunner::resolve()
{
if (!m_tool)
return false;
m_resolvedExecutable = QString::null;
m_resolvedArguments = QString::null;
m_resolvedWorkingDirectory = QString::null;
m_resolvedExecutable.clear();
m_resolvedArguments.clear();
m_resolvedWorkingDirectory.clear();
{ // executable
foreach (const QString &executable, m_tool->executables()) {
QString resolved = Utils::expandMacros(executable,
......@@ -813,7 +813,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
it.next();
ActionContainer *container = 0;
const QString &containerName = it.key();
if (containerName == QString()) { // no displayCategory, so put into external tools menu directly
if (containerName.isEmpty()) { // no displayCategory, so put into external tools menu directly
container = mexternaltools;
} else {
if (m_containers.contains(containerName)) {
......
......@@ -93,8 +93,8 @@ public:
bool save(QString *errorMessage = 0) const;
bool operator==(const ExternalTool &other);
bool operator!=(const ExternalTool &other) { return !((*this) == other); }
bool operator==(const ExternalTool &other) const;
bool operator!=(const ExternalTool &other) const { return !((*this) == other); }
ExternalTool &operator=(const ExternalTool &other);
void setId(const QString &id);
......
......@@ -339,7 +339,7 @@ void FileManager::renamedFile(const QString &from, const QString &to)
}
}
/* Removes all occurrances of the IFile from m_filesWithWatch and m_states.
/* Removes all occurrences of the IFile from m_filesWithWatch and m_states.
If that results in a file no longer being referenced by any IFile, this
also removes the file watcher.
*/
......
......@@ -112,7 +112,7 @@ public:
QList<IFile *> saveModifiedFiles(const QList<IFile *> &files,
bool *cancelled = 0,
const QString &message = QString(),
const QString &alwaysSaveMessage = QString::null,
const QString &alwaysSaveMessage = QString(),
bool *alwaysSave = 0);
......@@ -167,7 +167,7 @@ private:
QList<IFile *> saveModifiedFiles(const QList<IFile *> &files,
bool *cancelled, bool silently,
const QString &message,
const QString &alwaysSaveMessage = QString::null,
const QString &alwaysSaveMessage = QString(),
bool *alwaysSave = 0);
Internal::FileManagerPrivate *d;
......
......@@ -61,7 +61,7 @@ namespace Internal {
// breakpoint type. The controls not applicable to the current type
// (say function name for file-and-line) are disabled and cleared out.
// However,the values are saved and restored once the respective mode
// is again choosen, which is done using m_savedParameters and
// is again chosen, which is done using m_savedParameters and
// setters/getters taking the parts mask enumeration parameter.
//
///////////////////////////////////////////////////////////////////////
......
......@@ -2472,7 +2472,7 @@ static inline void formatCdbBreakPointResponse(BreakpointId id, const Breakpoint
void CdbEngine::handleBreakPoints(const CdbExtensionCommandPtr &reply)
{
if (debugBreakpoints)
qDebug("CdbEngine::handleBreakPoints: sucess=%d: %s", reply->success, reply->reply.constData());
qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData());
if (!reply->success) {
showMessage(QString::fromAscii(reply->errorMessage), LogError);
return;
......
......@@ -310,7 +310,7 @@ void ConsoleWindow::showOutput(int channel, const QString &output)
line.truncate(n);
line += QLatin1String(" [...] <cut off>");
}
m_console->appendPlainText(charForChannel(channel) + line + "\n");
m_console->appendPlainText(charForChannel(channel) + line + '\n');
}
QTextCursor cursor = m_console->textCursor();
cursor.movePosition(QTextCursor::End);
......
......@@ -271,12 +271,12 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents)
for (int i = 0, n = contents.size(); i != n; ++i) {
const DisassemblerLine &dl = contents.at(i);
if (dl.address) {
str += QString("0x");
str += QLatin1String("0x");
str += QString::number(dl.address, 16);
str += " ";
str += QLatin1String(" ");
}
str += dl.data;
str += "\n";
str += QLatin1Char('\n');
}
plainTextEdit->setPlainText(str);
plainTextEdit->setReadOnly(true);
......
......@@ -280,7 +280,7 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
if (debuggerCore()->boolSetting(AutoDerefPointers)) {
// Try automatic dereferentiation
data.exp = "(*(" + data.exp + "))";
data.type = data.type + "."; // FIXME: fragile HACK to avoid recursion
data.type = data.type + '.'; // FIXME: fragile HACK to avoid recursion
insertData(data);
} else {
data.setChildrenUnneeded();
......
......@@ -597,7 +597,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendGdbServerAck();
logMessage(_("Not implemented 'Continue with signal' %1: ").arg(signalNumber),
LogWarning);
sendGdbServerMessage("O" + QByteArray("Console output").toHex());
sendGdbServerMessage('O' + QByteArray("Console output").toHex());
sendGdbServerMessage("W81"); // "Process exited with result 1
sendTrkContinue();
}
......
......@@ -2782,7 +2782,7 @@ void GdbEngine::requestModuleSymbols(const QString &moduleName)
QString fileName = tf.fileName();
tf.close();
postCommand("maint print msymbols " + fileName.toLocal8Bit()
+ " " + moduleName.toLocal8Bit(),
+ ' ' + moduleName.toLocal8Bit(),
NeedsStop, CB(handleShowModuleSymbols),
QVariant(moduleName + QLatin1Char('@') + fileName));
}
......
......@@ -837,7 +837,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
} // qPart/qXfer
else if (cmd.startsWith("X")) {
else if (cmd.startsWith('X')) {
logMessage(msgGdbPacket(QLatin1String("Write memory")));
// X addr,length
sendGdbServerAck();
......
......@@ -350,7 +350,7 @@ void LldbEngineGuest::requestUpdateWatchData(const Internal::WatchData &data,
void LldbEngineGuest::getWatchDataR(lldb::SBValue v, int level,
const QByteArray &p_iname, QList<WatchData> &wd)
{
QByteArray iname = p_iname + "." + QByteArray(v.GetName());
QByteArray iname = p_iname + '.' + QByteArray(v.GetName());
m_localesCache.insert(QString::fromLocal8Bit(iname), v);
#if defined(HAVE_LLDB_PRIVATE)
......@@ -584,7 +584,7 @@ void LldbEngineGuest::updateThreads()
ThreadData thread;
thread.id = t.GetThreadID();
thread.targetId = QString::number(t.GetThreadID());
thread.core = QString();
thread.core.clear();
thread.state = QString::number(t.GetStopReason());
switch (t.GetStopReason()) {
......
......@@ -368,7 +368,7 @@ void QmlCppEngine::interruptInferior()
void QmlCppEngine::requestInterruptInferior()
{
EDEBUG("\nMASTER REQUEST INTERUPT INFERIOR");
EDEBUG("\nMASTER REQUEST INTERRUPT INFERIOR");
DebuggerEngine::requestInterruptInferior();
d->m_cppEngine->requestInterruptInferior();
}
......
......@@ -826,9 +826,9 @@ void QmlEngine::messageReceived(const QByteArray &message)
logMessage(LogReceive, logString);
QString msg = stackFrames.isEmpty()
? tr("<p>An Uncaught Exception occured:</p><p>%2</p>")
? tr("<p>An Uncaught Exception occurred:</p><p>%2</p>")
.arg(Qt::escape(error))
: tr("<p>An Uncaught Exception occured in <i>%1</i>:</p><p>%2</p>")
: tr("<p>An Uncaught Exception occurred in <i>%1</i>:</p><p>%2</p>")
.arg(stackFrames.value(0).file, Qt::escape(error));
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
} else {
......
......@@ -61,7 +61,7 @@ void dumpBacktrace(int maxdepth)
proc.start("addr2line", args);
proc.waitForStarted();
for (int i = 0; i < qMin(size, maxdepth); i++)
proc.write("0x" + QByteArray::number(quintptr(bt[i]), 16) + "\n");
proc.write("0x" + QByteArray::number(quintptr(bt[i]), 16) + '\n');
proc.closeWriteChannel();
QByteArray out = proc.readAllStandardOutput();
qDebug() << QCoreApplication::arguments().at(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment