clang-tidy modernize-loop-convert in oox to sax

Change-Id: If0d87b6679765fc6d1f9300c6972845cf3742b9c
Reviewed-on: https://gerrit.libreoffice.org/24674
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-05 10:10:54 +02:00 committed by Noel Grandin
parent 931a72efbc
commit f07ff7ed8a
21 changed files with 98 additions and 99 deletions

View File

@ -423,8 +423,8 @@ static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperti
if ( !pCommandHashMap ) if ( !pCommandHashMap )
{ {
FormulaCommandHMap* pHM = new FormulaCommandHMap(); FormulaCommandHMap* pHM = new FormulaCommandHMap();
for( sal_Int32 i = 0; i < FC_LAST; i++ ) for(const FormularCommandNameTable& i : pFormularCommandNameTable)
(*pHM)[ OUString::createFromAscii( pFormularCommandNameTable[ i ].pS ) ] = pFormularCommandNameTable[ i ].pE; (*pHM)[ OUString::createFromAscii( i.pS ) ] = i.pE;
pCommandHashMap = pHM; pCommandHashMap = pHM;
} }

View File

@ -360,13 +360,13 @@ ContextHandlerRef ArtisticEffectContext::onCreateContext(
XML_size, XML_brushSize, XML_scaling, XML_detail, XML_bright, XML_contrast, XML_size, XML_brushSize, XML_scaling, XML_detail, XML_bright, XML_contrast,
XML_colorTemp, XML_sat, XML_amount XML_colorTemp, XML_sat, XML_amount
}; };
for( sal_Int32 i=0; i<19; ++i ) for(sal_Int32 nAttrib : aAttribs)
{ {
if( rAttribs.hasAttribute( aAttribs[i] ) ) if( rAttribs.hasAttribute( nAttrib ) )
{ {
OUString sName = ArtisticEffectProperties::getEffectString( aAttribs[i] ); OUString sName = ArtisticEffectProperties::getEffectString( nAttrib );
if( !sName.isEmpty() ) if( !sName.isEmpty() )
maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( aAttribs[i], 0 ) ); maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( nAttrib, 0 ) );
} }
} }

View File

@ -833,13 +833,13 @@ Reference< XShape > Shape::createAndInsert(
{ {
PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
}; };
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) for (sal_Int32 nBorder : aBorders)
{ {
css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<css::table::BorderLine2>(); css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<css::table::BorderLine2>();
aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>(); aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
if (aLineProperties.moLineWidth.has()) if (aLineProperties.moLineWidth.has())
aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get()); aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
aShapeProps.setProperty(aBorders[i], uno::makeAny(aBorderLine)); aShapeProps.setProperty(nBorder, uno::makeAny(aBorderLine));
} }
aShapeProps.erase(PROP_LineColor); aShapeProps.erase(PROP_LineColor);
} }

View File

@ -237,18 +237,18 @@ static uno::Reference<io::XInputStream> lcl_StoreOwnAsOOXML(
const char * pFilterName(nullptr); const char * pFilterName(nullptr);
SvGlobalName const classId(xObj->getClassID()); SvGlobalName const classId(xObj->getClassID());
for (size_t i = 0; i < SAL_N_ELEMENTS(s_Mapping); ++i) for (auto & i : s_Mapping)
{ {
auto const& rId(s_Mapping[i].ClassId); auto const& rId(i.ClassId);
SvGlobalName const temp(rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15); SvGlobalName const temp(rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15);
if (temp == classId) if (temp == classId)
{ {
assert(SvGlobalName(SO3_SCH_CLASSID_60) != classId); // chart should be written elsewhere! assert(SvGlobalName(SO3_SCH_CLASSID_60) != classId); // chart should be written elsewhere!
assert(SvGlobalName(SO3_SM_CLASSID_60) != classId); // formula should be written elsewhere! assert(SvGlobalName(SO3_SM_CLASSID_60) != classId); // formula should be written elsewhere!
pFilterName = s_Mapping[i].pFilterName; pFilterName = i.pFilterName;
o_rMediaType = OUString::createFromAscii(s_Mapping[i].pMediaType); o_rMediaType = OUString::createFromAscii(i.pMediaType);
o_rpProgID = s_Mapping[i].pProgID; o_rpProgID = i.pProgID;
o_rSuffix = OUString::createFromAscii(s_Mapping[i].pSuffix); o_rSuffix = OUString::createFromAscii(i.pSuffix);
o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
break; break;
} }

View File

@ -504,13 +504,13 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
static const sal_Int32 aBorders[] = { static const sal_Int32 aBorders[] = {
PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
}; };
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) for (sal_Int32 nBorder : aBorders)
{ {
table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<table::BorderLine2>(); table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<table::BorderLine2>();
aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>(); aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>();
if (oLineWidth) if (oLineWidth)
aBorderLine.LineWidth = *oLineWidth; aBorderLine.LineWidth = *oLineWidth;
aPropMap.setProperty(aBorders[i], uno::makeAny(aBorderLine)); aPropMap.setProperty(nBorder, uno::makeAny(aBorderLine));
} }
aPropMap.erase(PROP_LineColor); aPropMap.erase(PROP_LineColor);
} }

