[Libreoffice-commits] .: basic/source configmgr/source connectivity/source editeng/source formula/source fpicker/source framework/source linguistic/source linguistic/workben scripting/source sfx2/source shell/source svx/source ucb/source uui/source vbahelper/source xmloff/source

Michael Meeks mmeeks at kemper.freedesktop.org
Thu Oct 14 13:16:05 PDT 2010


 basic/source/runtime/stdobj.cxx                           |    2 
 configmgr/source/xmlreader.cxx                            |    4 -
 connectivity/source/commontools/TDatabaseMetaDataBase.cxx |    2 
 connectivity/source/commontools/dbmetadata.cxx            |    2 
 connectivity/source/drivers/adabas/BDriver.cxx            |    2 
 connectivity/source/drivers/adabas/BUser.cxx              |    2 
 connectivity/source/drivers/ado/Awrapado.cxx              |   24 +++---
 connectivity/source/drivers/jdbc/DatabaseMetaData.cxx     |    2 
 connectivity/source/drivers/mozab/MColumnAlias.cxx        |    2 
 connectivity/source/drivers/mozab/MDriver.cxx             |    2 
 connectivity/source/parse/sqlnode.cxx                     |    2 
 editeng/source/editeng/editview.cxx                       |    2 
 formula/source/core/api/FormulaCompiler.cxx               |    8 +-
 fpicker/source/office/OfficeControlAccess.cxx             |    4 -
 fpicker/source/office/iodlg.cxx                           |   10 +-
 fpicker/source/win32/filepicker/controlaccess.cxx         |    3 
 framework/source/services/backingwindow.cxx               |    2 
 framework/source/uielement/controlmenucontroller.cxx      |    6 -
 framework/source/xml/menudocumenthandler.cxx              |    2 
 framework/source/xml/toolboxdocumenthandler.cxx           |    2 
 linguistic/source/gciterator.cxx                          |    2 
 linguistic/source/lngopt.cxx                              |    2 
 linguistic/source/lngprophelp.cxx                         |    6 -
 linguistic/source/misc.cxx                                |    2 
 linguistic/workben/sprophelp.cxx                          |    2 
 scripting/source/vbaevents/eventhelper.cxx                |    2 
 sfx2/source/appl/shutdowniconw32.cxx                      |    2 
 sfx2/source/dialog/alienwarn.cxx                          |    2 
 sfx2/source/dialog/printopt.cxx                           |    6 -
 sfx2/source/view/frmload.cxx                              |    2 
 shell/source/backends/gconfbe/gconfaccess.cxx             |    3 
 shell/source/win32/shlxthandler/columninfo/columninfo.cxx |    2 
 shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx   |    2 
 shell/source/win32/shlxthandler/util/fileextensions.cxx   |    2 
 shell/source/win32/simplemail/senddoc.cxx                 |    2 
 svx/source/dialog/docrecovery.cxx                         |    4 -
 svx/source/dialog/srchdlg.cxx                             |    2 
 svx/source/fmcomp/fmgridif.cxx                            |    8 +-
 svx/source/fmcomp/gridcell.cxx                            |    8 +-
 svx/source/fmcomp/gridctrl.cxx                            |    4 -
 svx/source/form/ParseContext.cxx                          |    2 
 svx/source/form/datanavi.cxx                              |    4 -
 svx/source/form/fmPropBrw.cxx                             |    4 -
 svx/source/form/fmdmod.cxx                                |    2 
 svx/source/form/fmpage.cxx                                |    2 
 svx/source/form/fmshimp.cxx                               |   14 +--
 svx/source/form/fmundo.cxx                                |    4 -
 svx/source/form/formcontrolling.cxx                       |    4 -
 svx/source/unodraw/unoprov.cxx                            |    2 
 svx/source/xml/xmlgrhlp.cxx                               |    2 
 ucb/source/ucp/ext/ucpext_content.cxx                     |    2 
 ucb/source/ucp/gio/gio_content.cxx                        |    4 -
 ucb/source/ucp/gvfs/gvfs_content.cxx                      |    5 -
 ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx         |    4 -
 ucb/source/ucp/package/pkgcontentcaps.cxx                 |    4 -
 ucb/source/ucp/tdoc/tdoc_contentcaps.cxx                  |    4 -
 uui/source/masterpasscrtdlg.cxx                           |    6 -
 uui/source/passcrtdlg.cxx                                 |    2 
 uui/source/passworddlg.cxx                                |    2 
 uui/source/secmacrowarnings.cxx                           |    4 -
 vbahelper/source/vbahelper/vbaapplicationbase.cxx         |    2 
 vbahelper/source/vbahelper/vbaglobalbase.cxx              |    4 -
 xmloff/source/core/xmltoken.cxx                           |    2 
 xmloff/source/forms/elementexport.cxx                     |   55 ++++++--------
 64 files changed, 142 insertions(+), 148 deletions(-)

New commits:
commit 8279868bb177cdfc07f3eeed380412616e4958db
Author: Kayo Hamid <revol.code at yahoo.com>
Date:   Thu Oct 14 21:14:52 2010 +0100

    Switch to use SAL_N_ELEMENTS macro, everywhere

diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 44ecdb2..e23b95e 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -85,7 +85,7 @@ friend class VBABlackListQuery;
     VBABlacklist()
     {
         const char* list[] = { "Red" };
-        sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
+        sal_Int32 nSize = SAL_N_ELEMENTS( list );
         for ( sal_Int32 index = 0; index < nSize; ++index )
         {
             mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
diff --git a/configmgr/source/xmlreader.cxx b/configmgr/source/xmlreader.cxx
index c385176..4865c87 100644
--- a/configmgr/source/xmlreader.cxx
+++ b/configmgr/source/xmlreader.cxx
@@ -430,7 +430,7 @@ XmlReader::Namespace XmlReader::scanNamespaceIri(
           XmlReader::NAMESPACE_XSI },
         { RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/XML/1998/namespace"),
           XmlReader::NAMESPACE_XML } };
-    for (std::size_t i = 0; i < sizeof iris / sizeof iris[0]; ++i) {
+    for (std::size_t i = 0; i < SAL_N_ELEMENTS( iris ); ++i) {
         if (rtl_str_compare_WithLength(
                 iri.begin, iri.length, iris[i].begin, iris[i].length) ==
             0)
@@ -550,7 +550,7 @@ char const * XmlReader::handleReference(char const * position, char const * end)
               RTL_CONSTASCII_STRINGPARAM("'") },
             { RTL_CONSTASCII_STRINGPARAM("quot;"),
               RTL_CONSTASCII_STRINGPARAM("\"") } };
-        for (std::size_t i = 0; i < sizeof refs / sizeof refs[0]; ++i) {
+        for (std::size_t i = 0; i < SAL_N_ELEMENTS( refs ); ++i) {
             if (rtl_str_shortenedCompare_WithLength(
                     position, end - position, refs[i].inBegin, refs[i].inLength,
                     refs[i].inLength) ==
diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
index ae02127..73a1ee1 100644
--- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
+++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
@@ -149,7 +149,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo(  ) throw(SQ
                 ::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
                 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
                 sal_Int32* pType = pTypes;
-                for (sal_Int32 i = 1; i <= sal_Int32(sizeof(pTypes)/sizeof(pTypes[0])); ++i,++pType)
+                for (sal_Int32 i = 1; i <= sal_Int32(SAL_N_ELEMENTS(pTypes)); ++i,++pType)
                 {
                     ORowSetValue aValue;
                     aValue.fill(i,*pType,xRow);
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index fa13f6b..fbe5528 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -354,7 +354,7 @@ namespace dbtools
             {
                 const ::rtl::OUString url = m_pImpl->xConnectionMetaData->getURL();
                 char pMySQL[] = "sdbc:mysql";
-                bSupport = url.matchAsciiL(pMySQL,(sizeof(pMySQL)/sizeof(pMySQL[0]))-1);
+                bSupport = url.matchAsciiL(pMySQL,(SAL_N_ELEMENTS(pMySQL))-1);
             }
         }
         catch( const Exception& )
diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx
index 49385bc..54572a8 100644
--- a/connectivity/source/drivers/adabas/BDriver.cxx
+++ b/connectivity/source/drivers/adabas/BDriver.cxx
@@ -1299,7 +1299,7 @@ void ODriver::fillEnvironmentVariables()
         { "DBROOT",     &m_sDbRoot,     &m_sDbRootURL }
     };
 
-    for ( size_t i = 0; i < sizeof( EnvData ) / sizeof( EnvData[0] ); ++i )
+    for ( size_t i = 0; i < SAL_N_ELEMENTS( EnvData ); ++i )
     {
         ::rtl::OUString sVarName = ::rtl::OUString::createFromAscii( EnvData[i].pAsciiEnvName );
         ::rtl::OUString sEnvValue;
diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx
index 1a74b7d..5e3092e 100644
--- a/connectivity/source/drivers/adabas/BUser.cxx
+++ b/connectivity/source/drivers/adabas/BUser.cxx
@@ -163,7 +163,7 @@ void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int3
                     { "SEL", Privilege::SELECT },
                     { "REF", Privilege::REFERENCE }
                 };
-                for ( size_t i = 0; i < sizeof( privileges ) / sizeof( privileges[0] ); ++i )
+                for ( size_t i = 0; i < SAL_N_ELEMENTS( privileges ); ++i )
                 {
                     sal_Int32 nIndex = sPrivs.indexOf( ::rtl::OUString::createFromAscii( privileges[i].pAsciiName ) );
                     if ( nIndex == -1 )
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
index 7f8d597..545d0ef 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -1641,7 +1641,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1682,7 +1682,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1725,7 +1725,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any&
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1766,7 +1766,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1809,7 +1809,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1856,7 +1856,7 @@ ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::A
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1906,7 +1906,7 @@ ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any&
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -1948,7 +1948,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno:
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -2020,7 +2020,7 @@ ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& cata
         varCriteria[nPos].setString(sTypeNames);
 
     // Create SafeArray Bounds and initialize the array
-    const sal_Int32 nCrit = sizeof varCriteria / sizeof varCriteria[0];
+    const sal_Int32 nCrit = SAL_N_ELEMENTS( varCriteria );
     SAFEARRAYBOUND rgsabound[1];
     rgsabound[0].lLbound   = 0;
     rgsabound[0].cElements = nCrit;
@@ -2058,7 +2058,7 @@ ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& cat
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -2103,7 +2103,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno:
 
     // Create SafeArray Bounds and initialize the array
     rgsabound[0].lLbound   = 0;
-    rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+    rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
     psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
 
     sal_Int32 nPos=0;
@@ -2138,7 +2138,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
 {
     // Create elements used in the array
     OLEVariant varCriteria[2];
-    const int nCrit = sizeof varCriteria / sizeof varCriteria[0];
+    const int nCrit = SAL_N_ELEMENTS( varCriteria );
     // Create SafeArray Bounds and initialize the array
     SAFEARRAYBOUND rgsabound[1];
     rgsabound[0].lLbound   = 0;
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index 362da4e..dbb763c 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -462,7 +462,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
                 for (sal_Int32 i = 1 ; i <= nCount ; ++i)
                 {
                     sColumnName = xMeta->getColumnName(i);
-                    for (sal_uInt32 j = 0 ; j < sizeof(sPrivs)/sizeof(sPrivs[0]); ++j)
+                    for (sal_uInt32 j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j)
                     {
                         if ( sPrivs[j] == sColumnName )
                         {
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
index 34c1fbb..c6a928f 100644
--- a/connectivity/source/drivers/mozab/MColumnAlias.cxx
+++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx
@@ -91,7 +91,7 @@ OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::
         "Notes",
     };
 
-    for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
+    for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i )
         m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
 
     initialize( _rxORB );
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
index f1af6ac..19a1e89 100644
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -259,7 +259,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url )
         { LDAP,             "ldap" }
     };
 
-    for ( size_t i=0; i < sizeof( aSchemeMap ) / sizeof( aSchemeMap[0] ); ++i )
+    for ( size_t i=0; i < SAL_N_ELEMENTS( aSchemeMap ); ++i )
     {
         if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 )
             return aSchemeMap[i].eType;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index f5da2a6..fd28dbd 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1428,7 +1428,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
             { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" },
             { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }
         };
-        size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] );
+        size_t nRuleMapCount = SAL_N_ELEMENTS( aRuleDescriptions );
         OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" );
 
         for ( size_t mapEntry = 0; mapEntry < nRuleMapCount; ++mapEntry )
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 035171a..e95893e 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -148,7 +148,7 @@ LanguageType lcl_CheckLanguage(
         lang::Locale a3( SvxCreateLocale( aLangList[3] ) );
 #endif
 
-        INT32   nCount = sizeof(aLangList) / sizeof(aLangList[0]);
+        INT32   nCount = SAL_N_ELEMENTS(aLangList);
         for (INT32 i = 0;  i < nCount;  i++)
         {
             INT16 nTmpLang = aLangList[i];
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 6fbe19b..4b5c3ca 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -346,7 +346,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
             { FormulaMapGroupSpecialOffset::MACRO             , ocMacro }          ,
             { FormulaMapGroupSpecialOffset::COL_ROW_NAME      , ocColRowName }     
         };
-        const size_t nCount = sizeof(aMap)/sizeof(aMap[0]);
+        const size_t nCount = SAL_N_ELEMENTS(aMap);
         // Preallocate vector elements.
         if (aVec.size() < nCount)
         {
@@ -386,7 +386,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
                 SC_OPCODE_CLOSE,
                 SC_OPCODE_SEP,
             };
-            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
+            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
         }
         if ((nGroups & FormulaMapGroup::ARRAY_SEPARATORS) != 0)
         {
@@ -396,7 +396,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
                 SC_OPCODE_ARRAY_ROW_SEP,
                 SC_OPCODE_ARRAY_COL_SEP
             };
-            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
+            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
         }
         if ((nGroups & FormulaMapGroup::UNARY_OPERATORS) != 0)
         {
@@ -452,7 +452,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
                 SC_OPCODE_NOT,
                 SC_OPCODE_NEG
             };
-            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
+            lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
             // functions with 2 or more parameters.
             for (USHORT nOp = SC_OPCODE_START_2_PAR; nOp < SC_OPCODE_STOP_2_PAR && nOp < mnSymbols; ++nOp)
             {
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx
index 759c010..4b4f538 100644
--- a/fpicker/source/office/OfficeControlAccess.cxx
+++ b/fpicker/source/office/OfficeControlAccess.cxx
@@ -116,7 +116,7 @@ namespace svt
         };
 
         // ................................................................
-        static const sal_Int32 s_nControlCount = sizeof( aDescriptions ) / sizeof( aDescriptions[0] );
+        static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions );
 
         static ControlDescIterator s_pControls = aDescriptions;
         static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount;
@@ -166,7 +166,7 @@ namespace svt
         };
 
         // ................................................................
