diff options
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 12 | ||||
-rw-r--r-- | writerperfect/source/common/WPXSvInputStream.cxx | 12 |
2 files changed, 10 insertions, 14 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 */ diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 206d3b0d27ce..c0ac94ae3e18 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -224,11 +224,11 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, const rt rStorage->FillInfoList(&infos); - for (SvStorageInfoList::const_iterator aIt = infos.begin(); infos.end() != aIt; ++aIt) + for (const auto& info : infos) { - if (aIt->IsStream()) + if (info.IsStream()) { - rtl::OUString baseName = aIt->GetName(), rvngName = baseName; + rtl::OUString baseName = info.GetName(), rvngName = baseName; // librevenge::RVNGOLEStream ignores the first character when is a control code, so ... if (!rvngName.isEmpty() && rvngName.toChar() < 32) rvngName = rvngName.copy(1); @@ -237,11 +237,11 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, const rt rtl::OUStringToOString(concatPath(rPath, rvngName), RTL_TEXTENCODING_UTF8)); maNameMap[concatPath(rPath, rvngName)] = maStreams.size() - 1; } - else if (aIt->IsStorage()) + else if (info.IsStorage()) { - const rtl::OUString aPath = concatPath(rPath, aIt->GetName()); + const rtl::OUString aPath = concatPath(rPath, info.GetName()); SotStorageRefWrapper aStorage; - aStorage.ref = rStorage->OpenSotStorage(aIt->GetName(), StreamMode::STD_READ); + aStorage.ref = rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ); maStorageMap[aPath] = aStorage; // deep-first traversal |