From 4b9a0c0a7c739650d0e123032be517eb40c2f32c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Jan 2015 11:33:10 +0100 Subject: QLogging: migrate to QString::(v)asprintf Change-Id: I63141c258c9409b03ce23cd77b90c4e4bc3487ab Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 4fb5d7ff1f..af5d7cf55a 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -253,7 +253,7 @@ static void qt_message(QtMsgType msgType, const QMessageLogContext &context, con { if (msg) - buf = QString().vsprintf(msg, ap); + buf = QString::vasprintf(msg, ap); qt_message_print(msgType, context, buf); } @@ -1367,13 +1367,13 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con } else if (token == timeTokenC) { if (pattern->timeFormat == QLatin1String("process")) { quint64 ms = pattern->timer.elapsed(); - message.append(QString().sprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); + message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); } else if (pattern->timeFormat == QLatin1String("boot")) { // just print the milliseconds since the elapsed timer reference // like the Linux kernel does pattern->timer.elapsed(); uint ms = pattern->timer.msecsSinceReference(); - message.append(QString().sprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); + message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); } else if (pattern->timeFormat.isEmpty()) { message.append(QDateTime::currentDateTime().toString(Qt::ISODate)); } else { @@ -1611,7 +1611,7 @@ void qErrnoWarning(const char *msg, ...) va_list ap; va_start(ap, msg); if (msg) - buf.vsprintf(msg, ap); + buf = QString::vasprintf(msg, ap); va_end(ap); buf += QLatin1String(" (") + qt_error_string(-1) + QLatin1Char(')'); @@ -1627,7 +1627,7 @@ void qErrnoWarning(int code, const char *msg, ...) va_list ap; va_start(ap, msg); if (msg) - buf.vsprintf(msg, ap); + buf = QString::vasprintf(msg, ap); va_end(ap); buf += QLatin1String(" (") + qt_error_string(code) + QLatin1Char(')'); -- cgit v1.2.3