-        static const int s_nPropertyCount = sizeof( aProperties ) / sizeof( aProperties[0] );
+        static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties );
 
         static ControlPropertyIterator s_pProperties = aProperties;
         static ControlPropertyIterator s_pPropertiesEnd = aProperties + s_nPropertyCount;
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 10760be..c14d6ca 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -2571,7 +2571,7 @@ void SvtFileDialog::implArrangeControls()
     // loop through all these controls and adjust the z-order
     Window* pPreviousWin = NULL;
     Control** pCurrent = pControls;
-    for ( sal_Int32 i = 0; i < sal_Int32(sizeof( pControls ) / sizeof( pControls[ 0 ] )); ++i, ++pCurrent )
+    for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pControls )); ++i, ++pCurrent )
     {
         if ( !*pCurrent )
             // this control is not available in the current operation mode -> skip
@@ -2751,7 +2751,7 @@ void SvtFileDialog::Resize()
             _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection
         };
         Control** ppMoveControls = aMoveControlsVert;
-        Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsVert ) / sizeof( aMoveControlsVert[0] );
+        Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsVert );
         for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
             lcl_MoveControl( *ppMoveControls, 0, nDeltaY );
     }
@@ -2763,7 +2763,7 @@ void SvtFileDialog::Resize()
             _pImp->_pBtnFileOpen, _pImp->_pBtnCancel, _pImp->_pBtnHelp
         };
         Control** ppMoveControls = aMoveControlsBoth;
-        Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsBoth ) / sizeof( aMoveControlsBoth[0] );
+        Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsBoth );
         for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
             lcl_MoveControl( *ppMoveControls, nDeltaX, nDeltaY );
     }
@@ -2775,7 +2775,7 @@ void SvtFileDialog::Resize()
             _pImp->_pBtnUp, _pImp->_pBtnNewFolder, _pImp->_pBtnStandard
         };
         Control** ppMoveControls = aMoveControlsHor;
-        Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsHor ) / sizeof( aMoveControlsHor[0] );
+        Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsHor );
         for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
             lcl_MoveControl( *ppMoveControls, nDeltaX, 0 );
     }
@@ -2788,7 +2788,7 @@ void SvtFileDialog::Resize()
             _pImp->_pEdFileName, _pImp->_pLbFileVersion, _pImp->_pLbTemplates, _pImp->_pLbImageTemplates,
             _pImp->GetFilterListControl(), _pImp->_pFtCurrentPath,
         };
-        sal_Int32 nSizeControls = sizeof( aSizeControls ) / sizeof( aSizeControls[0] );
+        sal_Int32 nSizeControls = SAL_N_ELEMENTS( aSizeControls );
         Control** ppSizeControls = aSizeControls;
         for ( sal_Int32 j=0; j<nSizeControls; ++j, ++ppSizeControls )
         {
diff --git a/fpicker/source/win32/filepicker/controlaccess.cxx b/fpicker/source/win32/filepicker/controlaccess.cxx
index d1eccbc..5239605 100644
--- a/fpicker/source/win32/filepicker/controlaccess.cxx
+++ b/fpicker/source/win32/filepicker/controlaccess.cxx
@@ -184,8 +184,7 @@ namespace // private
         stc2,       //  LISTBOX_FILTER_LABEL
         stc3        //  LISTBOX_FILE_NAME_LABEL
     };
