diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-09-29 19:35:12 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-29 21:14:35 +0200 |
commit | 65b00f316517b0f570b6aff30e70d95d4d543c03 (patch) | |
tree | 57793ade4859169f33ee5d8672872d53b51ba1c5 /writerperfect/source/calc | |
parent | 618d474f059a75c2ac04df16c830d71a88690118 (diff) |
Simplify containers iterations in w*
Use range-based loop or replace with STL functions.
Change-Id: Ie1e169f9d2d44e188180164bd1f93af43740425d
Reviewed-on: https://gerrit.libreoffice.org/61141
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerperfect/source/calc')
-rw-r--r-- | writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index ca12e62eb648..d1d513f974fc 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -105,15 +105,11 @@ public: /** returns the ith sub streams name */ const char* subStreamName(unsigned id) override { - std::map<std::string, rtl::OUString>::const_iterator it = m_nameToPathMap.begin(); - for (unsigned i = 0; i < id; ++i) - { - if (it == m_nameToPathMap.end()) - return nullptr; - ++it; - } - if (it == m_nameToPathMap.end()) + if (m_nameToPathMap.size() < id) return nullptr; + + std::map<std::string, rtl::OUString>::const_iterator it = m_nameToPathMap.begin(); + std::advance(it, id); return it->first.c_str(); } /** returns true if a substream with name exists */ |