summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-04-04 14:04:03 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-05 01:44:46 +0200
commit3669ceb77968e55225fecc7f4232b5545c98a69b (patch)
treee31e15825989b576714252092029e3a3da564b25 /src/corelib/tools/qbytearray.cpp
parente5d10b2a3be77244d8db3a4dac86168ee9b91e6f (diff)
Rename realloc -> reallocData
This avoids confusion with standard ::realloc. Change-Id: Ibeccf2f702ec37161033febf4f3926bee8f7aea6 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 731a1b163b..2e9c1fb801 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -919,7 +919,7 @@ QByteArray &QByteArray::operator=(const char *str)
} else {
int len = strlen(str);
if (d->ref.isShared() || len > int(d->alloc) || (len < d->size && len < int(d->alloc) >> 1))
- realloc(len);
+ reallocData(len);
x = d;
memcpy(x->data(), str, len + 1); // include null terminator
x->size = len;
@@ -1432,7 +1432,7 @@ void QByteArray::resize(int size)
} else {
if (d->ref.isShared() || size > int(d->alloc)
|| (!d->capacityReserved && size < d->size && size < int(d->alloc) >> 1))
- realloc(size, true);
+ reallocData(size, true);
if (int(d->alloc) >= size) {
d->size = size;
d->data()[size] = '\0';
@@ -1459,7 +1459,7 @@ QByteArray &QByteArray::fill(char ch, int size)
return *this;
}
-void QByteArray::realloc(int alloc, bool grow)
+void QByteArray::reallocData(int alloc, bool grow)
{
if (grow)
alloc = qAllocMore(alloc + 1, sizeof(Data)) - 1;
@@ -1566,7 +1566,7 @@ QByteArray &QByteArray::prepend(const char *str, int len)
{
if (str) {
if (d->ref.isShared() || d->size + len > int(d->alloc))
- realloc(d->size + len, true);
+ reallocData(d->size + len, true);
memmove(d->data()+len, d->data(), d->size);
memcpy(d->data(), str, len);
d->size += len;
@@ -1584,7 +1584,7 @@ QByteArray &QByteArray::prepend(const char *str, int len)
QByteArray &QByteArray::prepend(char ch)
{
if (d->ref.isShared() || d->size + 1 > int(d->alloc))
- realloc(d->size + 1, true);
+ reallocData(d->size + 1, true);
memmove(d->data()+1, d->data(), d->size);
d->data()[0] = ch;
++d->size;
@@ -1622,7 +1622,7 @@ QByteArray &QByteArray::append(const QByteArray &ba)
*this = ba;
} else if (ba.d != &shared_null.ba) {
if (d->ref.isShared() || d->size + ba.d->size > int(d->alloc))
- realloc(d->size + ba.d->size, true);
+ reallocData(d->size + ba.d->size, true);
memcpy(d->data() + d->size, ba.d->data(), ba.d->size);
d->size += ba.d->size;
d->data()[d->size] = '\0';
@@ -1656,7 +1656,7 @@ QByteArray& QByteArray::append(const char *str)
if (str) {
int len = strlen(str);
if (d->ref.isShared() || d->size + len > int(d->alloc))
- realloc(d->size + len, true);
+ reallocData(d->size + len, true);
memcpy(d->data() + d->size, str, len + 1); // include null terminator
d->size += len;
}
@@ -1681,7 +1681,7 @@ QByteArray &QByteArray::append(const char *str, int len)
len = qstrlen(str);
if (str && len) {
if (d->ref.isShared() || d->size + len > int(d->alloc))
- realloc(d->size + len, true);
+ reallocData(d->size + len, true);
memcpy(d->data() + d->size, str, len); // include null terminator
d->size += len;
d->data()[d->size] = '\0';
@@ -1698,7 +1698,7 @@ QByteArray &QByteArray::append(const char *str, int len)
QByteArray& QByteArray::append(char ch)
{
if (d->ref.isShared() || d->size + 1 > int(d->alloc))
- realloc(d->size + 1, true);
+ reallocData(d->size + 1, true);
d->data()[d->size++] = ch;
d->data()[d->size] = '\0';
return *this;