View File

@ -71,9 +71,8 @@ OString generateMD5(const void* pData, size_t length)
OStringBuffer aBuffer; OStringBuffer aBuffer;
const char* pString = "0123456789ABCDEF"; const char* pString = "0123456789ABCDEF";
for(size_t i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i) for(sal_uInt8 val : pBuffer)
{ {
sal_uInt8 val = pBuffer[i];
aBuffer.append(pString[val/16]); aBuffer.append(pString[val/16]);
aBuffer.append(pString[val%16]); aBuffer.append(pString[val%16]);
} }
@ -272,12 +271,12 @@ void releaseOpenCLEnv( GPUEnv *gpuInfo )
return; return;
} }
for (int i = 0; i < OPENCL_CMDQUEUE_SIZE; ++i) for (_cl_command_queue* & i : gpuEnv.mpCmdQueue)
{ {
if (gpuEnv.mpCmdQueue[i]) if (i)
{ {
clReleaseCommandQueue(gpuEnv.mpCmdQueue[i]); clReleaseCommandQueue(i);
gpuEnv.mpCmdQueue[i] = nullptr; i = nullptr;
} }
} }
gpuEnv.mnCmdQueuePos = 0; gpuEnv.mnCmdQueuePos = 0;

View File

@ -374,9 +374,9 @@ OUString ManifestImport::PushNameAndNamespaces( const OUString& aName, const uno
aStack.push_back( ManifestScopeEntry( aConvertedName, aNamespaces ) ); aStack.push_back( ManifestScopeEntry( aConvertedName, aNamespaces ) );
for ( size_t nInd = 0; nInd < aAttribsStrs.size(); nInd++ ) { for (const std::pair<OUString,OUString> & rAttribsStr : aAttribsStrs) {
// convert the attribute names on filling // convert the attribute names on filling
o_aConvertedAttribs[ConvertName( aAttribsStrs[nInd].first )] = aAttribsStrs[nInd].second; o_aConvertedAttribs[ConvertName( rAttribsStr.first )] = rAttribsStr.second;
} }
return aConvertedName; return aConvertedName;

View File

@ -179,10 +179,10 @@ void ZipOutputStream::finish()
consumeAllScheduledThreadEntries(); consumeAllScheduledThreadEntries();
sal_Int32 nOffset= static_cast < sal_Int32 > (m_aChucker.GetPosition()); sal_Int32 nOffset= static_cast < sal_Int32 > (m_aChucker.GetPosition());
for (size_t i = 0; i < m_aZipList.size(); i++) for (ZipEntry* p : m_aZipList)
{ {
writeCEN( *m_aZipList[i] ); writeCEN( *p );
delete m_aZipList[i]; delete p;
} }
writeEND( nOffset, static_cast < sal_Int32 > (m_aChucker.GetPosition()) - nOffset); writeEND( nOffset, static_cast < sal_Int32 > (m_aChucker.GetPosition()) - nOffset);
m_xStream->flush(); m_xStream->flush();

View File

@ -1569,8 +1569,8 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
if ( !sFunction.isEmpty() ) if ( !sFunction.isEmpty() )
{ {
const sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'}; const sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'};
for(sal_uInt32 j= 0; j < SAL_N_ELEMENTS(pReplaceChars);++j) for(sal_Unicode ch : pReplaceChars)
sFunctionName = sFunctionName.replace(pReplaceChars[j],'_'); sFunctionName = sFunctionName.replace(ch,'_');
xFunction->setName(sFunctionName); xFunction->setName(sFunctionName);
if ( !sInitialFormula.isEmpty() ) if ( !sInitialFormula.isEmpty() )

View File

@ -87,8 +87,8 @@ ODateTimeDialog::ODateTimeDialog( vcl::Window* _pParent
m_aTimeControlling.enableOnCheckMark( *m_pTime, *m_pFTTimeFormat, *m_pTimeListBox); m_aTimeControlling.enableOnCheckMark( *m_pTime, *m_pFTTimeFormat, *m_pTimeListBox);
CheckBox* aCheckBoxes[] = { m_pDate,m_pTime}; CheckBox* aCheckBoxes[] = { m_pDate,m_pTime};
for ( size_t i = 0 ; i < SAL_N_ELEMENTS(aCheckBoxes); ++i) for (CheckBox* pCheckBox : aCheckBoxes)
aCheckBoxes[i]->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl)); pCheckBox->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl));
} }

