From 4d1ad4e4d386b2afb29e8476e21dc8f38262d238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 1 Feb 2012 11:06:52 +0100 Subject: [PATCH] Don't treat QByteArray(0, char) as null This also changes behavior for negative sizes, but those cases could be viewed as errors on the client side, anyway. Change-Id: I9e56f2ba53b1edcd9f2faa5384c7d77f6823e24a Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.cpp | 2 +- src/dbus/qdbusmetatype.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index ac936b1d0a9..ea6f5c46268 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1338,7 +1338,7 @@ QByteArray::QByteArray(const char *data, int size) QByteArray::QByteArray(int size, char ch) { if (size <= 0) { - d = const_cast(&shared_null.ba); + d = const_cast(&shared_empty.ba); } else { d = static_cast(malloc(sizeof(Data) + size + 1)); Q_CHECK_PTR(d); diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index b5a138f6548..0359b4da35c 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE class QDBusCustomTypeInfo { public: - QDBusCustomTypeInfo() : signature(0, '\0'), marshall(0), demarshall(0) + QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0) { } // Suggestion: