mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
Rewrite outputBits without sprintf (deprecated)
This commit is contained in:
parent
a8fba863a3
commit
38141ef655
1 changed files with 13 additions and 9 deletions
|
@ -183,19 +183,23 @@ void outputBits(unsigned char byte, QDebug* continuedDebug) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString resultString;
|
QString resultString;
|
||||||
|
QTextStream qts (&resultString);
|
||||||
|
|
||||||
|
qts << "[ ";
|
||||||
|
qts << qSetFieldWidth(3) << byte << qSetFieldWidth(0);
|
||||||
|
qts << qSetPadChar('0');
|
||||||
|
|
||||||
if (isalnum(byte)) {
|
if (isalnum(byte)) {
|
||||||
resultString.sprintf("[ %d (%c): ", byte, byte);
|
qts << " (" << QString(byte) << ") : ";
|
||||||
} else {
|
} else {
|
||||||
resultString.sprintf("[ %d (0x%x): ", byte, byte);
|
qts << " (0x" << Qt::hex << qSetFieldWidth(2) << byte << qSetFieldWidth(0) << "): ";
|
||||||
}
|
}
|
||||||
debug << qPrintable(resultString);
|
|
||||||
|
qts << Qt::bin << qSetFieldWidth(8) << byte << qSetFieldWidth(0);
|
||||||
for (int i = 0; i < 8; i++) {
|
qts << " ]";
|
||||||
resultString.sprintf("%d", byte >> (7 - i) & 1);
|
|
||||||
debug << qPrintable(resultString);
|
debug.noquote();
|
||||||
}
|
debug << resultString;
|
||||||
debug << " ]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int numberOfOnes(unsigned char byte) {
|
int numberOfOnes(unsigned char byte) {
|
||||||
|
|
Loading…
Reference in a new issue