View File

@ -961,11 +961,11 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl
m_pFieldExpression->set_vexpand(true); m_pFieldExpression->set_vexpand(true);
Control* pControlsLst[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst, m_pGroupIntervalEd}; Control* pControlsLst[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst, m_pGroupIntervalEd};
for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst); ++i) for (Control* i : pControlsLst)
{ {
pControlsLst[i]->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot)); i->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot));
pControlsLst[i]->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost)); i->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost));
pControlsLst[i]->Show(); i->Show();
} }
for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst) - 1; ++i) for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst) - 1; ++i)
@ -1072,8 +1072,8 @@ void OGroupsSortingDialog::SaveData( sal_Int32 _nRow)
xGroup->setSortAscending( m_pOrderLst->GetSelectEntryPos() == 0 ); xGroup->setSortAscending( m_pOrderLst->GetSelectEntryPos() == 0 );
ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst}; ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) for (ListBox* pControl : pControls)
pControls[i]->SaveValue(); pControl->SaveValue();
} }
@ -1305,13 +1305,13 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _x
m_pOrderLst->SelectEntryPos(_xGroup->getSortAscending() ? 0 : 1); m_pOrderLst->SelectEntryPos(_xGroup->getSortAscending() ? 0 : 1);
ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst}; ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) for (ListBox* pControl : pControls)
pControls[i]->SaveValue(); pControl->SaveValue();
ListBox* pControlsLst2[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst}; ListBox* pControlsLst2[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
bool bReadOnly = !m_pController->isEditable(); bool bReadOnly = !m_pController->isEditable();
for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst2); ++i) for (ListBox* i : pControlsLst2)
pControlsLst2[i]->SetReadOnly(bReadOnly); i->SetReadOnly(bReadOnly);
m_pGroupIntervalEd->SetReadOnly(bReadOnly); m_pGroupIntervalEd->SetReadOnly(bReadOnly);
} }

View File

@ -374,9 +374,9 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope
,OUString(PROPERTY_PREVIEW_COUNT) ,OUString(PROPERTY_PREVIEW_COUNT)
}; };
for (size_t nPos = 0; nPos < SAL_N_ELEMENTS(s_pProperties); ++nPos ) for (const OUString & rName : s_pProperties)
{ {
aValue.Name = s_pProperties[nPos]; aValue.Name = rName;
aNewProps.push_back(aValue); aNewProps.push_back(aValue);
} }
} }

View File

@ -119,9 +119,9 @@ namespace rptui
const size_t nFactories = SAL_N_ELEMENTS( aFactories ); const size_t nFactories = SAL_N_ELEMENTS( aFactories );
Sequence< Any > aReturn( nFactories ); Sequence< Any > aReturn( nFactories );
Any* pReturn = aReturn.getArray(); Any* pReturn = aReturn.getArray();
for ( size_t i = 0; i < nFactories; ++i ) for (const auto& rFactory : aFactories)
{ {
*pReturn++ <<= OUString::createFromAscii( aFactories[i].serviceName ); *pReturn++ <<= OUString::createFromAscii( rFactory.serviceName );
} }
return aReturn; return aReturn;

View File

