summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qtextstream.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index e2bb309db9..f870fb11e3 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -233,6 +233,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
#if defined QTEXTSTREAM_DEBUG
#include <ctype.h>
+#include "private/qtools_p.h"
QT_BEGIN_NAMESPACE
@@ -250,10 +251,16 @@ static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
case '\n': out += "\\n"; break;
case '\r': out += "\\r"; break;
case '\t': out += "\\t"; break;
- default:
- QString tmp;
- tmp.sprintf("\\x%x", (unsigned int)(unsigned char)c);
- out += tmp.toLatin1();
+ default: {
+ const char buf[] = {
+ '\\',
+ 'x',
+ QtMiscUtils::toHexLower(uchar(c) / 16),
+ QtMiscUtils::toHexLower(uchar(c) % 16),
+ 0
+ };
+ out += buf;
+ }
}
}