path: root/src/corelib/tools/qbytearray.h
diff options
authorJoão Abecasis <>2012-04-04 13:50:21 +0200
committerQt by Nokia <>2012-04-05 01:44:34 +0200
commite5d10b2a3be77244d8db3a4dac86168ee9b91e6f (patch)
treee9f2a63e957d95fd2f10a62c772aaa993bdd9f79 /src/corelib/tools/qbytearray.h
parent7488b79652cb18de3e2b295835c08a46f3e286f4 (diff)
Move growth computation to re-allocation function
Callers of QByteArray/QString::realloc() are still responsible for the heuristics and decide whether to provide the "grow" hint, but computation is centralized there. With this change we also ensure growth takes into account the terminating null. Previously, calls to qAllocMore took into account header and string size, for left out the null, meaning we ended up allocating ("nice-size" + Null). Change-Id: Iad1536e7706cd2d446daee96859db9b01c5f9680 Reviewed-by: Marius Storm-Olsen <> Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/tools/qbytearray.h')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 93e241904d..62273c55fd 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -406,7 +406,7 @@ private:
static const QStaticByteArrayData<1> shared_null;
static const QStaticByteArrayData<1> shared_empty;
Data *d;
- void realloc(int alloc);
+ void realloc(int alloc, bool grow = false);
void expand(int i);
QByteArray nulTerminated() const;