[Libreoffice-commits] .: starmath/source sw/source

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Sat Oct 9 11:59:38 PDT 2010


 starmath/source/cfgitem.cxx             |    4 ++--
 starmath/source/parse.cxx               |    2 +-
 sw/source/core/doc/fmtcol.cxx           |    2 +-
 sw/source/core/unocore/unobkm.cxx       |    2 +-
 sw/source/core/unocore/unocoll.cxx      |    6 +++---
 sw/source/core/unocore/unoftn.cxx       |    2 +-
 sw/source/core/unocore/unoidx.cxx       |    6 +++---
 sw/source/core/unocore/unoobj.cxx       |    2 +-
 sw/source/core/unocore/unoobj2.cxx      |    8 ++++----
 sw/source/core/unocore/unoparagraph.cxx |    2 +-
 sw/source/core/unocore/unorefmk.cxx     |    6 +++---
 sw/source/core/unocore/unosect.cxx      |    3 +--
 sw/source/core/unocore/unotext.cxx      |    5 ++---
 sw/source/filter/rtf/rtffld.cxx         |    2 +-
 sw/source/filter/ww8/dump/ww8darr.cxx   |    4 ++--
 sw/source/filter/ww8/dump/ww8scan.cxx   |    4 ++--
 sw/source/filter/ww8/fields.cxx         |    2 +-
 sw/source/filter/ww8/styles.cxx         |    2 +-
 sw/source/filter/ww8/writerwordglue.cxx |    2 +-
 sw/source/filter/ww8/ww8par6.cxx        |    8 ++++----
 sw/source/filter/ww8/ww8scan.cxx        |    6 +++---
 sw/source/ui/app/docshini.cxx           |    4 ++--
 sw/source/ui/app/swmodul1.cxx           |    3 +--
 sw/source/ui/docvw/PostItMgr.cxx        |    6 +++---
 sw/source/ui/frmdlg/column.cxx          |    2 +-
 sw/source/ui/frmdlg/cption.cxx          |    2 +-
 26 files changed, 47 insertions(+), 50 deletions(-)

New commits:
commit a606d81ea3f82645b70409e609124ffc3655b836
Author: Kayo Hamid <revol.code at yahoo.com>
Date:   Sat Oct 9 13:49:07 2010 -0500

    Use SAL_N_ELEMENTS macro

diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 05b8941..47527ed 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -184,14 +184,14 @@ static Sequence< OUString > lcl_GetPropertyNames(
     
 static Sequence< OUString > GetFormatPropertyNames()
 {
-    USHORT nCnt = sizeof(aFormatPropNames) / sizeof(aFormatPropNames[0]);
+    USHORT nCnt = SAL_N_ELEMENTS(aFormatPropNames);
     return lcl_GetPropertyNames( aFormatPropNames, nCnt );
 }
 
 
 static Sequence< OUString > GetOtherPropertyNames()
 {
-    USHORT nCnt = sizeof(aMathPropNames) / sizeof(aMathPropNames[0]);
+    USHORT nCnt = SAL_N_ELEMENTS(aMathPropNames);
     return lcl_GetPropertyNames( aMathPropNames, nCnt );
 }
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 2a497f1..cbe31aa 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -309,7 +309,7 @@ static const SmTokenTableEntry * GetTokenTableEntry( const String &rName )
     const SmTokenTableEntry * pRes = 0;
     if (rName.Len())
     {
-        INT32 nEntries = sizeof( aTokenTable ) / sizeof( aTokenTable[0] );
+        INT32 nEntries = SAL_N_ELEMENTS(aTokenTable);
         for (INT32 i = 0;  i < nEntries;  ++i)
         {
             if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index f6f8293..c1082da 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -316,7 +316,7 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
     }
 
 
-    for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]);
+    for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr);
             nC < nArrLen; ++nC )
     {
         SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 82425de..0527242 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -392,7 +392,7 @@ static char const*const g_ServicesBookmark[] =
     "com.sun.star.document.LinkTarget",
 };
 static const size_t g_nServicesBookmark(
-    sizeof(g_ServicesBookmark)/sizeof(g_ServicesBookmark[0]));
+    SAL_N_ELEMENTS(g_ServicesBookmark));
 
 sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 2cdb02d..bbabfa9 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -295,7 +295,7 @@ OUString	SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
     OUString sRet;
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
     if(nObjectType < nEntries)
         sRet = C2U(aProvNamesId[nObjectType].pName);
     return sRet;
