Use memmove in QListData::append(int) as regions overlap.

It's undefined behaviour to memcpy regions with overlapping area. You
have to use memmove.

Change-Id: I912c819bf7ab26ba1e60028ee9d7c833dfc5138a
Reviewed-on: http://codereview.qt.nokia.com/1355
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
This commit is contained in:
Thiago Macieira 2011-07-08 10:42:49 +02:00 committed by Qt by Nokia
parent 948d051fb1
commit d96b7b809e

View File

@ -164,7 +164,7 @@ void **QListData::append(int n)
if (b - n >= 2 * d->alloc / 3) {
// we have enough space. Just not at the end -> move it.
e -= b;
::memcpy(d->array, d->array + b, e * sizeof(void *));
::memmove(d->array, d->array + b, e * sizeof(void *));
d->begin = 0;
} else {
realloc(grow(d->alloc + n));