-    const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS =
-        sizeof(WindowsFileOpenCtrlIds)/sizeof(WindowsFileOpenCtrlIds[0]);
+    const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = SAL_N_ELEMENTS(WindowsFileOpenCtrlIds);
 
 }; // end namespace 
 
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 9fa8942..35b51b4 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -684,7 +684,7 @@ void BackingWindow::layoutButton(
     long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() );
 
     nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on the safe side
-    if( nColumn >= 0 && nColumn < static_cast<int>(sizeof(mnColumnWidth)/sizeof(mnColumnWidth[0])) )
+    if( nColumn >= 0 && nColumn < static_cast<int>(SAL_N_ELEMENTS(mnColumnWidth)) )
     {
         if( nTextWidth > mnColumnWidth[nColumn] )
             mnColumnWidth[nColumn] = nTextWidth;
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx
index 5d3d2e8..cf5df76 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -240,7 +240,7 @@ void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu )
     if ( pResMgr->IsAvailable( aResId ))
     {
         ImageList aImageList( aResId );
-      for ( sal_uInt32 i=0; i < sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i )
+      for ( sal_uInt32 i=0; i < SAL_N_ELEMENTS(nConvertSlots); ++i )
         {
             // das entsprechende Image dran
             if ( m_bShowMenuImages )
@@ -291,7 +291,7 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve
     osl::ResettableMutexGuard aLock( m_aMutex );
         
     USHORT nMenuId = 0;    
-    for (sal_uInt32 i=0; i < sizeof(aCommands)/sizeof(aCommands[0]); ++i)
+    for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
     {
         if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] ))
         {
@@ -417,7 +417,7 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::
         fillPopupMenu( m_xPopupMenu );
         m_aURLToDispatchMap.free();
         
-        for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i)
+        for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
         {
             aTargetURL.Complete = rtl::OUString::createFromAscii( aCommands[i] );
             m_xURLTransformer->parseStrict( aTargetURL );
diff --git a/framework/source/xml/menudocumenthandler.cxx b/framework/source/xml/menudocumenthandler.cxx
index a5b20bd..4d1338c 100644
--- a/framework/source/xml/menudocumenthandler.cxx
+++ b/framework/source/xml/menudocumenthandler.cxx
@@ -140,7 +140,7 @@ MenuStyleItem MenuItemStyles[ ] = {
 };
 
 
-sal_Int32 nMenuStyleItemEntries = sizeof( MenuItemStyles ) / sizeof( MenuItemStyles[ 0 ] );
+sal_Int32 nMenuStyleItemEntries = SAL_N_ELEMENTS( MenuItemStyles );
 
 static void ExtractMenuParameters( const Sequence< PropertyValue > rProp,
                                    ::rtl::OUString&                       rCommandURL,
diff --git a/framework/source/xml/toolboxdocumenthandler.cxx b/framework/source/xml/toolboxdocumenthandler.cxx
index 6dca663..93f7e7e 100644
--- a/framework/source/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/xml/toolboxdocumenthandler.cxx
@@ -135,7 +135,7 @@ ToolboxStyleItem Styles[ ] = {
     { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
 };
 
-sal_Int32 nStyleItemEntries = sizeof( Styles ) / sizeof( Styles[ 0 ] );
+sal_Int32 nStyleItemEntries = SAL_N_ELEMENTS( Styles );
 
 struct ToolBarEntryProperty
 {
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index bac27d3..291018a 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -138,7 +138,7 @@ static sal_Unicode aWhiteSpaces[] =
     0xfffb    /* INTERLINEAR ANNOTATION TERMINATOR */
 };
 
-static int nWhiteSpaces = sizeof( aWhiteSpaces ) / sizeof( aWhiteSpaces[0] );
+static int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
 
 static bool lcl_IsWhiteSpace( sal_Unicode cChar )
 {
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index 6edcdad..86c2494 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -298,7 +298,7 @@ OUString LinguOptions::GetName( INT32 nWID )
 
     OUString aRes;
 
-    INT32 nLen = sizeof( aWID_Name ) / sizeof( aWID_Name[0] );
+    INT32 nLen = SAL_N_ELEMENTS( aWID_Name );
     if (0 <= nWID  &&  nWID < nLen
         && aWID_Name[ nWID ].nWID == nWID)
     {
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index e264f01..7dc3412 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -64,7 +64,7 @@ static const char *aCH[] =
     UPN_IS_USE_DICTIONARY_LIST,
 };
 
-static int nCHCount = sizeof(aCH) / sizeof(aCH[0]);
+static int nCHCount = SAL_N_ELEMENTS(aCH);
 
 
 PropertyChgHelper::PropertyChgHelper(
@@ -389,7 +389,7 @@ PropertyHelper_Spell::PropertyHelper_Spell(
         Reference< XPropertySet > &rxPropSet ) :
     PropertyChgHelper	( rxSource, rxPropSet, AE_SPELLCHECKER )
 {
-    AddPropNames( aSP, sizeof(aSP) / sizeof(aSP[0]) );
+    AddPropNames( aSP, SAL_N_ELEMENTS(aSP));
     SetDefaultValues();
     GetCurrentValues();
 
@@ -577,7 +577,7 @@ PropertyHelper_Hyphen::PropertyHelper_Hyphen(
         Reference< XPropertySet > &rxPropSet ) :
     PropertyChgHelper	( rxSource, rxPropSet, AE_HYPHENATOR )
 {
-    AddPropNames( aHP, sizeof(aHP) / sizeof(aHP[0]) );
+    AddPropNames( aHP, SAL_N_ELEMENTS(aHP));
     SetDefaultValues();
     GetCurrentValues();
 }
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 1c113a4..75124ad 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -836,7 +836,7 @@ static const sal_uInt32 the_aDigitZeroes [] =
 
 BOOL HasDigits( const OUString &rText )
 {
-    static const int nNumDigitZeroes = sizeof(the_aDigitZeroes) / sizeof(the_aDigitZeroes[0]);
+    static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes);
     const sal_Int32 nLen = rText.getLength();
 
     sal_Int32 i = 0;
diff --git a/linguistic/workben/sprophelp.cxx b/linguistic/workben/sprophelp.cxx
index 09a4c6a..870e438 100644
--- a/linguistic/workben/sprophelp.cxx
+++ b/linguistic/workben/sprophelp.cxx
@@ -193,7 +193,7 @@ static const char *aSP[] =
 PropertyHelper_Spell::PropertyHelper_Spell(
         const Reference< XInterface > & rxSource,
         Reference< XPropertySet > &rxPropSet ) :
-    PropertyChgHelper	( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) )
+    PropertyChgHelper	( rxSource, rxPropSet, aSP, SAL_N_ELEMENTS(aSP))
 {
     SetDefault();
     INT32 nLen = GetPropNames().getLength();
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index d75f146..46e0e9e 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -416,7 +416,7 @@ EventInfoHash& getEventTransInfo()
     {
         rtl::OUString sEventInfo = MAP_CHAR_LEN("");
         TranslatePropMap* pTransProp = aTranslatePropMap_Impl;
-        int nCount = sizeof(aTranslatePropMap_Impl) / sizeof(aTranslatePropMap_Impl[0]);
+        int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl);
 
         int i = 0;
         while (i < nCount)
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index 919a67c..0377089 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -251,7 +251,7 @@ static HMENU createSystrayMenu( )
     OUString aEmpty;
 
     // insert the menu entries for launching the applications
-    for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i )
+    for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i )
     {
         if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) )
             // the complete application is not even installed
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index ceb09ea..aacad9f 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -144,7 +144,7 @@ void SfxAlienWarningDialog::InitSize()
         &m_aSaveODFBtn, &m_aKeepCurrentBtn, &m_aMoreInfoBtn, &m_aOptionLine, &m_aWarningOnBox
     };
     Window** pCurrent = pWins;
-    for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+    for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
     {
         Point aNewPos = (*pCurrent)->GetPosPixel();
         aNewPos.Y() -= nDelta;
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index fe1bf6d..f77a653 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -44,8 +44,6 @@
 static USHORT   aDPIArray[] = { 72, 96, 150, 200, 300, 600 };
 static BOOL     bOutputForPrinter = TRUE;
 
-#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ]))
-
 SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) :
     SfxTabPage( pParent, SfxResId( TP_COMMONPRINTOPTIONS ), rSet ),
 
@@ -233,7 +231,7 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
         aReduceBitmapsResolutionLB.SelectEntryPos( 0 );
     else
     {
-        for( long i = ( DPI_COUNT - 1 ); i >= 0; i-- )
+        for( long i = ( SAL_N_ELEMENTS(aDPIArray) - 1 ); i >= 0; i-- )
         {
             if( nDPI >= aDPIArray[ i ] )
             {
@@ -362,7 +360,7 @@ void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOpt
     pCurrentOptions->SetReducedBitmapMode( aReduceBitmapsOptimalRB.IsChecked() ? PRINTER_BITMAP_OPTIMAL :
                                            ( aReduceBitmapsNormalRB.IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) );
     pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ Min( (USHORT) aReduceBitmapsResolutionLB.GetSelectEntryPos(),
-                                                            (USHORT)( sizeof( aDPIArray ) / sizeof( aDPIArray[ 0 ] ) - 1 ) ) ] );
+                                                            (USHORT)( SAL_N_ELEMENTS( aDPIArray ) - 1 ) ) ] );
     pCurrentOptions->SetReducedBitmapIncludesTransparency( aReduceBitmapsTransparencyCB.IsChecked() );
     pCurrentOptions->SetConvertToGreyscales( aConvertToGreyscalesCB.IsChecked() );
 }
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index b379d60..971b29f 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -459,7 +459,7 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
     };
 
     ::comphelper::NamedValueCollection aViewArgs;