@@ -305,7 +305,7 @@ OUString	SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
  * --------------------------------------------------*/
 uno::Sequence<OUString> 	SwXServiceProvider::GetAllServiceNames()
 {
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
     uno::Sequence<OUString> aRet(nEntries);
     OUString* pArray = aRet.getArray();
     sal_uInt16 n = 0;
@@ -328,7 +328,7 @@ uno::Sequence<OUString> 	SwXServiceProvider::GetAllServiceNames()
   -----------------------------------------------------------------------*/
 sal_uInt16	SwXServiceProvider::GetProviderType(const OUString& rServiceName)
 {
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
     for(sal_uInt16 i = 0; i < nEntries; i++ )
     {
         if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNamesId[i].pName))
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 1a23ce4..fb1a1a7 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -247,7 +247,7 @@ static char const*const g_ServicesFootnote[] =
     "com.sun.star.text.Endnote", // NB: only supported for endnotes!
 };
 static const size_t g_nServicesEndnote(
-    sizeof(g_ServicesFootnote)/sizeof(g_ServicesFootnote[0]));
+    SAL_N_ELEMENTS(g_ServicesFootnote));
 static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit!
 
 sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 2a9ea3c..affee81 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2539,7 +2539,7 @@ static char const*const g_ServicesDocumentIndexes[] =
     "com.sun.star.text.DocumentIndexes",
 };
 static const size_t g_nServicesDocumentIndexes(
-    sizeof(g_ServicesDocumentIndexes)/sizeof(g_ServicesDocumentIndexes[0]));
+    SAL_N_ELEMENT(g_ServicesDocumentIndexes));
 
 sal_Bool SAL_CALL
 SwXDocumentIndexes::supportsService(const OUString& rServiceName)
@@ -2771,7 +2771,7 @@ static char const*const g_ServicesIndexStyleAccess[] =
     "com.sun.star.text.DocumentIndexParagraphStyles",
 };
 static const size_t g_nServicesIndexStyleAccess(
-    sizeof(g_ServicesIndexStyleAccess)/sizeof(g_ServicesIndexStyleAccess[0]));
+    SAL_N_ELEMENT(g_ServicesIndexStyleAccess));
 
 sal_Bool SAL_CALL
 SwXDocumentIndex::StyleAccess_Impl::supportsService(
@@ -2924,7 +2924,7 @@ static char const*const g_ServicesIndexTokenAccess[] =
     "com.sun.star.text.DocumentIndexLevelFormat",
 };
 static const size_t g_nServicesIndexTokenAccess(
-    sizeof(g_ServicesIndexTokenAccess)/sizeof(g_ServicesIndexTokenAccess[0]));
+    SAL_N_ELEMENT(g_ServicesIndexTokenAccess));
 
 sal_Bool SAL_CALL
 SwXDocumentIndex::TokenAccess_Impl::supportsService(
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index f63dfc7..8d404a5 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1055,7 +1055,7 @@ static char const*const g_ServicesTextCursor[] =
     "com.sun.star.text.TextSortable",
 };
 static const size_t g_nServicesTextCursor(
-    sizeof(g_ServicesTextCursor)/sizeof(g_ServicesTextCursor[0]));
+    SAL_N_ELEMENTS(g_ServicesTextCursor));
 
 sal_Bool SAL_CALL SwXTextCursor::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 1b3ed92..ced97d5 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -580,7 +580,7 @@ static char const*const g_ServicesParagraphEnum[] =
     "com.sun.star.text.ParagraphEnumeration",
 };
 static const size_t g_nServicesParagraphEnum(
-    sizeof(g_ServicesParagraphEnum)/sizeof(g_ServicesParagraphEnum[0]));
+    SAL_N_ELEMENTS(g_ServicesParagraphEnum));
 
 sal_Bool SAL_CALL
 SwXParagraphEnumeration::supportsService(const OUString& rServiceName)
@@ -973,7 +973,7 @@ static char const*const g_ServicesTextRange[] =
     "com.sun.star.style.ParagraphPropertiesComplex",
 };
 static const size_t g_nServicesTextRange(
-    sizeof(g_ServicesTextRange)/sizeof(g_ServicesTextRange[0]));
+    SAL_N_ELEMENTS(g_ServicesTextRange));
 
 sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
@@ -1722,7 +1722,7 @@ static char const*const g_ServicesTextRanges[] =
     "com.sun.star.text.TextRanges",
 };
 static const size_t g_nServicesTextRanges(
-    sizeof(g_ServicesTextRanges)/sizeof(g_ServicesTextRanges[0]));
+    SAL_N_ELEMENTS(g_ServicesTextRanges));
 
 sal_Bool SAL_CALL SwXTextRanges::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
