diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-03-28 17:12:04 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-03-31 08:00:13 +0000 |
commit | 1aa4df615fa5599d05e9dd5e925b5852676185fa (patch) | |
tree | 1f637fa13140941a5775c91f058d0742f911693f /svx/source/form | |
parent | 2bd1e7aafeebdfe0e1656ed1ff01762039be5af1 (diff) |
use SAL_N_ELEMENTS in for loops
for with
git grep -n 'for.*sizeof'
Change-Id: I6211024385e03ac5eeeb38690d2c1c699e015c2f
Reviewed-on: https://gerrit.libreoffice.org/23569
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx/source/form')
-rw-r--r-- | svx/source/form/fmPropBrw.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 14 | ||||
-rw-r--r-- | svx/source/form/formcontrolling.cxx | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index af7487d966da..f0e3abc90ab9 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -271,7 +271,7 @@ void FmPropBrw::dispose() , OUString( "DialogParentWindow" ) , OUString( "ControlContext" ) , OUString( "ControlShapeAccess" ) }; - for ( size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i ) xName->removeByName( pProps[i] ); } } diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index cf4d5919a6fd..3dc3c370fd71 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -193,7 +193,7 @@ bool FmFormPage::RequestHelp( vcl::Window* pWindow, SdrView* pView, INetProtocol::Https, INetProtocol::Javascript, INetProtocol::Ldap }; - for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i) + for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(s_aQuickHelpSupported); ++i) if (s_aQuickHelpSupported[i] == aProtocol) { aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), INetURLObject::DECODE_UNAMBIGUOUS); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 0e8f324268db..fbe33f7335a1 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1046,7 +1046,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU )); ImageList aImageList( SVX_RES( RID_SVXIMGLIST_FMEXPL) ); - for ( size_t i = 0; i < sizeof (nConvertSlots) / sizeof (nConvertSlots[0]); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(nConvertSlots); ++i ) { // das entsprechende Image dran pNewMenu->SetItemImage(nConvertSlots[i], aImageList.GetImage(nCreateSlots[i])); @@ -1058,7 +1058,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId ) { - for ( size_t i = 0; i < sizeof (nConvertSlots) / sizeof (nConvertSlots[0]); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(nConvertSlots); ++i ) if (nConvertSlots[i] == nSlotId) return true; return false; @@ -1094,7 +1094,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent OSL_ENSURE( isSolelySelected( _rxObject ), "FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" ); - for ( size_t lookupSlot = 0; lookupSlot < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++lookupSlot ) + for ( size_t lookupSlot = 0; lookupSlot < SAL_N_ELEMENTS(nConvertSlots); ++lookupSlot ) { if (nConvertSlots[lookupSlot] == _nSlotId) { @@ -1310,10 +1310,10 @@ bool FmXFormShell::canConvertCurrentSelectionToControl( sal_Int16 nConversionSlo ) return false; // those types cannot be converted - DBG_ASSERT(sizeof(nConvertSlots)/sizeof(nConvertSlots[0]) == sizeof(nObjectTypes)/sizeof(nObjectTypes[0]), + DBG_ASSERT(SAL_N_ELEMENTS(nConvertSlots) == SAL_N_ELEMENTS(nObjectTypes), "FmXFormShell::canConvertCurrentSelectionToControl: nConvertSlots & nObjectTypes must have the same size !"); - for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) if (nConvertSlots[i] == nConversionSlot) return nObjectTypes[i] != nObjectType; @@ -2031,7 +2031,7 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection ) impl_updateCurrentForm( xNewCurrentForm ); // ensure some slots are updated - for ( size_t i = 0; i < sizeof( SelObjectSlotMap ) / sizeof( SelObjectSlotMap[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(SelObjectSlotMap); ++i ) InvalidateSlot( SelObjectSlotMap[i], false); return true; @@ -2071,7 +2071,7 @@ void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurFo pPage->GetImpl().setCurForm( m_xCurrentForm ); // ensure the UI which depends on the current form is up-to-date - for ( size_t i = 0; i < sizeof( DlgSlotMap ) / sizeof( DlgSlotMap[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( DlgSlotMap ); ++i ) InvalidateSlot( DlgSlotMap[i], false ); } diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx index 0baab098e9ad..14bc9c9be11e 100644 --- a/svx/source/form/formcontrolling.cxx +++ b/svx/source/form/formcontrolling.cxx @@ -109,7 +109,7 @@ namespace svx { OUString(FMURL_FORM_APPLY_FILTER), SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter }, { OUString(FMURL_FORM_REMOVE_FILTER), SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort } }; - for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i ) + for ( size_t i=0; i<SAL_N_ELEMENTS(aDescriptions); ++i ) s_aFeatureDescriptions.push_back( aDescriptions[i] ); } }; |