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 <thiago.macieira@intel.com>
This commit is contained in:
João Abecasis 2012-02-01 11:06:52 +01:00 committed by Qt by Nokia
parent 0ebca8f46f
commit 4d1ad4e4d3
2 changed files with 2 additions and 2 deletions

View File

@ -1338,7 +1338,7 @@ QByteArray::QByteArray(const char *data, int size)
QByteArray::QByteArray(int size, char ch)
{
if (size <= 0) {
d = const_cast<Data *>(&shared_null.ba);
d = const_cast<Data *>(&shared_empty.ba);
} else {
d = static_cast<Data *>(malloc(sizeof(Data) + size + 1));
Q_CHECK_PTR(d);

View File

@ -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: