Debugger: use QString::fromLatin1 instead of QString::fromAscii

By source - latin1 is really expected as there is no any check
or usage of QTextCodec::setCodecForCStrings() currently.

QString::fromAscii() might break 'Latin1' input in some cases.

A quote from documentation about QString::fromAscii():

"Note that, despite the name, this function actually uses the
codec defined by QTextCodec::setCodecForCStrings() to convert str
to Unicode. Depending on the codec, it may not accept valid
US-ASCII (ANSI X3.4-1986) input. If no codec has been set, this
function does the same as fromLatin1()."

Change-Id: I49cf047ca674d2ec621b517c635d1927bb2e796f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Denis Mingulov
2012-02-16 09:55:47 +02:00
committed by hjk
parent d766c2e773
commit 87b1dc25a1
19 changed files with 51 additions and 51 deletions

View File

@@ -92,7 +92,7 @@ static QString stateToString(BreakpointState state)
static QString msgBreakpointAtSpecialFunc(const char *func) static QString msgBreakpointAtSpecialFunc(const char *func)
{ {
return BreakHandler::tr("Breakpoint at \"%1\"").arg(QString::fromAscii(func)); return BreakHandler::tr("Breakpoint at \"%1\"").arg(QString::fromLatin1(func));
} }
static QString typeToString(BreakpointType type) static QString typeToString(BreakpointType type)
@@ -578,7 +578,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
case 4: case 4:
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
if (res.address) if (res.address)
return QString::fromAscii("0x%1").arg(res.address, 0, 16); return QString::fromLatin1("0x%1").arg(res.address, 0, 16);
} }
return QVariant(); return QVariant();
} }
@@ -646,7 +646,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
const quint64 address = orig ? data.address : response.address; const quint64 address = orig ? data.address : response.address;
if (address) if (address)
return QString::fromAscii("0x%1").arg(address, 0, 16); return QString::fromLatin1("0x%1").arg(address, 0, 16);
return QVariant(); return QVariant();
} }
break; break;

View File

@@ -315,7 +315,7 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
if (mask & AddressPart) { if (mask & AddressPart) {
if (data.address) { if (data.address) {
m_ui.lineEditAddress->setText( m_ui.lineEditAddress->setText(
QString::fromAscii("0x%1").arg(data.address, 0, 16)); QString::fromLatin1("0x%1").arg(data.address, 0, 16));
} else { } else {
m_ui.lineEditAddress->clear(); m_ui.lineEditAddress->clear();
} }

View File

@@ -748,7 +748,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
arguments << QLatin1String("-lines") << QLatin1String("-G") arguments << QLatin1String("-lines") << QLatin1String("-G")
// register idle (debuggee stop) notification // register idle (debuggee stop) notification
<< QLatin1String("-c") << QLatin1String("-c")
<< QLatin1String(".idle_cmd ") + QString::fromAscii(m_extensionCommandPrefixBA) + QLatin1String("idle"); << QLatin1String(".idle_cmd ") + QString::fromLatin1(m_extensionCommandPrefixBA) + QLatin1String("idle");
if (sp.useTerminal) // Separate console if (sp.useTerminal) // Separate console
arguments << QLatin1String("-2"); arguments << QLatin1String("-2");
if (!m_options->symbolPaths.isEmpty()) if (!m_options->symbolPaths.isEmpty())
@@ -1049,7 +1049,7 @@ void CdbEngine::handleAddWatch(const CdbExtensionCommandPtr &reply)
item.setError(tr("Unable to add expression")); item.setError(tr("Unable to add expression"));
watchHandler()->insertData(item); watchHandler()->insertData(item);
showMessage(QString::fromLatin1("Unable to add watch item '%1'/'%2': %3"). showMessage(QString::fromLatin1("Unable to add watch item '%1'/'%2': %3").
arg(QString::fromAscii(item.iname), QString::fromAscii(item.exp), arg(QString::fromLatin1(item.iname), QString::fromLatin1(item.exp),
QString::fromLocal8Bit(reply->errorMessage)), LogError); QString::fromLocal8Bit(reply->errorMessage)), LogError);
} }
} }
@@ -1383,7 +1383,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags,
{ {
if (!m_accessible) { if (!m_accessible) {
const QString msg = QString::fromLatin1("Attempt to issue builtin command '%1' to non-accessible session (%2)") const QString msg = QString::fromLatin1("Attempt to issue builtin command '%1' to non-accessible session (%2)")
.arg(QString::fromLocal8Bit(cmd), QString::fromAscii(stateName(state()))); .arg(QString::fromLocal8Bit(cmd), QString::fromLatin1(stateName(state())));
showMessage(msg, LogError); showMessage(msg, LogError);
return; return;
} }
@@ -1420,7 +1420,7 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd,
{ {
if (!m_accessible) { if (!m_accessible) {
const QString msg = QString::fromLatin1("Attempt to issue extension command '%1' to non-accessible session (%2)") const QString msg = QString::fromLatin1("Attempt to issue extension command '%1' to non-accessible session (%2)")
.arg(QString::fromLocal8Bit(cmd), QString::fromAscii(stateName(state()))); .arg(QString::fromLocal8Bit(cmd), QString::fromLatin1(stateName(state())));
showMessage(msg, LogError); showMessage(msg, LogError);
return; return;
} }
@@ -1878,8 +1878,8 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
modules.reserve(value.childCount()); modules.reserve(value.childCount());
foreach (const GdbMi &gdbmiModule, value.children()) { foreach (const GdbMi &gdbmiModule, value.children()) {
Module module; Module module;
module.moduleName = QString::fromAscii(gdbmiModule.findChild("name").data()); module.moduleName = QString::fromLatin1(gdbmiModule.findChild("name").data());
module.modulePath = QString::fromAscii(gdbmiModule.findChild("image").data()); module.modulePath = QString::fromLatin1(gdbmiModule.findChild("image").data());
module.startAddress = gdbmiModule.findChild("start").data().toULongLong(0, 0); module.startAddress = gdbmiModule.findChild("start").data().toULongLong(0, 0);
module.endAddress = gdbmiModule.findChild("end").data().toULongLong(0, 0); module.endAddress = gdbmiModule.findChild("end").data().toULongLong(0, 0);
if (gdbmiModule.findChild("deferred").type() == GdbMi::Invalid) if (gdbmiModule.findChild("deferred").type() == GdbMi::Invalid)
@@ -2034,7 +2034,7 @@ static inline QString msgCheckingConditionalBreakPoint(BreakpointModelId id, con
const QString &threadId) const QString &threadId)
{ {
return CdbEngine::tr("Conditional breakpoint %1 (%2) in thread %3 triggered, examining expression '%4'.") return CdbEngine::tr("Conditional breakpoint %1 (%2) in thread %3 triggered, examining expression '%4'.")
.arg(id.toString()).arg(number).arg(threadId, QString::fromAscii(condition)); .arg(id.toString()).arg(number).arg(threadId, QString::fromLatin1(condition));
} }
unsigned CdbEngine::examineStopReason(const GdbMi &stopReason, unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
@@ -2057,7 +2057,7 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
// Additional stop messages occurring for debuggee function calls (widgetAt, etc). Just log. // Additional stop messages occurring for debuggee function calls (widgetAt, etc). Just log.
if (state() == InferiorStopOk) { if (state() == InferiorStopOk) {
*message = QString::fromLatin1("Ignored stop notification from function call (%1)."). *message = QString::fromLatin1("Ignored stop notification from function call (%1).").
arg(QString::fromAscii(reason)); arg(QString::fromLatin1(reason));
rc |= StopReportLog; rc |= StopReportLog;
return rc; return rc;
} }
@@ -2248,14 +2248,14 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
return; return;
} }
} else { } else {
showMessage(QString::fromAscii(stopReason.findChild("stackerror").data()), LogError); showMessage(QString::fromLatin1(stopReason.findChild("stackerror").data()), LogError);
} }
} }
const GdbMi threads = stopReason.findChild("threads"); const GdbMi threads = stopReason.findChild("threads");
if (threads.isValid()) { if (threads.isValid()) {
parseThreads(threads, forcedThreadId); parseThreads(threads, forcedThreadId);
} else { } else {
showMessage(QString::fromAscii(stopReason.findChild("threaderror").data()), LogError); showMessage(QString::fromLatin1(stopReason.findChild("threaderror").data()), LogError);
} }
// Fire off remaining commands asynchronously // Fire off remaining commands asynchronously
if (!m_pendingBreakpointMap.isEmpty()) if (!m_pendingBreakpointMap.isEmpty())
@@ -2379,7 +2379,7 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what
} }
if (what == "event") { if (what == "event") {
showStatusMessage(QString::fromAscii(message), 5000); showStatusMessage(QString::fromLatin1(message), 5000);
return; return;
} }
@@ -2873,7 +2873,7 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto)
const bool hasFile = !frames.at(i).file.isEmpty(); const bool hasFile = !frames.at(i).file.isEmpty();
// jmp-frame hit by step into, do another 't' and abort sequence. // jmp-frame hit by step into, do another 't' and abort sequence.
if (!hasFile && i == 0 && sourceStepInto && frames.at(i).function.contains(QLatin1String("ILT+"))) { if (!hasFile && i == 0 && sourceStepInto && frames.at(i).function.contains(QLatin1String("ILT+"))) {
showMessage(QString::fromAscii("Step into: Call instruction hit, performing additional step..."), LogMisc); showMessage(QString::fromLatin1("Step into: Call instruction hit, performing additional step..."), LogMisc);
return ParseStackStepInto; return ParseStackStepInto;
} }
if (hasFile) { if (hasFile) {
@@ -2982,19 +2982,19 @@ void CdbEngine::handleWidgetAt(const CdbExtensionCommandPtr &reply)
QString message; QString message;
do { do {
if (!reply->success) { if (!reply->success) {
message = QString::fromAscii(reply->errorMessage); message = QString::fromLatin1(reply->errorMessage);
break; break;
} }
// Should be "namespace::QWidget:0x555" // Should be "namespace::QWidget:0x555"
QString watchExp = QString::fromAscii(reply->reply); QString watchExp = QString::fromLatin1(reply->reply);
const int sepPos = watchExp.lastIndexOf(QLatin1Char(':')); const int sepPos = watchExp.lastIndexOf(QLatin1Char(':'));
if (sepPos == -1) { if (sepPos == -1) {
message = QString::fromAscii("Invalid output: %1").arg(watchExp); message = QString::fromLatin1("Invalid output: %1").arg(watchExp);
break; break;
} }
// 0x000 -> nothing found // 0x000 -> nothing found
if (!watchExp.mid(sepPos + 1).toULongLong(0, 0)) { if (!watchExp.mid(sepPos + 1).toULongLong(0, 0)) {
message = QString::fromAscii("No widget could be found at %1, %2.").arg(m_watchPointX).arg(m_watchPointY); message = QString::fromLatin1("No widget could be found at %1, %2.").arg(m_watchPointX).arg(m_watchPointY);
break; break;
} }
// Turn into watch expression: "*(namespace::QWidget*)0x555" // Turn into watch expression: "*(namespace::QWidget*)0x555"
@@ -3031,13 +3031,13 @@ void CdbEngine::handleBreakPoints(const CdbExtensionCommandPtr &reply)
if (debugBreakpoints) if (debugBreakpoints)
qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData()); qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData());
if (!reply->success) { if (!reply->success) {
showMessage(QString::fromAscii(reply->errorMessage), LogError); showMessage(QString::fromLatin1(reply->errorMessage), LogError);
return; return;
} }
GdbMi value; GdbMi value;
value.fromString(reply->reply); value.fromString(reply->reply);
if (value.type() != GdbMi::List) { if (value.type() != GdbMi::List) {
showMessage(QString::fromAscii("Unabled to parse breakpoints reply"), LogError); showMessage(QString::fromLatin1("Unabled to parse breakpoints reply"), LogError);
return; return;
} }
handleBreakPoints(value); handleBreakPoints(value);
@@ -3105,7 +3105,7 @@ void CdbEngine::watchPoint(const QPoint &p)
break; break;
default: default:
showMessage(tr("\"Select Widget to Watch\": Not supported in state '%1'."). showMessage(tr("\"Select Widget to Watch\": Not supported in state '%1'.").
arg(QString::fromAscii(stateName(state()))), LogWarning); arg(QString::fromLatin1(stateName(state()))), LogWarning);
break; break;
} }
} }

View File

@@ -263,7 +263,7 @@ static inline bool parseThread(QByteArray line, ThreadData *thread, bool *curren
const QByteArray &pidTid = tokens.at(2); const QByteArray &pidTid = tokens.at(2);
const int dotPos = pidTid.indexOf('.'); const int dotPos = pidTid.indexOf('.');
if (dotPos != -1) if (dotPos != -1)
thread->targetId = QLatin1String("0x") + QString::fromAscii(pidTid.mid(dotPos + 1)); thread->targetId = QLatin1String("0x") + QString::fromLatin1(pidTid.mid(dotPos + 1));
} }
case 1: case 1:
thread->id = tokens.at(0).toInt(); thread->id = tokens.at(0).toInt();

View File

@@ -1093,7 +1093,7 @@ QString StartRemoteCdbDialog::connection() const
QRegExp ipRegexp(QLatin1String("([\\w\\.\\-_]+):([0-9]{1,4})")); QRegExp ipRegexp(QLatin1String("([\\w\\.\\-_]+):([0-9]{1,4})"));
QTC_ASSERT(ipRegexp.isValid(), return QString()); QTC_ASSERT(ipRegexp.isValid(), return QString());
if (ipRegexp.exactMatch(rc)) if (ipRegexp.exactMatch(rc))
return QString::fromAscii("tcp:server=%1,port=%2").arg(ipRegexp.cap(1), ipRegexp.cap(2)); return QString::fromLatin1("tcp:server=%1,port=%2").arg(ipRegexp.cap(1), ipRegexp.cap(2));
return rc; return rc;
} }

View File

@@ -816,7 +816,7 @@ void DebuggerToolTipWidget::saveSessionData(QXmlStreamWriter &w) const
{ {
w.writeStartElement(QLatin1String(toolTipElementC)); w.writeStartElement(QLatin1String(toolTipElementC));
QXmlStreamAttributes attributes; QXmlStreamAttributes attributes;
attributes.append(QLatin1String(toolTipClassAttributeC), QString::fromAscii(metaObject()->className())); attributes.append(QLatin1String(toolTipClassAttributeC), QString::fromLatin1(metaObject()->className()));
attributes.append(QLatin1String(fileNameAttributeC), m_context.fileName); attributes.append(QLatin1String(fileNameAttributeC), m_context.fileName);
if (!m_context.function.isEmpty()) if (!m_context.function.isEmpty())
attributes.append(QLatin1String(functionAttributeC), m_context.function); attributes.append(QLatin1String(functionAttributeC), m_context.function);

View File

@@ -275,7 +275,7 @@ static double getDumperVersion(const GdbMi &contents)
const GdbMi dumperVersionG = contents.findChild("dumperversion"); const GdbMi dumperVersionG = contents.findChild("dumperversion");
if (dumperVersionG.type() != GdbMi::Invalid) { if (dumperVersionG.type() != GdbMi::Invalid) {
bool ok; bool ok;
const double v = QString::fromAscii(dumperVersionG.data()).toDouble(&ok); const double v = QString::fromLatin1(dumperVersionG.data()).toDouble(&ok);
if (ok) if (ok)
return v; return v;
} }

View File

@@ -438,9 +438,9 @@ void CodaGdbAdapter::readGdbServerCommand()
m_gdbReadBuffer.append(packet); m_gdbReadBuffer.append(packet);
logMessage(QLatin1String("gdb: -> ") + currentTime() logMessage(QLatin1String("gdb: -> ") + currentTime()
+ QLatin1Char(' ') + QString::fromAscii(packet)); + QLatin1Char(' ') + QString::fromLatin1(packet));
if (packet != m_gdbReadBuffer) if (packet != m_gdbReadBuffer)
logMessage(_("buffer: ") + QString::fromAscii(m_gdbReadBuffer)); logMessage(_("buffer: ") + QString::fromLatin1(m_gdbReadBuffer));
QByteArray &ba = m_gdbReadBuffer; QByteArray &ba = m_gdbReadBuffer;
while (ba.size()) { while (ba.size()) {
@@ -550,7 +550,7 @@ void CodaGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArra
packet.append(checkSum); packet.append(checkSum);
int pad = qMax(0, 24 - packet.size()); int pad = qMax(0, 24 - packet.size());
logMessage(QLatin1String("gdb: <- ") + currentTime() + QLatin1Char(' ') logMessage(QLatin1String("gdb: <- ") + currentTime() + QLatin1Char(' ')
+ QString::fromAscii(packet) + QString(pad, QLatin1Char(' ')) + QString::fromLatin1(packet) + QString(pad, QLatin1Char(' '))
+ QLatin1String(logNote)); + QLatin1String(logNote));
sendGdbServerPacket(packet, true); sendGdbServerPacket(packet, true);
} }
@@ -712,7 +712,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
} }
logMessage(_("Writing %1 bytes from 0x%2: %3"). logMessage(_("Writing %1 bytes from 0x%2: %3").
arg(addrLength.second).arg(addrLength.first, 0, 16). arg(addrLength.second).arg(addrLength.first, 0, 16).
arg(QString::fromAscii(data.toHex()))); arg(QString::fromLatin1(data.toHex())));
m_codaDevice->sendMemorySetCommand( m_codaDevice->sendMemorySetCommand(
CodaCallback(this, &CodaGdbAdapter::handleWriteMemory), CodaCallback(this, &CodaGdbAdapter::handleWriteMemory),
m_codaProcessId, addrLength.first, data); m_codaProcessId, addrLength.first, data);
@@ -976,7 +976,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
if (!handled) { if (!handled) {
const QString msg = _("FIXME unknown 'XFER'-request: ") const QString msg = _("FIXME unknown 'XFER'-request: ")
+ QString::fromAscii(cmd); + QString::fromLatin1(cmd);
logMessage(msgGdbPacket(msg), LogWarning); logMessage(msgGdbPacket(msg), LogWarning);
sendGdbServerMessage("E20", msg.toLatin1()); sendGdbServerMessage("E20", msg.toLatin1());
} }
@@ -984,7 +984,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
} // qPart/qXfer } // qPart/qXfer
else { else {
logMessage(msgGdbPacket(_("FIXME unknown: ") logMessage(msgGdbPacket(_("FIXME unknown: ")
+ QString::fromAscii(cmd)), LogWarning); + QString::fromLatin1(cmd)), LogWarning);
} }
} }
@@ -1126,7 +1126,7 @@ void CodaGdbAdapter::setupInferior()
QStringList libraries; QStringList libraries;
const unsigned libraryCount = sizeof(librariesC)/sizeof(char *); 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])); libraries.push_back(QString::fromLatin1(librariesC[i]));
m_codaDevice->sendProcessStartCommand( m_codaDevice->sendProcessStartCommand(
CodaCallback(this, &CodaGdbAdapter::handleCreateProcess), CodaCallback(this, &CodaGdbAdapter::handleCreateProcess),
@@ -1337,7 +1337,7 @@ void CodaGdbAdapter::handleRegisterChildren(const CodaCommandResult &result)
registerNames[i].remove(0, contextLength); registerNames[i].remove(0, contextLength);
if (i) if (i)
msg += QLatin1Char(','); msg += QLatin1Char(',');
msg += QString::fromAscii(registerNames[i]); msg += QString::fromLatin1(registerNames[i]);
} }
logMessage(msg); logMessage(msg);
m_codaDevice->setRegisterNames(registerNames); m_codaDevice->setRegisterNames(registerNames);