@ -1309,15 +1309,15 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie
}; };
const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo(); const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo();
const uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); const uno::Sequence< beans::Property> aSeq = xInfo->getProperties();
for (size_t i = 0; i < SAL_N_ELEMENTS(pIncludeProperties); ++i ) for (const auto & rIncludeProp : pIncludeProperties)
{ {
const beans::Property* pIter = aSeq.getConstArray(); const beans::Property* pIter = aSeq.getConstArray();
const beans::Property* pEnd = pIter + aSeq.getLength(); const beans::Property* pEnd = pIter + aSeq.getLength();
const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(pIncludeProperties[i]))); const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(rIncludeProp)));
if ( pFind != pEnd ) if ( pFind != pEnd )
{ {
// special case for controls which contain a data field // special case for controls which contain a data field
if ( PROPERTY_DATAFIELD == pIncludeProperties[i] ) if ( PROPERTY_DATAFIELD == rIncludeProp )
{ {
beans::Property aValue; beans::Property aValue;
aValue.Name = PROPERTY_FORMULALIST; aValue.Name = PROPERTY_FORMULALIST;

View File

@ -540,13 +540,13 @@ namespace
,{ITEMID_LANGUAGE_ASIAN,OUString(PROPERTY_CHARLOCALEASIAN)} ,{ITEMID_LANGUAGE_ASIAN,OUString(PROPERTY_CHARLOCALEASIAN)}
,{ITEMID_LANGUAGE_COMPLEX,OUString(PROPERTY_CHARLOCALECOMPLEX)} ,{ITEMID_LANGUAGE_COMPLEX,OUString(PROPERTY_CHARLOCALECOMPLEX)}
}; };
for(size_t k = 0; k < SAL_N_ELEMENTS(pItems); ++k) for(const auto & k : pItems)
{ {
if ( SfxItemState::SET == _rItemSet.GetItemState( pItems[k].nWhich,true,&pItem) && dynamic_cast< const SvxLanguageItem *>( pItem ) != nullptr) if ( SfxItemState::SET == _rItemSet.GetItemState( k.nWhich,true,&pItem) && dynamic_cast< const SvxLanguageItem *>( pItem ) != nullptr)
{ {
const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem); const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem);
lang::Locale aCharLocale( LanguageTag( pFontItem->GetLanguage()).getLocale()); lang::Locale aCharLocale( LanguageTag( pFontItem->GetLanguage()).getLocale());
lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) ); lcl_pushBack( _out_rProperties, k.sPropertyName, uno::makeAny( aCharLocale ) );
} }
} }
if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,true,&pItem) && dynamic_cast< const SvxEscapementItem *>( pItem ) != nullptr) if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,true,&pItem) && dynamic_cast< const SvxEscapementItem *>( pItem ) != nullptr)
@ -730,8 +730,8 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
} }
SfxItemPool::Free(pPool); SfxItemPool::Free(pPool);
for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i) for (SfxPoolItem* pDefault : pDefaults)
delete pDefaults[i]; delete pDefault;
return bSuccess; return bSuccess;
} }

View File

