summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-01-23 11:48:09 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-02-12 09:58:49 +0000
commitbdf43cac03aafb2bec2a9a0a09914916f7af0269 (patch)
treef931ded879dfe7884099419c379493264508bae9 /src
parent9400295a7ca6411cb220cd7161db393e11e1f807 (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_unix.cpp17
1 files changed, 11 insertions, 6 deletions
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 <ctype.h>
-
/*
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;
+ }
}
}