From 87b1dc25a1c67815f88041fbe57794e4099655e2 Mon Sep 17 00:00:00 2001
From: Denis Mingulov <denis@mingulov.com>
Date: Thu, 16 Feb 2012 09:55:47 +0200
Subject: [PATCH] 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>
---
 src/plugins/debugger/breakhandler.cpp         |  6 +--
 src/plugins/debugger/breakwindow.cpp          |  2 +-
 src/plugins/debugger/cdb/cdbengine.cpp        | 38 +++++++++----------
 src/plugins/debugger/cdb/cdbparsehelpers.cpp  |  2 +-
 src/plugins/debugger/debuggerdialogs.cpp      |  2 +-
 .../debugger/debuggertooltipmanager.cpp       |  2 +-
 src/plugins/debugger/gdb/classicgdbengine.cpp |  2 +-
 src/plugins/debugger/gdb/codagdbadapter.cpp   | 16 ++++----
 src/plugins/debugger/gdb/gdbengine.cpp        |  2 +-
 src/plugins/debugger/gdb/symbian.cpp          |  2 +-
 src/plugins/debugger/memoryview.cpp           |  2 +-
 src/plugins/debugger/registerhandler.cpp      |  2 +-
 src/plugins/debugger/registerwindow.cpp       |  4 +-
 src/plugins/debugger/stackhandler.cpp         |  2 +-
 src/plugins/debugger/threadshandler.cpp       |  2 +-
 src/plugins/debugger/watchdata.cpp            |  4 +-
 src/plugins/debugger/watchdelegatewidgets.cpp |  4 +-
 src/plugins/debugger/watchhandler.cpp         |  6 +--
 src/plugins/debugger/watchwindow.cpp          |  2 +-
 19 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 815424e5be7..ccc367461a2 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -92,7 +92,7 @@ static QString stateToString(BreakpointState state)
 
 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)
@@ -578,7 +578,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
         case 4:
             if (role == Qt::DisplayRole)
                 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();
     }
@@ -646,7 +646,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
             if (role == Qt::DisplayRole) {
                 const quint64 address = orig ? data.address : response.address;
                 if (address)
-                    return QString::fromAscii("0x%1").arg(address, 0, 16);
+                    return QString::fromLatin1("0x%1").arg(address, 0, 16);
                 return QVariant();
             }
             break;
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index e2cf6d60fd5..699025a18e2 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -315,7 +315,7 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
     if (mask & AddressPart) {
         if (data.address) {
             m_ui.lineEditAddress->setText(
-                QString::fromAscii("0x%1").arg(data.address, 0, 16));
+                QString::fromLatin1("0x%1").arg(data.address, 0, 16));
         } else {
             m_ui.lineEditAddress->clear();
         }
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 2a46d1c9884..c5276c5a7a9 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -748,7 +748,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
     arguments << QLatin1String("-lines") << QLatin1String("-G")
     // register idle (debuggee stop) notification
               << 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
         arguments << QLatin1String("-2");
     if (!m_options->symbolPaths.isEmpty())
@@ -1049,7 +1049,7 @@ void CdbEngine::handleAddWatch(const CdbExtensionCommandPtr &reply)
         item.setError(tr("Unable to add expression"));
         watchHandler()->insertData(item);
         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);
     }
 }
@@ -1383,7 +1383,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags,
 {
     if (!m_accessible) {
         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);
         return;
     }
@@ -1420,7 +1420,7 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd,
 {
     if (!m_accessible) {
         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);
         return;
     }
