summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qarraydata
Commit message (Collapse)AuthorAgeFilesLines
...
* Add test for GCC bug #43247João Abecasis2011-12-111-0/+28
| | | | | | | | | | | | | | A bug has been reported against GCC 4.4.3 (present in other version as well), where the use of an array of size 1 to implement dynamic arrays (such as QVector) leads to incorrect results in optimized builds as the compiler assumes the index to be 0. This test tries to ensure QArrayDataHeader is not affected by this bug, as QVector currently is. Change-Id: Id701496bae4d74170de43399c1062da40eb078e7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* template<class T> struct QTypedArrayDataJoão Abecasis2011-12-112-15/+152
| | | | | | | | | | QTypedArrayData is a typed overlay for QArrayData, providing convenience and type-safety. It adds no data members to QArrayData, thus avoiding compiler-generated warnings for aliasing issues when casting back and forth. Change-Id: I969342a30989c4c14b3d03d0602e3d60a4cc0e9d Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Allocate/free support in QArrayDataJoão Abecasis2011-12-091-0/+144
| | | | | | | | | | | | | | | | | | | Centralizing QArrayData memory management decisions in one place will allow us to be smarter in how we allocate header and data. At the moment, these are allocated as a single block. In the future we may decide to allocate them separately for "large" data or specific alignment requirements. For users of QArrayData this remains transparent and not part of the ABI. The offset field in QArrayDataHeader enables this. This also hard-wires allocation of empty arrays to return shared_empty. Allocating detached headers (e.g., to support fromRawData) will thus require explicit support. Change-Id: Icac5a1f51ee7e468c76b4493d29debc18780e5dc Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* SimpleVector as a test case for QArrayDataJoão Abecasis2011-12-073-0/+289
| | | | | | | | | | SimpleVector is meant solely as a test case and reference container implementation based on QArrayData functionality. It shall not replace QVector or friends. Change-Id: I5c66777c720f252c8e073a2884c6d5f1ac836d0e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Introducing QArrayDataJoão Abecasis2011-12-062-0/+156
Modeled on QByteArrayData/QStringData/QVectorData, the intent is to unify book-keeping structs for array-like data and enable sharing of code among them. As in those structures, size (and alloc) data member(s) specify the number of *typed* elements the array does (and can) hold. The size or alignment requirements of those objects is not tracked in this data structure and needs to be maintained by its users. Contrary to QByteArrayData and QStringData, QArrayData's offset member keeps a *byte* offset to the actual data array and is computed from the beginning of the struct. Shared-null and -empty functionality is provided by QArrayData and shared among all users. Planned features include setSharable (force deep copies), fromRawData (detached header and data allocations) and literals a la QStringLiteral (static immutable instances), thus covering the functionality needed for QByteArray, QString and QVector. Change-Id: I9aa709dbb675442e6d06965efb8138ab84602bbd Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>