summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-12 10:07:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-13 08:09:03 +0000
commit96fab0513215cc416e96e1b2089466afd0d2791c (patch)
tree7c03bd56b0c3744f0560c05ebb2f422155e64543 /xmloff
parentb3d5da663ff09c72455a8d3bf9be7c00220271bb (diff)
clang-tidy modernize-loop-convert in writerfilter to xmlsecurity
Change-Id: I334411c6b57c028ffb41b5deb72002f9d54038c3 Reviewed-on: https://gerrit.libreoffice.org/24923 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx6
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx14
-rw-r--r--xmloff/source/style/impastpl.cxx11
-rw-r--r--xmloff/source/style/xmlnumfi.cxx4
-rw-r--r--xmloff/source/style/xmlstyle.cxx6
-rw-r--r--xmloff/source/text/txtparae.cxx16
-rw-r--r--xmloff/source/text/txtparai.cxx4
-rw-r--r--xmloff/source/transform/OOo2Oasis.cxx8
-rw-r--r--xmloff/source/transform/Oasis2OOo.cxx8
-rw-r--r--xmloff/source/transform/StyleOOoTContext.cxx6
10 files changed, 37 insertions, 46 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 8338b756367d..cde978867028 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1597,10 +1597,9 @@ void SchXMLExportHelper_Impl::exportTable()
SvXMLElementExport aColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, true, true );
sal_Int32 nNextIndex = 0;
- for( size_t nN=0; nN< aData.aHiddenColumns.size(); nN++ )
+ for(sal_Int32 nHiddenIndex : aData.aHiddenColumns)
{
//i91578 display of hidden values (copy paste scenario; export hidden flag thus it can be used during migration to locale table upon paste )
- sal_Int32 nHiddenIndex = aData.aHiddenColumns[nN];
if( nHiddenIndex > nNextIndex )
{
sal_Int64 nRepeat = static_cast< sal_Int64 >( nHiddenIndex - nNextIndex );
@@ -2245,9 +2244,8 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis >& rChart2Axis, SvXMLExp
void disableLinkedNumberFormat(
std::vector<XMLPropertyState>& rPropStates, const rtl::Reference<XMLPropertySetMapper>& rMapper )
{
- for (size_t i = 0; i < rPropStates.size(); ++i)
+ for (XMLPropertyState & rState : rPropStates)
{
- XMLPropertyState& rState = rPropStates[i];
if (rState.mnIndex < 0 || rMapper->GetEntryCount() <= rState.mnIndex)
continue;
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index ecaef3bda4f4..d25d18b069cd 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -691,8 +691,8 @@ SdXMLExport::~SdXMLExport()
if(mpPageMasterInfoList)
{
- for ( size_t i = 0, n = mpPageMasterInfoList->size(); i < n; ++i )
- delete mpPageMasterInfoList->at( i );
+ for (ImpXMLEXPPageMasterInfo* p : *mpPageMasterInfoList)
+ delete p;
mpPageMasterInfoList->clear();
delete mpPageMasterInfoList;
mpPageMasterInfoList = nullptr;
@@ -701,8 +701,8 @@ SdXMLExport::~SdXMLExport()
// clear auto-layout infos
if(mpAutoLayoutInfoList)
{
- for ( size_t i = 0, n = mpAutoLayoutInfoList->size(); i < n; ++i )
- delete mpAutoLayoutInfoList->at( i );
+ for (ImpXMLAutoLayoutInfo* p : *mpAutoLayoutInfoList)
+ delete p;
mpAutoLayoutInfoList->clear();
delete mpAutoLayoutInfoList;
mpAutoLayoutInfoList = nullptr;
@@ -812,9 +812,8 @@ void SdXMLExport::ImpWriteAutoLayoutInfos()
{
if( !mpAutoLayoutInfoList->empty() )
{
- for(size_t nCnt = 0; nCnt < mpAutoLayoutInfoList->size(); nCnt++)
+ for(ImpXMLAutoLayoutInfo* pInfo : *mpAutoLayoutInfoList)
{
- ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->at( nCnt );
if(pInfo)
{
// prepare presentation-page layout attributes, style-name
@@ -1389,9 +1388,8 @@ ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString&
{
if(!rName.isEmpty() && !mpPageMasterInfoList->empty())
{
- for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
+ for(ImpXMLEXPPageMasterInfo* pInfo : *mpPageMasterInfoList)
{
- ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
if(pInfo)
{
if(!pInfo->GetMasterPageName().isEmpty() && rName.equals(pInfo->GetMasterPageName()))
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index 2d4959ee1d9d..8d2305aeca4d 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -189,9 +189,8 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam
}
// Create a name based on the properties used
- for( size_t i = 0, n = maProperties.size(); i < n; ++i )
+ for(XMLPropertyState & rState : maProperties)
{
- XMLPropertyState& rState = maProperties[i];
if (rState.mnIndex == -1)
continue;
OUString sXMLName(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryXMLName(rState.mnIndex));
@@ -250,9 +249,9 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam
#if OSL_DEBUG_LEVEL > 0
std::set<sal_Int32> DebugProperties;
- for (size_t i = 0; i < maProperties.size(); ++i)
+ for (XMLPropertyState & rPropState : maProperties)
{
- sal_Int32 const property(maProperties[i].mnIndex);
+ sal_Int32 const property(rPropState.mnIndex);
// serious bug: will cause duplicate attributes to be exported
assert(DebugProperties.find(property) == DebugProperties.end());
if (-1 != property)
@@ -361,9 +360,9 @@ OUString XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily& rFamilyData, co
{
OUString sName;
vector< XMLPropertyState>::size_type nItems = rProperties.size();
- for (size_t i = 0, n = m_PropertiesList.size(); i < n; ++i)
+ for (const auto & i : m_PropertiesList)
{
- const XMLAutoStylePoolProperties *const pIS = m_PropertiesList[i].get();
+ const XMLAutoStylePoolProperties *const pIS = i.get();
if( nItems > pIS->GetProperties().size() )
{
continue;
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index b3808e96d07f..dbf78643bb13 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1257,10 +1257,8 @@ sal_uInt16 SvXMLNumFmtDefaults::GetDefaultDateFormat( SvXMLDateElementAttributes
SvXMLDateElementAttributes eMins, SvXMLDateElementAttributes eSecs,
bool bSystem )
{
- static const sal_uInt16 nCount = sizeof(aDefaultDateFormats) / sizeof(SvXMLDefaultDateFormat);
- for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
+ for (const auto & rEntry : aDefaultDateFormats)
{
- const SvXMLDefaultDateFormat& rEntry = aDefaultDateFormats[nPos];
if ( bSystem == rEntry.bSystem &&
( eDOW == rEntry.eDOW || ( rEntry.eDOW == XML_DEA_ANY && eDOW != XML_DEA_NONE ) ) &&
( eDay == rEntry.eDay || ( rEntry.eDay == XML_DEA_ANY && eDay != XML_DEA_NONE ) ) &&
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 56a5c1fdcf50..73aa9053b134 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -292,9 +292,8 @@ SvXMLStylesContext_Impl::~SvXMLStylesContext_Impl()
{
delete pIndices;
- for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
+ for (SvXMLStyleContext* pStyle : aStyles)
{
- SvXMLStyleContext *pStyle = aStyles[ i ];
pStyle->ReleaseRef();
}
aStyles.clear();
@@ -312,9 +311,8 @@ void SvXMLStylesContext_Impl::Clear()
{
FlushIndex();
- for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
+ for (SvXMLStyleContext* pStyle : aStyles)
{
- SvXMLStyleContext *pStyle = aStyles[ i ];
pStyle->ReleaseRef();
}
aStyles.clear();
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index ba08a558ada5..9dfe9d298b4d 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -379,17 +379,17 @@ void FieldParamExporter::Export()
const Type aSeqType = cppu::UnoType<Sequence<OUString>>::get();
const Type aIntType = ::cppu::UnoType<sal_Int32>::get();
Sequence<OUString> vParameters(m_xFieldParams->getElementNames());
- for(const OUString* pCurrent = vParameters.begin(); pCurrent != vParameters.end(); ++pCurrent)
+ for(const auto & rParameter : vParameters)
{
- const Any aValue = m_xFieldParams->getByName(*pCurrent);
+ const Any aValue = m_xFieldParams->getByName(rParameter);
const Type& aValueType = aValue.getValueType();
if(aValueType == aStringType)
{
OUString sValue;
aValue >>= sValue;
- ExportParameter(*pCurrent,sValue);
+ ExportParameter(rParameter,sValue);
- if ( *pCurrent == ODF_OLE_PARAM )
+ if ( rParameter == ODF_OLE_PARAM )
{
// Save the OLE object
Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
@@ -414,22 +414,22 @@ void FieldParamExporter::Export()
{
bool bValue = false;
aValue >>= bValue;
- ExportParameter(*pCurrent, OUString::boolean(bValue) );
+ ExportParameter(rParameter, OUString::boolean(bValue) );
}
else if(aValueType == aSeqType)
{
Sequence<OUString> vValue;
aValue >>= vValue;
- for(OUString* pSeqCurrent = vValue.begin(); pSeqCurrent != vValue.end(); ++pSeqCurrent)
+ for(const OUString & i : vValue)
{
- ExportParameter(*pCurrent, *pSeqCurrent);
+ ExportParameter(rParameter, i);
}
}
else if(aValueType == aIntType)
{
sal_Int32 nValue = 0;
aValue >>= nValue;
- ExportParameter(*pCurrent, OUStringBuffer().append(nValue).makeStringAndClear());
+ ExportParameter(rParameter, OUStringBuffer().append(nValue).makeStringAndClear());
}
}
}
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 5570bf36fc9a..c851e00b392a 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2065,9 +2065,9 @@ XMLParaContext::~XMLParaContext()
if (pHints && !pHints->GetHints().empty())
{
- for (size_t i = 0; i < pHints->GetHints().size(); ++i)
+ for (const auto & i : pHints->GetHints())
{
- XMLHint_Impl *const pHint = pHints->GetHints()[i].get();
+ XMLHint_Impl *const pHint = i.get();
xAttrCursor->gotoRange( pHint->GetStart(), false );
xAttrCursor->gotoRange( pHint->GetEnd(), true );
switch( pHint->GetType() )
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index c8ff4c696222..e6937ac0c5b6 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -1829,14 +1829,14 @@ OOo2OasisTransformer::OOo2OasisTransformer( const sal_Char *pImplName,
GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
- for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
- m_aActions[i] = nullptr;
+ for(XMLTransformerActions*& rp : m_aActions)
+ rp = nullptr;
}
OOo2OasisTransformer::~OOo2OasisTransformer() throw()
{
- for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
- delete m_aActions[i];
+ for(XMLTransformerActions* p : m_aActions)
+ delete p;
XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap );
}
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 03b99f35f704..209bf61cc5db 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -1937,14 +1937,14 @@ Oasis2OOoTransformer::Oasis2OOoTransformer() throw() :
GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
- for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i )
- m_aActions[i] = nullptr;
+ for(XMLTransformerActions* & rp : m_aActions)
+ rp = nullptr;
}
Oasis2OOoTransformer::~Oasis2OOoTransformer() throw()
{
- for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i )
- delete m_aActions[i];
+ for(XMLTransformerActions* p : m_aActions)
+ delete p;
XMLEventOASISTransformerContext::FlushEventMap( m_pEventMap );
XMLEventOASISTransformerContext::FlushEventMap( m_pFormEventMap );
}
diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx
index a7321722ee96..4f28f654541e 100644
--- a/xmloff/source/transform/StyleOOoTContext.cxx
+++ b/xmloff/source/transform/StyleOOoTContext.cxx
@@ -1026,10 +1026,10 @@ void XMLPropertiesOOoTContext_Impl::Characters( const OUString& )
void XMLPropertiesOOoTContext_Impl::Export()
{
- for( sal_uInt16 i=0; i < MAX_PROP_TYPES; i++ )
+ for(rtl::Reference<XMLTypedPropertiesOOoTContext_Impl> & rPropContext : m_aPropContexts)
{
- if( m_aPropContexts[i].is() )
- m_aPropContexts[i]->Export();
+ if( rPropContext.is() )
+ rPropContext->Export();
}
}