diff options
author | Kayo Hamid <revol.code@yahoo.com> | 2010-10-09 13:49:07 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-09 13:49:07 -0500 |
commit | a7be30202460cd143cb3815cf31c71ea4b374843 (patch) | |
tree | 001c226e2d014fc66d67fb725032227b98534d71 | |
parent | 66a65ad0cfb7f0fbcd89342dcce8e07ecf515828 (diff) |
Use SAL_N_ELEMENTS macro
26 files changed, 47 insertions, 50 deletions
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 2516c100a8a5..fd6592a6fd61 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 89d89ce621c0..839999204ca6 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 d87d2d58d0f6..54c63485404e 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 6baae75b28fb..3e77ba890244 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 cc9d82930ea6..59f87d6f9483 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 d0d74fa023c7..b5db26084fe9 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 94ee14450f08..710df9c33f55 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 fc23f7d7be1d..24485b8d2fcc 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 d9334e97c841..45d34c7a6d8a 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 3b865d49bf09..be4270230577 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 25ce3ec6c441..190efb1deb29 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 2810b500ea4b..8781ccc10960 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 3ddcfc1d2ed7..22d9710826f1 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 98672a68df1c..1534e63667a8 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 8e97075f2c69..63ec2330a28d 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 cd211520e083..7db26890eadf 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 a44be9ab19b7..75cfc49f22dc 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 a0db7fd31a02..50f1230371ac 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 db37f69b00b8..897f9183faab 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 0714fb1c461d..1ea11b98d5b2 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 ba7116d15318..cdeafb08cf86 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 123ca10684a0..414dd4e60dcd 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 1a838dfa4e82..28692fa27005 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 645d4773626a..1800936f366e 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 0a3c8cc33623..dca1698a0a96 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 eb187c07c40f..18769fd51fea 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; |