-    for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i )
+    for ( size_t i=0; i < SAL_N_ELEMENTS( pKnownViewArgs ); ++i )
     {
         if ( io_rDescriptor.has( pKnownViewArgs[i] ) )
         {
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
index 2258f5f..bccae4d 100644
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -819,8 +819,7 @@ ConfigurationValue const ConfigurationValues[] =
 #endif // ENABLE_LOCKDOWN
 };
 
-std::size_t const nConfigurationValues =
-    sizeof ConfigurationValues / sizeof ConfigurationValues[0];
+std::size_t const nConfigurationValues = SAL_N_ELEMENTS(ConfigurationValues);
 
 css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
 {
diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
index 5d5bc82..7bfdb4a 100644
--- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
+++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
@@ -53,7 +53,7 @@ namespace /* private */
         {{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT},VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"}
     };
     
-    size_t ColumnInfoTableSize = sizeof(ColumnInfoTable)/sizeof(ColumnInfoTable[0]);
+    size_t ColumnInfoTableSize = SAL_N_ELEMENTS(ColumnInfoTable);
 }
 
 //----------------------------
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index 8c7b21b..7daa879 100644
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -68,7 +68,7 @@ PROPERTYMAP g_rgPROPERTYMAP[] =
     { PKEY_Comment,        L"OpenOffice.org",          L"Comments" },
 };
 
-size_t gPropertyMapTableSize = sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]);
+size_t gPropertyMapTableSize = SAL_N_ELEMENTS(g_rgPROPERTYMAP);
 
 //----------------------------
 //
diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx
index 714cde7..d302ef4 100644
--- a/shell/source/win32/shlxthandler/util/fileextensions.cxx
+++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx
@@ -68,7 +68,7 @@ FileExtensionEntry OOFileExtensionTable[] = {
     };
      
 
-size_t OOFileExtensionTableSize = sizeof(OOFileExtensionTable)/sizeof(OOFileExtensionTable[0]);
+size_t OOFileExtensionTableSize = SAL_N_ELEMENTS(OOFileExtensionTable);
 
 //---------------------------------
 /** Return the extension of a file
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx
index 55059cf..aa1ca65 100644
--- a/shell/source/win32/simplemail/senddoc.cxx
+++ b/shell/source/win32/simplemail/senddoc.cxx
@@ -187,7 +187,7 @@ char* KnownParameter[] =
     "--mapi-logon-ui"     
 };
 
-const size_t nKnownParameter = (sizeof(KnownParameter)/sizeof(KnownParameter[0]));
+const size_t nKnownParameter = (SAL_N_ELEMENTS(KnownParameter));
 
 /** @internal */
 bool isKnownParameter(const char* aParameterName)
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 7240f92..589b72b 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -1863,7 +1863,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
                 }
 
                 // loop through all the other windows and adjust their size
