summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/doceventnotifier.cxx3
-rw-r--r--basctl/source/dlged/propbrw.cxx5
-rw-r--r--crashrep/source/win32/soreport.cpp2
-rw-r--r--cui/source/customize/acccfg.cxx4
-rw-r--r--cui/source/dialogs/commonlingui.cxx7
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx11
-rw-r--r--cui/source/options/optgdlg.cxx9
-rw-r--r--cui/source/options/optinet2.cxx10
-rw-r--r--cui/source/options/optlingu.cxx2
-rw-r--r--cui/source/options/webconninfo.cxx3
-rw-r--r--extensions/source/abpilot/fieldmappingimpl.cxx5
-rw-r--r--extensions/source/activex/main/SOActionsApproval.cpp2
-rw-r--r--extensions/source/activex/main/SOComWindowPeer.cpp2
-rw-r--r--extensions/source/activex/main/SODispatchInterceptor.cpp2
-rw-r--r--extensions/source/logging/loggerconfig.cxx3
-rw-r--r--extensions/source/plugin/unx/npwrap.cxx2
-rw-r--r--extensions/source/propctrlr/defaultforminspection.cxx5
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx9
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx3
-rw-r--r--extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx3
-rw-r--r--extensions/source/scanner/sanedlg.cxx7
-rw-r--r--extensions/workben/testpgp.cxx3
-rw-r--r--forms/source/richtext/richtextvclcontrol.cxx4
-rw-r--r--forms/source/runtime/formoperations.cxx3
-rw-r--r--forms/source/solar/control/navtoolbar.cxx3
-rw-r--r--lingucomponent/source/languageguessing/guesslang.cxx4
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx4
-rw-r--r--setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx2
-rw-r--r--setup_native/source/win32/customactions/sellang/sellang.cxx2
-rw-r--r--setup_native/source/win32/stwrapper/stwrapper.cxx14
30 files changed, 75 insertions, 63 deletions
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index 038032a76fd3..86cf38223a5b 100644
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ b/basctl/source/basicide/doceventnotifier.cxx
@@ -44,6 +44,7 @@
#include <comphelper/processfactory.hxx>
#include <vos/mutex.hxx>
+#include <sal/macros.h>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
@@ -166,7 +167,7 @@ namespace basctl
{ "OnModeChanged", &DocumentEventListener::onDocumentModeChanged }
};
- for ( size_t i=0; i < sizeof( aEvents ) / sizeof( aEvents[0] ); ++i )
+ for ( size_t i=0; SAL_N_ELEMENTS( aEvents ); ++i )
{
if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) )
continue;
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index d12b4d9b67e1..d210482a8ef5 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basctl.hxx"
-
+#include <sal/macros.h>
#include "propbrw.hxx"
#include "dlgedobj.hxx"
@@ -204,8 +204,7 @@ void PropBrw::ImplReCreateController()
::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) )
};
Reference< XComponentContext > xInspectorContext(
- ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
- xOwnContext ) );
+ ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), xOwnContext ) );
// create a property browser controller
Reference< XMultiComponentFactory > xFactory( xInspectorContext->getServiceManager(), UNO_QUERY_THROW );
diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp
index 4f1556e7a9fa..3251305a59b2 100644
--- a/crashrep/source/win32/soreport.cpp
+++ b/crashrep/source/win32/soreport.cpp
@@ -944,7 +944,7 @@ BOOL CALLBACK PreviewDialogProc(
{
int i;
- count = fread( buf, sizeof(buf[0]), sizeof(buf)/sizeof(buf[0]), fp );
+ count = fread( buf, sizeof(buf[0]), SAL_N_ELEMENTS(buf), fp );
for ( i = 0; i < count; i++ )
{
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 4295d7f0f6d9..8a3b81562bd2 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -43,6 +43,8 @@
#include <sfx2/minfitem.hxx>
#include <svl/stritem.hxx>
+#include <sal/macros.h>
+
#include "cuires.hrc"
#include "acccfg.hrc"
@@ -586,7 +588,7 @@ static USHORT __FAR_DATA KEYCODE_ARRAY[] =
KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2
};
-static USHORT KEYCODE_ARRAY_SIZE = (sizeof(KEYCODE_ARRAY) / sizeof(KEYCODE_ARRAY[0]));
+static USHORT KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY);
//-----------------------------------------------
// seems to be needed to layout the list box, which shows all
diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx
index c1d5ae50aac6..9b23a1386963 100644
--- a/cui/source/dialogs/commonlingui.cxx
+++ b/cui/source/dialogs/commonlingui.cxx
@@ -33,6 +33,7 @@
#include <cuires.hrc>
#include <dialmgr.hxx>
#include <vcl/decoview.hxx>
+#include <sal/macros.h>
#include "hangulhanjadlg.hrc"
@@ -253,7 +254,7 @@ void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY )
{
this, &aAuditBox, &aStatusText
};
- for ( sal_uInt32 i = 0; i < sizeof( pResize ) / sizeof( pResize[0] ); ++i )
+ for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pResize ); ++i )
{
aSize = pResize[i]->GetSizePixel( );
pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) );
@@ -266,7 +267,7 @@ void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY )
{
&aStatusText, &aHelpBtn, &aCancelBtn
};
- for ( sal_uInt32 i = 0; i < sizeof( pMoveDown ) / sizeof( pMoveDown[0] ); ++i )
+ for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveDown ); ++i )
{
aPos = pMoveDown[i]->GetPosPixel();
aPos.Y() += _nY;
@@ -280,7 +281,7 @@ void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY )
{
&aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn
};
- for ( sal_uInt32 i = 0; i < sizeof( pMoveRight ) / sizeof( pMoveRight[0] ); ++i )
+ for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveRight ); ++i )
{
aPos = pMoveRight[i]->GetPosPixel();
aPos.X() += _nX;
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 4f6d7643c315..18177096d2a4 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/i18n/TransliterationModules.hpp>
#include <comphelper/processfactory.hxx>
#include <svx/svxdlg.hxx>
+#include <sal/macros.h>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::i18n;
@@ -73,7 +74,7 @@ void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor )
// hide the options for the japanese search
Control* pFieldsToMove[] = { &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint };
- implMoveControls(pFieldsToMove, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), nDifference, &m_flOptions);
+ implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flOptions);
m_aSoundsLikeCJK.Hide();
m_aSoundsLikeCJKSettings.Hide();
@@ -172,7 +173,7 @@ FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, c
&m_pbApproxSettings, &m_aHalfFullFormsCJK, &m_aSoundsLikeCJK, &m_aSoundsLikeCJKSettings,
&m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint };
- implMoveControls(pFieldsToMove, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), nDifference, &m_flWhere);
+ implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flWhere);
Point pt = m_rbAllFields.GetPosPixel();
pt.X() = m_ftForm.GetPosPixel().X();
@@ -276,7 +277,7 @@ void FmSearchDialog::Init(const UniString& strVisibleFields, const UniString& sI
RID_STR_SEARCH_END,
RID_STR_SEARCH_WHOLE
};
- for ( size_t i=0; i<sizeof(nResIds)/sizeof(nResIds[0]); ++i )
+ for ( size_t i=0; i<SAL_N_ELEMENTS(nResIds); ++i )
m_lbPosition.InsertEntry( String( CUI_RES( nResIds[i] ) ) );
m_lbPosition.SelectEntryPos(MATCHING_ANYWHERE);
@@ -725,13 +726,13 @@ void FmSearchDialog::EnableControlPaint(sal_Bool bEnable)
&m_pbSearchAgain, &m_pbClose };
if (!bEnable)
- for (sal_uInt32 i=0; i<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++i)
+ for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
{
pAffectedControls[i]->SetUpdateMode(bEnable);
pAffectedControls[i]->EnablePaint(bEnable);
}
else
- for (sal_uInt32 i=0; i<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++i)
+ for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
{
pAffectedControls[i]->EnablePaint(bEnable);
pAffectedControls[i]->SetUpdateMode(bEnable);
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 3976d99c304e..50f6849bdbc0 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -78,6 +78,7 @@
#include <dialmgr.hxx>
#include <svtools/helpopt.hxx>
#include <unotools/saveopt.hxx>
+#include <sal/macros.h>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -246,7 +247,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
&aInterpretFT, &aYearValueField, &aToYearFT
};
Window** pCurrent = pWins;
- const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
{
aNewPos = (*pCurrent)->GetPosPixel();
@@ -268,7 +269,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
&aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT
};
Window** pCurrent = pWins;
- const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
{
aNewPos = (*pCurrent)->GetPosPixel();
@@ -294,7 +295,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
&aInterpretFT, &aYearValueField, &aToYearFT
};
Window** pCurrent = pWins;
- const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
{
aNewPos = (*pCurrent)->GetPosPixel();
@@ -803,7 +804,7 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
DELETEZ( pFontAntiAliasing );
Point aPos;
- for ( sal_Int32 i = 0; i < sizeof( pMiscOptions ) / sizeof( pMiscOptions[0] ); ++i )
+ for ( sal_Int32 i = 0; i < SAL_N_ELEMENTS( pMiscOptions ); ++i )
{
aPos = pMiscOptions[i]->GetPosPixel( );
aPos.Y() -= nMoveUp;
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 531b497826a1..6143c3211b18 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -59,6 +59,7 @@
#include <unotools/localfilehelper.hxx>
#include <unotools/extendedsecurityoptions.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+
#define _SVX_OPTINET2_CXX
#include <dialmgr.hxx>
#include "optinet2.hxx"
@@ -87,6 +88,7 @@
#include <osl/nlsupport.h>
#endif
#include <sal/types.h>
+#include <sal/macros.h>
#include <rtl/ustring.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
@@ -911,7 +913,7 @@ void SvxSearchTabPage::InitControls_Impl()
long nLabelTextWidth = 0;
Window* pLabels[] = { &aSearchNameFT, &aSearchFT, &aURLFT, &aPostFixFT, &aSeparatorFT, &aCaseFT };
Window** pLabel = pLabels;
- const sal_Int32 nLabelCount = sizeof( pLabels ) / sizeof( pLabels[0] );
+ const sal_Int32 nLabelCount = SAL_N_ELEMENTS( pLabels );
for ( ; i < nLabelCount; ++i, ++pLabel )
{
long nTemp = (*pLabel)->GetCtrlTextWidth( (*pLabel)->GetText() );
@@ -935,7 +937,7 @@ void SvxSearchTabPage::InitControls_Impl()
Window* pEdits[] = { &aSearchNameED, &aAndRB, &aOrRB,
&aExactRB, &aURLED, &aPostFixED, &aSeparatorED, &aCaseED };
Window** pEdit = pEdits;
- const sal_Int32 nCCount = sizeof( pEdits ) / sizeof( pEdits[ 0 ] );
+ const sal_Int32 nCCount = SAL_N_ELEMENTS( pEdits );
for ( i = 0; i < nCCount; ++i, ++pEdit )
{
Point aNewPos = (*pEdit)->GetPosPixel();
@@ -1540,7 +1542,7 @@ void SvxSecurityTabPage::InitControls()
Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB,
&maShowConnectionsPB, &maMacroSecPB };
Window** pButton = pButtons;
- const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ const sal_Int32 nBCount = SAL_N_ELEMENTS( pButtons );
for ( ; i < nBCount; ++i, ++pButton )
{
long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
@@ -1580,7 +1582,7 @@ void SvxSecurityTabPage::InitControls()
Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB,
&maMasterPasswordFI, &maMacroSecFI };
Window** pControl = pControls;
- const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[ 0 ] );
+ const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
for ( i = 0; i < nCCount; ++i, ++pControl )
{
Size aNewSize = (*pControl)->GetSizePixel();
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index fc8b23683525..84de2dd786c3 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -407,7 +407,7 @@ static const char * aEidToPropName[] =
static inline String lcl_GetPropertyName( EID_OPTIONS eEntryId )
{
- DBG_ASSERT( (unsigned int) eEntryId < sizeof(aEidToPropName) / sizeof(aEidToPropName[0]), "index out of range" );
+ DBG_ASSERT( (unsigned int) eEntryId < SAL_N_ELEMENTS(aEidToPropName), "index out of range" );
return String::CreateFromAscii( aEidToPropName[ (int) eEntryId ] );
}
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 955555bb4a61..2c9a7ebbdd7c 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -32,6 +32,7 @@
// include ---------------------------------------------------------------
#include <dialmgr.hxx>
#include <cuires.hrc>
+#include <sal/macros.h>
#include <com/sun/star/task/UrlRecord.hpp>
#include <com/sun/star/task/XPasswordContainer.hpp>
#include <com/sun/star/task/XMasterPasswordHandling.hpp>
@@ -128,7 +129,7 @@ WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) :
long nBtnTextWidth = 0;
Window* pButtons[] = { &m_aRemoveBtn, &m_aRemoveAllBtn, &m_aChangeBtn };
Window** pButton = pButtons;
- const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ const sal_Int32 nBCount = SAL_N_ELEMENTS( pButtons );
for ( ; i < nBCount; ++i, ++pButton )
{
long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
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 <unotools/confignode.hxx>
+#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<sizeof(arr)/sizeof(arr[0]);i++)
+ for (int i=0;i<SAL_N_ELEMENTS(arr);i++)
{
#if defined(_MSC_VER) && (_MSC_VER >= 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<sizeof(arr)/sizeof(arr[0]);i++)
+ for (int i=0;i<SAL_N_ELEMENTS(arr);i++)
{
#if defined(_MSC_VER) && (_MSC_VER >= 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<sizeof(arr)/sizeof(arr[0]);i++)
+ for (int i=0;i<SAL_N_ELEMENTS(arr);i++)
{
#if defined(_MSC_VER) && (_MSC_VER >= 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 <cppuhelper/component_context.hxx>
#include <vector>
+#include <sal/macros.h>
//........................................................................
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 <cppuhelper/implbase1.hxx>
#include <osl/diagnose.h>
+#include <sal/macros.h>
//------------------------------------------------------------------------
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<nCategories; ++i, ++pReturn )
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 83c7027887b2..c5eb86be632c 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -106,6 +106,7 @@
#include <vcl/stdtext.hxx>
#include <vcl/wrkwin.hxx>
#include <tools/StringListResource.hxx>
+#include <sal/macros.h>
#include <limits>
@@ -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<sizeof(aAffectedProps)/sizeof(aAffectedProps[0]); ++i)
+ for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aAffectedProps); ++i)
{
Reference< XPropertyControl > 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<sizeof(aFormattedPropertyControls)/sizeof(aFormattedPropertyControls[0]); ++i )
+ for ( sal_uInt16 i=0; i<SAL_N_ELEMENTS(aFormattedPropertyControls); ++i )
{
Reference< XPropertyControl > 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 <algorithm>
#include <functional>
+#include <sal/macros.h>
//------------------------------------------------------------------------
// !!! 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 <vcl/msgbox.hxx>
#include <tools/debug.hxx>
#include <svtools/localresaccess.hxx>
+#include <sal/macros.h>
#include <algorithm>
#include <functional>
@@ -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 <sanedlg.hrc>
#include <grid.hxx>
#include <math.h>
+#include <sal/macros.h>
#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)
{
diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx
index 6dea7285ea86..53e7d9091f80 100644
--- a/forms/source/richtext/richtextvclcontrol.cxx
+++ b/forms/source/richtext/richtextvclcontrol.cxx
@@ -262,7 +262,7 @@ namespace frm
::sfx2::FileDialogHelper aFP( bLoad ? com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE : com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, 0, this );
- for ( size_t i = 0; i < sizeof( aExportFormats ) / sizeof( aExportFormats[ 0 ] ); ++i )
+ for ( size_t i = 0; i < SAL_N_ELEMENTS( aExportFormats ); ++i )
{
aFP.AddFilter(
String::CreateFromAscii( aExportFormats[i].pDescription ),
@@ -279,7 +279,7 @@ namespace frm
{
EETextFormat eFormat = EE_FORMAT_XML;
String sFilter = aFP.GetCurrentFilter();
- for ( size_t i = 0; i < sizeof( aExportFormats ) / sizeof( aExportFormats[ 0 ] ); ++i )
+ for ( size_t i = 0; i < SAL_N_ELEMENTS( aExportFormats ); ++i )
{
if ( sFilter.EqualsAscii( aExportFormats[i].pDescription ) )
{
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index c6c700acdc1b..b1d7e01f837b 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -69,6 +69,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <vos/mutex.hxx>
+#include <sal/macros.h>
//--------------------------------------------------------------------------
extern "C" void SAL_CALL createRegistryInfo_FormOperations()
@@ -1124,7 +1125,7 @@ namespace frm
FormFeature::SaveRecordChanges,
FormFeature::UndoRecordChanges
};
- size_t nFeatureCount = sizeof( pModifyDependentFeatures ) / sizeof( pModifyDependentFeatures[ 0 ] );
+ size_t nFeatureCount = SAL_N_ELEMENTS( pModifyDependentFeatures );
s_aModifyDependentFeatures = Sequence< sal_Int16 >( pModifyDependentFeatures, nFeatureCount );
}
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 747cf3379aef..7e5974971283 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -43,6 +43,7 @@
#include <vcl/fixed.hxx>
#include <memory>
+#include <sal/macros.h>
#define LID_RECORD_LABEL 1000
#define LID_RECORD_FILLER 1001
@@ -295,7 +296,7 @@ namespace frm
{ FormFeature::RemoveFilterAndSort, false, false },
};
- size_t nSupportedFeatures = sizeof( aSupportedFeatures ) / sizeof( aSupportedFeatures[0] );
+ size_t nSupportedFeatures = SAL_N_ELEMENTS( aSupportedFeatures );
FeatureDescription* pSupportedFeatures = aSupportedFeatures;
FeatureDescription* pSupportedFeaturesEnd = aSupportedFeatures + nSupportedFeatures;
for ( ; pSupportedFeatures < pSupportedFeaturesEnd; ++pSupportedFeatures )
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx
index 1ce4bd493ddf..0efe7eebf200 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -49,6 +49,8 @@
#include <unotools/localfilehelper.hxx>
#include <osl/thread.h>
+#include <sal/macros.h>
+
using namespace ::rtl;
using namespace ::osl;
using namespace ::cppu;
@@ -172,7 +174,7 @@ void LangGuess_Impl::EnsureInitialized()
{"sa", ""}, {"ta", ""}, {"th", ""},
{"qu", ""}, {"yi", ""}
};
- sal_Int32 nNum = sizeof(aDisable) / sizeof(aDisable[0]);
+ sal_Int32 nNum = SAL_N_ELEMENTS(aDisable);
Sequence< Locale > aDisableSeq( nNum );
Locale *pDisableSeq = aDisableSeq.getArray();
for (sal_Int32 i = 0; i < nNum; ++i)
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index 77875a3d049d..de7cdc3f4539 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -60,7 +60,7 @@
#include <lingutil.hxx>
#include <dictmgr.hxx>
-
+#include <sal/macros.h>
using ::com::sun::star::lang::Locale;
@@ -88,7 +88,7 @@ rtl::OString Win_GetShortPathName( const rtl::OUString &rLongPathName )
rtl::OString aRes;
sal_Unicode aShortBuffer[1024] = {0};
- sal_Int32 nShortBufSize = sizeof( aShortBuffer ) / sizeof( aShortBuffer[0] );
+ sal_Int32 nShortBufSize = SAL_N_ELEMENTS( aShortBuffer );
// use the version of 'GetShortPathName' that can deal with Unicode...
sal_Int32 nShortLen = GetShortPathNameW(
diff --git a/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx b/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx
index ffbbafc9a68d..e3f930ccfcbd 100644
--- a/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx
+++ b/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx
@@ -43,8 +43,6 @@
#include <memory>
#include <string>
-#define ELEMENTS_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))
-
void DetermineWordPreselectionState(MSIHANDLE handle)
{
if (query_preselect_registration_for_ms_application(handle, MSWORD))
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index 3b52d7ee0373..ecae30371082 100644
--- a/setup_native/source/win32/customactions/sellang/sellang.cxx
+++ b/setup_native/source/win32/customactions/sellang/sellang.cxx
@@ -185,7 +185,7 @@ enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
return TRUE;
ui_langs[num_ui_langs] = langid_to_string((LANGID) langid, NULL);
num_ui_langs++;
- if (num_ui_langs == sizeof(ui_langs) / sizeof(ui_langs[0]))
+ if (num_ui_langs == SAL_N_ELEMENTS(ui_langs) )
return FALSE;
return TRUE;
}
diff --git a/setup_native/source/win32/stwrapper/stwrapper.cxx b/setup_native/source/win32/stwrapper/stwrapper.cxx
index d2c72c6422d4..0a12b3a80f61 100644
--- a/setup_native/source/win32/stwrapper/stwrapper.cxx
+++ b/setup_native/source/win32/stwrapper/stwrapper.cxx
@@ -13,8 +13,6 @@
#include <stdio.h>
-#define elementsof(buf) (sizeof(buf) / sizeof(buf[0]))
-
enum PathResult
{
PATHRESULT_OK,
@@ -281,7 +279,7 @@ int WINAPI _tWinMain( HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR, int )
{
if ( i < nArgs )
++i;
- SafeCopy( szInstanceURN, lpArgs[i], elementsof( szInstanceURN ));
+ SafeCopy( szInstanceURN, lpArgs[i], SAL_N_ELEMENTS( szInstanceURN ));
break;
}
@@ -289,35 +287,35 @@ int WINAPI _tWinMain( HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR, int )
{
if ( i < nArgs )
++i;
- SafeCopy( szTargetURN, lpArgs[i], elementsof( szTargetURN ));
+ SafeCopy( szTargetURN, lpArgs[i], SAL_N_ELEMENTS( szTargetURN ));
break;
}
case 'p':
{
if ( i < nArgs )
++i;
- SafeCopy( szProductName, lpArgs[i], elementsof( szProductName ));
+ SafeCopy( szProductName, lpArgs[i], SAL_N_ELEMENTS( szProductName ));
break;
}
case 'e':
{
if ( i < nArgs )
++i;
- SafeCopy( szProductVersion, lpArgs[i], elementsof( szProductVersion ));
+ SafeCopy( szProductVersion, lpArgs[i], SAL_N_ELEMENTS( szProductVersion ));
break;
}
case 'P':
{
if ( i < nArgs )
++i;
- SafeCopy( szParentProductName, lpArgs[i], elementsof( szParentProductName ));
+ SafeCopy( szParentProductName, lpArgs[i], SAL_N_ELEMENTS( szParentProductName ));
break;
}
case 'S':
{
if ( i < nArgs )
++i;
- SafeCopy( szProductSource, lpArgs[i], elementsof( szProductSource ));
+ SafeCopy( szProductSource, lpArgs[i], SAL_N_ELEMENTS( szProductSource ));
break;
}