Debugger: Fix MSVC warning

warning: C4305: '/=': truncation from 'int' to 'IntType'

with q[u]int8 template argument.

Change-Id: I0f0063191b0e51ab79f94073ead65da86ea82440
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2022-01-04 08:55:52 +02:00
committed by Orgad Shaneh
parent 14f40f3cdf
commit 28334638ab

View File

@@ -624,7 +624,7 @@ template <class IntType> QString reformatInteger(IntType value, int format)
QString res = "\""; QString res = "\"";
while (value > 0) { while (value > 0) {
res = QChar(ushort(value & 255)) + res; res = QChar(ushort(value & 255)) + res;
value /= 256; value >>= 8;
} }
return "\"" + res; return "\"" + res;
} }
@@ -641,25 +641,20 @@ static QString reformatInteger(quint64 value, int format, int size, bool isSigne
switch (size) { switch (size) {
case 1: case 1:
value = value & 0xff; value = value & 0xff;
return isSigned break;
? reformatInteger<qint8>(value, format)
: reformatInteger<quint8>(value, format);
case 2: case 2:
value = value & 0xffff; value = value & 0xffff;
return isSigned break;
? reformatInteger<qint16>(value, format)
: reformatInteger<quint16>(value, format);
case 4: case 4:
value = value & 0xffffffff; value = value & 0xffffffff;
return isSigned break;
? reformatInteger<qint32>(value, format)
: reformatInteger<quint32>(value, format);
default: default:
case 8: return isSigned break;
}
return isSigned
? reformatInteger<qint64>(value, format) ? reformatInteger<qint64>(value, format)
: reformatInteger<quint64>(value, format); : reformatInteger<quint64>(value, format);
} }
}
// Format printable (char-type) characters // Format printable (char-type) characters
static QString reformatCharacter(int code, int size, bool isSigned) static QString reformatCharacter(int code, int size, bool isSigned)