summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-09-29 19:35:12 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-29 21:14:35 +0200
commit65b00f316517b0f570b6aff30e70d95d4d543c03 (patch)
tree57793ade4859169f33ee5d8672872d53b51ba1c5 /writerperfect
parent618d474f059a75c2ac04df16c830d71a88690118 (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')
-rw-r--r--writerperfect/source/calc/MSWorksCalcImportFilter.cxx12
-rw-r--r--writerperfect/source/common/WPXSvInputStream.cxx12
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