14 is the number of fields (ints) in the QMetaObjectPrivate struct
as of revision 6.
Use the calculated number of fields instead, so that the code will
still be correct when more fields are added in future revisions.
Change-Id: I4f2c2bfc125f3fabc8e8caedf5c6ba6c17a34d06
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
#endif
};
+// For meta-object generators
+
+enum { MetaObjectPrivateFieldCount = sizeof(QMetaObjectPrivate) / sizeof(int) };
+
#ifndef UTILS_H
// mirrored in moc's utils.h
static inline bool is_ident_char(char s)
QMetaObjectPrivate *pmeta
= reinterpret_cast<QMetaObjectPrivate *>(buf + size);
int pmetaSize = size;
- dataIndex = 14; // Number of fields in the QMetaObjectPrivate.
+ dataIndex = MetaObjectPrivateFieldCount;
for (index = 0; index < d->properties.size(); ++index) {
if (d->properties[index].notifySignal != -1) {
hasNotifySignals = true;
}
// Reset the current data position to just past the QMetaObjectPrivate.
- dataIndex = 14;
+ dataIndex = MetaObjectPrivateFieldCount;
// Add the class name to the string table.
int offset = 0;
QByteArray qualifiedClassNameIdentifier = cdef->qualified;
qualifiedClassNameIdentifier.replace(':', '_');
- int index = 14;
+ int index = MetaObjectPrivateFieldCount;
fprintf(out, "static const uint qt_meta_data_%s[] = {\n", qualifiedClassNameIdentifier.constData());
fprintf(out, "\n // content:\n");
fprintf(out, " %4d, // revision\n", int(QMetaObjectPrivate::OutputRevision));