summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-10-28 11:47:35 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-10-28 14:27:45 (GMT)
commit5b4b6b2be7b901ef9a29c37431998034730fa3d3 (patch)
tree9dd31b2f0af3f23462575c02f17eb33bdf9bb7e0 /src/corelib/tools
parente83bb2fdfc2dc899526c8157fd8b77a68cdde9da (diff)
downloadQt-5b4b6b2be7b901ef9a29c37431998034730fa3d3.zip
Qt-5b4b6b2be7b901ef9a29c37431998034730fa3d3.tar.gz
Qt-5b4b6b2be7b901ef9a29c37431998034730fa3d3.tar.bz2
Initialise the reserved bits to 0.
This is future compatibility: we must rely on them being 0 in older versions of Qt. Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcontiguouscache.h3
-rw-r--r--src/corelib/tools/qhash.cpp3
-rw-r--r--src/corelib/tools/qhash.h1
-rw-r--r--src/corelib/tools/qmap.cpp3
-rw-r--r--src/corelib/tools/qmap.h1
-rw-r--r--src/corelib/tools/qvector.cpp2
-rw-r--r--src/corelib/tools/qvector.h2
7 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index b9d04b8..ef5b238 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -62,7 +62,7 @@ struct Q_CORE_EXPORT QContiguousCacheData
int start;
int offset;
uint sharable : 1;
- // uint unused : 31;
+ uint reserved : 31;
// total is 24 bytes (HP-UX aCC: 40 bytes)
// the next entry is already aligned to 8 bytes
@@ -186,6 +186,7 @@ void QContiguousCache<T>::detach_helper()
x.d->offset = d->offset;
x.d->alloc = d->alloc;
x.d->sharable = true;
+ x.d->reserved = 0;
T *dest = x.p->array + x.d->start;
T *src = p->array + d->start;
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 23fff1c..c82c389 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -166,7 +166,7 @@ static int countBits(int hint)
const int MinNumBits = 4;
QHashData QHashData::shared_null = {
- 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false
+ 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false, 0
};
void *QHashData::allocateNode()
@@ -214,6 +214,7 @@ QHashData *QHashData::detach_helper2(void (*node_duplicate)(Node *, void *),
d->numBuckets = numBuckets;
d->sharable = true;
d->strictAlignment = nodeAlign > 8;
+ d->reserved = 0;
if (numBuckets) {
QT_TRY {
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 67b394b..1918229 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -126,6 +126,7 @@ struct Q_CORE_EXPORT QHashData
int numBuckets;
uint sharable : 1;
uint strictAlignment : 1;
+ uint reserved : 30;
void *allocateNode(); // ### Qt5 remove me
void *allocateNode(int nodeAlign);
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index cfb18b4..3b48c3f 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QMapData QMapData::shared_null = {
&shared_null,
{ &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false
+ Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false, 0
};
QMapData *QMapData::createData()
@@ -75,6 +75,7 @@ QMapData *QMapData::createData(int alignment)
d->insertInOrder = false;
d->sharable = true;
d->strictAlignment = alignment > 8;
+ d->reserved = 0;
return d;
}
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 20980e7..65c3d2a 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -75,6 +75,7 @@ struct Q_CORE_EXPORT QMapData
uint insertInOrder : 1;
uint sharable : 1;
uint strictAlignment : 1;
+ uint reserved : 29;
static QMapData *createData(); // ### Qt5 remove me
static QMapData *createData(int alignment);
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index 6522791..8bb1074 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -52,7 +52,7 @@ static inline int alignmentThreshold()
return 2 * sizeof(void*);
}
-QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false };
+QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false, 0 };
QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init)
{
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index cf7df12..7402d77 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -72,6 +72,7 @@ struct Q_CORE_EXPORT QVectorData
#else
uint sharable : 1;
uint capacity : 1;
+ uint reserved : 30;
#endif
static QVectorData shared_null;
@@ -486,6 +487,7 @@ void QVector<T>::realloc(int asize, int aalloc)
x.d->alloc = aalloc;
x.d->sharable = true;
x.d->capacity = d->capacity;
+ x.d->reserved = 0;
}
if (QTypeInfo<T>::isComplex) {