diff options
author | Kenneth Venken <kenneth.venken@gmail.com> | 2010-10-18 12:28:33 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2010-10-18 12:28:33 +0200 |
commit | bbe30ed8144fbfee7500b98a67224731c581663e (patch) | |
tree | 69c3c4238eb51d2be523c9eb9e1e2a498c36b9cf /unotools/source | |
parent | 309b89b93489c785a7ed2460ad5064ff0422dfd3 (diff) |
replace sizeof(foo)/sizeof(foo[0]) by SAL_N_ELEMENTS
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 5 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 3 | ||||
-rw-r--r-- | unotools/source/config/searchopt.cxx | 3 | ||||
-rw-r--r-- | unotools/source/i18n/localedatawrapper.cxx | 3 | ||||
-rw-r--r-- | unotools/source/misc/fontcvt.cxx | 9 |
5 files changed, 14 insertions, 9 deletions
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index d4a8ebc571b0..408a208e7bee 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -37,6 +37,7 @@ #include <unotools/configpathes.hxx> #include <unotools/syslocale.hxx> #include <rtl/ustrbuf.hxx> +#include <sal/macros.h> #include <tools/debug.hxx> #if OSL_DEBUG_LEVEL > 1 @@ -1002,7 +1003,7 @@ FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Re const OUString* pLine = (const OUString*)aAny.getValue(); if( pLine->getLength() ) { - for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- ) + for( weight=SAL_N_ELEMENTS(pWeightNames)-1; weight >= 0; weight-- ) if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) ) break; } @@ -1034,7 +1035,7 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe const OUString* pLine = (const OUString*)aAny.getValue(); if( pLine->getLength() ) { - for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- ) + for( width=SAL_N_ELEMENTS(pWidthNames)-1; width >= 0; width-- ) if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) ) break; } diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 43dbf7b6c15b..3cfeaaff2e01 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -45,6 +45,7 @@ #include <tools/string.hxx> #include <unotools/lingucfg.hxx> #include <unotools/linguprops.hxx> +#include <sal/macros.h> #include <comphelper/processfactory.hxx> @@ -293,7 +294,7 @@ const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() if (!bInitialized) { - INT32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]); + INT32 nMax = SAL_N_ELEMENTS(aNamesToHdl); aNames.realloc( nMax ); OUString *pNames = aNames.getArray(); diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index b21e6afbda9d..c4cae792c953 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Any.h> #include <rtl/logfile.hxx> +#include <sal/macros.h> using namespace rtl; @@ -172,7 +173,7 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const "IsNotes" // 25 }; - const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] ); + const int nCount = SAL_N_ELEMENTS( aPropNames ); Sequence< OUString > aNames( nCount ); OUString* pNames = aNames.getArray(); for (INT32 i = 0; i < nCount; ++i) diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 3b1d6e8d2078..e2fd6fcf91a4 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/i18n/NumberFormatIndex.hdl> #include <rtl/instance.hxx> +#include <sal/macros.h> #define LOCALEDATA_LIBRARYNAME "i18npool" #define LOCALEDATA_SERVICENAME "com.sun.star.i18n.LocaleData" @@ -1741,7 +1742,7 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, USHORT nDecimals, new sal_Unicode[nGuess + 16]); sal_Unicode* const pBuffer = - ((size_t(rCurrencySymbol.Len()) + nGuess + 20) < sizeof(aBuf)/sizeof(aBuf[0]) ? aBuf : + ((size_t(rCurrencySymbol.Len()) + nGuess + 20) < SAL_N_ELEMENTS(aBuf) ? aBuf : new sal_Unicode[ rCurrencySymbol.Len() + nGuess + 20 ]); sal_Unicode* pBuf = pBuffer; diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 558bc43db7cb..95342a0f896b 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -30,6 +30,7 @@ #include "precompiled_unotools.hxx" #include <unotools/fontcvt.hxx> #include <unotools/fontdefs.hxx> +#include <sal/macros.h> #ifndef _STLP_MAP #include <map> @@ -1188,7 +1189,7 @@ StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly) //Reverse map from a given starsymbol char to exact matches in ms symbol //fonts. - int nEntries = sizeof(aConservativeTable) / sizeof(aConservativeTable[0]); + int nEntries = SAL_N_ELEMENTS(aConservativeTable); int i; for (i = 0; i < nEntries; ++i) { @@ -1219,7 +1220,7 @@ StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly) //Allow extra conversions that are not perfect, but "good enough" if (!bPerfectOnly) - nEntries = sizeof(aAgressiveTable) / sizeof(aAgressiveTable[0]); + nEntries = SAL_N_ELEMENTS(aAgressiveTable); else nEntries = 1; @@ -1439,7 +1440,7 @@ const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const if( aMapName.EqualsAscii( "starsymbol" ) || aMapName.EqualsAscii( "opensymbol" ) ) { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); + int nEntries = SAL_N_ELEMENTS(aRecodeTable); for( int i = 0; i < nEntries; ++i) { RecodeTable& r = aRecodeTable[i]; @@ -1470,7 +1471,7 @@ FontToSubsFontConverter CreateFontToSubsFontConverter( if ( nFlags & FONTTOSUBSFONT_IMPORT ) { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); + int nEntries = SAL_N_ELEMENTS(aRecodeTable); if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats nEntries = 2; for( int i = 0; i < nEntries; ++i ) |