[PATCH] more Sal n elements

Kenneth Venken kenneth.venken at gmail.com
Thu Dec 2 16:41:20 PST 2010


---
 chart2/source/tools/ConfigColorScheme.cxx   |    3 ++-
 sc/source/core/data/global.cxx              |    4 ++--
 sc/source/core/tool/interpr2.cxx            |    2 +-
 sc/source/core/tool/parclass.cxx            |    3 ++-
 sc/source/filter/excel/xiescher.cxx         |    3 ++-
 sc/source/filter/excel/xistyle.cxx          |    3 ++-
 sc/source/filter/excel/xlchart.cxx          |   11 ++++++-----
 sc/source/filter/excel/xlpage.cxx           |    3 ++-
 sc/source/filter/excel/xlstyle.cxx          |    9 +++++----
 sc/source/filter/excel/xltools.cxx          |   11 ++++++-----
 sc/source/filter/inc/ftools.hxx             |    5 ++---
 sc/source/ui/dbgui/csvgrid.cxx              |    3 ++-
 sc/source/ui/vba/vbainterior.cxx            |    4 ++--
 sc/source/ui/view/gridwin.cxx               |    3 ++-
 scaddins/source/analysis/analysis.cxx       |    3 ++-
 scaddins/source/analysis/analysishelper.cxx |    5 ++---
 scaddins/source/datefunc/datefunc.cxx       |    6 ++----
 17 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx
index d7f630d..bd10a5c 100644
--- a/chart2/source/tools/ConfigColorScheme.cxx
+++ b/chart2/source/tools/ConfigColorScheme.cxx
@@ -34,6 +34,7 @@
 #include "macros.hxx"
 
 #include <unotools/configitem.hxx>
+#include <sal/macros.h>
 
 #include <set>
 
@@ -175,7 +176,7 @@ void ConfigColorScheme::retrieveConfigColors()
         0xff00ff, 0x00ffff, 0xffff00
     };
 
-    static const sal_Int32 nMaxDefaultColors = sizeof( nDefaultColors ) / sizeof( sal_Int32 );
+    static const sal_Int32 nMaxDefaultColors = SAL_N_ELEMENTS( nDefaultColors );
     return nDefaultColors[ nIndex % nMaxDefaultColors ];
 }
 
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 4474a59..93550a9 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -50,6 +50,7 @@
 #include <svl/zformat.hxx>
 #include <vcl/image.hxx>
 #include <vcl/virdev.hxx>
+#include <sal/macros.h>
 #include <tools/rcid.h>
 #include <unotools/charclass.hxx>
 #include <stdlib.h>
@@ -1219,11 +1220,10 @@ ScFunctionList::ScFunctionList() :
         RID_SC_FUNCTION_DESCRIPTIONS1,
         RID_SC_FUNCTION_DESCRIPTIONS2
     };
-    const USHORT nBlocks = sizeof(nDescBlock) / sizeof(USHORT);
 
     aFunctionList.Clear();
 
-    for ( USHORT k = 0; k < nBlocks; k++ )
+    for ( USHORT k = 0; k < SAL_N_ELEMENTS(nDescBlock); k++ )
     {
         ::std::auto_ptr<ScResourcePublisher> pBlock( new ScResourcePublisher( ScResId( nDescBlock[k] ) ) );
         // Browse for all possible OpCodes. This is not the fastest method, but
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 599d2ba..eabcc29 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2235,7 +2235,7 @@ void ScInterpreter::ScBase()
             'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
             0
         };
