From 394235bba1f7c474c9655f929f4fe27a550aba45 Mon Sep 17 00:00:00 2001 From: Kenneth Venken Date: Fri, 15 Oct 2010 18:15:35 +0100 Subject: SAL_N_ELEMENTS changes for components --- extensions/source/abpilot/fieldmappingimpl.cxx | 5 +++-- extensions/source/activex/main/SOActionsApproval.cpp | 2 +- extensions/source/activex/main/SOComWindowPeer.cpp | 2 +- extensions/source/activex/main/SODispatchInterceptor.cpp | 2 +- extensions/source/logging/loggerconfig.cxx | 3 ++- extensions/source/plugin/unx/npwrap.cxx | 2 +- extensions/source/propctrlr/defaultforminspection.cxx | 5 +++-- extensions/source/propctrlr/formcomponenthandler.cxx | 9 +++++---- extensions/source/propctrlr/propcontroller.cxx | 3 ++- extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx | 3 ++- extensions/source/scanner/sanedlg.cxx | 7 +++---- extensions/workben/testpgp.cxx | 3 +-- 12 files changed, 25 insertions(+), 21 deletions(-) (limited to 'extensions') diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 101d210e2ad7..c7af76636362 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -42,6 +42,7 @@ #include "abpresid.hrc" #include "componentmodule.hxx" #include +#include "sal/macros.h" //......................................................................... namespace abp @@ -207,10 +208,10 @@ namespace abp _rxORB, sDriverAliasesNodeName, -1, OConfigurationTreeRoot::CM_READONLY); // loop through all programmatic pairs - DBG_ASSERT( 0 == ( sizeof( pMappingProgrammatics ) / sizeof( pMappingProgrammatics[ 0 ] ) ) % 2, + DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2, "fieldmapping::defaultMapping: invalid programmatic map!" ); // number of pairs - sal_Int32 nIntersectedProgrammatics = sizeof( pMappingProgrammatics ) / sizeof( pMappingProgrammatics[ 0 ] ) / 2; + sal_Int32 nIntersectedProgrammatics = SAL_N_ELEMENTS( pMappingProgrammatics ) / 2; const sal_Char** pProgrammatic = pMappingProgrammatics; ::rtl::OUString sAddressProgrammatic; diff --git a/extensions/source/activex/main/SOActionsApproval.cpp b/extensions/source/activex/main/SOActionsApproval.cpp index b795b92fcf76..5eb2fb7cf93e 100644 --- a/extensions/source/activex/main/SOActionsApproval.cpp +++ b/extensions/source/activex/main/SOActionsApproval.cpp @@ -16,7 +16,7 @@ STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) &IID_ISOActionsApproval, }; - for (int i=0;i= 1300) if (InlineIsEqualGUID(*arr[i],riid)) diff --git a/extensions/source/activex/main/SOComWindowPeer.cpp b/extensions/source/activex/main/SOComWindowPeer.cpp index 6ae1c805fa39..9d6a18629c21 100644 --- a/extensions/source/activex/main/SOComWindowPeer.cpp +++ b/extensions/source/activex/main/SOComWindowPeer.cpp @@ -15,7 +15,7 @@ STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) &IID_ISOComWindowPeer, }; - for (int i=0;i= 1300) if (InlineIsEqualGUID(*arr[i],riid)) diff --git a/extensions/source/activex/main/SODispatchInterceptor.cpp b/extensions/source/activex/main/SODispatchInterceptor.cpp index 5a4455265b97..447afe321c0b 100644 --- a/extensions/source/activex/main/SODispatchInterceptor.cpp +++ b/extensions/source/activex/main/SODispatchInterceptor.cpp @@ -18,7 +18,7 @@ STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid) &IID_ISODispatchInterceptor, }; - for (int i=0;i= 1300) if (InlineIsEqualGUID(*arr[i],riid)) diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 904f18789d80..048ede71a41e 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -51,6 +51,7 @@ #include #include +#include //........................................................................ namespace logging @@ -114,7 +115,7 @@ namespace logging Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName ) }; - for ( size_t i = 0; i < sizeof( aVariables ) / sizeof( aVariables[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aVariables ); ++i ) { ::rtl::OUString sPattern( aVariables[i].pVariablePattern, aVariables[i].nPatternLength, aVariables[i].eEncoding ); sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index 38fb5654d153..7124972d8578 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -215,7 +215,7 @@ static void signal_handler( int nSig ) fprintf( stderr, "caught signal %d, exiting\n", nSig ); #ifdef LINUX void* pStack[64]; - int nStackLevels = backtrace( pStack, sizeof(pStack)/sizeof(pStack[0]) ); + int nStackLevels = backtrace( pStack, SAL_N_ELEMENTS(pStack) ); backtrace_symbols_fd( pStack, nStackLevels, STDERR_FILENO ); #endif #endif diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index 72b1cdb89330..3fd14196537a 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -42,6 +42,7 @@ /** === end UNO includes === **/ #include #include +#include //------------------------------------------------------------------------ extern "C" void SAL_CALL createRegistryInfo_DefaultFormComponentInspectorModel() @@ -159,7 +160,7 @@ namespace pcr { "com.sun.star.form.inspection.FormGeometryHandler", true } }; - sal_Int32 nFactories = sizeof( aFactories ) / sizeof( aFactories[ 0 ] ); + sal_Int32 nFactories = SAL_N_ELEMENTS( aFactories ); Sequence< Any > aReturn( nFactories ); Any* pReturn = aReturn.getArray(); for ( sal_Int32 i = 0; i < nFactories; ++i ) @@ -189,7 +190,7 @@ namespace pcr { "Events", RID_STR_EVENTS, HID_FM_PROPDLG_TAB_EVT } }; - sal_Int32 nCategories = sizeof( aCategories ) / sizeof( aCategories[0] ); + sal_Int32 nCategories = SAL_N_ELEMENTS( aCategories ); Sequence< PropertyCategoryDescriptor > aReturn( nCategories ); PropertyCategoryDescriptor* pReturn = aReturn.getArray(); for ( sal_Int32 i=0; i #include #include +#include #include @@ -1724,7 +1725,7 @@ namespace pcr // propagate the changes to the min/max/default fields Any aCurrentProp; ::rtl::OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX }; - for (sal_uInt16 i=0; i xControl; try @@ -1771,7 +1772,7 @@ namespace pcr ::rtl::OUString aFormattedPropertyControls[] = { PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE }; - for ( sal_uInt16 i=0; i xControl; try @@ -2164,8 +2165,8 @@ namespace pcr ControlType::PROGRESSBAR }; - sal_Int32 nKnownControlTypes = sizeof( aControlModelServiceNames ) / sizeof( aControlModelServiceNames[ 0 ] ); - OSL_ENSURE( nKnownControlTypes == sizeof( nClassIDs ) / sizeof( nClassIDs[ 0 ] ), + sal_Int32 nKnownControlTypes = SAL_N_ELEMENTS( aControlModelServiceNames ); + OSL_ENSURE( nKnownControlTypes == SAL_N_ELEMENTS( nClassIDs ), "FormComponentPropertyHandler::impl_classifyControlModel_throw: inconsistence" ); for ( sal_Int32 i = 0; i < nKnownControlTypes; ++i ) diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 72d89e5e0f06..f4791a316137 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -62,6 +62,7 @@ #include #include +#include //------------------------------------------------------------------------ // !!! outside the namespace !!! @@ -1505,7 +1506,7 @@ namespace pcr ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( m_pView ) ) ) }; xHandlerContext = ::cppu::createComponentContext( - aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), + aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), m_aContext.getUNOContext() ); } diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index c90033d00b12..c254800af14c 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -629,7 +630,7 @@ namespace pcr size_t i=0; const ::rtl::OUString* pLoop = NULL; for ( i = 0, pLoop = aFacets; - i < sizeof( aFacets ) / sizeof( aFacets[0] ); + i < SAL_N_ELEMENTS( aFacets ); ++i, ++pLoop ) { diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index db40ead2739a..a58ce6173a59 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #define USE_SAVE_STATE #undef SAVE_ALL_STATES @@ -395,7 +396,7 @@ void SaneDlg::InitFields() { BOOL bIsSpecial = FALSE; for( size_t n = 0; !bIsSpecial && - n < sizeof(ppSpecialOptions)/sizeof(ppSpecialOptions[0]); n++ ) + n < SAL_N_ELEMENTS(ppSpecialOptions); n++ ) { if( aOption.EqualsAscii( ppSpecialOptions[n] ) ) bIsSpecial=TRUE; @@ -1314,9 +1315,7 @@ void SaneDlg::SaveState() "br-x", "br-y" }; - for( size_t i = 0; - i < (sizeof(pSaveOptions)/sizeof(pSaveOptions[0])); - i++ ) + for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); i++ ) { ByteString aOption = pSaveOptions[i]; int nOption = mrSane.GetOptionByName( pSaveOptions[i] ); diff --git a/extensions/workben/testpgp.cxx b/extensions/workben/testpgp.cxx index 288ca8825507..84318ad6301c 100644 --- a/extensions/workben/testpgp.cxx +++ b/extensions/workben/testpgp.cxx @@ -756,8 +756,7 @@ int SAL_CALL main (int argc, char **argv) S2U("mhu@rabbit") }; - sal_Int32 nRecipients = - sizeof(aRecipients) / sizeof(aRecipients[0]); + sal_Int32 nRecipients = SAL_N_ELEMENTS(aRecipients); if (nOptions & OPTION_SIGN) { -- cgit v1.2.3