@ -2093,10 +2093,10 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _
,OUString("private:resource/toolbar/resizebar") ,OUString("private:resource/toolbar/resizebar")
,OUString("private:resource/toolbar/sectionshrinkbar") ,OUString("private:resource/toolbar/sectionshrinkbar")
}; };
for (size_t i = 0; i< SAL_N_ELEMENTS(s_sMenu); ++i) for (const auto & i : s_sMenu)
{ {
_xLayoutManager->createElement( s_sMenu[i] ); _xLayoutManager->createElement( i );
_xLayoutManager->requestElement( s_sMenu[i] ); _xLayoutManager->requestElement( i );
} }
} }
} }
@ -2536,8 +2536,8 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
} }
SfxItemPool::Free(pPool); SfxItemPool::Free(pPool);
for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i) for (SfxPoolItem* pDefault : pDefaults)
delete pDefaults[i]; delete pDefault;
} }
@ -2735,11 +2735,11 @@ uno::Any SAL_CALL OReportController::getViewData() throw( uno::RuntimeException,
}; };
::comphelper::NamedValueCollection aCommandProperties; ::comphelper::NamedValueCollection aCommandProperties;
for ( size_t i=0; i < SAL_N_ELEMENTS(nCommandIDs); ++i ) for (sal_Int32 nCommandID : nCommandIDs)
{ {
const FeatureState aFeatureState = GetState( nCommandIDs[i] ); const FeatureState aFeatureState = GetState( nCommandID );
OUString sCommandURL( getURLForId( nCommandIDs[i] ).Main ); OUString sCommandURL( getURLForId( nCommandID ).Main );
OSL_ENSURE( sCommandURL.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" ); OSL_ENSURE( sCommandURL.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
sCommandURL = sCommandURL.copy( 5 ); sCommandURL = sCommandURL.copy( 5 );
@ -3208,10 +3208,10 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
,OUString(PROPERTY_FORMATSSUPPLIER) ,OUString(PROPERTY_FORMATSSUPPLIER)
,OUString(PROPERTY_BACKGROUNDCOLOR) ,OUString(PROPERTY_BACKGROUNDCOLOR)
}; };
for(size_t i = 0; i < SAL_N_ELEMENTS(sProps); ++i) for(const auto & sProp : sProps)
{ {
if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) ) if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i])); xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
} }
if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) ) if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
@ -3507,10 +3507,10 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
,OUString(PROPERTY_BORDER) ,OUString(PROPERTY_BORDER)
,OUString(PROPERTY_BACKGROUNDCOLOR) ,OUString(PROPERTY_BACKGROUNDCOLOR)
}; };
for(size_t k = 0; k < SAL_N_ELEMENTS(sProps); ++k) for(const auto & sProp : sProps)
{ {
if ( xInfo->hasPropertyByName(sProps[k]) && xShapeInfo->hasPropertyByName(sProps[k]) ) if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
xUnoProp->setPropertyValue(sProps[k],xShapeProp->getPropertyValue(sProps[k])); xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
} }
if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) ) if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
{ {
@ -3618,8 +3618,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
} }
else else
{ {
for(size_t i = 0; i < SAL_N_ELEMENTS(pControl); ++i) for(SdrUnoObj* i : pControl)
delete pControl[i]; delete i;
} }
} }
} }
@ -3679,8 +3679,8 @@ void OReportController::listen(const bool _bAdd)
void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const OUString&, const uno::Reference< XPropertyChangeListener >& ) = void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const OUString&, const uno::Reference< XPropertyChangeListener >& ) =
_bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener; _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener;
for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i) for (const auto & aProp : aProps)
(m_xReportDefinition.get()->*pPropertyListenerAction)( aProps[i], static_cast< XPropertyChangeListener* >( this ) ); (m_xReportDefinition.get()->*pPropertyListenerAction)( aProp, static_cast< XPropertyChangeListener* >( this ) );
OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv(); OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv; uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv;
@ -4259,8 +4259,8 @@ void OReportController::openZoomDialog()
} }
SfxItemPool::Free(pPool); SfxItemPool::Free(pPool);
for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i) for (SfxPoolItem* pDefault : pDefaults)
delete pDefaults[i]; delete pDefault;
} }
} }

View File

@ -194,8 +194,8 @@ void PropBrw::dispose()
const OUString pProps[] = { OUString( "ContextDocument" ) const OUString pProps[] = { OUString( "ContextDocument" )
, OUString( "DialogParentWindow" ) , OUString( "DialogParentWindow" )
, OUString( "ActiveConnection" )}; , OUString( "ActiveConnection" )};
for (size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i) for (const auto & i : pProps)
xName->removeByName(pProps[i]); xName->removeByName(i);
} }
} }
catch(Exception&) catch(Exception&)

View File