@@ -1878,8 +1878,8 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
             modules.reserve(value.childCount());
             foreach (const GdbMi &gdbmiModule, value.children()) {
                 Module module;
-                module.moduleName = QString::fromAscii(gdbmiModule.findChild("name").data());
-                module.modulePath = QString::fromAscii(gdbmiModule.findChild("image").data());
+                module.moduleName = QString::fromLatin1(gdbmiModule.findChild("name").data());
+                module.modulePath = QString::fromLatin1(gdbmiModule.findChild("image").data());
                 module.startAddress = gdbmiModule.findChild("start").data().toULongLong(0, 0);
                 module.endAddress = gdbmiModule.findChild("end").data().toULongLong(0, 0);
                 if (gdbmiModule.findChild("deferred").type() == GdbMi::Invalid)
@@ -2034,7 +2034,7 @@ static inline QString msgCheckingConditionalBreakPoint(BreakpointModelId id, con
                                                        const QString &threadId)
 {
     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,
@@ -2057,7 +2057,7 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
     // Additional stop messages occurring for debuggee function calls (widgetAt, etc). Just log.
     if (state() == InferiorStopOk) {
         *message = QString::fromLatin1("Ignored stop notification from function call (%1).").
-                    arg(QString::fromAscii(reason));
+                    arg(QString::fromLatin1(reason));
         rc |= StopReportLog;
         return rc;
     }
@@ -2248,14 +2248,14 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
                     return;
                 }
             } else {
-                showMessage(QString::fromAscii(stopReason.findChild("stackerror").data()), LogError);
+                showMessage(QString::fromLatin1(stopReason.findChild("stackerror").data()), LogError);
             }
         }
         const GdbMi threads = stopReason.findChild("threads");
         if (threads.isValid()) {
             parseThreads(threads, forcedThreadId);
         } else {
-            showMessage(QString::fromAscii(stopReason.findChild("threaderror").data()), LogError);
+            showMessage(QString::fromLatin1(stopReason.findChild("threaderror").data()), LogError);
         }
         // Fire off remaining commands asynchronously
         if (!m_pendingBreakpointMap.isEmpty())
@@ -2379,7 +2379,7 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what
     }
 
     if (what == "event") {
-        showStatusMessage(QString::fromAscii(message),  5000);
+        showStatusMessage(QString::fromLatin1(message),  5000);
         return;
     }
 
@@ -2873,7 +2873,7 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto)
         const bool hasFile = !frames.at(i).file.isEmpty();
         // jmp-frame hit by step into, do another 't' and abort sequence.
         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;
         }
         if (hasFile) {
@@ -2982,19 +2982,19 @@ void CdbEngine::handleWidgetAt(const CdbExtensionCommandPtr &reply)
     QString message;
     do {
         if (!reply->success) {
-            message = QString::fromAscii(reply->errorMessage);
+            message = QString::fromLatin1(reply->errorMessage);
             break;
         }
         // Should be "namespace::QWidget:0x555"
-        QString watchExp = QString::fromAscii(reply->reply);
+        QString watchExp = QString::fromLatin1(reply->reply);
         const int sepPos = watchExp.lastIndexOf(QLatin1Char(':'));
         if (sepPos == -1) {
-            message = QString::fromAscii("Invalid output: %1").arg(watchExp);
+            message = QString::fromLatin1("Invalid output: %1").arg(watchExp);
             break;
         }
         // 0x000 -> nothing found
         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;
         }
         // Turn into watch expression: "*(namespace::QWidget*)0x555"
@@ -3031,13 +3031,13 @@ void CdbEngine::handleBreakPoints(const CdbExtensionCommandPtr &reply)
     if (debugBreakpoints)
         qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData());
     if (!reply->success) {
-        showMessage(QString::fromAscii(reply->errorMessage), LogError);
+        showMessage(QString::fromLatin1(reply->errorMessage), LogError);
         return;
     }
     GdbMi value;
     value.fromString(reply->reply);
     if (value.type() != GdbMi::List) {
-        showMessage(QString::fromAscii("Unabled to parse breakpoints reply"), LogError);
+        showMessage(QString::fromLatin1("Unabled to parse breakpoints reply"), LogError);
         return;
     }
     handleBreakPoints(value);
@@ -3105,7 +3105,7 @@ void CdbEngine::watchPoint(const QPoint &p)
         break;
     default:
         showMessage(tr("\"Select Widget to Watch\": Not supported in state '%1'.").
-                    arg(QString::fromAscii(stateName(state()))), LogWarning);
+                    arg(QString::fromLatin1(stateName(state()))), LogWarning);
         break;
     }
 }
diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
index b554938cb6a..d888434b37e 100644
--- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp
+++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
@@ -263,7 +263,7 @@ static inline bool parseThread(QByteArray line, ThreadData *thread, bool *curren
         const QByteArray &pidTid = tokens.at(2);
         const int dotPos = pidTid.indexOf('.');
         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:
         thread->id = tokens.at(0).toInt();
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index 530a2eee65d..bec4eae50cc 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -1093,7 +1093,7 @@ QString StartRemoteCdbDialog::connection() const
     QRegExp ipRegexp(QLatin1String("([\\w\\.\\-_]+):([0-9]{1,4})"));
     QTC_ASSERT(ipRegexp.isValid(), return QString());
     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;
 }
 
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index d7ac689cd9a..1a8de6ee43a 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -816,7 +816,7 @@ void DebuggerToolTipWidget::saveSessionData(QXmlStreamWriter &w) const
 {
     w.writeStartElement(QLatin1String(toolTipElementC));
     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);
     if (!m_context.function.isEmpty())
         attributes.append(QLatin1String(functionAttributeC), m_context.function);
diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp
index fd21906a510..a74387904f3 100644
--- a/src/plugins/debugger/gdb/classicgdbengine.cpp
+++ b/src/plugins/debugger/gdb/classicgdbengine.cpp
@@ -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;
     }
diff --git a/src/plugins/debugger/gdb/codagdbadapter.cpp b/src/plugins/debugger/gdb/codagdbadapter.cpp
index 63f71674ff8..7ffb4e7e960 100644
--- a/src/plugins/debugger/gdb/codagdbadapter.cpp
+++ b/src/plugins/debugger/gdb/codagdbadapter.cpp
@@ -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);
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 07034fed923..48ff1491cde 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -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") {
diff --git a/src/plugins/debugger/gdb/symbian.cpp b/src/plugins/debugger/gdb/symbian.cpp
index d690077ba07..a7f7abdf2a6 100644
--- a/src/plugins/debugger/gdb/symbian.cpp
+++ b/src/plugins/debugger/gdb/symbian.cpp
@@ -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);
 }
diff --git a/src/plugins/debugger/memoryview.cpp b/src/plugins/debugger/memoryview.cpp
index 2857bac1b41..0eea9534566 100644
--- a/src/plugins/debugger/memoryview.cpp
+++ b/src/plugins/debugger/memoryview.cpp
@@ -184,7 +184,7 @@ QList<MemoryMarkup> RegisterMemoryView::registerMarkup(quint64 a, const QString
 void RegisterMemoryView::init(RegisterHandler *h, int 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
     // registers it reports.
     connect(h, SIGNAL(modelReset()), this, SLOT(close()));
diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp
index 0f0924dc842..d275b652a9b 100644
--- a/src/plugins/debugger/registerhandler.cpp
+++ b/src/plugins/debugger/registerhandler.cpp
@@ -380,7 +380,7 @@ QString Register::displayValue(int base, int strlen) const
 {
     const QVariant editV = editValue();
     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();
     if (stringValue.size() < strlen)
         return QString(strlen - stringValue.size(), QLatin1Char(' ')) + QLatin1String(value);
diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp
index b1c74c8b72a..37608353bd2 100644
--- a/src/plugins/debugger/registerwindow.cpp
+++ b/src/plugins/debugger/registerwindow.cpp
@@ -207,7 +207,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
         actEditMemory->setText(tr("Open Memory Editor at 0x%1").arg(address, 0, 16));
         actEditMemory->setEnabled(canShow);
         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")
             .arg(address, 0, 16));
         actShowDisassemblerAt->setEnabled(engine->hasCapability(DisassemblerCapability));
@@ -243,7 +243,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
     if (act == actReload)
         engine->reloadRegisters();
     else if (act == actEditMemory) {
-        const QString registerName = QString::fromAscii(aRegister.name);
+        const QString registerName = QString::fromLatin1(aRegister.name);
         engine->openMemoryView(address, 0,
             RegisterMemoryView::registerMarkup(address, registerName),
             QPoint(), RegisterMemoryView::title(registerName), 0);
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp
index 00a3636761c..6a28e4fdc58 100644
--- a/src/plugins/debugger/stackhandler.cpp
+++ b/src/plugins/debugger/stackhandler.cpp
@@ -112,7 +112,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
             return frame.line >= 0 ? QVariant(frame.line) : QVariant();
         case 4: // 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 QVariant();
diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp
index b8021d79827..2abfe22dfee 100644
--- a/src/plugins/debugger/threadshandler.cpp
+++ b/src/plugins/debugger/threadshandler.cpp
@@ -311,7 +311,7 @@ Threads ThreadsHandler::parseGdbmiThreads(const GdbMi &data, int *currentThread)
         const GdbMi frame = item.findChild("frame");
         ThreadData thread;
         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.state = QString::fromLatin1(item.findChild("state").data());
         thread.address = frame.findChild("addr").data().toULongLong(&ok, 0);
diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp
index 4c67bec3c7d..d8112360b00 100644
--- a/src/plugins/debugger/watchdata.cpp
+++ b/src/plugins/debugger/watchdata.cpp
@@ -379,10 +379,10 @@ QString WatchData::toToolTip() const
     }
     formatToolTipRow(str, tr("Value"), val);
     formatToolTipRow(str, tr("Object Address"),
-                     QString::fromAscii(hexAddress()));
+                     QString::fromLatin1(hexAddress()));
     if (referencingAddress)
         formatToolTipRow(str, tr("Referencing Address"),
-                         QString::fromAscii(hexReferencingAddress()));
+                         QString::fromLatin1(hexReferencingAddress()));
     if (size)
         formatToolTipRow(str, tr("Size"), QString::number(size));
     formatToolTipRow(str, tr("Internal ID"), QLatin1String(iname));