-        static const int nDigits = (sizeof(pDigits)/sizeof(sal_Unicode))-1;
+        static const int nDigits = SAL_N_ELEMENTS(pDigits)-1;
         xub_StrLen nMinLen;
         if ( nParamCount == 3 )
         {
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index f7b414d..7248ba7 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -38,6 +38,7 @@
 #include "funcdesc.hxx"
 #include <unotools/charclass.hxx>
 #include <tools/debug.hxx>
+#include <sal/macros.h>
 #include <string.h>
 
 #if OSL_DEBUG_LEVEL > 1
@@ -214,7 +215,7 @@ void ScParameterClassification::Init()
     memset( pData, 0, sizeof(RunData) * (SC_OPCODE_LAST_OPCODE_ID + 1));
 
     // init from specified static data above
-    for ( size_t i=0; i < sizeof(pRawData) / sizeof(RawData); ++i )
+    for ( size_t i=0; i < SAL_N_ELEMENTS(pRawData); ++i )
     {
         const RawData* pRaw = &pRawData[i];
         if ( pRaw->eOp > SC_OPCODE_LAST_OPCODE_ID )
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 8295128..99f7d12 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -84,6 +84,7 @@
 #include <editeng/eeitem.hxx>
 #include <editeng/colritem.hxx>
 #include <svx/xflclit.hxx>
+#include <sal/macros.h>
 #include <editeng/adjitem.hxx>
 #include <svx/xlineit.hxx>
 #include <svx/xlinjoit.hxx>
@@ -657,7 +658,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
                 { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 },
                 { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 }
             };
-            const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_TABLE_SIZE( sppnPatterns ) ) ];
+            const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, SAL_N_ELEMENTS( sppnPatterns ) ) ];
             // create 2-colored 8x8 DIB
             SvMemoryStream aMemStrm;
             aMemStrm << sal_uInt32( 12 ) << sal_Int16( 8 ) << sal_Int16( 8 ) << sal_uInt16( 1 ) << sal_uInt16( 1 );
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index f15a6dd..62541f9 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -53,6 +53,7 @@
 #include <editeng/eeitem.hxx>
 #include <editeng/flstitem.hxx>
 #include <editeng/justifyitem.hxx>
+#include <sal/macros.h>
 #include "document.hxx"
 #include "docpool.hxx"
 #include "attrib.hxx"
@@ -904,7 +905,7 @@ bool lclConvertBorderLine( SvxBorderLine& rLine, const XclImpPalette& rPalette,
 
     if( nXclLine == EXC_LINE_NONE )
         return false;
-    if( nXclLine >= STATIC_TABLE_SIZE( ppnLineParam ) )
+    if( nXclLine >= SAL_N_ELEMENTS( ppnLineParam ) )
         nXclLine = EXC_LINE_THIN;
 
     rLine.SetColor( rPalette.GetColor( nXclColor ) );
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index a4279c2..fe26ad5 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
 #include <com/sun/star/chart2/Symbol.hpp>
 
+#include <sal/macros.h>
 #include <rtl/math.hxx>
 #include <svl/itemset.hxx>
 #include <svx/xfillit0.hxx>
@@ -405,7 +406,7 @@ sal_uInt16 XclChartHelper::GetSeriesLineAutoColorIdx( sal_uInt16 nFormatIdx )
         17, 18, 19, 20, 21, 22, 23, 24,
         25, 26, 27, 28, 29, 30, 31, 63
     };
-    return spnLineColors[ nFormatIdx % STATIC_TABLE_SIZE( spnLineColors ) ];
+    return spnLineColors[ nFormatIdx % SAL_N_ELEMENTS( spnLineColors ) ];
 }
 
 sal_uInt16 XclChartHelper::GetSeriesFillAutoColorIdx( sal_uInt16 nFormatIdx )
@@ -420,13 +421,13 @@ sal_uInt16 XclChartHelper::GetSeriesFillAutoColorIdx( sal_uInt16 nFormatIdx )
          8,  9, 10, 11, 12, 13, 14, 15,
         16, 17, 18, 19, 20, 21, 22, 23
     };
-    return spnFillColors[ nFormatIdx % STATIC_TABLE_SIZE( spnFillColors ) ];
+    return spnFillColors[ nFormatIdx % SAL_N_ELEMENTS( spnFillColors ) ];
 }
 
 sal_uInt8 XclChartHelper::GetSeriesFillAutoTransp( sal_uInt16 nFormatIdx )
 {
     static const sal_uInt8 spnTrans[] = { 0x00, 0x40, 0x20, 0x60, 0x70 };
-    return spnTrans[ (nFormatIdx / 56) % STATIC_TABLE_SIZE( spnTrans ) ];
+    return spnTrans[ (nFormatIdx / 56) % SAL_N_ELEMENTS( spnTrans ) ];
 }
 
 sal_uInt16 XclChartHelper::GetAutoMarkerType( sal_uInt16 nFormatIdx )