@ -208,21 +208,21 @@ bool onInitSignal()
sigfillset(&(act.sa_mask)); sigfillset(&(act.sa_mask));
/* Initialize the rest of the signals */ /* Initialize the rest of the signals */
for (int i = 0; i < NoSignals; ++i) for (SignalAction & rSignal : Signals)
{ {
#if defined HAVE_VALGRIND_HEADERS #if defined HAVE_VALGRIND_HEADERS
if (Signals[i].Signal == SIGUSR2 && RUNNING_ON_VALGRIND) if (rSignal.Signal == SIGUSR2 && RUNNING_ON_VALGRIND)
Signals[i].Action = ACT_IGNORE; rSignal.Action = ACT_IGNORE;
#endif #endif
/* hack: stomcatd is attaching JavaVM which does not work with an sigaction(SEGV) */ /* hack: stomcatd is attaching JavaVM which does not work with an sigaction(SEGV) */
if ((bSetSEGVHandler || Signals[i].Signal != SIGSEGV) if ((bSetSEGVHandler || rSignal.Signal != SIGSEGV)
&& (bSetWINCHHandler || Signals[i].Signal != SIGWINCH) && (bSetWINCHHandler || rSignal.Signal != SIGWINCH)
&& (bSetILLHandler || Signals[i].Signal != SIGILL)) && (bSetILLHandler || rSignal.Signal != SIGILL))
{ {
if (Signals[i].Action != ACT_SYSTEM) if (rSignal.Action != ACT_SYSTEM)
{ {
if (Signals[i].Action == ACT_HIDE) if (rSignal.Action == ACT_HIDE)
{ {
struct sigaction ign; struct sigaction ign;
@ -231,18 +231,18 @@ bool onInitSignal()
sigemptyset(&ign.sa_mask); sigemptyset(&ign.sa_mask);
struct sigaction oact; struct sigaction oact;
if (sigaction(Signals[i].Signal, &ign, &oact) == 0) if (sigaction(rSignal.Signal, &ign, &oact) == 0)
Signals[i].Handler = oact.sa_handler; rSignal.Handler = oact.sa_handler;
else else
Signals[i].Handler = SIG_DFL; rSignal.Handler = SIG_DFL;
} }
else else
{ {
struct sigaction oact; struct sigaction oact;
if (sigaction(Signals[i].Signal, &act, &oact) == 0) if (sigaction(rSignal.Signal, &act, &oact) == 0)
Signals[i].Handler = oact.sa_handler; rSignal.Handler = oact.sa_handler;
else else
Signals[i].Handler = SIG_DFL; rSignal.Handler = SIG_DFL;
} }
} }
} }

View File

@ -58,10 +58,10 @@ getNextSize (sal_uInt32 nSize)
2097143, 4194301, 8388593, 16777213, 2097143, 4194301, 8388593, 16777213,
33554393, 67108859, 134217689 }; 33554393, 67108859, 134217689 };
for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(nPrimes); i++) for (sal_uInt32 nPrime : nPrimes)
{ {
if (nPrimes[i] > nSize) if (nPrime > nSize)
return nPrimes[i]; return nPrime;
} }
return nSize * 2; return nSize * 2;
} }

View File

@ -120,8 +120,8 @@ void FastAttributeList::addUnknown( const OString& rName, const OString& value )
// XFastAttributeList // XFastAttributeList
sal_Bool FastAttributeList::hasAttribute( ::sal_Int32 Token ) throw (RuntimeException, std::exception) sal_Bool FastAttributeList::hasAttribute( ::sal_Int32 Token ) throw (RuntimeException, std::exception)
{ {
for (size_t i = 0; i < maAttributeTokens.size(); ++i) for (sal_Int32 i : maAttributeTokens)
if (maAttributeTokens[i] == Token) if (i == Token)
return true; return true;
return false; return false;

View File

@ -255,11 +255,11 @@ namespace sax_fastparser {
#ifdef DBG_UTIL #ifdef DBG_UTIL
::std::set<OString> DebugAttributes; ::std::set<OString> DebugAttributes;
#endif #endif
for (size_t j = 0; j < maTokenValues.size(); j++) for (const TokenValue & rTokenValue : maTokenValues)
{ {
writeBytes(sSpace, N_CHARS(sSpace)); writeBytes(sSpace, N_CHARS(sSpace));
sal_Int32 nToken = maTokenValues[j].nToken; sal_Int32 nToken = rTokenValue.nToken;
writeId(nToken); writeId(nToken);
#ifdef DBG_UTIL #ifdef DBG_UTIL
@ -271,7 +271,7 @@ namespace sax_fastparser {
writeBytes(sEqualSignAndQuote, N_CHARS(sEqualSignAndQuote)); writeBytes(sEqualSignAndQuote, N_CHARS(sEqualSignAndQuote));
write(maTokenValues[j].pValue, -1, true); write(rTokenValue.pValue, -1, true);
writeBytes(sQuote, N_CHARS(sQuote)); writeBytes(sQuote, N_CHARS(sQuote));
} }