summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-03-28 17:12:04 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-03-31 08:00:13 +0000
commit1aa4df615fa5599d05e9dd5e925b5852676185fa (patch)
tree1f637fa13140941a5775c91f058d0742f911693f /svx
parent2bd1e7aafeebdfe0e1656ed1ff01762039be5af1 (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')
-rw-r--r--svx/source/fmcomp/fmgridif.cxx4
-rw-r--r--svx/source/fmcomp/gridcell.cxx8
-rw-r--r--svx/source/fmcomp/gridctrl.cxx6
-rw-r--r--svx/source/form/fmPropBrw.cxx2
-rw-r--r--svx/source/form/fmpage.cxx2
-rw-r--r--svx/source/form/fmshimp.cxx14
-rw-r--r--svx/source/form/formcontrolling.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx2
-rw-r--r--svx/source/unodraw/unoprov.cxx2
9 files changed, 21 insertions, 21 deletions
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index a75a10ddd879..912bed33d0a1 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1610,13 +1610,13 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol)
{
// the same props as in addColumnListeners ... linux has problems with global static UStrings, so
// we have to do it this way ....
- static OUString aPropsListenedTo[] =
+ static const OUString aPropsListenedTo[] =
{
OUString(FM_PROP_LABEL), OUString(FM_PROP_WIDTH), OUString(FM_PROP_HIDDEN), OUString(FM_PROP_ALIGN), OUString(FM_PROP_FORMATKEY)
};
Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
- for (sal_uInt16 i=0; i<sizeof(aPropsListenedTo)/sizeof(aPropsListenedTo[0]); ++i)
+ for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aPropsListenedTo); ++i)
if (xInfo->hasPropertyByName(aPropsListenedTo[i]))
xCol->removePropertyChangeListener(aPropsListenedTo[i], this);
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index cc14e9de9e99..30df2f2f7ce8 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -718,7 +718,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet
if ((_eInitWhat & InitWritingMode) != 0)
{
- for (size_t i = 0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i)
+ for (size_t i = 0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if (pWindows[i])
pWindows[i]->EnableRTL(rParent.IsRTLEnabled());
@@ -727,7 +727,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet
if ((_eInitWhat & InitFontFacet) != 0)
{
- for (size_t i = 0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i)
+ for (size_t i = 0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if (!pWindows[i])
continue;
@@ -757,7 +757,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet
bool bTextLineColor = rParent.IsTextLineColor();
Color aTextLineColor(rParent.GetTextLineColor());
- for (size_t i=0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if (pWindows[i])
{
@@ -778,7 +778,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet
if (rParent.IsControlBackground())
{
Color aColor(rParent.GetControlBackground());
- for (size_t i=0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if (pWindows[i])
{
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index b0770273cd87..9d1768ca0687 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -541,7 +541,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
m_aNewBtn.get()
};
- for (size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if (pWindows[i]->GetPosPixel().X() < 0)
pWindows[i]->SetSizePixel(Size(0, nH));
@@ -812,7 +812,7 @@ void DbGridControl::NavigationBar::StateChanged(StateChangedType nType)
case StateChangedType::Mirroring:
{
bool bIsRTLEnabled = IsRTLEnabled();
- for (size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
pWindows[i]->EnableRTL( bIsRTLEnabled );
}
break;
@@ -826,7 +826,7 @@ void DbGridControl::NavigationBar::StateChanged(StateChangedType nType)
if (IsControlFont())
aFont.Merge(GetControlFont());
- for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
pWindows[i]->SetZoom(aZoom);
pWindows[i]->SetZoomedPointFont(*pWindows[i], aFont);
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] );
}
};
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 0a5690108b3b..66376264ba1e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2171,7 +2171,7 @@ struct SvxStyleToolBoxControl::Impl
};
Reference<container::XNameAccess> xCellStyles;
xStylesSupplier->getStyleFamilies()->getByName("CellStyles") >>= xCellStyles;
- for( sal_uInt32 nStyle = 0; nStyle < sizeof( aCalcStyles ) / sizeof( sal_Char*); ++nStyle )
+ for( sal_uInt32 nStyle = 0; nStyle < SAL_N_ELEMENTS(aCalcStyles); ++nStyle )
{
try
{
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index ee6635a88b37..678a30420304 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -849,7 +849,7 @@ const UHashMapImpl& GetUHashImpl()
{ RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG },
};
- for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++)
+ for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++)
aImpl[OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id;
bInited = true;
}