summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qbytearray.cpp15
-rw-r--r--src/corelib/tools/qbytearray.h3
2 files changed, 17 insertions, 1 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 0c45776..142dfeb 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1304,6 +1304,21 @@ QByteArray::QByteArray(int size, char ch)
}
/*!
+ \internal
+
+ Constructs a byte array of size \a size with uninitialized contents.
+*/
+
+QByteArray::QByteArray(int size, enum Qt::Uninitialized)
+{
+ d = static_cast<Data *>(qMalloc(sizeof(Data)+size));
+ d->ref = 1;
+ d->alloc = d->size = size;
+ d->data = d->array;
+ d->array[size] = '\0';
+}
+
+/*!
Sets the size of the byte array to \a size bytes.
If \a size is greater than the current size, the byte array is
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 5cd4d63..3cb10d7 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -42,8 +42,8 @@
#ifndef QBYTEARRAY_H
#define QBYTEARRAY_H
-#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
+#include <QtCore/qnamespace.h>
#include <string.h>
#include <stdarg.h>
@@ -127,6 +127,7 @@ public:
QByteArray(const char *);
QByteArray(const char *, int size);
QByteArray(int size, char c);
+ QByteArray(int size, enum Qt::Uninitialized);
inline QByteArray(const QByteArray &);
inline ~QByteArray();