View File

@@ -970,7 +970,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Ideally, this code should not be present at all. // Ideally, this code should not be present at all.
showMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN (%2). " showMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN (%2). "
"TWO RESPONSES FOR ONE COMMAND?").arg(token). "TWO RESPONSES FOR ONE COMMAND?").arg(token).
arg(QString::fromAscii(stateName(state())))); arg(QString::fromLatin1(stateName(state()))));
if (response->resultClass == GdbResultError) { if (response->resultClass == GdbResultError) {
QByteArray msg = response->data.findChild("msg").data(); QByteArray msg = response->data.findChild("msg").data();
if (msg == "Cannot find new threads: generic error") { if (msg == "Cannot find new threads: generic error") {

View File

@@ -620,7 +620,7 @@ QByteArray symFileLoadCommand(const QString &symFileNameIn,
QString msgLoadLocalSymFile(const QString &symFileName, QString msgLoadLocalSymFile(const QString &symFileName,
const QByteArray &libName, quint64 code) const QByteArray &libName, quint64 code)
{ {
return QString::fromAscii("Loading symbol file '%1' for '%2' at 0x%3"). return QString::fromLatin1("Loading symbol file '%1' for '%2' at 0x%3").
arg(symFileName, QString::fromLatin1(libName)). arg(symFileName, QString::fromLatin1(libName)).
arg(code, 0, 16); arg(code, 0, 16);
} }

View File

@@ -184,7 +184,7 @@ QList<MemoryMarkup> RegisterMemoryView::registerMarkup(quint64 a, const QString
void RegisterMemoryView::init(RegisterHandler *h, int registerIndex) void RegisterMemoryView::init(RegisterHandler *h, int registerIndex)
{ {
m_registerIndex = registerIndex; m_registerIndex = registerIndex;
m_registerName = QString::fromAscii(h->registerAt(registerIndex).name); m_registerName = QString::fromLatin1(h->registerAt(registerIndex).name);
// Known issue: CDB might reset the model by changing the special // Known issue: CDB might reset the model by changing the special
// registers it reports. // registers it reports.
connect(h, SIGNAL(modelReset()), this, SLOT(close())); connect(h, SIGNAL(modelReset()), this, SLOT(close()));

View File

@@ -380,7 +380,7 @@ QString Register::displayValue(int base, int strlen) const
{ {
const QVariant editV = editValue(); const QVariant editV = editValue();
if (editV.type() == QVariant::ULongLong) if (editV.type() == QVariant::ULongLong)
return QString::fromAscii("%1").arg(editV.toULongLong(), strlen, base); return QString::fromLatin1("%1").arg(editV.toULongLong(), strlen, base);
const QString stringValue = editV.toString(); const QString stringValue = editV.toString();
if (stringValue.size() < strlen) if (stringValue.size() < strlen)
return QString(strlen - stringValue.size(), QLatin1Char(' ')) + QLatin1String(value); return QString(strlen - stringValue.size(), QLatin1Char(' ')) + QLatin1String(value);

View File

@@ -207,7 +207,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
actEditMemory->setText(tr("Open Memory Editor at 0x%1").arg(address, 0, 16)); actEditMemory->setText(tr("Open Memory Editor at 0x%1").arg(address, 0, 16));
actEditMemory->setEnabled(canShow); actEditMemory->setEnabled(canShow);
actViewMemory->setText(tr("Open Memory View at Value of Register %1 0x%2") actViewMemory->setText(tr("Open Memory View at Value of Register %1 0x%2")
.arg(QString::fromAscii(aRegister.name)).arg(address, 0, 16)); .arg(QString::fromLatin1(aRegister.name)).arg(address, 0, 16));
actShowDisassemblerAt->setText(tr("Open Disassembler at 0x%1") actShowDisassemblerAt->setText(tr("Open Disassembler at 0x%1")
.arg(address, 0, 16)); .arg(address, 0, 16));
actShowDisassemblerAt->setEnabled(engine->hasCapability(DisassemblerCapability)); actShowDisassemblerAt->setEnabled(engine->hasCapability(DisassemblerCapability));
@@ -243,7 +243,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actReload) if (act == actReload)
engine->reloadRegisters(); engine->reloadRegisters();
else if (act == actEditMemory) { else if (act == actEditMemory) {
const QString registerName = QString::fromAscii(aRegister.name); const QString registerName = QString::fromLatin1(aRegister.name);
engine->openMemoryView(address, 0, engine->openMemoryView(address, 0,
RegisterMemoryView::registerMarkup(address, registerName), RegisterMemoryView::registerMarkup(address, registerName),
QPoint(), RegisterMemoryView::title(registerName), 0); QPoint(), RegisterMemoryView::title(registerName), 0);

View File

@@ -112,7 +112,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
return frame.line >= 0 ? QVariant(frame.line) : QVariant(); return frame.line >= 0 ? QVariant(frame.line) : QVariant();
case 4: // Address case 4: // Address
if (frame.address) if (frame.address)
return QString::fromAscii("0x%1").arg(frame.address, 0, 16); return QString::fromLatin1("0x%1").arg(frame.address, 0, 16);
return QString(); return QString();
} }
return QVariant(); return QVariant();

View File

@@ -311,7 +311,7 @@ Threads ThreadsHandler::parseGdbmiThreads(const GdbMi &data, int *currentThread)
const GdbMi frame = item.findChild("frame"); const GdbMi frame = item.findChild("frame");
ThreadData thread; ThreadData thread;
thread.id = item.findChild("id").data().toInt(); thread.id = item.findChild("id").data().toInt();
thread.targetId = QString::fromAscii(item.findChild("target-id").data()); thread.targetId = QString::fromLatin1(item.findChild("target-id").data());
thread.core = QString::fromLatin1(item.findChild("core").data()); thread.core = QString::fromLatin1(item.findChild("core").data());
thread.state = QString::fromLatin1(item.findChild("state").data()); thread.state = QString::fromLatin1(item.findChild("state").data());
thread.address = frame.findChild("addr").data().toULongLong(&ok, 0); thread.address = frame.findChild("addr").data().toULongLong(&ok, 0);

View File

@@ -379,10 +379,10 @@ QString WatchData::toToolTip() const
} }
formatToolTipRow(str, tr("Value"), val); formatToolTipRow(str, tr("Value"), val);
formatToolTipRow(str, tr("Object Address"), formatToolTipRow(str, tr("Object Address"),
QString::fromAscii(hexAddress())); QString::fromLatin1(hexAddress()));
if (referencingAddress) if (referencingAddress)
formatToolTipRow(str, tr("Referencing Address"), formatToolTipRow(str, tr("Referencing Address"),
QString::fromAscii(hexReferencingAddress())); QString::fromLatin1(hexReferencingAddress()));
if (size) if (size)
formatToolTipRow(str, tr("Size"), QString::number(size)); formatToolTipRow(str, tr("Size"), QString::number(size));
formatToolTipRow(str, tr("Internal ID"), QLatin1String(iname)); formatToolTipRow(str, tr("Internal ID"), QLatin1String(iname));

View File

@@ -236,7 +236,7 @@ void IntegerWatchLineEdit::setModelData(const QVariant &v)
} }
break; break;
case QVariant::ByteArray: case QVariant::ByteArray:
setNumberText(QString::fromAscii(v.toByteArray())); setNumberText(QString::fromLatin1(v.toByteArray()));
break; break;
case QVariant::String: case QVariant::String:
setNumberText(v.toString()); setNumberText(v.toString());
@@ -281,7 +281,7 @@ void FloatWatchLineEdit::setModelData(const QVariant &v)
setText(v.toString()); setText(v.toString());
break; break;
case QVariant::ByteArray: case QVariant::ByteArray:
setText(QString::fromAscii(v.toByteArray())); setText(QString::fromLatin1(v.toByteArray()));
break; break;
default: default:
qWarning("Invalid value (%s) passed to FloatWatchLineEdit::setModelData", qWarning("Invalid value (%s) passed to FloatWatchLineEdit::setModelData",

View File

@@ -713,14 +713,14 @@ int WatchModel::itemFormat(const WatchData &data) const
static inline QString expression(const WatchItem *item) static inline QString expression(const WatchItem *item)
{ {
if (!item->exp.isEmpty()) if (!item->exp.isEmpty())
return QString::fromAscii(item->exp); return QString::fromLatin1(item->exp);
if (item->address && !item->type.isEmpty()) { if (item->address && !item->type.isEmpty()) {
return QString::fromAscii("*(%1*)%2"). return QString::fromLatin1("*(%1*)%2").
arg(QLatin1String(item->type), QLatin1String(item->hexAddress())); arg(QLatin1String(item->type), QLatin1String(item->hexAddress()));
} }
if (const WatchItem *parent = item->parent) { if (const WatchItem *parent = item->parent) {
if (!parent->exp.isEmpty()) if (!parent->exp.isEmpty())
return QString::fromAscii("(%1).%2") return QString::fromLatin1("(%1).%2")
.arg(QString::fromLatin1(parent->exp), item->name); .arg(QString::fromLatin1(parent->exp), item->name);
} }
return QString(); return QString();

View File

@@ -181,7 +181,7 @@ RegisterMap registerMap(const DebuggerEngine *engine)
foreach (const Register &reg, engine->registerHandler()->registers()) { foreach (const Register &reg, engine->registerHandler()->registers()) {
const QVariant v = reg.editValue(); const QVariant v = reg.editValue();
if (v.type() == QVariant::ULongLong) if (v.type() == QVariant::ULongLong)
result.insert(v.toULongLong(), QString::fromAscii(reg.name)); result.insert(v.toULongLong(), QString::fromLatin1(reg.name));
} }
return result; return result;
} }