From 6a6425dff5fb12bf7522dd3c0894a43336667263 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 6 Feb 2012 08:32:59 +0100 Subject: Don't hardcode the number 14 in meta-object generators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Bradley T. Hughes Reviewed-by: Jędrzej Nowacki --- src/tools/moc/generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools/moc') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index e2055e44e8..8242fb45ec 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -164,7 +164,7 @@ void Generator::generateCode() 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)); -- cgit v1.2.3