From 454e87a57b6876b8db2180236082d7c7bc408a0e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 11 Dec 2009 16:13:00 +0100 Subject: Fix normalization of Type * const After commit b881d8fb99972f1bd04ab4c84843cc8d43ddbeed, we would no longer append "const" when seeing it after a *. This commit fixes the regression. Reviewed-by: ogoffart --- src/corelib/kernel/qmetaobject_p.h | 3 +++ tests/auto/qmetaobject/tst_qmetaobject.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 7afb70b..83ca9af 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -295,6 +295,9 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc } else if (!star) { // move const to the front (but not if const comes after a *) result.prepend("const "); + } else { + // keep const after a * + result += "const"; } } } diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 8331ca1..fb62312 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -664,7 +664,7 @@ void tst_QMetaObject::normalizedSignature_data() QTest::newRow("const rettype") << "const QString *foo()" << "const QString*foo()"; QTest::newRow("const ref") << "const QString &foo()" << "const QString&foo()"; QTest::newRow("reference") << "QString &foo()" << "QString&foo()"; - QTest::newRow("const2") << "void foo(QString const *)" << "void foo(const QString*)"; + QTest::newRow("const1") << "void foo(QString const *)" << "void foo(const QString*)"; QTest::newRow("const2") << "void foo(QString * const)" << "void foo(QString*const)"; QTest::newRow("const3") << "void foo(QString const &)" << "void foo(QString)"; QTest::newRow("const4") << "void foo(const int)" << "void foo(int)"; @@ -672,7 +672,7 @@ void tst_QMetaObject::normalizedSignature_data() << "void foo(int,int,int,int)"; QTest::newRow("const6") << "void foo(QList)" << "void foo(QList)"; QTest::newRow("const7") << "void foo(QList)" << "void foo(QList)"; - QTest::newRow("const7") << "void foo(QList)" << "void foo(QList)"; + QTest::newRow("const8") << "void foo(QList)" << "void foo(QList)"; } void tst_QMetaObject::normalizedSignature() -- cgit v0.12