Name watchutils encoding types consistently.

Change-Id: I26d92ffc6fdbe67bf0cbbb0dde40211330ef8e34
Reviewed-on: http://codereview.qt.nokia.com/2748
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2011-08-08 15:03:34 +02:00
committed by hjk
parent 99ba300ae3
commit 3c5604e267
2 changed files with 12 additions and 12 deletions

View File

@@ -556,24 +556,24 @@ QString decodeData(const QByteArray &ba, int encoding)
case Base64Encoded8Bit: { // 5, without quotes (see 1) case Base64Encoded8Bit: { // 5, without quotes (see 1)
return quoteUnprintableLatin1(QByteArray::fromBase64(ba)); return quoteUnprintableLatin1(QByteArray::fromBase64(ba));
} }
case Hex2EncodedLatin1: { // 6, %02x encoded 8 bit Latin1 data case Hex2EncodedLatin1WithQuotes: { // 6, %02x encoded 8 bit Latin1 data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba); const QByteArray decodedBa = QByteArray::fromHex(ba);
return doubleQuote + QString::fromLatin1(decodedBa) + doubleQuote; return doubleQuote + QString::fromLatin1(decodedBa) + doubleQuote;
} }
case Hex4EncodedLittleEndian: { // 7, %04x encoded 16 bit data case Hex4EncodedLittleEndianWithQuotes: { // 7, %04x encoded 16 bit data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba); const QByteArray decodedBa = QByteArray::fromHex(ba);
return doubleQuote + QString::fromUtf16(reinterpret_cast<const ushort *> return doubleQuote + QString::fromUtf16(reinterpret_cast<const ushort *>
(decodedBa.data()), decodedBa.size() / 2) + doubleQuote; (decodedBa.data()), decodedBa.size() / 2) + doubleQuote;
} }
case Hex8EncodedLittleEndian: { // 8, %08x encoded 32 bit data case Hex8EncodedLittleEndianWithQuotes: { // 8, %08x encoded 32 bit data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba); const QByteArray decodedBa = QByteArray::fromHex(ba);
return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *> return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *>
(decodedBa.data()), decodedBa.size() / 4) + doubleQuote; (decodedBa.data()), decodedBa.size() / 4) + doubleQuote;
} }
case Hex2EncodedUtf8: { // 9, %02x encoded 8 bit UTF-8 data case Hex2EncodedUtf8WithQuotes: { // 9, %02x encoded 8 bit UTF-8 data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba); const QByteArray decodedBa = QByteArray::fromHex(ba);
return doubleQuote + QString::fromUtf8(decodedBa) + doubleQuote; return doubleQuote + QString::fromUtf8(decodedBa) + doubleQuote;
@@ -592,7 +592,7 @@ QString decodeData(const QByteArray &ba, int encoding)
return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *> return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *>
(decodedBa.data()), decodedBa.size() / 4) + doubleQuote; (decodedBa.data()), decodedBa.size() / 4) + doubleQuote;
} }
case Hex4EncodedBigEndian: { // 11, %04x encoded 16 bit data case Hex4EncodedBigEndianWithQuotes: { // 11, %04x encoded 16 bit data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
QByteArray decodedBa = QByteArray::fromHex(ba); QByteArray decodedBa = QByteArray::fromHex(ba);
for (int i = 0; i < decodedBa.size(); i += 2) { for (int i = 0; i < decodedBa.size(); i += 2) {
@@ -608,7 +608,7 @@ QString decodeData(const QByteArray &ba, int encoding)
return QString::fromUtf16(reinterpret_cast<const ushort *> return QString::fromUtf16(reinterpret_cast<const ushort *>
(decodedBa.data()), decodedBa.size() / 2); (decodedBa.data()), decodedBa.size() / 2);
} }
case Hex2EncodedLocal8Bit: { // 13, %02x encoded 8 bit UTF-8 data case Hex2EncodedLocal8BitWithQuotes: { // 13, %02x encoded 8 bit UTF-8 data
const QChar doubleQuote(QLatin1Char('"')); const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba); const QByteArray decodedBa = QByteArray::fromHex(ba);
return doubleQuote + QString::fromLocal8Bit(decodedBa) + doubleQuote; return doubleQuote + QString::fromLocal8Bit(decodedBa) + doubleQuote;

View File

@@ -62,14 +62,14 @@ enum DebuggerEncoding
Base64Encoded32BitWithQuotes = 3, Base64Encoded32BitWithQuotes = 3,
Base64Encoded16Bit = 4, Base64Encoded16Bit = 4,
Base64Encoded8Bit = 5, Base64Encoded8Bit = 5,
Hex2EncodedLatin1 = 6, Hex2EncodedLatin1WithQuotes = 6,
Hex4EncodedLittleEndian = 7, Hex4EncodedLittleEndianWithQuotes = 7,
Hex8EncodedLittleEndian = 8, Hex8EncodedLittleEndianWithQuotes = 8,
Hex2EncodedUtf8 = 9, Hex2EncodedUtf8WithQuotes = 9,
Hex8EncodedBigEndian = 10, Hex8EncodedBigEndian = 10,
Hex4EncodedBigEndian = 11, Hex4EncodedBigEndianWithQuotes = 11,
Hex4EncodedLittleEndianWithoutQuotes = 12, Hex4EncodedLittleEndianWithoutQuotes = 12,
Hex2EncodedLocal8Bit = 13 Hex2EncodedLocal8BitWithQuotes = 13
}; };
bool isEditorDebuggable(Core::IEditor *editor); bool isEditorDebuggable(Core::IEditor *editor);