@@ -2074,7 +2074,7 @@ static char const*const g_ServicesParaFrameEnum[] =
     "com.sun.star.util.ContentEnumeration",
 };
 static const size_t g_nServicesParaFrameEnum(
-    sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0]));
+    SAL_N_ELEMENTS(g_ServicesParaFrameEnum));
 
 sal_Bool SAL_CALL
 SwXParaFrameEnumeration::supportsService(const OUString& rServiceName)
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 194f66a..57fe7a2 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -331,7 +331,7 @@ static char const*const g_ServicesParagraph[] =
     "com.sun.star.style.ParagraphPropertiesComplex",
 };
 static const size_t g_nServicesParagraph(
-    sizeof(g_ServicesParagraph)/sizeof(g_ServicesParagraph[0]));
+    SAL_N_ELEMENTS(g_ServicesParagraph));
 
 sal_Bool SAL_CALL
 SwXParagraph::supportsService(const OUString& rServiceName)
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index d088b6c..76816d9 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -214,7 +214,7 @@ static char const*const g_ServicesReferenceMark[] =
     "com.sun.star.text.ReferenceMark",
 };
 static const size_t g_nServicesReferenceMark(
-    sizeof(g_ServicesReferenceMark)/sizeof(g_ServicesReferenceMark[0]));
+    SAL_N_ELEMENTS(g_ServicesReferenceMark));
 
 sal_Bool SAL_CALL
 SwXReferenceMark::supportsService(const OUString& rServiceName)
@@ -988,7 +988,7 @@ static char const*const g_ServicesMeta[] =
     "com.sun.star.text.InContentMetadata",
 };
 static const size_t g_nServicesMeta(
-    sizeof(g_ServicesMeta)/sizeof(g_ServicesMeta[0]));
+    SAL_N_ELEMENTS(g_ServicesMeta));
 
 sal_Bool SAL_CALL
 SwXMeta::supportsService(const ::rtl::OUString& rServiceName)
@@ -1430,7 +1430,7 @@ static char const*const g_ServicesMetaField[] =
     "com.sun.star.text.textfield.MetadataField",
 };
 static const size_t g_nServicesMetaField(
-    sizeof(g_ServicesMetaField)/sizeof(g_ServicesMetaField[0]));
+    SAL_N_ELEMENTS(g_ServicesMetaField));
 
 sal_Bool SAL_CALL
 SwXMetaField::supportsService(const ::rtl::OUString& rServiceName)
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 6514ca6..ecf603a 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1875,8 +1875,7 @@ static char const*const g_ServicesTextSection[] =
     "com.sun.star.text.TextSection",
     "com.sun.star.document.LinkTarget",
 };
-static const size_t g_nServicesTextSection(
-    sizeof(g_ServicesTextSection)/sizeof(g_ServicesTextSection[0]));
+static const size_t g_nServicesTextSection(SAL_N_ELEMENTS(g_ServicesTextSection));
 
 sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 2022161..96c7f8a 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2424,7 +2424,7 @@ static char const*const g_ServicesBodyText[] =
     "com.sun.star.text.Text",
 };
 static const size_t g_nServicesBodyText(
-    sizeof(g_ServicesBodyText)/sizeof(g_ServicesBodyText[0]));
+    SAL_N_ELEMENTS(g_ServicesBodyText));
 
 sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
@@ -2757,8 +2757,7 @@ static char const*const g_ServicesHeadFootText[] =
 {
     "com.sun.star.text.Text",
 };
-static const size_t g_nServicesHeadFootText(
-    sizeof(g_ServicesHeadFootText)/sizeof(g_ServicesHeadFootText[0]));
+static const size_t g_nServicesHeadFootText(SAL_N_ELEMENTS(g_ServicesHeadFootText));
 
 sal_Bool SAL_CALL SwXHeadFootText::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException)
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 56355d6..a816578 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -145,7 +145,7 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
     xub_StrLen nTokenStt = rName.Search( sNm );
     sNm.ToLowerAscii();
 
