diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-29 10:37:38 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-29 10:38:39 +0200 |
commit | a3c2cce616c3a072ed7f7f8133b88db165ccbc5c (patch) | |
tree | cf348d0ef3af3ce2787155460248d1e9b7e75791 /writerfilter | |
parent | 1ac17afea63e52386c7fd822d2a7082c0619654f (diff) |
Revert "writerfilter: convert loops to range-based-for"
This reverts commit 25cd067a82742210793e39708cc1de9ff84692a7, as it
broke CppunitTest_sw_ooxmlexport4. The comment above the change suggests
that perhaps the usage of indexes was intentional to avoid the usage of
invalidated iterators.
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/ooxml/OOXMLPropertySet.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx index d4b7d1284af7..bd80f8dc5112 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx @@ -329,8 +329,8 @@ OOXMLValue * OOXMLInputStreamValue::clone() const */ OOXMLPropertySet::OOXMLPropertySet() - : maType("OOXMLPropertySet") { + maType = "OOXMLPropertySet"; } OOXMLPropertySet::~OOXMLPropertySet() @@ -343,8 +343,10 @@ void OOXMLPropertySet::resolve(Properties & rHandler) // be appended to mProperties. I don't think it can cause elements // to be deleted. But let's check with < here just to be safe that // the indexing below works. - for (OOXMLProperty::Pointer_t & pProp : mProperties) + for (size_t nIt = 0; nIt < mProperties.size(); ++nIt) { + OOXMLProperty::Pointer_t pProp = mProperties[nIt]; + if (pProp.get() != nullptr) pProp->resolve(rHandler); } @@ -745,17 +747,23 @@ OOXMLTable::~OOXMLTable() void OOXMLTable::resolve(Table & rTable) { + Table * pTable = &rTable; + int nPos = 0; - for (const ValuePointer_t & it : mPropertySets) + PropertySets_t::iterator it = mPropertySets.begin(); + PropertySets_t::iterator itEnd = mPropertySets.end(); + + while (it != itEnd) { writerfilter::Reference<Properties>::Pointer_t pProperties - (it->getProperties()); + ((*it)->getProperties()); if (pProperties.get() != nullptr) - rTable.entry(nPos, pProperties); + pTable->entry(nPos, pProperties); ++nPos; + ++it; } } |