forked from qt-creator/qt-creator
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:
@@ -275,7 +275,7 @@ static double getDumperVersion(const GdbMi &contents)
|
||||
const GdbMi dumperVersionG = contents.findChild("dumperversion");
|
||||
if (dumperVersionG.type() != GdbMi::Invalid) {
|
||||
bool ok;
|
||||
const double v = QString::fromAscii(dumperVersionG.data()).toDouble(&ok);
|
||||
const double v = QString::fromLatin1(dumperVersionG.data()).toDouble(&ok);
|
||||
if (ok)
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -438,9 +438,9 @@ void CodaGdbAdapter::readGdbServerCommand()
|
||||
m_gdbReadBuffer.append(packet);
|
||||
|
||||
logMessage(QLatin1String("gdb: -> ") + currentTime()
|
||||
+ QLatin1Char(' ') + QString::fromAscii(packet));
|
||||
+ QLatin1Char(' ') + QString::fromLatin1(packet));
|
||||
if (packet != m_gdbReadBuffer)
|
||||
logMessage(_("buffer: ") + QString::fromAscii(m_gdbReadBuffer));
|
||||
logMessage(_("buffer: ") + QString::fromLatin1(m_gdbReadBuffer));
|
||||
|
||||
QByteArray &ba = m_gdbReadBuffer;
|
||||
while (ba.size()) {
|
||||
@@ -550,7 +550,7 @@ void CodaGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArra
|
||||
packet.append(checkSum);
|
||||
int pad = qMax(0, 24 - packet.size());
|
||||
logMessage(QLatin1String("gdb: <- ") + currentTime() + QLatin1Char(' ')
|
||||
+ QString::fromAscii(packet) + QString(pad, QLatin1Char(' '))
|
||||
+ QString::fromLatin1(packet) + QString(pad, QLatin1Char(' '))
|
||||
+ QLatin1String(logNote));
|
||||
sendGdbServerPacket(packet, true);
|
||||
}
|
||||
@@ -712,7 +712,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
|
||||
}
|
||||
logMessage(_("Writing %1 bytes from 0x%2: %3").
|
||||
arg(addrLength.second).arg(addrLength.first, 0, 16).
|
||||
arg(QString::fromAscii(data.toHex())));
|
||||
arg(QString::fromLatin1(data.toHex())));
|
||||
m_codaDevice->sendMemorySetCommand(
|
||||
CodaCallback(this, &CodaGdbAdapter::handleWriteMemory),
|
||||
m_codaProcessId, addrLength.first, data);
|
||||
@@ -976,7 +976,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
|
||||
|
||||
if (!handled) {
|
||||
const QString msg = _("FIXME unknown 'XFER'-request: ")
|
||||
+ QString::fromAscii(cmd);
|
||||
+ QString::fromLatin1(cmd);
|
||||
logMessage(msgGdbPacket(msg), LogWarning);
|
||||
sendGdbServerMessage("E20", msg.toLatin1());
|
||||
}
|
||||
@@ -984,7 +984,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
|
||||
} // qPart/qXfer
|
||||
else {
|
||||
logMessage(msgGdbPacket(_("FIXME unknown: ")
|
||||
+ QString::fromAscii(cmd)), LogWarning);
|
||||
+ QString::fromLatin1(cmd)), LogWarning);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1126,7 +1126,7 @@ void CodaGdbAdapter::setupInferior()
|
||||
QStringList libraries;
|
||||
const unsigned libraryCount = sizeof(librariesC)/sizeof(char *);
|
||||
for (unsigned i = 0; i < libraryCount; ++i)
|
||||
libraries.push_back(QString::fromAscii(librariesC[i]));
|
||||
libraries.push_back(QString::fromLatin1(librariesC[i]));
|
||||
|
||||
m_codaDevice->sendProcessStartCommand(
|
||||
CodaCallback(this, &CodaGdbAdapter::handleCreateProcess),
|
||||
@@ -1337,7 +1337,7 @@ void CodaGdbAdapter::handleRegisterChildren(const CodaCommandResult &result)
|
||||
registerNames[i].remove(0, contextLength);
|
||||
if (i)
|
||||
msg += QLatin1Char(',');
|
||||
msg += QString::fromAscii(registerNames[i]);
|
||||
msg += QString::fromLatin1(registerNames[i]);
|
||||
}
|
||||
logMessage(msg);
|
||||
m_codaDevice->setRegisterNames(registerNames);
|
||||
|
||||
@@ -970,7 +970,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
||||
// Ideally, this code should not be present at all.
|
||||
showMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN (%2). "
|
||||
"TWO RESPONSES FOR ONE COMMAND?").arg(token).
|
||||
arg(QString::fromAscii(stateName(state()))));
|
||||
arg(QString::fromLatin1(stateName(state()))));
|
||||
if (response->resultClass == GdbResultError) {
|
||||
QByteArray msg = response->data.findChild("msg").data();
|
||||
if (msg == "Cannot find new threads: generic error") {
|
||||
|
||||
@@ -620,7 +620,7 @@ QByteArray symFileLoadCommand(const QString &symFileNameIn,
|
||||
QString msgLoadLocalSymFile(const QString &symFileName,
|
||||
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(code, 0, 16);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user