-    for (size_t n = 0; n < sizeof(aFldNmArr) / sizeof(aFldNmArr[0]); ++n)
+    for (size_t n = 0; n < SAL_N_ELEMENTS(aFldNmArr); ++n)
     {
         const sal_Char* pCmp = aFldNmArr[n].pFldNm;
         int nLen = *pCmp++;
diff --git a/sw/source/filter/ww8/dump/ww8darr.cxx b/sw/source/filter/ww8/dump/ww8darr.cxx
index b1671bb..26aefcd 100644
--- a/sw/source/filter/ww8/dump/ww8darr.cxx
+++ b/sw/source/filter/ww8/dump/ww8darr.cxx
@@ -520,7 +520,7 @@ SprmDumpInfo& WW8GetSprmDumpInfo( USHORT nId )
     if( !bInit )
     {
         qsort( (void*)aSprmDumpTab,
-            sizeof( aSprmDumpTab      ) / sizeof (aSprmDumpTab[ 0 ]),
+            SAL_N_ELEMENTS(aSprmDumpTab),
             sizeof( aSprmDumpTab[ 0 ] ),
             CompSprmDumpId );
         bInit = TRUE;
@@ -531,7 +531,7 @@ SprmDumpInfo& WW8GetSprmDumpInfo( USHORT nId )
     aSrch.nId = nId;
     if( 0 == ( pFound = bsearch( (char *) &aSrch,
                         (void*) aSprmDumpTab,
-                        sizeof( aSprmDumpTab      ) / sizeof (aSprmDumpTab[ 0 ]),
+                        SAL_N_ELEMENTS(aSprmDumpTab),
                         sizeof( aSprmDumpTab[ 0 ] ),
                         CompSprmDumpId )))
     {
diff --git a/sw/source/filter/ww8/dump/ww8scan.cxx b/sw/source/filter/ww8/dump/ww8scan.cxx
index e2f5f3e..a86af41 100644
--- a/sw/source/filter/ww8/dump/ww8scan.cxx
+++ b/sw/source/filter/ww8/dump/ww8scan.cxx
@@ -348,7 +348,7 @@ const wwSprmSearcher *wwSprmParser::GetWW6SprmSearcher()
         {200, 4, L_FIX}  // "sprmTSetShd", tap.rgshd complex 4 bytes
     };
 
-    static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 };
 
@@ -684,7 +684,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher()
         {0x245C, 1, L_FIX}  // undocumented, para autoafter
     };
 
-    static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 };
 
diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx
index 33d8306..b2e28fb 100644
--- a/sw/source/filter/ww8/fields.cxx
+++ b/sw/source/filter/ww8/fields.cxx
@@ -142,7 +142,7 @@ namespace ww
         };
 
         size_t nIndex = static_cast<size_t>(eIndex);
-        if (nIndex >= sizeof(aFieldNames) / sizeof(aFieldNames[0]))
+        if (nIndex >= SAL_N_ELEMENTS(aFieldNames))
             eIndex = eNONE;
         ASSERT(eIndex != eNONE, "Unknown WinWord Field, let cmc know");
         return aFieldNames[eIndex];
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 86115b1..ce0bfe9 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -147,7 +147,7 @@ namespace
             "Plain Text"
         };
 
-        DBG_ASSERT( (sizeof(stiName) / sizeof(stiName[0])) == ww::stiMax, "WrongSizeOfArray" );
+        DBG_ASSERT( (SAL_N_ELEMENTS(stiName)) == ww::stiMax, "WrongSizeOfArray" );
 
         return stiName;
     }
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 078e2a7..dc712c8 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -168,7 +168,7 @@ namespace myImplHelpers
             RES_NONE, RES_NONE, RES_POOLCOLL_DOC_SUBTITEL
         };
 
-        const size_t nArrSize = (sizeof(aArr) / sizeof(aArr[0]));
+        const size_t nArrSize = (SAL_N_ELEMENTS(aArr));
         ASSERT(nArrSize == 75, "Style Array has false size");
 
         SwTxtFmtColl* pRet = 0;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 90ff9ce..f1ee7eb 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4669,7 +4669,7 @@ void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
         nUseBack = COL_WHITE;
 
 
-    if( nIndex >= sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] ) )
+    if( nIndex >= SAL_N_ELEMENTS(eMSGrayScale))
         nIndex = 0;
 
     ULONG nWW8BrushStyle = eMSGrayScale[nIndex];
@@ -5234,7 +5234,7 @@ const wwSprmDispatcher *GetWW2SprmDispatcher()
          {99, 0}                                     //"sprmPicBrcRight",
     };
 
-    static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 }
 
@@ -5596,7 +5596,7 @@ const wwSprmDispatcher *GetWW6SprmDispatcher()
         {207, 0},                                    //dunno
     };
 
-    static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 }
 
@@ -6183,7 +6183,7 @@ const wwSprmDispatcher *GetWW8SprmDispatcher()
         {0x246D, &SwWW8ImplReader::Read_DontAddEqual}//undocumented, para
     };
 
