Commit 2f51579f authored by Friedemann Kleint's avatar Friedemann Kleint Committed by hjk

Debugger: Fix string usages.

- Compile with QT_NO_CAST_FROM_ASCII.
- Remove single character string constants.

Change-Id: Icece98619b6c30e047d3fce00e6ae74bbcd53c67
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 0418e6dc
......@@ -182,7 +182,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
break;
case WatchpointAtAddress: { // Read/write, no space here
const unsigned size = bp.size ? bp.size : 1;
str << "r" << size << ' ' << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
str << 'r' << size << ' ' << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
}
break;
}
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "debuggeractions.h"
#include "debuggerconstants.h"
......@@ -551,8 +553,9 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
item->setDefaultValue(true);
insertItem(ShowQmlObjectTree, item);
const QString qmlInspectorGroup = QLatin1String("QML.Inspector");
item = new SavedAction(this);
item->setSettingsKey("QML.Inspector", QLatin1String("QmlInspector.ShowAppOnTop"));
item->setSettingsKey(qmlInspectorGroup, QLatin1String("QmlInspector.ShowAppOnTop"));
item->setText(tr("Show Application On Top"));
item->setCheckable(true);
item->setDefaultValue(false);
......@@ -560,7 +563,7 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
insertItem(ShowAppOnTop, item);
item = new SavedAction(this);
item->setSettingsKey("QML.Inspector", QLatin1String("QmlInspector.FromQml"));
item->setSettingsKey(qmlInspectorGroup, QLatin1String("QmlInspector.FromQml"));
item->setText(tr("Apply Changes on Save"));
item->setCheckable(true);
item->setDefaultValue(false);
......@@ -611,7 +614,7 @@ QString DebuggerSettings::dump() const
const QString current = item->value().toString();
const QString default_ = item->defaultValue().toString();
ts << '\n' << key << ": " << current
<< " (default: " << default_ << ")";
<< " (default: " << default_ << ')';
if (current != default_)
ts << " ***";
}
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "debuggerplugin.h"
#include "debuggerstartparameters.h"
......@@ -563,7 +565,7 @@ void fillParameters(DebuggerStartParameters *sp, Profile *profile)
IDevice::ConstPtr device = DeviceProfileInformation::device(profile);
if (device) {
sp->connParams = device->sshParameters();
sp->remoteChannel = QString("%1:%2").arg(sp->connParams.host).arg(sp->connParams.port);
sp->remoteChannel = sp->connParams.host + QLatin1Char(':') + QString::number(sp->connParams.port);
}
}
......@@ -3398,7 +3400,7 @@ void DebuggerPluginPrivate::testPythonDumpers1()
{
m_testSuccess = true;
QString proFile = ICore::resourcePath()
+ "/../../tests/manual/debugger/simple/simple.pro";
+ QLatin1String("/../../tests/manual/debugger/simple/simple.pro");
testLoadProject(proFile, TestCallBack(this, "testPythonDumpers2"));
QVERIFY(m_testSuccess);
QTestEventLoop::instance().enterLoop(20);
......@@ -3430,7 +3432,7 @@ void DebuggerPluginPrivate::testStateMachine1()
{
m_testSuccess = true;
QString proFile = ICore::resourcePath()
+ "/../../tests/manual/debugger/simple/simple.pro";
+ QLatin1String("/../../tests/manual/debugger/simple/simple.pro");
testLoadProject(proFile, TestCallBack(this, "testStateMachine2"));
QVERIFY(m_testSuccess);
QTestEventLoop::instance().enterLoop(20);
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "coregdbadapter.h"
#include "debuggerstartparameters.h"
......@@ -94,7 +96,7 @@ void GdbCoreEngine::continueSetupEngine()
// Read executable from core.
ElfReader reader(coreFileName());
bool isCore = false;
m_executable = reader.readCoreName(&isCore);
m_executable = QString::fromLocal8Bit(reader.readCoreName(&isCore));
if (!isCore) {
showMessageBox(QMessageBox::Warning,
......@@ -212,7 +214,9 @@ void GdbCoreEngine::unpackCoreIfNeeded()
QProcess *process = new QProcess(this);
process->setWorkingDirectory(QDir::tempPath());
process->start("/usr/bin/lzop", QStringList() << "-o" << m_tempCoreName << "-x" << m_coreName);
QStringList arguments;
arguments << QLatin1String("-o") << m_tempCoreName << QLatin1String("-x") << m_coreName;
process->start(QLatin1String("/usr/bin/lzop"), arguments);
connect(process, SIGNAL(finished(int)), SLOT(continueSetupEngine()));
}
......
......@@ -129,7 +129,7 @@ void GdbServerStarter::portListReady()
connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
QByteArray cmd = "/usr/bin/gdbserver --attach :"
+ QByteArray::number(port) + " " + QByteArray::number(d->process.pid);
+ QByteArray::number(port) + ' ' + QByteArray::number(d->process.pid);
logMessage(tr("Running command: %1").arg(QString::fromLatin1(cmd)));
d->runner.run(cmd, d->device->sshParameters());
}
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "loadcoredialog.h"
#include "debuggerconstants.h"
......@@ -203,7 +205,7 @@ void SelectRemoteFileDialog::selectFile()
SLOT(handleSftpOperationFinished(QSsh::SftpJobId,QString)));
{
QTemporaryFile localFile(QDir::tempPath() + "/remotecore-XXXXXX");
QTemporaryFile localFile(QDir::tempPath() + QLatin1String("/remotecore-XXXXXX"));
localFile.open();
m_localFile = localFile.fileName();
}
......
......@@ -61,7 +61,7 @@ public:
#define DEMANGLER_ASSERT(cond) \
do { \
if (!(cond)) { \
throw InternalDemanglerException(Q_FUNC_INFO, __FILE__, __LINE__); \
throw InternalDemanglerException(QLatin1String(Q_FUNC_INFO), QLatin1String(__FILE__), __LINE__); \
} \
} while (0)
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "namedemangler.h"
#include "demanglerexceptions.h"
......@@ -61,7 +63,7 @@ bool NameDemanglerPrivate::demangle(const QString &mangledName)
m_demangledName.clear();
if (!MangledNameRule::mangledRepresentationStartsWith(m_parseState.peek())) {
m_demangledName = m_parseState.m_mangledName;
m_demangledName = QLatin1String(m_parseState.m_mangledName);
return true;
}
......@@ -76,7 +78,7 @@ bool NameDemanglerPrivate::demangle(const QString &mangledName)
// Uncomment for debugging.
//m_parseState.stackTop()->print(0);
m_demangledName = m_parseState.stackTop()->toByteArray();
m_demangledName = QLatin1String(m_parseState.stackTop()->toByteArray());
success = true;
} catch (const ParseException &p) {
m_errorString = QString::fromLocal8Bit("Parse error at index %1 of mangled name '%2': %3.")
......
......@@ -27,6 +27,9 @@
**
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "parsetreenodes.h"
#include "demanglerexceptions.h"
......@@ -50,7 +53,7 @@
#define PARSE_RULE_AND_ADD_RESULT_AS_CHILD(nodeType) \
PARSE_RULE_AND_ADD_RESULT_AS_CHILD_TO_NODE(nodeType, parseState(), this)
#define CHILD_AT(obj, index) obj->childAt(index, Q_FUNC_INFO, __FILE__, __LINE__)
#define CHILD_AT(obj, index) obj->childAt(index, QLatin1String(Q_FUNC_INFO), QLatin1String(__FILE__), __LINE__)
#define MY_CHILD_AT(index) CHILD_AT(this, index)
#define CHILD_TO_BYTEARRAY(index) MY_CHILD_AT(index)->toByteArray()
......@@ -693,7 +696,7 @@ void ExpressionNode::parse()
while (ExpressionNode::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(ExpressionNode);
if (ADVANCE() != '_')
throw ParseException("Invalid expression");
throw ParseException(QLatin1String("Invalid expression"));
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(TypeNode);
if (PEEK() == 'E')
ADVANCE();
......@@ -2074,7 +2077,7 @@ void NumberNode::parse()
{
const char next = PEEK();
if (!mangledRepresentationStartsWith(next))
throw ParseException("Invalid number");
throw ParseException(QLatin1String("Invalid number"));
if (next == 'n') {
m_isNegative = true;
......@@ -2799,15 +2802,15 @@ QByteArray LambdaSigNode::toByteArray() const
void ClosureTypeNameNode::parse()
{
if (parseState()->readAhead(2) != "Ul")
throw ParseException("Invalid closure-type-name");
throw ParseException(QLatin1String("Invalid closure-type-name"));
parseState()->advance(2);
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(LambdaSigNode);
if (ADVANCE() != 'E')
throw ParseException("invalid closure-type-name");
throw ParseException(QLatin1String("invalid closure-type-name"));
if (NonNegativeNumberNode<10>::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(NonNegativeNumberNode<10>);
if (ADVANCE() != '_')
throw ParseException("Invalid closure-type-name");
throw ParseException(QLatin1String("Invalid closure-type-name"));
}
QByteArray ClosureTypeNameNode::toByteArray() const
......@@ -2841,7 +2844,7 @@ void UnnamedTypeNameNode::parse()
if (NonNegativeNumberNode<10>::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(NonNegativeNumberNode<10>);
if (ADVANCE() != '_')
throw ParseException("Invalid unnamed-type-node");
throw ParseException(QLatin1String("Invalid unnamed-type-node"));
} else {
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(ClosureTypeNameNode);
}
......@@ -2877,7 +2880,7 @@ void DeclTypeNode::parse()
{
const QByteArray start = parseState()->readAhead(2);
if (start != "DT" && start != "Dt")
throw ParseException("Invalid decltype");
throw ParseException(QLatin1String("Invalid decltype"));
parseState()->advance(2);
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(ExpressionNode);
if (ADVANCE() != 'E')
......@@ -2913,7 +2916,7 @@ void UnresolvedTypeRule::parse(GlobalParseState *parseState)
else if (SubstitutionNode::mangledRepresentationStartsWith(next))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD_TO_NODE(SubstitutionNode, parseState, parentNode);
else
throw ParseException("Invalid unresolved-type");
throw ParseException(QLatin1String("Invalid unresolved-type"));
}
......@@ -2954,7 +2957,7 @@ void DestructorNameNode::parse()
else if (SimpleIdNode::mangledRepresentationStartsWith(next))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(SimpleIdNode);
else
throw ParseException("Invalid destructor-name");
throw ParseException(QLatin1String("Invalid destructor-name"));
}
QByteArray DestructorNameNode::toByteArray() const
......@@ -3011,7 +3014,7 @@ void BaseUnresolvedNameNode::parse()
parseState()->advance(2);
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(DestructorNameNode);
} else {
throw ParseException("Invalid <base-unresolved-name>");
throw ParseException(QLatin1String("Invalid <base-unresolved-name>"));
}
}
......@@ -3038,12 +3041,12 @@ bool InitializerNode::mangledRepresentationStartsWith(char c)
void InitializerNode::parse()
{
if (parseState()->readAhead(2) != "pi")
throw ParseException("Invalid initializer");
throw ParseException(QLatin1String("Invalid initializer"));
parseState()->advance(2);
while (ExpressionNode::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(ExpressionNode);
if (ADVANCE() != 'E')
throw ParseException("Invalid initializer");
throw ParseException(QLatin1String("Invalid initializer"));
}
QByteArray InitializerNode::toByteArray() const
......@@ -3093,20 +3096,20 @@ void UnresolvedNameNode::parse()
UnresolvedQualifierLevelRule::parse(parseState());
while (UnresolvedQualifierLevelRule::mangledRepresentationStartsWith(PEEK()));
if (ADVANCE() != 'E')
throw ParseException("Invalid unresolev-name");
throw ParseException(QLatin1String("Invalid unresolved-name"));
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(BaseUnresolvedNameNode);
} else if (UnresolvedTypeRule::mangledRepresentationStartsWith(PEEK())) {
if (m_globalNamespace)
throw ParseException("Invalid unresolved-name");
throw ParseException(QLatin1String("Invalid unresolved-name"));
UnresolvedTypeRule::parse(parseState());
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(BaseUnresolvedNameNode);
} else {
if (!UnresolvedQualifierLevelRule::mangledRepresentationStartsWith(PEEK()))
throw ParseException("Invalid unresolved-name");
throw ParseException(QLatin1String("Invalid unresolved-name"));
while (UnresolvedQualifierLevelRule::mangledRepresentationStartsWith(PEEK()))
UnresolvedQualifierLevelRule::parse(parseState());
if (ADVANCE() != 'E')
throw ParseException("Invalid unresolved-name");
throw ParseException(QLatin1String("Invalid unresolved-name"));
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(BaseUnresolvedNameNode);
}
} else {
......@@ -3152,19 +3155,19 @@ void FunctionParamNode::parse()
if (NonNegativeNumberNode<10>::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(NonNegativeNumberNode<10>);
if (ADVANCE() != '_')
throw ParseException("Invalid function-param");
throw ParseException(QLatin1String("Invalid function-param"));
} else if (parseState()->readAhead(2) == "fL") {
parseState()->advance(2);
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(NonNegativeNumberNode<10>);
if (ADVANCE() != 'p')
throw ParseException("Invalid function-param");
throw ParseException(QLatin1String("Invalid function-param"));
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(CvQualifiersNode);
if (NonNegativeNumberNode<10>::mangledRepresentationStartsWith(PEEK()))
PARSE_RULE_AND_ADD_RESULT_AS_CHILD(NonNegativeNumberNode<10>);
if (ADVANCE() != '_')
throw ParseException("Invalid function-param");
throw ParseException(QLatin1String("Invalid function-param"));
} else {
throw ParseException("Invalid function-param");
throw ParseException(QLatin1String("Invalid function-param"));
}
}
......
......@@ -361,7 +361,7 @@ void PdbEngine::handleBreakInsert(const PdbResponse &response)
int pos1 = response.data.indexOf(" at ");
QTC_ASSERT(pos1 != -1, return);
QByteArray bpnr = response.data.mid(11, pos1 - 11);
int pos2 = response.data.lastIndexOf(":");
int pos2 = response.data.lastIndexOf(':');
QByteArray file = response.data.mid(pos1 + 4, pos2 - pos1 - 4);
QByteArray line = response.data.mid(pos2 + 1);
BreakpointResponse br;
......@@ -630,7 +630,7 @@ void PdbEngine::handleOutput(const QByteArray &data)
{
//qDebug() << "READ: " << data;
m_inbuffer.append(data);
qDebug() << "BUFFER FROM: '" << m_inbuffer << "'";
qDebug() << "BUFFER FROM: '" << m_inbuffer << '\'';
while (true) {
int pos = m_inbuffer.indexOf("(Pdb)");
if (pos == -1)
......@@ -641,7 +641,7 @@ void PdbEngine::handleOutput(const QByteArray &data)
m_inbuffer = m_inbuffer.mid(pos + 6);
emit outputReady(response);
}
qDebug() << "BUFFER LEFT: '" << m_inbuffer << "'";
qDebug() << "BUFFER LEFT: '" << m_inbuffer << '\'';
//m_inbuffer.clear();
}
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "qmlinspectoradapter.h"
#include "debuggeractions.h"
......@@ -117,8 +119,8 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
// toolbar
m_selectAction->setObjectName("QML Select Action");
m_zoomAction->setObjectName("QML Zoom Action");
m_selectAction->setObjectName(QLatin1String("QML Select Action"));
m_zoomAction->setObjectName(QLatin1String("QML Zoom Action"));
m_selectAction->setCheckable(true);
m_zoomAction->setCheckable(true);
......@@ -294,14 +296,14 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
QmlJS::ModelManagerInterface::instance();
QmlJS::Document::Ptr doc = modelManager->snapshot().document(filename);
if (!doc) {
if (filename.endsWith(".qml") || filename.endsWith(".js")) {
if (filename.endsWith(QLatin1String(".qml")) || filename.endsWith(QLatin1String(".js"))) {
// add to list of docs that we have to update when
// snapshot figures out that there's a new document
m_pendingPreviewDocumentNames.append(filename);
}
return;
}
if (!doc->qmlProgram() && !filename.endsWith(".js"))
if (!doc->qmlProgram() && !filename.endsWith(QLatin1String(".js")))
return;
QmlJS::Document::Ptr initdoc = m_loadedSnapshot.document(filename);
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "qmllivetextpreview.h"
#include "qmlinspectoradapter.h"
......@@ -602,7 +604,7 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
m_docWithUnappliedChanges.clear();
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()) {
if (doc->fileName().endsWith(".js")) {
if (doc->fileName().endsWith(QLatin1String(".js"))) {
showSyncWarning(JSChangeWarning, QString(), 0, 0);
m_previousDoc = doc;
return;
......@@ -715,7 +717,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
Core::InfoBarEntry info(INFO_OUT_OF_SYNC, errorMessage);
Core::InfoBarEntry info(QLatin1String(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
info.setCustomButtonInfo(tr("Reload QML"), this,
......@@ -736,7 +738,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
infoBar->removeInfo(INFO_OUT_OF_SYNC);
infoBar->removeInfo(QLatin1String(INFO_OUT_OF_SYNC));
}
}
}
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "qmlv8debuggerclient.h"
#include "qmlv8debuggerclientconstants.h"
#include "debuggerstringutils.h"
......@@ -1409,7 +1411,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
const QVariantMap breakData = resp.value(_(BODY)).toMap();
const QString invocationText = breakData.value(_("invocationText")).toString();
const QString scriptUrl = breakData.value(_("script")).toMap().value(_("name")).toString();
const QString sourceLineText = breakData.value("sourceLineText").toString();
const QString sourceLineText = breakData.value(_("sourceLineText")).toString();
bool inferiorStop = true;
......@@ -1448,7 +1450,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
params.enabled,
params.lineNumber,
newColumn,
QString(params.condition),
QString(QString::fromLatin1(params.condition)),
params.ignoreCount);
d->breakpointsSync.insert(d->sequence, internalId);
}
......@@ -1627,7 +1629,7 @@ StackFrame QmlV8DebuggerClient::extractStackFrame(const QVariant &bodyVal, const
StackFrame stackFrame;
stackFrame.level = body.value(_("index")).toInt();
//Do not insert the frame corresponding to the internal function
if (body.value("sourceLineText").toByteArray() == INTERNAL_FUNCTION) {
if (body.value(QLatin1String("sourceLineText")) == QLatin1String(INTERNAL_FUNCTION)) {
stackFrame.level = -1;
return stackFrame;
}
......@@ -1827,7 +1829,7 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, con
QList<WatchData> watchDataList;
WatchData data;
//Do we have request to evaluate a local?
if (exp.startsWith("local.")) {
if (exp.startsWith(QLatin1String("local."))) {
const WatchData *watch = watchHandler->findData(exp.toLatin1());
watchDataList << createWatchDataList(watch, body.properties, refsVal);
} else {
......@@ -1959,7 +1961,7 @@ QList<WatchData> QmlV8DebuggerClient::createWatchDataList(const WatchData *paren
foreach (const QVariant &property, properties) {
QmlV8ObjectData propertyData = d->extractData(property, refsVal);
WatchData data;
data.name = propertyData.name;
data.name = QString::fromUtf8(propertyData.name);
//Check for v8 specific local data
if (data.name.startsWith(QLatin1Char('.')) || data.name.isEmpty())
......
......@@ -62,7 +62,7 @@ QString SnapshotData::function() const
if (m_frames.isEmpty())
return QString();
const StackFrame &frame = m_frames.at(0);
return frame.function + ":" + QString::number(frame.line);
return frame.function + QLatin1Char(':') + QString::number(frame.line);
}
QString SnapshotData::toString() const
......
......@@ -28,6 +28,8 @@
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "watchhandler.h"
#include "breakhandler.h"
......@@ -1413,7 +1415,7 @@ void WatchModel::showInEditorHelper(QString *contents, WatchItem *item, int dept
contents->append(tab);
contents->append(item->value);
contents->append(tab);
contents->append(item->type);
contents->append(QString::fromLatin1(item->type));
contents->append(nl);
foreach (WatchItem *child, item->children)
showInEditorHelper(contents, child, depth + 1);
......
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