summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-01-02 09:41:30 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2019-01-02 09:41:30 +0000
commit169dff19d4da8d76e69b8e896aa25b0013639c03 (patch)
treea0c070fa95188b5cde708ac285e6a2db9df4a83f /src/util
parentAvoid creating a new document before opening an old document. (diff)
downloadinkscape-169dff19d4da8d76e69b8e896aa25b0013639c03.tar.gz
inkscape-169dff19d4da8d76e69b8e896aa25b0013639c03.zip
modernize loops
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ege-tags.cpp8
-rw-r--r--src/util/units.cpp10
-rw-r--r--src/util/ziptool.cpp24
3 files changed, 21 insertions, 21 deletions
diff --git a/src/util/ege-tags.cpp b/src/util/ege-tags.cpp
index c37a9d2fe..f8acab82b 100644
--- a/src/util/ege-tags.cpp
+++ b/src/util/ege-tags.cpp
@@ -105,12 +105,12 @@ bool TagSet::addTag(Tag const& tag)
if (tag.key == it->key) {
present = true;
- for ( std::vector<Label>::const_iterator it2 = tag.labels.begin(); it2 != tag.labels.end(); ++it2 ) {
- std::vector<Label>::iterator itOld = std::find_if( it->labels.begin(), it->labels.end(), std::bind2nd(sameLang(), *it2) );
+ for (const auto & label : tag.labels) {
+ std::vector<Label>::iterator itOld = std::find_if( it->labels.begin(), it->labels.end(), std::bind2nd(sameLang(), label) );
if (itOld != it->labels.end()) {
- itOld->value = it2->value;
+ itOld->value = label.value;
} else {
- it->labels.push_back(*it2);
+ it->labels.push_back(label);
}
}
}
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 8c0be134d..0a1fdbf31 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -267,9 +267,9 @@ UnitTable::UnitTable()
UnitTable::~UnitTable()
{
- for (UnitCodeMap::iterator iter = _unit_map.begin(); iter != _unit_map.end(); ++iter)
+ for (auto & iter : _unit_map)
{
- delete iter->second;
+ delete iter.second;
}
}
@@ -383,9 +383,9 @@ bool UnitTable::hasUnit(Glib::ustring const &unit) const
UnitTable::UnitMap UnitTable::units(UnitType type) const
{
UnitMap submap;
- for (UnitCodeMap::const_iterator iter = _unit_map.begin(); iter != _unit_map.end(); ++iter) {
- if (iter->second->type == type) {
- submap.insert(UnitMap::value_type(iter->second->abbr, *iter->second));
+ for (auto iter : _unit_map) {
+ if (iter.second->type == type) {
+ submap.insert(UnitMap::value_type(iter.second->abbr, *iter.second));
}
}
diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp
index 82712b87d..8eb525473 100644
--- a/src/util/ziptool.cpp
+++ b/src/util/ziptool.cpp
@@ -355,9 +355,9 @@ void Inflater::trace(char const *fmt, ...)
*/
void Inflater::dump()
{
- for (unsigned int i=0 ; i<dest.size() ; i++)
+ for (unsigned char i : dest)
{
- fputc(dest[i], stdout);
+ fputc(i, stdout);
}
}
@@ -1599,8 +1599,8 @@ bool GzipFile::write()
putByte(0);
//file name
- for (unsigned int i=0 ; i<fileName.size() ; i++)
- putByte(fileName[i]);
+ for (char i : fileName)
+ putByte(i);
putByte(0);
@@ -2323,8 +2323,8 @@ bool ZipFile::writeFileData()
putInt(fname.size());//fileName length
putInt(8);//extra field length
//file name
- for (unsigned int i=0 ; i<fname.size() ; i++)
- putByte((unsigned char)fname[i]);
+ for (char i : fname)
+ putByte((unsigned char)i);
//extra field
putInt(0x7855);
putInt(4);
@@ -2374,14 +2374,14 @@ bool ZipFile::writeCentralDirectory()
putLong(entry->getPosition());
//file name
- for (unsigned int i=0 ; i<fname.size() ; i++)
- putByte((unsigned char)fname[i]);
+ for (char i : fname)
+ putByte((unsigned char)i);
//extra field
putInt(0x7855);
putInt(0);
//comment
- for (unsigned int i=0 ; i<ecomment.size() ; i++)
- putByte((unsigned char)ecomment[i]);
+ for (char i : ecomment)
+ putByte((unsigned char)i);
}
unsigned long cdSize = fileBuf.size() - cdPosition;
@@ -2393,8 +2393,8 @@ bool ZipFile::writeCentralDirectory()
putLong(cdSize); //size of central dir
putLong(cdPosition); //position of central dir
putInt(comment.size());//comment size
- for (unsigned int i=0 ; i<comment.size() ; i++)
- putByte(comment[i]);
+ for (char i : comment)
+ putByte(i);
return true;
}