From 108a64dd89132c10cb1fd06b6ac43677f5528783 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Jan 2018 08:59:33 +0100 Subject: shiboken: replace first()/last() by constFirst/constLast() Fix clazy warnings about possibly detaching containers. Change-Id: I3c3a229de5e0c71f17c1f26273e1b0be3b0d7e81 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Alexandru Croitor --- sources/shiboken2/ApiExtractor/typesystem.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp') diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp index 8564da3c4..4a8d3063d 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.cpp +++ b/sources/shiboken2/ApiExtractor/typesystem.cpp @@ -615,11 +615,10 @@ void Handler::addFlags(const QString &name, QString flagName, if (QStringList(lst.mid(0, lst.size() - 1)).join(colonColon()) != m_currentEnum->targetLangQualifier()) { qCWarning(lcShiboken).noquote().nospace() << QStringLiteral("enum %1 and flags %2 differ in qualifiers") - // avoid constFirst to stay Qt 5.5 compatible - .arg(m_currentEnum->targetLangQualifier(), lst.first()); + .arg(m_currentEnum->targetLangQualifier(), lst.constFirst()); } - ftype->setFlagsName(lst.last()); + ftype->setFlagsName(lst.constLast()); m_currentEnum->setFlags(ftype); m_database->addFlagsType(ftype); @@ -933,7 +932,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts else m_currentEnum = new EnumTypeEntry(QStringList(names.mid(0, names.size() - 1)).join(colonColon()), - names.last(), since); + names.constLast(), since); m_currentEnum->setAnonymous(!attributes[QLatin1String("identified-by-value")].isEmpty()); element->entry = m_currentEnum; m_currentEnum->setCodeGeneration(m_generate); @@ -1978,7 +1977,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts } if (topElement.type == StackElement::ModifyFunction || topElement.type == StackElement::AddFunction) { - FunctionModification mod = m_contextStack.top()->functionMods.last(); + FunctionModification mod = m_contextStack.top()->functionMods.constLast(); if (snip.language == TypeSystem::ShellDeclaration) { m_error = QLatin1String("no function implementation in shell declaration in which to inject code"); return false; -- cgit v1.2.3