Don't assign iterator to const_iterator

It should also be possible to use QT_STRICT_ITERATORS in Qt's own code base

Change-Id: I0914db480d4d2b06e71e3a2588163efdd3ff6d27
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Sérgio Martins 2015-05-10 12:26:47 +01:00
parent cd0bed6d71
commit f44a59f390
9 changed files with 49 additions and 49 deletions

View File

@ -115,8 +115,8 @@ public:
QStringList QCommandLineParserPrivate::aliases(const QString &optionName) const
{
const NameHash_t::const_iterator it = nameHash.find(optionName);
if (it == nameHash.end()) {
const NameHash_t::const_iterator it = nameHash.constFind(optionName);
if (it == nameHash.cend()) {
qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName));
return QStringList();
}
@ -806,8 +806,8 @@ QString QCommandLineParser::value(const QString &optionName) const
QStringList QCommandLineParser::values(const QString &optionName) const
{
d->checkParsed("values");
const NameHash_t::const_iterator it = d->nameHash.find(optionName);
if (it != d->nameHash.end()) {
const NameHash_t::const_iterator it = d->nameHash.constFind(optionName);
if (it != d->nameHash.cend()) {
const int optionOffset = *it;
QStringList values = d->optionValuesHash.value(optionOffset);
if (values.isEmpty())

View File

@ -115,7 +115,7 @@ public:
QtFreetypeData::~QtFreetypeData()
{
for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.begin(); iter != faces.end(); ++iter)
for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.cbegin(); iter != faces.cend(); ++iter)
iter.value()->cleanup();
faces.clear();
FT_Done_FreeType(library);

View File

@ -46,32 +46,32 @@ static OidNameMap createOidMap()
{
OidNameMap oids;
// used by unit tests
oids.insert(oids.end(), QByteArrayLiteral("0.9.2342.19200300.100.1.5"), QByteArrayLiteral("favouriteDrink"));
oids.insert(oids.end(), QByteArrayLiteral("1.2.840.113549.1.9.1"), QByteArrayLiteral("emailAddress"));
oids.insert(oids.end(), QByteArrayLiteral("1.3.6.1.5.5.7.1.1"), QByteArrayLiteral("authorityInfoAccess"));
oids.insert(oids.end(), QByteArrayLiteral("1.3.6.1.5.5.7.48.1"), QByteArrayLiteral("OCSP"));
oids.insert(oids.end(), QByteArrayLiteral("1.3.6.1.5.5.7.48.2"), QByteArrayLiteral("caIssuers"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.29.14"), QByteArrayLiteral("subjectKeyIdentifier"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.29.15"), QByteArrayLiteral("keyUsage"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.29.17"), QByteArrayLiteral("subjectAltName"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.29.19"), QByteArrayLiteral("basicConstraints"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.29.35"), QByteArrayLiteral("authorityKeyIdentifier"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.10"), QByteArrayLiteral("O"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.11"), QByteArrayLiteral("OU"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.12"), QByteArrayLiteral("title"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.13"), QByteArrayLiteral("description"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.17"), QByteArrayLiteral("postalCode"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.3"), QByteArrayLiteral("CN"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.4"), QByteArrayLiteral("SN"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.41"), QByteArrayLiteral("name"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.42"), QByteArrayLiteral("GN"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.43"), QByteArrayLiteral("initials"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.46"), QByteArrayLiteral("dnQualifier"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.5"), QByteArrayLiteral("serialNumber"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.6"), QByteArrayLiteral("C"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.7"), QByteArrayLiteral("L"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.8"), QByteArrayLiteral("ST"));
oids.insert(oids.end(), QByteArrayLiteral("2.5.4.9"), QByteArrayLiteral("street"));
oids.insert(oids.cend(), QByteArrayLiteral("0.9.2342.19200300.100.1.5"), QByteArrayLiteral("favouriteDrink"));
oids.insert(oids.cend(), QByteArrayLiteral("1.2.840.113549.1.9.1"), QByteArrayLiteral("emailAddress"));
oids.insert(oids.cend(), QByteArrayLiteral("1.3.6.1.5.5.7.1.1"), QByteArrayLiteral("authorityInfoAccess"));
oids.insert(oids.cend(), QByteArrayLiteral("1.3.6.1.5.5.7.48.1"), QByteArrayLiteral("OCSP"));
oids.insert(oids.cend(), QByteArrayLiteral("1.3.6.1.5.5.7.48.2"), QByteArrayLiteral("caIssuers"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.29.14"), QByteArrayLiteral("subjectKeyIdentifier"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.29.15"), QByteArrayLiteral("keyUsage"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.29.17"), QByteArrayLiteral("subjectAltName"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.29.19"), QByteArrayLiteral("basicConstraints"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.29.35"), QByteArrayLiteral("authorityKeyIdentifier"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.10"), QByteArrayLiteral("O"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.11"), QByteArrayLiteral("OU"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.12"), QByteArrayLiteral("title"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.13"), QByteArrayLiteral("description"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.17"), QByteArrayLiteral("postalCode"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.3"), QByteArrayLiteral("CN"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.4"), QByteArrayLiteral("SN"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.41"), QByteArrayLiteral("name"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.42"), QByteArrayLiteral("GN"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.43"), QByteArrayLiteral("initials"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.46"), QByteArrayLiteral("dnQualifier"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.5"), QByteArrayLiteral("serialNumber"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.6"), QByteArrayLiteral("C"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.7"), QByteArrayLiteral("L"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.8"), QByteArrayLiteral("ST"));
oids.insert(oids.cend(), QByteArrayLiteral("2.5.4.9"), QByteArrayLiteral("street"));
return oids;
}
Q_GLOBAL_STATIC_WITH_ARGS(OidNameMap, oidNameMap, (createOidMap()))

View File

@ -364,8 +364,8 @@ void QXcbConnection::xi2Select(xcb_window_t window)
XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
{
XInput2TouchDeviceData *dev = Q_NULLPTR;
QHash<int, XInput2TouchDeviceData*>::const_iterator devIt = m_touchDevices.find(id);
if ( devIt != m_touchDevices.end() ) {
QHash<int, XInput2TouchDeviceData*>::const_iterator devIt = m_touchDevices.constFind(id);
if (devIt != m_touchDevices.cend()) {
dev = devIt.value();
} else {
int nrDevices = 0;

View File

@ -2199,7 +2199,7 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
QStringList::ConstIterator i;
for (i = requisiteorder.begin(); i != requisiteorder.constEnd(); ++i) {
for (i = requisiteorder.constBegin(); i != requisiteorder.constEnd(); ++i) {
if (requisites.contains(*i)) {
out() << "<tr>"
@ -2319,7 +2319,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
QStringList::ConstIterator i;
for (i = requisiteorder.begin(); i != requisiteorder.constEnd(); ++i) {
for (i = requisiteorder.constBegin(); i != requisiteorder.constEnd(); ++i) {
if (requisites.contains(*i)) {
out() << "<tr>"

View File

@ -2763,8 +2763,8 @@ bool CollectionNode::hasNamespaces() const
bool CollectionNode::hasClasses() const
{
if (!members_.isEmpty()) {
NodeList::const_iterator i = members_.begin();
while (i != members_.end()) {
NodeList::const_iterator i = members_.cbegin();
while (i != members_.cend()) {
if ((*i)->isClass())
return true;
++i;
@ -2780,8 +2780,8 @@ bool CollectionNode::hasClasses() const
void CollectionNode::getMemberNamespaces(NodeMap& out)
{
out.clear();
NodeList::const_iterator i = members_.begin();
while (i != members_.end()) {
NodeList::const_iterator i = members_.cbegin();
while (i != members_.cend()) {
if ((*i)->isNamespace())
out.insert((*i)->name(),(*i));
++i;
@ -2795,8 +2795,8 @@ void CollectionNode::getMemberNamespaces(NodeMap& out)
void CollectionNode::getMemberClasses(NodeMap& out)
{
out.clear();
NodeList::const_iterator i = members_.begin();
while (i != members_.end()) {
NodeList::const_iterator i = members_.cbegin();
while (i != members_.cend()) {
if ((*i)->isClass())
out.insert((*i)->name(),(*i));
++i;

View File

@ -188,8 +188,8 @@ bool PureDocParser::processQdocComments()
topics.insert(i+1,"and");
doc.location().warning(tr("Multiple topic commands found in comment: %1").arg(topics));
}
ArgList::ConstIterator a = args.begin();
while (a != args.end()) {
ArgList::ConstIterator a = args.cbegin();
while (a != args.cend()) {
Doc nodeDoc = doc;
Node* node = processTopicCommand(nodeDoc,topic,*a);
if (node != 0) {

View File

@ -1549,8 +1549,8 @@ void QDocDatabase::mergeCollections(Node::Genus genus, CNMap& cnm, const Node* r
foreach (Tree* t, searchOrder()) {
CNMap* m = t->getCollectionMap(genus);
if (m && !m->isEmpty()) {
CNMap::const_iterator i = m->begin();
while (i != m->end()) {
CNMap::const_iterator i = m->cbegin();
while (i != m->cend()) {
if (!i.value()->isInternal())
cnmm.insert(i.key(), i.value());
++i;

View File

@ -1222,8 +1222,8 @@ CollectionNode* Tree::getCollection(const QString& name, Node::Genus genus)
{
CNMap* m = getCollectionMap(genus);
if (m) {
CNMap::const_iterator i = m->find(name);
if (i != m->end())
CNMap::const_iterator i = m->constFind(name);
if (i != m->cend())
return i.value();
}
return 0;
@ -1249,8 +1249,8 @@ CollectionNode* Tree::findCollection(const QString& name, Node::Genus genus)
CNMap* m = getCollectionMap(genus);
if (!m) // error
return 0;
CNMap::const_iterator i = m->find(name);
if (i != m->end())
CNMap::const_iterator i = m->constFind(name);
if (i != m->cend())
return i.value();
Node::Type t = Node::NoType;
switch (genus) {