summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-06-18 14:36:46 (GMT)
committerhjk <qtc-committer@nokia.com>2009-06-19 06:39:38 (GMT)
commitcce29e63108827f551c74221d0aafbbba891dd51 (patch)
tree0060d9cb361cab7d64fed0f79e7673f1f620ce6a /src/corelib/tools/qbytearray.cpp
parentf9f08de9d41fd55d9c7d01578191ef5d4099c9e6 (diff)
downloadQt-cce29e63108827f551c74221d0aafbbba891dd51.zip
Qt-cce29e63108827f551c74221d0aafbbba891dd51.tar.gz
Qt-cce29e63108827f551c74221d0aafbbba891dd51.tar.bz2
New constructor QByteArray::QByteArray(int size, enum Qt::Uninitialized)
Contrary to the QByteArray::QByteArray(int size, enum Qt::Uninitialized) constructor this does not initialize its data. Reviewed-by: mariusSO
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp15
1 files changed, 15 insertions, 0 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