-                for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+                for ( ; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
                 {
                     Size aSize = (*pCurrent)->GetSizePixel();
                     aSize.Width() -= nDelta;
@@ -1934,7 +1934,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
                 &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT
             };
             Window** pCurrent = pWins;
-            for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+            for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
             {
                 Point aPos = (*pCurrent)->GetPosPixel();
                 aPos.Y() -= nDelta;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 6117e34..af487e0 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -895,7 +895,7 @@ void SvxSearchDialog::CalculateDelta_Impl()
         if ( nOffset > 0 )
         {
             long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height();
-            for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+            for ( i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
             {
                 if ( ( bCalcApp && i < nCalcCtrlCount )
                     || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() )
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index d171129..91929d9 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1696,7 +1696,7 @@ void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol)
     Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
     Property aPropDesc;
     const ::rtl::OUString* pProps = aPropsListenedTo;
-    const ::rtl::OUString* pPropsEnd = pProps + sizeof( aPropsListenedTo ) / sizeof( aPropsListenedTo[ 0 ] );
+    const ::rtl::OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo );
     for (; pProps != pPropsEnd; ++pProps)
     {
         if ( xInfo->hasPropertyByName( *pProps ) )
@@ -1719,7 +1719,7 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol)
     };
 
     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);
 }
@@ -2765,7 +2765,7 @@ Sequence<sal_uInt16>& FmXGridPeer::getSupportedGridSlots()
             DbGridControl::NavigationBar::RECORD_NEW,
             SID_FM_RECORD_UNDO
         };
-        aSupported.realloc(sizeof(nSupported)/sizeof(nSupported[0]));
+        aSupported.realloc(SAL_N_ELEMENTS(nSupported));
         sal_uInt16* pSupported = aSupported.getArray();
         for (sal_uInt16 i=0; i<aSupported.getLength(); ++i, ++pSupported)
             *pSupported = nSupported[i];
@@ -2787,7 +2787,7 @@ Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs()
             FMURL_RECORD_MOVETONEW,
             FMURL_RECORD_UNDO
         };
-        aSupported.realloc(sizeof(sSupported)/sizeof(sSupported[0]));
+        aSupported.realloc(SAL_N_ELEMENTS(sSupported));
         ::com::sun::star::util::URL* pSupported = aSupported.getArray();
         sal_uInt16 i;
 
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index fe51701..ca7fc9e 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -736,7 +736,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
 
     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() );
@@ -745,7 +745,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
 
     if ( ( _eInitWhat & InitFont ) != 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;
@@ -777,7 +777,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
         sal_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] )
             {
@@ -798,7 +798,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
         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 94a0259..f4bec55 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -778,7 +778,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
         case STATE_CHANGE_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;
@@ -792,7 +792,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(aFont);
diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx
index ca76ca7..becfabd 100644
--- a/svx/source/form/ParseContext.cxx
+++ b/svx/source/form/ParseContext.cxx
@@ -171,7 +171,7 @@ IParseContext::InternationalKeyCode OSystemParseContext::getIntlKeyCode(const ::
         KEY_COLLECT, KEY_FUSION, KEY_INTERSECTION
     };
 
-    sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0];
+    sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID );
     for (sal_uInt32 i = 0; i < nCount; i++)
     {
         ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 6091026..7357840 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -2925,7 +2925,7 @@ namespace svxform
                 &m_aCalculateBtn
             };
             Window** pCurrent = pWinsForHide;
-            for ( ; i < sizeof( pWinsForHide ) / sizeof( pWinsForHide[ 0 ] ); ++i, ++pCurrent )
+            for ( ; i < SAL_N_ELEMENTS( pWinsForHide ); ++i, ++pCurrent )
                 (*pCurrent)->Hide();
 
             Window* pWinsForMove[] =
@@ -2933,7 +2933,7 @@ namespace svxform
                 &m_aButtonsFL, &m_aOKBtn, &m_aEscBtn, &m_aHelpBtn
             };
             pCurrent = pWinsForMove;
-            for ( i = 0; i < sizeof( pWinsForMove ) / sizeof( pWinsForMove[ 0 ] ); ++i, ++pCurrent )
+            for ( i = 0; i < SAL_N_ELEMENTS( pWinsForMove ); ++i, ++pCurrent )
             {
                 Point aNewPos = (*pCurrent)->GetPosPixel();
                 aNewPos.Y() -= nDelta;
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
index bcc3d2b..6afe1df 100644
--- a/svx/source/form/fmPropBrw.cxx
+++ b/svx/source/form/fmPropBrw.cxx
@@ -307,7 +307,7 @@ FmPropBrw::~FmPropBrw()
                                              , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) )
                                              , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) )
                                              , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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] );
         }
     }
@@ -594,7 +594,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell )
         ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ), makeAny( xControlMap ) )
     };
     m_xInspectorContext.set(
-        ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
+        ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ),
         xOwnContext ) );
 
     bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );
diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx
index 2dce4f6..d83ff0f 100644
--- a/svx/source/form/fmdmod.cxx
+++ b/svx/source/form/fmdmod.cxx
@@ -87,7 +87,7 @@ using namespace ::svxform;
         FM_SUN_COMPONENT_IMAGECONTROL
     };
 
-    static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
+    static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
 
     ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
     ::rtl::OUString* pStrings = aSeq.getArray();
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index ecd65e7..e60eba6 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -230,7 +230,7 @@ sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView,
                     INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3,
                     INET_PROT_VIM, INET_PROT_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 ad9230a..c1c6de8 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1139,7 +1139,7 @@ PopupMenu* FmXFormShell::GetConversionMenu()
     PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU ));
 
     ImageList aImageList( SVX_RES( bIsHiContrastMode ? RID_SVXIMGLIST_FMEXPL_HC : 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]));
@@ -1152,7 +1152,7 @@ PopupMenu* FmXFormShell::GetConversionMenu()
 bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen at sun.com", "FmXFormShell::isControlConversionSlot" );
-    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;
@@ -1190,7 +1190,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)
         {
@@ -1406,10 +1406,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;
 
@@ -2168,7 +2168,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], sal_False);
 
     return true;
@@ -2211,7 +2211,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], sal_False );
 }
 
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index bc11399..491b8bb 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -596,8 +596,8 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
             FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME,
             FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE
         };
-        sal_Int32 nDefaultValueProps = sizeof(pDefaultValueProperties)/sizeof(pDefaultValueProperties[0]);
-        OSL_ENSURE(sizeof(aValueProperties)/sizeof(aValueProperties[0]) == nDefaultValueProps,
+        sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties);
+        OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps,
             "FmXUndoEnvironment::propertyChange: inconsistence!");
         for (sal_Int32 i=0; i<nDefaultValueProps; ++i)
         {
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index 17a3253..44acc7e 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -121,7 +121,7 @@ namespace svx
                         { FMURL_FORM_APPLY_FILTER,    SID_FM_FORM_FILTERED,       FormFeature::ToggleApplyFilter },
                         { 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] );
                 }
             };
@@ -534,7 +534,7 @@ namespace svx
             SID_FM_FILTER_START,
             SID_FM_VIEW_AS_GRID
         };
-        sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
+        sal_Int32 nFeatureCount = SAL_N_ELEMENTS( pSupportedFeatures );
         aSupportedFeatures.resize( nFeatureCount );
         ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );
 
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index afd7e6e..07ffbaf 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -879,7 +879,7 @@ namespace {
               { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"),	E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG },
               { 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[rtl::OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id;
           bInited = true;
         }
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index ba31991..e54591d 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -551,7 +551,7 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con
     {
         const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US );
 
-        for( long i = 0, nCount = sizeof( aMapper ) / sizeof( aMapper[ 0 ] ); ( i < nCount ) && !aMimeType.Len(); i++ )
+        for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ )
             if( aExt == aMapper[ i ].pExt )
                 aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US );
     }
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
index 6cf2ddc..666ceb8 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -620,7 +620,7 @@ namespace ucb { namespace ucp { namespace ext
                 PropertyAttribute::BOUND | PropertyAttribute::READONLY
             )
         };
-        return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) );
+        return Sequence< Property >( aProperties, SAL_N_ELEMENTS( aProperties ));
     }
 
     //------------------------------------------------------------------------------------------------------------------
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index cc623d4..16ccdcf 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -1255,7 +1255,7 @@ uno::Sequence< beans::Property > Content::getProperties(
             beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
     };
 
-    const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]);
+    const int nProps = SAL_N_ELEMENTS(aGenericProperties);
     return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
 }
 
@@ -1297,7 +1297,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc
           -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
     };
 
-    const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]);
+    const int nProps = SAL_N_ELEMENTS(aCommandInfoTable);
     return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
 }
 
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index 5ca193b..1009e24 100644
--- a/ucb/source/ucp/gvfs/gvfs_content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -1355,7 +1355,7 @@ uno::Sequence< beans::Property > Content::getProperties(
                  beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
     };
 
-    const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]);
+    const int nProps = SAL_N_ELEMENTS(aGenericProperties);
 
     return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
 
@@ -1399,8 +1399,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
           -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
     };
 
-    const int nProps
-        = sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] );
+    const int nProps = SAL_N_ELEMENTS( aCommandInfoTable );
     return uno::Sequence< ucb::CommandInfo >(
         aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 );
 }
diff --git a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
index 9699ec5..91410b3 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
@@ -78,10 +78,10 @@ using namespace hierarchy_ucp;
 //=========================================================================
 
 #define MAKEPROPSEQUENCE( a ) \
-    uno::Sequence< beans::Property >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) )
 
 #define MAKECMDSEQUENCE( a ) \
-    uno::Sequence< ucb::CommandInfo >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
 
 //=========================================================================
 //
diff --git a/ucb/source/ucp/package/pkgcontentcaps.cxx b/ucb/source/ucp/package/pkgcontentcaps.cxx
index 01e1ef7..28bd56d 100644
--- a/ucb/source/ucp/package/pkgcontentcaps.cxx
+++ b/ucb/source/ucp/package/pkgcontentcaps.cxx
@@ -79,10 +79,10 @@ using namespace package_ucp;
 //=========================================================================
 
 #define MAKEPROPSEQUENCE( a ) \
-    uno::Sequence< beans::Property >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) )
 
 #define MAKECMDSEQUENCE( a ) \
-    uno::Sequence< ucb::CommandInfo >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
 
 //=========================================================================
 //
diff --git a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
index d8674eb..d8aa7e1 100644
--- a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
@@ -89,10 +89,10 @@ using namespace tdoc_ucp;
 //=========================================================================
 
 #define MAKEPROPSEQUENCE( a ) \
-    uno::Sequence< beans::Property >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< beans::Property >( a, SAL_N_ELEMTS( a ) )
 
 #define MAKECMDSEQUENCE( a ) \
-    uno::Sequence< ucb::CommandInfo >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
+    uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
 
 //=========================================================================
 //
diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx
index 52155d5..0b346df 100644
--- a/uui/source/masterpasscrtdlg.cxx
+++ b/uui/source/masterpasscrtdlg.cxx
@@ -126,7 +126,7 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog
     aFTMasterPasswordWarning.SetPosSizePixel( aFTMasterPasswordWarning.GetPosPixel(), aNewWarningSize );
 
     Window* pControls[] = { &aFL, &aOKBtn, &aCancelBtn, &aHelpBtn };
-    const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
+    const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
     for ( int i = 0; i < nCCount; ++i )
     {
         Point aNewPos =(*pControls[i]).GetPosPixel();
@@ -149,7 +149,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight()
                             &aFTMasterPasswordRepeat, &aEDMasterPasswordRepeat, &aFTCautionText,
                             &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
         Window** pWindow = 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, ++pWindow )
         {
             Point aNewPos = (*pWindow)->GetPosPixel();
@@ -168,7 +168,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight()
         nDelta += nTemp;
         Window* pWins[] = { &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
         Window** pWindow = 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, ++pWindow )
         {
             Point aNewPos = (*pWindow)->GetPosPixel();
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
index 53b05dc..63f3039 100644
--- a/uui/source/passcrtdlg.cxx
+++ b/uui/source/passcrtdlg.cxx
@@ -115,7 +115,7 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr,
     aFTWarning.SetPosSizePixel( aFTWarning.GetPosPixel(), aNewWarningSize );
 
     Window* pControls[] = { &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
-    const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
+    const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
     for ( int i = 0; i < nCCount; ++i )
     {
         Point aNewPos =(*pControls[i]).GetPosPixel();
diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx
index 940ac37..243ebbf 100644
--- a/uui/source/passworddlg.cxx
+++ b/uui/source/passworddlg.cxx
@@ -103,7 +103,7 @@ PasswordDialog::PasswordDialog(
     aFTPassword.SetPosSizePixel( aFTPassword.GetPosPixel(), aNewLabelSize );
 
     Window* pControls[] = { &aEDPassword, &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
-    const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
+    const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
     for ( int i = 0; i < nCCount; ++i )
     {
         Point aNewPos =(*pControls[i]).GetPosPixel();
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 218c361..eb12698 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -225,7 +225,7 @@ void MacroWarning::InitControls()
             &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
         };
         Window** pCurrent = pWins;
-        for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+        for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
         {
             Point aNewPos = (*pCurrent)->GetPosPixel();
             aNewPos.Y() -= nDelta;
@@ -323,7 +323,7 @@ void MacroWarning::FitControls()
         &maDescr2FI, &maAlwaysTrustCB, &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
     };
     Window** pCurrent = pWins;
-    for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+    for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
     {
         Point aNewPos = (*pCurrent)->GetPosPixel();
         aNewPos.Y() -= nDelta;
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index ba5b3c4..47afa13 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -352,7 +352,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
         // handle the arguments
         const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
 
-        int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] );
+        int nArg = SAL_N_ELEMENTS( aArgsPtrArray );
         uno::Sequence< uno::Any > aArgs( nArg );
 
         const uno::Any** pArg = aArgsPtrArray;
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index b9415fa..0515d1a 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -60,7 +60,7 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s
     };
     // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
     // some strange behavior
-    mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
+    mxContext = ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), NULL );
 }
 
 VbaGlobalsBase::~VbaGlobalsBase()
@@ -137,7 +137,7 @@ VbaGlobalsBase::getAvailableServiceNames(  ) throw (uno::RuntimeException)
     // common
         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ),
       };
-    static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
+    static uno::Sequence< rtl::OUString > serviceNames( names, SAL_N_ELEMENTS( names ) );
     return serviceNames;
 }
 
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 97f63c1..086476f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3157,7 +3157,7 @@ namespace xmloff { namespace token {
 #endif
         DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
         DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" );
-        DBG_ASSERT(sal_uInt16(eToken) < sizeof(aTokenList)/sizeof(aTokenList[0]),"Illegal position!");
+        DBG_ASSERT(sal_uInt16(eToken) < SAL_N_ELEMENTS(aTokenList),"Illegal position!");
 
         XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
         if (!pToken->pOUString)
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 9a204ae..98e75a9 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -500,11 +500,10 @@ namespace xmloff
             {
                 PROPERTY_LABEL, PROPERTY_TITLE
             };
-            OSL_ENSURE(	sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) ==
-                        sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
+            OSL_ENSURE(	SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds),
                         "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
 
-            for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
+            for (i=0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i)
                 if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
                 {
                     exportStringPropertyAttribute(
@@ -535,13 +534,13 @@ namespace xmloff
                 BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
             };
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
-            sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
-            sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+            sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
                 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
         #endif
-            for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
+            for (i=0; i < SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i)
                 if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
                 {
                     exportBooleanPropertyAttribute(
@@ -578,13 +577,13 @@ namespace xmloff
                 exportedProperty(PROPERTY_MAXTEXTLENGTH);
 
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
-            sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
-            sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames);
+            sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults);
             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
                 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
         #endif
-            for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
+            for (i=0; i < SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i)
                 if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
                 {
                     exportInt16PropertyAttribute(
@@ -933,9 +932,9 @@ namespace xmloff
                 &PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE,
                 &PROPERTY_TOGGLE, &PROPERTY_FOCUS_ON_CLICK
             };
-            sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
             OSL_ENSURE((nIdCount == nNameCount),
                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
         #endif
@@ -975,12 +974,12 @@ namespace xmloff
                 10
             };
 
-            sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] );
+            sal_Int32 nIdCount = SAL_N_ELEMENTS( nIntegerPropertyAttributeIds );
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] );
+            sal_Int32 nNameCount = SAL_N_ELEMENTS( pIntegerPropertyNames );
             OSL_ENSURE( ( nIdCount == nNameCount ),
                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
-            sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] );
+            sal_Int32 nDefaultCount = SAL_N_ELEMENTS( nIntegerPropertyAttrDefaults );
             OSL_ENSURE( ( nIdCount == nDefaultCount ),
                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
         #endif
@@ -1119,9 +1118,9 @@ namespace xmloff
                 &PROPERTY_GROUP_NAME
             };
 
-            sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
+            sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds );
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
+            sal_Int32 nNameCount = SAL_N_ELEMENTS( pStringPropertyNames );
             OSL_ENSURE( ( nIdCount == nNameCount ),
                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
         #endif
@@ -2058,9 +2057,9 @@ namespace xmloff
             {
                 PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER
             };
-            sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds);
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames);
             OSL_ENSURE((nIdCount == nNameCount),
                 "OFormExport::exportAttributes: somebody tampered with the maps (1)!");
         #endif
@@ -2107,10 +2106,10 @@ namespace xmloff
             {
                 BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
             };
-            sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds);
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
-            sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+            sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
                 "OFormExport::exportAttributes: somebody tampered with the maps (2)!");
         #endif
@@ -2146,12 +2145,12 @@ namespace xmloff
             {
                 sal_False, sal_False, sal_False, sal_False, sal_True
             };
-            sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
+            sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds);
         #if OSL_DEBUG_LEVEL > 0
-            sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]);
-            sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]);
-            sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]);
-            sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]);
+            sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames);
+            sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults);
+            sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags);
+            sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps);
             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
                 "OFormExport::exportAttributes: somebody tampered with the maps (3)!");
         #endif


More information about the Libreoffice-commits mailing list