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>
This commit is contained in:
Marc Mutz 2015-01-23 11:48:09 +01:00
parent 9400295a7c
commit bdf43cac03

View File

@ -37,10 +37,9 @@
#ifndef QT_NO_PROCESS #ifndef QT_NO_PROCESS
#if defined QPROCESS_DEBUG #if defined QPROCESS_DEBUG
#include "qstring.h" #include "private/qtools_p.h"
#include <ctype.h> #include <ctype.h>
/* /*
Returns a human readable representation of the first \a len Returns a human readable representation of the first \a len
characters in \a data. 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 '\n': out += "\\n"; break;
case '\r': out += "\\r"; break; case '\r': out += "\\r"; break;
case '\t': out += "\\t"; break; case '\t': out += "\\t"; break;
default: default: {
QString tmp; const char buf[] = {
tmp.sprintf("\\%o", c); '\\',
out += tmp.toLatin1(); QtMiscUtils::toOct(uchar(c) / 64),
QtMiscUtils::toOct(uchar(c) % 64 / 8),
QtMiscUtils::toOct(uchar(c) % 8),
0
};
out += buf;
}
} }
} }