@@ -435,14 +436,14 @@ sal_uInt16 XclChartHelper::GetAutoMarkerType( sal_uInt16 nFormatIdx )
         EXC_CHMARKERFORMAT_DIAMOND, EXC_CHMARKERFORMAT_SQUARE, EXC_CHMARKERFORMAT_TRIANGLE,
         EXC_CHMARKERFORMAT_CROSS, EXC_CHMARKERFORMAT_STAR, EXC_CHMARKERFORMAT_CIRCLE,
         EXC_CHMARKERFORMAT_PLUS, EXC_CHMARKERFORMAT_DOWJ, EXC_CHMARKERFORMAT_STDDEV };
-    return spnSymbols[ nFormatIdx % STATIC_TABLE_SIZE( spnSymbols ) ];
+    return spnSymbols[ nFormatIdx % SAL_N_ELEMENTS( spnSymbols ) ];
 }
 
 bool XclChartHelper::HasMarkerFillColor( sal_uInt16 nMarkerType )
 {
     static const bool spbFilled[] = {
         false, true, true, true, false, false, false, false, true, false };
-    return (nMarkerType < STATIC_TABLE_SIZE( spbFilled )) && spbFilled[ nMarkerType ];
+    return (nMarkerType < SAL_N_ELEMENTS( spbFilled )) && spbFilled[ nMarkerType ];
 }
 
 OUString XclChartHelper::GetErrorBarValuesRole( sal_uInt8 nBarType )
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index 6a68867..9cf52de 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -33,6 +33,7 @@
 #include <editeng/svxenum.hxx>
 #include <editeng/paperinf.hxx>
 #include <vcl/svapp.hxx>
+#include <sal/macros.h>
 #include "scitems.hxx"
 #include <editeng/brshitem.hxx>
 #include "global.hxx"
@@ -209,7 +210,7 @@ void XclPageData::SetDefaults()
 Size XclPageData::GetScPaperSize() const
 {
     const XclPaperSize* pEntry = pPaperSizeTable;
-    if( mnPaperSize < STATIC_TABLE_SIZE( pPaperSizeTable ) )
+    if( mnPaperSize < SAL_N_ELEMENTS( pPaperSizeTable ) )
         pEntry += mnPaperSize;
 
     Size aSize;
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index e144c0b..6033958 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <vcl/svapp.hxx>
 #include <vcl/font.hxx>
+#include <sal/macros.h>
 #include <rtl/tencinfo.h>
 #include <toolkit/unohlp.hxx>
 #include <editeng/svxfont.hxx>
@@ -112,20 +113,20 @@ XclDefaultPalette::XclDefaultPalette( const XclRoot& rRoot ) :
     {
         case EXC_BIFF2:
             mpnColorTable = spnDefColorTable2;
-            mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable2 );
+            mnTableSize = SAL_N_ELEMENTS( spnDefColorTable2 );
         break;
         case EXC_BIFF3:
         case EXC_BIFF4:
             mpnColorTable = spnDefColorTable3;
-            mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable3 );
+            mnTableSize = SAL_N_ELEMENTS( spnDefColorTable3 );
         break;
         case EXC_BIFF5:
             mpnColorTable = spnDefColorTable5;
-            mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable5 );
+            mnTableSize = SAL_N_ELEMENTS( spnDefColorTable5 );
         break;
         case EXC_BIFF8:
             mpnColorTable = spnDefColorTable8;
-            mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable8 );
+            mnTableSize = SAL_N_ELEMENTS( spnDefColorTable8 );
         break;
         default:
             DBG_ERROR_BIFF();
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index 36505c8..eb262bd 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -34,6 +34,7 @@
 #include <sal/mathconf.h>
 #include <unotools/fontcvt.hxx>
 #include <sfx2/objsh.hxx>
+#include <sal/macros.h>
 #include <editeng/editstat.hxx>
 #include <filter/msfilter/msvbahelper.hxx>
 #include "xestream.hxx"
@@ -358,7 +359,7 @@ Color XclTools::GetPatternColor( const Color& rPattColor, const Color& rBackColo
         0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48,     // 08 - 15
         0x50, 0x70, 0x78                                    // 16 - 18
     };
-    return (nXclPattern < STATIC_TABLE_SIZE( pnRatioTable )) ?
+    return (nXclPattern < SAL_N_ELEMENTS( pnRatioTable )) ?
         ScfTools::GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor;
 }
 
