From b70fa47aec65fe95da94fc17640dda27650e9677 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 14 Jun 2017 09:35:16 +0200 Subject: use more SAL_N_ELEMENTS part 1 - teach comphelper::containerToSequence to handle sized arrays - also use range based for-loop where appropriate. Change-Id: I73ba9b6295e7b29c872ee53de7a9340969e07f99 Reviewed-on: https://gerrit.libreoffice.org/38769 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- toolkit/source/awt/vclxprinter.cxx | 2 +- toolkit/source/awt/vclxtoolkit.cxx | 4 ++-- toolkit/source/helper/property.cxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index fe4a8f089fe1..b2f3ac103bba 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -55,7 +55,7 @@ css::beans::Property* ImplGetProperties( sal_uInt16& rElementCount ) css::beans::Property( "Horizontal", PROPERTY_Horizontal, cppu::UnoType::get(), 0 ) }; pProperties = aPropTable; - nElements = sizeof( aPropTable ) / sizeof( css::beans::Property ); + nElements = SAL_N_ELEMENTS( aPropTable ); } } rElementCount = nElements; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 5c781f5ef6ab..380abb76af30 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -511,7 +511,7 @@ WindowType ImplGetComponentType( const OUString& rServiceName ) if( !bSorted ) { qsort( static_cast(aComponentInfos), - sizeof( aComponentInfos ) / sizeof( ComponentInfo ), + SAL_N_ELEMENTS( aComponentInfos ), sizeof( ComponentInfo ), ComponentInfoCompare ); bSorted = true; @@ -527,7 +527,7 @@ WindowType ImplGetComponentType( const OUString& rServiceName ) ComponentInfo* pInf = static_cast(bsearch( &aSearch, static_cast(aComponentInfos), - sizeof( aComponentInfos ) / sizeof( ComponentInfo ), + SAL_N_ELEMENTS( aComponentInfos ), sizeof( ComponentInfo ), ComponentInfoCompare )); diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 7b98d1d80611..3ace75837bcb 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -285,7 +285,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "InactiveSelectionTextColor", INACTIVE_SEL_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), }; pPropertyInfos = aImplPropertyInfos; - nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); + nElements = SAL_N_ELEMENTS( aImplPropertyInfos ); } } rElementCount = nElements; -- cgit