-    static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 }
 
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 26d4004..f9acb2b 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -256,7 +256,7 @@ const wwSprmSearcher *wwSprmParser::GetWW2SprmSearcher()
         {164, 4, L_FIX}, // "sprmTSetShd", tap.rgshd complex 4 bytes
     };
 
-    static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 };
 
@@ -439,7 +439,7 @@ const wwSprmSearcher *wwSprmParser::GetWW6SprmSearcher()
         {207, 0, L_VAR}  // rtl property ?
     };
 
-    static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 };
 
@@ -778,7 +778,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher()
         {0x246D, 1, L_FIX}
     };
 
-    static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
+    static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
     return &aSprmSrch;
 };
 
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index 8905f97..0d31329 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -732,8 +732,8 @@ void SwDocShell::SubInitNew()
         0, 0, 0  };
     if(!bWeb)
     {
-        nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP;
-        nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE;
+        nRange[ (SAL_N_ELEMENTS(nRange)) - 3 ] = RES_PARATR_TABSTOP;
+        nRange[ (SAL_N_ELEMENTS(nRange)) - 2 ] = RES_PARATR_HYPHENZONE;
     }
     SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange );
 
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index c95c7c2..04de10d 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -491,8 +491,7 @@ void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
          COL_AUTHOR4_DARK,		COL_AUTHOR5_DARK,	COL_AUTHOR6_DARK,
          COL_AUTHOR7_DARK,		COL_AUTHOR8_DARK,	COL_AUTHOR9_DARK };
 
-        aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
-                                           sizeof( aColArr[0] )) ] );
+        aCol.SetColor( aColArr[ nAuthor % (SAL_N_ELEMENTS(aColArr)) ] );
     }
 
     sal_Bool bBackGr = COL_NONE == rAttr.nColor;
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 35067b2..d6af414 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -1720,7 +1720,7 @@ Color SwPostItMgr::GetColorDark(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_NORMAL,		COL_AUTHOR5_NORMAL,		COL_AUTHOR6_NORMAL,
             COL_AUTHOR7_NORMAL,		COL_AUTHOR8_NORMAL,		COL_AUTHOR9_NORMAL };
 
-        return Color( aArrayNormal[ aAuthorIndex % (sizeof( aArrayNormal )/ sizeof( aArrayNormal[0] ))]);
+        return Color( aArrayNormal[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayNormal))]);
     }
     else
         return Color(COL_WHITE);
@@ -1735,7 +1735,7 @@ Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_LIGHT,		COL_AUTHOR5_LIGHT,		COL_AUTHOR6_LIGHT,
             COL_AUTHOR7_LIGHT,		COL_AUTHOR8_LIGHT,		COL_AUTHOR9_LIGHT };
 
-        return Color( aArrayLight[ aAuthorIndex % (sizeof( aArrayLight )/ sizeof( aArrayLight[0] ))]);
+        return Color( aArrayLight[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayLight))]);
     }
     else
         return Color(COL_WHITE);
@@ -1750,7 +1750,7 @@ Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_DARK,		COL_AUTHOR5_DARK,		COL_AUTHOR6_DARK,
             COL_AUTHOR7_DARK,		COL_AUTHOR8_DARK,		COL_AUTHOR9_DARK };
 
-        return Color( aArrayAnchor[  aAuthorIndex % (sizeof( aArrayAnchor )  / sizeof( aArrayAnchor[0] ))]);
+        return Color( aArrayAnchor[  aAuthorIndex % (SAL_N_ELEMENTS(aArrayAnchor))]);
     }
     else
         return Color(COL_WHITE);
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 79f727a..a832101 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -85,7 +85,7 @@ static const USHORT __FAR_DATA nLines[] = {
     DEF_LINE_WIDTH_4
 };
 
-static const USHORT nLineCount = sizeof(nLines) / sizeof(nLines[0]);
+static const USHORT nLineCount = SAL_N_ELEMENTS(nLines);
 static const USHORT nVisCols = 3;
 
 inline BOOL IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect )
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index cdec741..6f05456 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -460,7 +460,7 @@ void SwCaptionDialog::CheckButtonWidth()
             &aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton
         };
         Button** pCurrent = pBtns;
-        for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent )
+        for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS(pBtns); ++i, ++pCurrent )
         {
             aNewSize = (*pCurrent)->GetSizePixel();
             aNewSize.Width() += nDelta;


More information about the Libreoffice-commits mailing list