diff --git a/src/plugins/debugger/watchdelegatewidgets.cpp b/src/plugins/debugger/watchdelegatewidgets.cpp
index 6eb21e04987..a87875457e9 100644
--- a/src/plugins/debugger/watchdelegatewidgets.cpp
+++ b/src/plugins/debugger/watchdelegatewidgets.cpp
@@ -236,7 +236,7 @@ void IntegerWatchLineEdit::setModelData(const QVariant &v)
         }
         break;
     case QVariant::ByteArray:
-        setNumberText(QString::fromAscii(v.toByteArray()));
+        setNumberText(QString::fromLatin1(v.toByteArray()));
         break;
     case QVariant::String:
         setNumberText(v.toString());
@@ -281,7 +281,7 @@ void FloatWatchLineEdit::setModelData(const QVariant &v)
         setText(v.toString());
         break;
     case QVariant::ByteArray:
-        setText(QString::fromAscii(v.toByteArray()));
+        setText(QString::fromLatin1(v.toByteArray()));
         break;
     default:
         qWarning("Invalid value (%s) passed to FloatWatchLineEdit::setModelData",
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 5215cf8c47d..79264f95d40 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -713,14 +713,14 @@ int WatchModel::itemFormat(const WatchData &data) const
 static inline QString expression(const WatchItem *item)
 {
     if (!item->exp.isEmpty())
-         return QString::fromAscii(item->exp);
+         return QString::fromLatin1(item->exp);
     if (item->address && !item->type.isEmpty()) {
-        return QString::fromAscii("*(%1*)%2").
+        return QString::fromLatin1("*(%1*)%2").
                 arg(QLatin1String(item->type), QLatin1String(item->hexAddress()));
     }
     if (const WatchItem *parent = item->parent) {
         if (!parent->exp.isEmpty())
-           return QString::fromAscii("(%1).%2")
+           return QString::fromLatin1("(%1).%2")
             .arg(QString::fromLatin1(parent->exp), item->name);
     }
     return QString();
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index c773a62ef87..06e18efd7e3 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -181,7 +181,7 @@ RegisterMap registerMap(const DebuggerEngine *engine)
     foreach (const Register &reg, engine->registerHandler()->registers()) {
         const QVariant v = reg.editValue();
         if (v.type() == QVariant::ULongLong)
-            result.insert(v.toULongLong(), QString::fromAscii(reg.name));
+            result.insert(v.toULongLong(), QString::fromLatin1(reg.name));
     }
     return result;
 }
-- 
GitLab