From aff3f7f767617c9f569ed5101a12d677233be901 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 29 May 2015 12:29:55 +0200 Subject: [PATCH] Fix QIODevice::errorString() and other places where we expose errno Commit e486d69133178ccce7c75cf48201ab28efb20e44 changed the behavior of QString::fromLocal8Bit(const QByteArray &) to preserve embedded null characters. The embedded null character from qt_error_string()'s buffer is not something we want to preserve, it is merely a safe guard. Therefore let's strip it away. Change-Id: Iceac91551f51a1036a942ff30d246baea7a6fd7c Reviewed-by: Marc Mutz --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2176a148b0..4f611bddbc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2955,7 +2955,7 @@ namespace { // depending on the return type static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf) { - return QString::fromLocal8Bit(buf); + return QString::fromLocal8Bit(buf.constData()); } static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &) {