@@ -488,10 +489,10 @@ static const sal_Char* const ppcDefNames[] =
 
 String XclTools::GetXclBuiltInDefName( sal_Unicode cBuiltIn )
 {
-    DBG_ASSERT( STATIC_TABLE_SIZE( ppcDefNames ) == EXC_BUILTIN_UNKNOWN,
+    DBG_ASSERT( SAL_N_ELEMENTS( ppcDefNames ) == EXC_BUILTIN_UNKNOWN,
         "XclTools::GetXclBuiltInDefName - built-in defined name list modified" );
     String aDefName;
-    if( cBuiltIn < STATIC_TABLE_SIZE( ppcDefNames ) )
+    if( cBuiltIn < SAL_N_ELEMENTS( ppcDefNames ) )
         aDefName.AssignAscii( ppcDefNames[ cBuiltIn ] );
     else
         aDefName = String::CreateFromInt32( cBuiltIn );
@@ -555,7 +556,7 @@ String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, s
     else
     {
         aStyleName = maStyleNamePrefix1;
-        if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) )
+        if( nStyleId < SAL_N_ELEMENTS( ppcStyleNames ) )
             aStyleName.AppendAscii( ppcStyleNames[ nStyleId ] );
         else if( rName.Len() > 0 )
             aStyleName.Append( rName );
@@ -595,7 +596,7 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI
     if( nPrefixLen > 0 )
     {
         String aShortName;
-        for( sal_uInt8 nId = 0; nId < STATIC_TABLE_SIZE( ppcStyleNames ); ++nId )
+        for( sal_uInt8 nId = 0; nId < SAL_N_ELEMENTS( ppcStyleNames ); ++nId )
         {
             if( nId != EXC_STYLE_NORMAL )
             {
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 8e90e7e..c04ad3e 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -36,6 +36,7 @@
 #include <tools/string.hxx>
 #include <tools/list.hxx>
 #include <tools/debug.hxx>
+#include <sal/macros.h>
 #include <oox/helper/helper.hxx>
 #include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
@@ -44,10 +45,8 @@
 
 // Common macros ==============================================================
 
-/** Expands to the size of a STATIC data array. */
-#define STATIC_TABLE_SIZE( array )  (sizeof(array)/sizeof(*(array)))
 /** Expands to a pointer behind the last element of a STATIC data array (like STL end()). */
-#define STATIC_TABLE_END( array )   ((array)+STATIC_TABLE_SIZE(array))
+#define STATIC_TABLE_END( array )   ((array)+SAL_N_ELEMENTS(array))
 
 /** Expands to a temporary String, created from an ASCII character array. */
 #define CREATE_STRING( ascii )      String( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 1450a35..ae1f5e5 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -38,6 +38,7 @@
 
 #include <svtools/colorcfg.hxx>
 #include <svl/smplhint.hxx>
+#include <sal/macros.h>
 #include <tools/poly.hxx>
 #include "scmod.hxx"
 #include "asciiopt.hxx"
@@ -523,7 +524,7 @@ sal_uInt8 lcl_GetExtColumnType( sal_Int32 nIntType )
 {
     static sal_uInt8 pExtTypes[] =
         { SC_COL_STANDARD, SC_COL_TEXT, SC_COL_DMY, SC_COL_MDY, SC_COL_YMD, SC_COL_ENGLISH, SC_COL_SKIP };
-    static sal_Int32 nExtTypeCount = sizeof( pExtTypes ) / sizeof( *pExtTypes );
+    static sal_Int32 nExtTypeCount = SAL_N_ELEMENTS(pExtTypes);
     return pExtTypes[ ((0 <= nIntType) && (nIntType < nExtTypeCount)) ? nIntType : 0 ];
 }
 
diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx
index 5b4df99..0afd6a9 100644
--- a/sc/source/ui/vba/vbainterior.cxx
+++ b/sc/source/ui/vba/vbainterior.cxx
@@ -43,13 +43,13 @@
 
 #include <map>
 
+#include <sal/macros.h>
 #include <svx/xtable.hxx>
 
 #include "vbainterior.hxx"
 #include "vbapalette.hxx"
 #include "document.hxx"
 
-#define STATIC_TABLE_SIZE( array )  (sizeof(array)/sizeof(*(array)))
 #define COLORMAST 0xFFFFFF
 const sal_uInt16 EXC_COLOR_WINDOWBACK = 65;
 typedef std::map< sal_Int32, sal_Int32 >  PatternMap;
@@ -240,7 +240,7 @@ ScVbaInterior::GetPatternColor( const Color& rPattColor, const Color& rBackColor
         0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48,     // 08 - 15
         0x50, 0x70, 0x78                                    // 16 - 18
     };
-    return ( nXclPattern < STATIC_TABLE_SIZE( pnRatioTable ) ) ?
+    return ( nXclPattern < SAL_N_ELEMENTS( pnRatioTable ) ) ?
         GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor;
 }
 Color
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 7e5f55d..b3fb762 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -55,6 +55,7 @@
 #include <vcl/hatch.hxx>
 #include <sot/formats.hxx>
 #include <sot/clsids.hxx>
+#include <sal/macros.h>
 
 #include <svx/svdview.hxx>		// fuer Command-Handler (COMMAND_INSERTTEXT)
 #include <editeng/outliner.hxx>		// fuer Command-Handler (COMMAND_INSERTTEXT)
@@ -953,7 +954,7 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
 
         //	default entries
         static const USHORT nDefIDs[] = { SCSTR_ALLFILTER, SCSTR_TOP10FILTER, SCSTR_STDFILTER, SCSTR_EMPTY, SCSTR_NOTEMPTY };
-        const USHORT nDefCount = sizeof(nDefIDs) / sizeof(USHORT);
+        const USHORT nDefCount = SAL_N_ELEMENTS(nDefIDs);
         for (i=0; i<nDefCount; i++)
         {
             String aEntry( (ScResId) nDefIDs[i] );
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index 5c146c8..b07c863 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -32,6 +32,7 @@
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/math.hxx>
+#include <sal/macros.h>
 #include <string.h>
 
 #include <tools/resmgr.hxx>
@@ -510,7 +511,7 @@ STRING SAL_CALL AnalysisAddIn::getDisplayCategoryName( const STRING& aProgrammat
 
 static const sal_Char*		pLang[] = { "de", "en" };
 static const sal_Char*		pCoun[] = { "DE", "US" };
-static const sal_uInt32		nNumOfLoc = sizeof( pLang ) / sizeof( sal_Char* );
+static const sal_uInt32		nNumOfLoc = SAL_N_ELEMENTS(pLang);
 
 
 void AnalysisAddIn::InitDefLocales( void )
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index dc88b53..e4651a4 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <tools/resary.hxx>
 #include <rtl/math.hxx>
+#include <sal/macros.h>
 #include "analysishelper.hxx"
 #include "analysis.hrc"
 
@@ -1413,9 +1414,7 @@ sal_uInt16 FuncData::GetStrIndex( sal_uInt16 nParamNum ) const
 
 FuncDataList::FuncDataList( ResMgr& rResMgr )
 {
-    const sal_uInt32	nNum = sizeof( pFuncDatas ) / sizeof( FuncDataBase );
-
-    for( sal_uInt16 n = 0 ; n < nNum ; n++ )
+    for( sal_uInt16 n = 0 ; n < SAL_N_ELEMENTS(pFuncDatas) ; n++ )
         Append( new FuncData( pFuncDatas[ n ], rResMgr ) );
 }
 
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index e350bc2..e3ca928 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -178,9 +178,7 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
 ScaFuncDataList::ScaFuncDataList( ResMgr& rResMgr ) :
     nLast( 0xFFFFFFFF )
 {
-    const sal_uInt32 nCnt = sizeof( pFuncDataArr ) / sizeof( ScaFuncDataBase );
-
-    for( sal_uInt16 nIndex = 0; nIndex < nCnt; nIndex++ )
+    for( sal_uInt16 nIndex = 0; nIndex < SAL_N_ELEMENTS(pFuncDataArr); nIndex++ )
         Append( new ScaFuncData( pFuncDataArr[ nIndex ], rResMgr ) );
 }
 
@@ -323,7 +321,7 @@ ScaDateAddIn::~ScaDateAddIn()
 
 static const sal_Char*  pLang[] = { "de", "en" };
 static const sal_Char*  pCoun[] = { "DE", "US" };
-static const sal_uInt32 nNumOfLoc = sizeof( pLang ) / sizeof( sal_Char* );
+static const sal_uInt32 nNumOfLoc = SAL_N_ELEMENTS( pLang );
 
 void ScaDateAddIn::InitDefLocales()
 {
-- 
1.7.1


--=-PqpRQIe1QgwtRJCvIGEk
Content-Disposition: attachment; filename="0001-more-Sal-n-elements-components.patch"
Content-Type: text/x-patch; name="0001-more-Sal-n-elements-components.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



More information about the LibreOffice mailing list