mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:03:57 +02:00
fix debug to properly work with outputBufferBits()
This commit is contained in:
parent
f1b612d8d8
commit
2cf2e693b9
2 changed files with 12 additions and 7 deletions
|
@ -101,10 +101,12 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D
|
|||
|
||||
const int STATS_PELS_PER_LINE = 20;
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
||||
QString messageWithNewLine = message + "\n";
|
||||
fprintf(stdout, "%s", messageWithNewLine.toLocal8Bit().constData());
|
||||
Application::getInstance()->getLogger()->addMessage(messageWithNewLine.toLocal8Bit().constData());
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
|
||||
if (message.size() > 0) {
|
||||
QString messageWithNewLine = message + "\n";
|
||||
fprintf(stdout, "%s", messageWithNewLine.toLocal8Bit().constData());
|
||||
Application::getInstance()->getLogger()->addMessage(messageWithNewLine.toLocal8Bit().constData());
|
||||
}
|
||||
}
|
||||
|
||||
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||
|
|
|
@ -65,6 +65,8 @@ bool shouldDo(float desiredInterval, float deltaTime) {
|
|||
return randFloat() < deltaTime / desiredInterval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void outputBufferBits(const unsigned char* buffer, int length, QDebug* continuedDebug) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
outputBits(buffer[i], continuedDebug);
|
||||
|
@ -76,6 +78,7 @@ void outputBits(unsigned char byte, QDebug* continuedDebug) {
|
|||
|
||||
if (continuedDebug) {
|
||||
debug = *continuedDebug;
|
||||
debug.nospace();
|
||||
}
|
||||
|
||||
QString resultString;
|
||||
|
@ -85,12 +88,12 @@ void outputBits(unsigned char byte, QDebug* continuedDebug) {
|
|||
} else {
|
||||
resultString.sprintf("[ %d (0x%x): ", byte, byte);
|
||||
}
|
||||
debug << resultString;
|
||||
|
||||
debug << qPrintable(resultString);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
resultString.sprintf("%d", byte >> (7 - i) & 1);
|
||||
debug << qPrintable(resultString);
|
||||
}
|
||||
debug << resultString;
|
||||
debug << " ]";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue