diff options
23 files changed, 59 insertions, 70 deletions
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 4870c61ead56..6108bf703bee 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -181,18 +181,14 @@ static Sequence< OUString > lcl_GetPropertyNames( return aNames; } - static Sequence< OUString > GetFormatPropertyNames() { - sal_uInt16 nCnt = SAL_N_ELEMENTS(aFormatPropNames); - return lcl_GetPropertyNames( aFormatPropNames, nCnt ); + return lcl_GetPropertyNames( aFormatPropNames, SAL_N_ELEMENTS( aFormatPropNames ) ); } - static Sequence< OUString > GetOtherPropertyNames() { - sal_uInt16 nCnt = SAL_N_ELEMENTS(aMathPropNames); - return lcl_GetPropertyNames( aMathPropNames, nCnt ); + return lcl_GetPropertyNames( aMathPropNames, SAL_N_ELEMENTS( aMathPropNames ) ); } ///////////////////////////////////////////////////////////////// diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index d3999a545d00..7503cb35e20d 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -334,8 +334,7 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName ) const SmTokenTableEntry * pRes = 0; if (rName.Len()) { - sal_Int32 nEntries = SAL_N_ELEMENTS(aTokenTable); - for (sal_Int32 i = 0; i < nEntries; ++i) + for (sal_Int32 i = 0; i < SAL_N_ELEMENTS(aTokenTable); ++i) { if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent )) { @@ -343,7 +342,6 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName ) break; } } - } return pRes; diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index be95c8100bff..3263a5815012 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -296,7 +296,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } - for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr); + for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]); 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 d20a5f38a0e6..03462f664843 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -402,7 +402,7 @@ static char const*const g_ServicesBookmark[] = "com.sun.star.document.LinkTarget", }; static const size_t g_nServicesBookmark( - SAL_N_ELEMENTS(g_ServicesBookmark)); + sizeof(g_ServicesBookmark)/sizeof(g_ServicesBookmark[0])); 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 47fa26eb72ad..28417912f7c4 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -490,7 +490,7 @@ OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType) { SolarMutexGuard aGuard; OUString sRet; - sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); + sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); if(nObjectType < nEntries) sRet = rtl::OUString::createFromAscii(aProvNamesId[nObjectType].pName); return sRet; @@ -498,7 +498,7 @@ OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType) uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames() { - sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); + sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); uno::Sequence<OUString> aRet(nEntries); OUString* pArray = aRet.getArray(); sal_uInt16 n = 0; @@ -518,7 +518,7 @@ uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames() sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName) { - sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); + sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); 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 3e1cb79e1a8e..09e63bd08e8d 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -206,8 +206,7 @@ static char const*const g_ServicesFootnote[] = "com.sun.star.text.Endnote", // NB: only supported for endnotes! }; -static const size_t g_nServicesEndnote( - SAL_N_ELEMENTS(g_ServicesFootnote)); +static const size_t g_nServicesEndnote( sizeof (g_ServicesFootnote) / sizeof (g_ServicesFootnote[0]) ); static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit! diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index a0ee7b30da91..302e9fa7ce2a 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2373,22 +2373,20 @@ static char const*const g_ServicesDocumentIndexes[] = "com.sun.star.text.DocumentIndexes", }; -static const size_t g_nServicesDocumentIndexes( - SAL_N_ELEMENTS(g_ServicesDocumentIndexes)); - sal_Bool SAL_CALL SwXDocumentIndexes::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) { return ::sw::SupportsServiceImpl( - g_nServicesDocumentIndexes, g_ServicesDocumentIndexes, rServiceName); + SAL_N_ELEMENTS(g_ServicesDocumentIndexes) + g_ServicesDocumentIndexes, rServiceName); } uno::Sequence< OUString > SAL_CALL SwXDocumentIndexes::getSupportedServiceNames() throw (uno::RuntimeException) { return ::sw::GetSupportedServiceNamesImpl( - g_nServicesDocumentIndexes, g_ServicesDocumentIndexes); + SAL_N_ELEMENTS(g_ServicesDocumentIndexes), g_ServicesDocumentIndexes); } sal_Int32 SAL_CALL @@ -2577,16 +2575,14 @@ static char const*const g_ServicesIndexStyleAccess[] = "com.sun.star.text.DocumentIndexParagraphStyles", }; -static const size_t g_nServicesIndexStyleAccess( - SAL_N_ELEMENTS(g_ServicesIndexStyleAccess)); - sal_Bool SAL_CALL SwXDocumentIndex::StyleAccess_Impl::supportsService( const OUString& rServiceName) throw (uno::RuntimeException) { return ::sw::SupportsServiceImpl( - g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess, rServiceName); + SAL_N_ELEMENTS(g_ServicesIndexStyleAccess), + g_ServicesIndexStyleAccess, rServiceName); } uno::Sequence< OUString > SAL_CALL @@ -2594,7 +2590,8 @@ SwXDocumentIndex::StyleAccess_Impl::getSupportedServiceNames() throw (uno::RuntimeException) { return ::sw::GetSupportedServiceNamesImpl( - g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess); + SAL_N_ELEMENTS(g_ServicesIndexStyleAccess), + g_ServicesIndexStyleAccess); } void SAL_CALL @@ -2712,16 +2709,14 @@ static char const*const g_ServicesIndexTokenAccess[] = "com.sun.star.text.DocumentIndexLevelFormat", }; -static const size_t g_nServicesIndexTokenAccess( - SAL_N_ELEMENTS(g_ServicesIndexTokenAccess)); - sal_Bool SAL_CALL SwXDocumentIndex::TokenAccess_Impl::supportsService( const OUString& rServiceName) throw (uno::RuntimeException) { return ::sw::SupportsServiceImpl( - g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess, rServiceName); + SAL_N_ELEMENTS(g_ServicesIndexTokenAccess), + g_ServicesIndexTokenAccess, rServiceName); } uno::Sequence< OUString > SAL_CALL @@ -2729,7 +2724,8 @@ SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames() throw (uno::RuntimeException) { return ::sw::GetSupportedServiceNamesImpl( - g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess); + SAL_N_ELEMENTS(g_ServicesIndexTokenAccess), + g_ServicesIndexTokenAccess); } struct TokenType { diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index e478a6952158..3bba0848c948 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -982,7 +982,7 @@ static char const*const g_ServicesTextCursor[] = }; static const size_t g_nServicesTextCursor( - SAL_N_ELEMENTS(g_ServicesTextCursor)); + sizeof(g_ServicesTextCursor)/sizeof(g_ServicesTextCursor[0])); 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 4052050da576..ea121c15581e 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -549,7 +549,7 @@ static char const*const g_ServicesParagraphEnum[] = }; static const size_t g_nServicesParagraphEnum( - SAL_N_ELEMENTS(g_ServicesParagraphEnum)); + sizeof(g_ServicesParagraphEnum)/sizeof(g_ServicesParagraphEnum[0])); sal_Bool SAL_CALL SwXParagraphEnumeration::supportsService(const OUString& rServiceName) @@ -934,7 +934,7 @@ static char const*const g_ServicesTextRange[] = }; static const size_t g_nServicesTextRange( - SAL_N_ELEMENTS(g_ServicesTextRange)); + sizeof(g_ServicesTextRange)/sizeof(g_ServicesTextRange[0])); sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) @@ -1666,7 +1666,7 @@ static char const*const g_ServicesTextRanges[] = }; static const size_t g_nServicesTextRanges( - SAL_N_ELEMENTS(g_ServicesTextRanges)); + sizeof(g_ServicesTextRanges)/sizeof(g_ServicesTextRanges[0])); sal_Bool SAL_CALL SwXTextRanges::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) @@ -1963,7 +1963,7 @@ static char const*const g_ServicesParaFrameEnum[] = }; static const size_t g_nServicesParaFrameEnum( - SAL_N_ELEMENTS(g_ServicesParaFrameEnum)); + sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0])); 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 5fa413c4197a..14ee1965ebc7 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -304,7 +304,7 @@ static char const*const g_ServicesParagraph[] = }; static const size_t g_nServicesParagraph( - SAL_N_ELEMENTS(g_ServicesParagraph)); + sizeof(g_ServicesParagraph)/sizeof(g_ServicesParagraph[0])); 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 088f5d24cf40..34e2e7e5f3a7 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -182,7 +182,7 @@ static char const*const g_ServicesReferenceMark[] = }; static const size_t g_nServicesReferenceMark( - SAL_N_ELEMENTS(g_ServicesReferenceMark)); + sizeof(g_ServicesReferenceMark)/sizeof(g_ServicesReferenceMark[0])); sal_Bool SAL_CALL SwXReferenceMark::supportsService(const OUString& rServiceName) @@ -923,7 +923,7 @@ static char const*const g_ServicesMeta[] = }; static const size_t g_nServicesMeta( - SAL_N_ELEMENTS(g_ServicesMeta)); + sizeof(g_ServicesMeta)/sizeof(g_ServicesMeta[0])); sal_Bool SAL_CALL SwXMeta::supportsService(const ::rtl::OUString& rServiceName) @@ -1361,7 +1361,7 @@ static char const*const g_ServicesMetaField[] = }; static const size_t g_nServicesMetaField( - SAL_N_ELEMENTS(g_ServicesMetaField)); + sizeof(g_ServicesMetaField)/sizeof(g_ServicesMetaField[0])); 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 4dc90b8099b3..338c37666217 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -1774,20 +1774,20 @@ static char const*const g_ServicesTextSection[] = "com.sun.star.document.LinkTarget", }; -static const size_t g_nServicesTextSection(SAL_N_ELEMENTS(g_ServicesTextSection)); - sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) { return ::sw::SupportsServiceImpl( - g_nServicesTextSection, g_ServicesTextSection, rServiceName); + SAL_N_ELEMENTS(g_ServicesTextSection), + g_ServicesTextSection, rServiceName); } uno::Sequence< OUString > SAL_CALL SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException) { return ::sw::GetSupportedServiceNamesImpl( - g_nServicesTextSection, g_ServicesTextSection); + SAL_N_ELEMENTS(g_ServicesTextSection), + g_ServicesTextSection); } // MetadatableMixin diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 2334391a9729..241aae3068ea 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2369,7 +2369,7 @@ static char const*const g_ServicesBodyText[] = }; static const size_t g_nServicesBodyText( - SAL_N_ELEMENTS(g_ServicesBodyText)); + sizeof(g_ServicesBodyText)/sizeof(g_ServicesBodyText[0])); sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) @@ -2665,20 +2665,20 @@ static char const*const g_ServicesHeadFootText[] = "com.sun.star.text.Text", }; -static const size_t g_nServicesHeadFootText(SAL_N_ELEMENTS(g_ServicesHeadFootText)); - sal_Bool SAL_CALL SwXHeadFootText::supportsService(const OUString& rServiceName) throw (uno::RuntimeException) { return ::sw::SupportsServiceImpl( - g_nServicesHeadFootText, g_ServicesHeadFootText, rServiceName); + SAL_N_ELEMENTS(g_ServicesHeadFootText), + g_ServicesHeadFootText, rServiceName); } uno::Sequence< OUString > SAL_CALL SwXHeadFootText::getSupportedServiceNames() throw (uno::RuntimeException) { return ::sw::GetSupportedServiceNamesImpl( - g_nServicesHeadFootText, g_ServicesHeadFootText); + SAL_N_ELEMENTS(g_ServicesHeadFootText), + g_ServicesHeadFootText); } const SwStartNode *SwXHeadFootText::GetStartNode() const diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index 9750d5258061..5886fcf1bf61 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 < SAL_N_ELEMENTS(aFldNmArr); ++n) + for (size_t n = 0; n < sizeof(aFldNmArr) / sizeof(aFldNmArr[0]); ++n) { const sal_Char* pCmp = aFldNmArr[n].pFldNm; int nLen = *pCmp++; diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx index 38a208b6e0cb..af21b39c8b3f 100644 --- a/sw/source/filter/ww8/fields.cxx +++ b/sw/source/filter/ww8/fields.cxx @@ -139,7 +139,7 @@ namespace ww }; size_t nIndex = static_cast<size_t>(eIndex); - if (nIndex >= SAL_N_ELEMENTS(aFieldNames)) + if (nIndex >= sizeof(aFieldNames) / sizeof(aFieldNames[0])) eIndex = eNONE; OSL_ENSURE(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 d1b819c4d156..920d9e52f896 100644 --- a/sw/source/filter/ww8/styles.cxx +++ b/sw/source/filter/ww8/styles.cxx @@ -144,7 +144,7 @@ namespace "Plain Text" }; - OSL_ENSURE( (SAL_N_ELEMENTS(stiName)) == ww::stiMax, "WrongSizeOfArray" ); + OSL_ENSURE( (sizeof (stiName) / sizeof (stiName[0])) == ww::stiMax, "WrongSizeOfArray" ); return stiName; } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index eece703b0240..2c1bd5426ebd 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -160,14 +160,13 @@ namespace myImplHelpers RES_NONE, RES_NONE, RES_POOLCOLL_DOC_SUBTITEL }; - const size_t nArrSize = (SAL_N_ELEMENTS(aArr)); - OSL_ENSURE(nArrSize == 75, "Style Array has false size"); + OSL_ENSURE(SAL_N_ELEMENTS(aArr) == 75, "Style Array has false size"); SwTxtFmtColl* pRet = 0; //If this is a built-in word style that has a built-in writer //equivalent, then map it to one of our built in styles regardless //of its name - if (sal::static_int_cast< size_t >(eSti) < nArrSize && aArr[eSti] != RES_NONE) + if (sal::static_int_cast< size_t >(eSti) < SAL_N_ELEMENTS(aArr) && aArr[eSti] != RES_NONE) pRet = mrDoc.GetTxtCollFromPool( static_cast< sal_uInt16 >(aArr[eSti]), false); return pRet; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index d0a94a1c8c6f..6d7954840303 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4571,7 +4571,7 @@ void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex) nUseBack = COL_WHITE; - if( nIndex >= SAL_N_ELEMENTS(eMSGrayScale)) + if( nIndex >= sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] ) ) nIndex = 0; sal_uLong nWW8BrushStyle = eMSGrayScale[nIndex]; @@ -5126,7 +5126,7 @@ const wwSprmDispatcher *GetWW2SprmDispatcher() {99, 0} //"sprmPicBrcRight", }; - static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; } @@ -5488,7 +5488,7 @@ const wwSprmDispatcher *GetWW6SprmDispatcher() {207, 0}, //dunno }; - static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; } @@ -6077,7 +6077,7 @@ const wwSprmDispatcher *GetWW8SprmDispatcher() {0x246D, &SwWW8ImplReader::Read_ParaContextualSpacing} //"sprmPFContextualSpacing" }; - static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index bd50f620e251..6af0100d5070 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -261,7 +261,7 @@ const wwSprmSearcher *wwSprmParser::GetWW2SprmSearcher() {164, 4, L_FIX}, // "sprmTSetShd", tap.rgshd complex 4 bytes }; - static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; }; @@ -444,7 +444,7 @@ const wwSprmSearcher *wwSprmParser::GetWW6SprmSearcher() {207, 0, L_VAR} // rtl property ? }; - static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; }; @@ -783,7 +783,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() {0x246D, 1, L_FIX} }; - static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms)); + static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0])); return &aSprmSrch; }; @@ -6360,7 +6360,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW)) eEnc = RTL_TEXTENCODING_MS_1252; p->sFontname = String(pVer6->szFfn, eEnc); - const sal_uInt16 maxStrSize = SAL_N_ELEMENTS(pVer6->szFfn); + const sal_uInt16 maxStrSize = sizeof (pVer6->szFfn) / sizeof (pVer6->szFfn[0]); if (p->ibszAlt && p->ibszAlt < maxStrSize) //don't start after end of string { p->sFontname.Append(';'); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 8321abd82adc..a860c3ba67f7 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -706,8 +706,8 @@ void SwDocShell::SubInitNew() 0, 0, 0 }; if(!bWeb) { - nRange[ (SAL_N_ELEMENTS(nRange)) - 3 ] = RES_PARATR_TABSTOP; - nRange[ (SAL_N_ELEMENTS(nRange)) - 2 ] = RES_PARATR_HYPHENZONE; + nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP; + nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 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 2ed478efbf41..186ae80c5eb8 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -467,7 +467,8 @@ 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 % (SAL_N_ELEMENTS(aColArr)) ] ); + aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) / + sizeof( aColArr[0] )) ] ); } sal_Bool bBackGr = COL_NONE == rAttr.nColor; diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 7052fcc5997a..84e55a11619a 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -1582,7 +1582,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 % (SAL_N_ELEMENTS(aArrayNormal))]); + return Color( aArrayNormal[ aAuthorIndex % (sizeof( aArrayNormal )/ sizeof( aArrayNormal[0] ))]); } else return Color(COL_WHITE); @@ -1597,7 +1597,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 % (SAL_N_ELEMENTS(aArrayLight))]); + return Color( aArrayLight[ aAuthorIndex % (sizeof( aArrayLight )/ sizeof( aArrayLight[0] ))]); } else return Color(COL_WHITE); @@ -1612,7 +1612,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 % (SAL_N_ELEMENTS(aArrayAnchor))]); + return Color( aArrayAnchor[ aAuthorIndex % (sizeof( aArrayAnchor ) / sizeof( aArrayAnchor[0] ))]); } else return Color(COL_WHITE); diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 4b386c43beca..0a16423f06df 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -461,7 +461,7 @@ void SwCaptionDialog::CheckButtonWidth() &aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton }; Button** pCurrent = pBtns; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS(pBtns); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent ) { aNewSize = (*pCurrent)->GetSizePixel(); aNewSize.Width() += nDelta; |