diff options
author | Kayo Hamid <revol.code@yahoo.com> | 2010-10-09 13:46:58 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-09 13:46:58 -0500 |
commit | 6c036ff59d350cd28975a4d4614b8bc22373460b (patch) | |
tree | 8f2bccfad5927502ad306fdf11f9f4a73d12fcf0 /sc | |
parent | f2b9b79cffe97904c3a361123b40bc67f70f05eb (diff) |
Use SAL_N_ELEMENTS macro
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/cell2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/odffmap.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/qpro/qproform.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/protectiondlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/scdetect.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/servuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/tokenuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaborders.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/vba/vbadialog.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaglobals.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/vba/vbapalette.cxx | 2 |
15 files changed, 19 insertions, 21 deletions
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 76149992f1b4..8165dd4b9301 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -152,7 +152,7 @@ void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr ) { ATTR_FONT_WEIGHT, EE_CHAR_WEIGHT }, { ATTR_FONT_COLOR, EE_CHAR_COLOR } }; - USHORT nMapCount = sizeof(AttrTypeMap) / sizeof(AttrTypeMap[0]); + USHORT nMapCount = SAL_N_ELEMENTS(AttrTypeMap); const SfxItemSet& rSet = rAttr.GetItemSet(); const SfxPoolItem* pItem; diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 29ba9f15dc92..7c963ee53f12 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1184,7 +1184,7 @@ bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_StrLen& r { aFuncStr.EraseLeadingAndTrailingChars( ' ' ); - const sal_Int32 nFuncCount = sizeof(aFunctions) / sizeof(aFunctions[0]); + const sal_Int32 nFuncCount = SAL_N_ELEMENTS(aFunctions); for ( sal_Int32 nFunc=0; nFunc<nFuncCount && !bFound; nFunc++ ) { if ( aFuncStr.EqualsIgnoreCaseAscii( aFunctions[nFunc].pName ) ) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c1d0b004bfc2..cecf575ccf2e 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2538,7 +2538,7 @@ BOOL ScCompiler::IsOpCode( const String& rName, bool bInArray ) { "LEGACY.TDIST", ocTDist }, // TDIST -> LEGACY.TDIST { "ORG.OPENOFFICE.EASTERSUNDAY", ocEasterSunday } // EASTERSUNDAY -> ORG.OPENOFFICE.EASTERSUNDAY }; - static const size_t nOdffAliases = sizeof(aOdffAliases) / sizeof(aOdffAliases[0]); + static const size_t nOdffAliases = SAL_N_ELEMENTS(aOdffAliases); for (size_t i=0; i<nOdffAliases; ++i) { if (rName.EqualsIgnoreCaseAscii( aOdffAliases[i].pName)) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index e5cf9a0ed665..549ca4444368 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2442,7 +2442,7 @@ void ScInterpreter::ScRoman() { static const sal_Unicode pChars[] = { 'M', 'D', 'C', 'L', 'X', 'V', 'I' }; static const USHORT pValues[] = { 1000, 500, 100, 50, 10, 5, 1 }; - static const USHORT nMaxIndex = (USHORT)(sizeof(pValues) / sizeof(pValues[0]) - 1); + static const USHORT nMaxIndex = (USHORT)(SAL_N_ELEMENTS(pValues) - 1); String aRoman; USHORT nVal = (USHORT) fVal; @@ -2675,7 +2675,7 @@ BOOL lclConvertMoney( const String& aSearchUnit, double& rfRate, int& rnDec ) { "SKK", 30.1260, 2 } }; - const size_t nConversionCount = sizeof( aConvertTable ) / sizeof( aConvertTable[0] ); + const size_t nConversionCount = SAL_N_ELEMENTS(aConvertTable); for ( size_t i = 0; i < nConversionCount; i++ ) if ( aSearchUnit.EqualsIgnoreCaseAscii( aConvertTable[i].pCurrText ) ) { diff --git a/sc/source/core/tool/odffmap.cxx b/sc/source/core/tool/odffmap.cxx index 0ffaa4aae025..367ff1c97faa 100644 --- a/sc/source/core/tool/odffmap.cxx +++ b/sc/source/core/tool/odffmap.cxx @@ -145,5 +145,5 @@ const ScCompiler::AddInMap* ScCompiler::GetAddInMap() // static size_t ScCompiler::GetAddInMapCount() { - return sizeof(maAddInMap)/sizeof(maAddInMap[0]); + return SAL_N_ELEMENTS(maAddInMap); } diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 9cb4a2d7b245..22502545dfeb 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -556,7 +556,7 @@ static const struct { ocNoName, FT_NotImpl } // gives properties of DOS menus }; -const int nIndexCount = sizeof( aFuncMap ) / sizeof( aFuncMap[ 0 ] ); +const int nIndexCount = SAL_N_ELEMENTS(aFuncMap); DefTokenId QProToSc::IndexToToken( sal_uInt16 nIndex ) { diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index fa1a99cb78b6..0413a7733e62 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1781,7 +1781,7 @@ ScXMLImport::ScXMLImport( { XML_CURRENCY, util::NumberFormat::CURRENCY }, { XML_BOOLEAN, util::NumberFormat::LOGICAL } }; - size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]); + size_t n = SAL_N_ELEMENTS(aCellTypePairs); for (size_t i = 0; i < n; ++i) { aCellTypeMap.insert( diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx index c10620bc8c4a..d1e3212e3c9d 100644 --- a/sc/source/ui/miscdlgs/protectiondlg.cxx +++ b/sc/source/ui/miscdlgs/protectiondlg.cxx @@ -41,7 +41,7 @@ static const ScTableProtection::Option aOptions[] = { ScTableProtection::SELECT_LOCKED_CELLS, ScTableProtection::SELECT_UNLOCKED_CELLS, }; -static const USHORT nOptionCount = sizeof(aOptions)/sizeof(aOptions[0]); +static const USHORT nOptionCount = SAL_N_ELEMENTS(aOptions); ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) : diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index ed45116bc44d..9d76730a25bf 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -165,7 +165,7 @@ static BOOL lcl_MayBeDBase( SvStream& rStream ) rStream.Seek(STREAM_SEEK_TO_BEGIN); rStream >> nMark; bool bValidMark = false; - for (size_t i=0; i < sizeof(nValidMarks)/sizeof(nValidMarks[0]) && !bValidMark; ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(nValidMarks) && !bValidMark; ++i) { if (nValidMarks[i] == nMark) bValidMark = true; @@ -631,7 +631,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) pLotus2, pQPro }; - const UINT16 nFilterCount = sizeof(ppFilterPatterns) / sizeof(ppFilterPatterns[0]); + const UINT16 nFilterCount = SAL_N_ELEMENTS(ppFilterPatterns); static const sal_Char* const pFilterName[] = // zugehoerige Filter { diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 0cbe98e96b05..0c541905e176 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -355,8 +355,8 @@ sal_uInt16 ScServiceProvider::GetProviderType(const String& rServiceName) { if (rServiceName.Len()) { - const sal_uInt16 nEntries = - sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); + const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); + for (sal_uInt16 i = 0; i < nEntries; i++) { if (rServiceName.EqualsAscii( aProvNamesId[i].pName )) @@ -576,7 +576,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( uno::Sequence<rtl::OUString> ScServiceProvider::GetAllServiceNames() { - const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); + const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); uno::Sequence<rtl::OUString> aRet(nEntries); rtl::OUString* pArray = aRet.getArray(); for (sal_uInt16 i = 0; i < nEntries; i++) diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 5e3b3102e14a..7aa0eefde772 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -105,7 +105,7 @@ void ScFormulaParserObj::SetCompilerFlags( ScCompiler& rCompiler ) const formula::FormulaGrammar::CONV_XL_OOX, // <- AddressConvention::XL_OOX formula::FormulaGrammar::CONV_LOTUS_A1 // <- AddressConvention::LOTUS_A1 }; - static const sal_Int16 nConvMapCount = sizeof(aConvMap)/sizeof(aConvMap[0]); + static const sal_Int16 nConvMapCount = SAL_N_ELEMENTS(aConvMap); // If mxOpCodeMap is not empty it overrides mbEnglish, and vice versa. We // don't need to initialize things twice. diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index 5424da041f84..e006c58f3c5d 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -34,7 +34,6 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/table/TableBorder.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> - #include "vbapalette.hxx" using namespace ::com::sun::star; @@ -332,7 +331,7 @@ public: // XIndexAccess virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { - return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] ); + return SAL_N_ELEMENTS( supportedIndexTable ); } virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) { diff --git a/sc/source/ui/vba/vbadialog.cxx b/sc/source/ui/vba/vbadialog.cxx index 3c578a04e5d0..4aa510f87154 100644 --- a/sc/source/ui/vba/vbadialog.cxx +++ b/sc/source/ui/vba/vbadialog.cxx @@ -58,7 +58,7 @@ static const rtl::OUString aStringList[]= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) }; -const sal_Int32 nDialogSize = sizeof( aStringList ) / sizeof( aStringList[ 0 ] ); +const sal_Int32 nDialogSize = SAL_N_ELEMENTS( aStringList ) ; rtl::OUString ScVbaDialog::mapIndexToName( sal_Int32 nIndex ) diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index c70a7f83726d..00d5a2b7c05c 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <cppuhelper/component_context.hxx> - #include "vbaapplication.hxx" #include "vbaworksheet.hxx" #include "vbarange.hxx" @@ -263,7 +262,7 @@ ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Hyperlink" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.script.vba.VBASpreadsheetEventProcessor" ) ) }; - sal_Int32 nExcelServices = ( sizeof( names )/ sizeof( names[0] ) ); + sal_Int32 nExcelServices = ( SAL_N_ELEMENTS(names) ); sal_Int32 startIndex = serviceNames.getLength(); serviceNames.realloc( serviceNames.getLength() + nExcelServices ); for ( sal_Int32 index = 0; index < nExcelServices; ++index ) diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx index c6ae5c488a20..2ca5c048ba94 100644 --- a/sc/source/ui/vba/vbapalette.cxx +++ b/sc/source/ui/vba/vbapalette.cxx @@ -62,7 +62,7 @@ public: // Methods XIndexAccess virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { - return sizeof(spnDefColorTable8) / sizeof(spnDefColorTable8[0]); + return SAL_N_ELEMENTS(spnDefColorTable8); } virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) |