Fix QIODevice::errorString() and other places where we expose errno

Commit e486d69133 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 <marc.mutz@kdab.com>
This commit is contained in:
Simon Hausmann 2015-05-29 12:29:55 +02:00
parent c0ddd5fa12
commit aff3f7f767

View File

@ -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 &)
{