diff options
author | hjk <[email protected]> | 2009-10-12 09:30:28 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2009-10-12 14:51:22 +0200 |
commit | 982347dda5ee8fa916a9760ecd89452fd3cd90c1 (patch) | |
tree | 898ca00a4a7e2dd4e2bb1a30a3449f5a3a4dc091 /src/plugins/debugger/watchutils.cpp | |
parent | f7263f2333e331b32b03a4b81b0a7fd0f2f779f6 (diff) |
debugger: provide support for .toHex() encoded string data.
more verbose than base64 but also less work on the dumper side
Diffstat (limited to 'src/plugins/debugger/watchutils.cpp')
-rw-r--r-- | src/plugins/debugger/watchutils.cpp | 15 |
1 files 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>"); } |