From bdf43cac03aafb2bec2a9a0a09914916f7af0269 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Jan 2015 11:48:09 +0100 Subject: QProcess: remove a use of QString::sprintf() Instead of using QString::sprintf() (and converting the result back to QByteArray), simply do the conversion from uchar to octal digits ourselves, using QtMiscTools. Change-Id: I452c085b717c71609cd1a9465e31d90e6a0ba54b Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 83e76edc86..fcebc08d7f 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -37,10 +37,9 @@ #ifndef QT_NO_PROCESS #if defined QPROCESS_DEBUG -#include "qstring.h" +#include "private/qtools_p.h" #include - /* Returns a human readable representation of the first \a len characters in \a data. @@ -58,10 +57,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("\\%o", c); - out += tmp.toLatin1(); + default: { + const char buf[] = { + '\\', + QtMiscUtils::toOct(uchar(c) / 64), + QtMiscUtils::toOct(uchar(c) % 64 / 8), + QtMiscUtils::toOct(uchar(c) % 8), + 0 + }; + out += buf; + } } } -- cgit v1.2.3