From 982347dda5ee8fa916a9760ecd89452fd3cd90c1 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Mon, 12 Oct 2009 09:30:28 +0200 Subject: [PATCH] debugger: provide support for .toHex() encoded string data. more verbose than base64 but also less work on the dumper side --- src/plugins/debugger/watchutils.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index c004a25652c..a351f34ced7 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -409,7 +409,8 @@ QString decodeData(const QByteArray &ba, int encoding) const QChar doubleQuote(QLatin1Char('"')); const QByteArray decodedBa = QByteArray::fromBase64(ba); QString rc = doubleQuote; - rc += QString::fromUtf16(reinterpret_cast<const ushort *>(decodedBa.data()), decodedBa.size() / 2); + rc += QString::fromUtf16(reinterpret_cast<const ushort *> + (decodedBa.data()), decodedBa.size() / 2); rc += doubleQuote; return rc; } @@ -417,17 +418,25 @@ QString decodeData(const QByteArray &ba, int encoding) const QByteArray decodedBa = QByteArray::fromBase64(ba); const QChar doubleQuote(QLatin1Char('"')); QString rc = doubleQuote; - rc += QString::fromUcs4(reinterpret_cast<const uint *>(decodedBa.data()), decodedBa.size() / 4); + rc += QString::fromUcs4(reinterpret_cast<const uint *> + (decodedBa.data()), decodedBa.size() / 4); rc += doubleQuote; return rc; } case 4: { // base64 encoded 16 bit data, without quotes (see 2) const QByteArray decodedBa = QByteArray::fromBase64(ba); - return QString::fromUtf16(reinterpret_cast<const ushort *>(decodedBa.data()), decodedBa.size() / 2); + return QString::fromUtf16(reinterpret_cast<const ushort *> + (decodedBa.data()), decodedBa.size() / 2); } case 5: { // base64 encoded 8 bit data, without quotes (see 1) return quoteUnprintableLatin1(QByteArray::fromBase64(ba)); } + case 7: { // %04x endoded 16 bit data + const QByteArray decodedBa = QByteArray::fromHex(ba); + qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n"; + return QString::fromUtf16(reinterpret_cast<const ushort *> + (decodedBa.data()), decodedBa.size() / 2); + } } return QCoreApplication::translate("Debugger", "<Encoding error>"); } -- GitLab