From 7ab6783e24c6a05a67f319817cd1bdd026a7ce43 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 24 Jul 2019 18:40:10 +0200 Subject: Standardize on int for line and column values Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar --- src/plugins/designer/codemodelhelpers.cpp | 8 ++++---- src/plugins/designer/qtcreatorintegration.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/plugins/designer') diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp index 52bb38f5d11..de7eb582ac6 100644 --- a/src/plugins/designer/codemodelhelpers.cpp +++ b/src/plugins/designer/codemodelhelpers.cpp @@ -67,7 +67,7 @@ public: bool visit(CPlusPlus::Function * f) override; private: - const size_t m_length; + const int m_length; const char *m_name; FunctionList m_matches; @@ -82,8 +82,8 @@ SearchFunction::SearchFunction(const char *name) : SearchFunction::FunctionList SearchFunction::operator()(const DocumentPtr &doc) { m_matches.clear(); - const unsigned globalSymbolCount = doc->globalSymbolCount(); - for (unsigned i = 0; i < globalSymbolCount; ++i) + const int globalSymbolCount = doc->globalSymbolCount(); + for (int i = 0; i < globalSymbolCount; ++i) accept(doc->globalSymbolAt(i)); return m_matches; } @@ -93,7 +93,7 @@ bool SearchFunction::visit(CPlusPlus::Function * f) if (const CPlusPlus::Name *name = f->name()) if (const CPlusPlus::Identifier *id = name->identifier()) if (id->size() == m_length) - if (!qstrncmp(m_name, id->chars(), uint(m_length))) + if (!qstrncmp(m_name, id->chars(), m_length)) m_matches.push_back(f); return true; } diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index d004f4a661b..22f66c02580 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -142,8 +142,8 @@ static QList findDocumentsIncluding(const Snapshot &docTable, // Does klass inherit baseClass? static bool inherits(const Overview &o, const Class *klass, const QString &baseClass) { - const unsigned int baseClassCount = klass->baseClassCount(); - for (unsigned int b = 0; b < baseClassCount; ++b) + const int baseClassCount = klass->baseClassCount(); + for (int b = 0; b < baseClassCount; ++b) if (o.prettyName(klass->baseClassAt(b)->name()) == baseClass) return true; return false; @@ -171,14 +171,14 @@ static const Class *findClass(const Namespace *parentNameSpace, const LookupCont qDebug() << Q_FUNC_INFO << className; const Overview o; - const unsigned namespaceMemberCount = parentNameSpace->memberCount(); - for (unsigned i = 0; i < namespaceMemberCount; ++i) { // we go through all namespace members + const int namespaceMemberCount = parentNameSpace->memberCount(); + for (int i = 0; i < namespaceMemberCount; ++i) { // we go through all namespace members const Symbol *sym = parentNameSpace->memberAt(i); // we have found a class - we are interested in classes only if (const Class *cl = sym->asClass()) { // 1) we go through class members - const unsigned classMemberCount = cl->memberCount(); - for (unsigned j = 0; j < classMemberCount; ++j) + const int classMemberCount = cl->memberCount(); + for (int j = 0; j < classMemberCount; ++j) if (Declaration *decl = cl->memberAt(j)->asDeclaration()) { // we want to know if the class contains a member (so we look into // a declaration) of uiClassName type -- cgit v1.2.3