diff options
author | hjk <[email protected]> | 2010-03-11 18:55:52 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2010-03-11 18:56:28 +0100 |
commit | c8a61cc8f2dbc155184c80fb5846ea9dc8641e2a (patch) | |
tree | b0486973527bd1418c36d1f4f6f92bc7b97bb9c2 /src/plugins/debugger/watchutils.cpp | |
parent | 8575e4c78416fa8696c2866b99ee707d5c94c35b (diff) |
debugger: implement selected of string encoding per pointer type/individual pointer
Diffstat (limited to 'src/plugins/debugger/watchutils.cpp')
-rw-r--r-- | src/plugins/debugger/watchutils.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index f84f98835e5..bda7f9d373b 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -640,7 +640,7 @@ QString decodeData(const QByteArray &ba, int encoding) case 5: { // base64 encoded 8 bit data, without quotes (see 1) return quoteUnprintableLatin1(QByteArray::fromBase64(ba)); } - case 6: { // %02x encoded 8 bit data + case 6: { // %02x encoded 8 bit Latin1 data const QChar doubleQuote(QLatin1Char('"')); const QByteArray decodedBa = QByteArray::fromHex(ba); //qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n"; @@ -660,6 +660,39 @@ QString decodeData(const QByteArray &ba, int encoding) return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *> (decodedBa.data()), decodedBa.size() / 4) + doubleQuote; } + case 9: { // %02x encoded 8 bit Utf-8 data + const QChar doubleQuote(QLatin1Char('"')); + const QByteArray decodedBa = QByteArray::fromHex(ba); + //qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n"; + return doubleQuote + QString::fromUtf8(decodedBa) + doubleQuote; + } + case 10: { // %08x encoded 32 bit data, Big Endian + const QChar doubleQuote(QLatin1Char('"')); + QByteArray decodedBa = QByteArray::fromHex(ba); + for (int i = 0; i < decodedBa.size(); i += 4) { + char c = decodedBa.at(i); + decodedBa[i] = decodedBa.at(i + 3); + decodedBa[i + 3] = c; + c = decodedBa.at(i + 1); + decodedBa[i + 1] = decodedBa.at(i + 2); + decodedBa[i + 2] = c; + } + //qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n"; + return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *> + (decodedBa.data()), decodedBa.size() / 4) + doubleQuote; + } + case 11: { // %02x encoded 16 bit data, Big Endian + const QChar doubleQuote(QLatin1Char('"')); + QByteArray decodedBa = QByteArray::fromHex(ba); + for (int i = 0; i < decodedBa.size(); i += 2) { + char c = decodedBa.at(i); + decodedBa[i] = decodedBa.at(i + 1); + decodedBa[i + 1] = c; + } + //qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n"; + return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *> + (decodedBa.data()), decodedBa.size() / 4) + doubleQuote; + } } qDebug() << "ENCODING ERROR: " << encoding; return QCoreApplication::translate("Debugger", "<Encoding error>"); |