diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-05-29 17:23:51 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-05-29 18:03:34 +0100 |
commit | 6e6d81e9cfc593d865e409ad22b2307f87a37859 (patch) | |
tree | 4d578e5be2dfd3a403576d7c638f83f041d56911 | |
parent | b7c6716b4bc0742af4206035495d161e7eb49424 (diff) |
targetted SAL_N_ELEMENTS reversion.
Change-Id: I30be93ccaeb1f9fd17cbe9e3ed3165e094810b2e
58 files changed, 143 insertions, 135 deletions
diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx index cd16b1e4e43e..0c97c09a478a 100644 --- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx +++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx @@ -148,7 +148,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQ ::connectivity::ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); sal_Int32* pType = pTypes; - for (sal_Int32 i = 1; i <= sal_Int32(SAL_N_ELEMENTS(pTypes)); ++i,++pType) + for (sal_Int32 i = 1; i <= sal_Int32(sizeof(pTypes)/sizeof(pTypes[0])); ++i,++pType) { ORowSetValue aValue; aValue.fill(i,*pType,xRow); diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 6d43a8be3a3e..8ebbd44fff90 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -353,7 +353,7 @@ namespace dbtools { const ::rtl::OUString url = m_pImpl->xConnectionMetaData->getURL(); char pMySQL[] = "sdbc:mysql"; - bSupport = url.matchAsciiL(pMySQL,(SAL_N_ELEMENTS(pMySQL))-1); + bSupport = url.matchAsciiL(pMySQL,(sizeof(pMySQL)/sizeof(pMySQL[0]))-1); } } catch( const Exception& ) diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx index 76318521576f..c29ef1652ad2 100644 --- a/connectivity/source/drivers/ado/Awrapado.cxx +++ b/connectivity/source/drivers/ado/Awrapado.cxx @@ -1639,7 +1639,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1679,7 +1679,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1721,7 +1721,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any& // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1761,7 +1761,7 @@ ADORecordset* WpADOConnection::getIndexInfo( // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1803,7 +1803,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno:: // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1849,7 +1849,7 @@ ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::A // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1898,7 +1898,7 @@ ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any& // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -1939,7 +1939,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno: // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -2011,7 +2011,7 @@ ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& cata varCriteria[nPos].setString(sTypeNames); // Create SafeArray Bounds and initialize the array - const sal_Int32 nCrit = SAL_N_ELEMENTS( varCriteria ); + const sal_Int32 nCrit = sizeof varCriteria / sizeof varCriteria[0]; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = nCrit; @@ -2048,7 +2048,7 @@ ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& cat // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -2092,7 +2092,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno: // Create SafeArray Bounds and initialize the array rgsabound[0].lLbound = 0; - rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria ); + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); sal_Int32 nPos=0; @@ -2127,7 +2127,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/) { // Create elements used in the array OLEVariant varCriteria[2]; - const int nCrit = SAL_N_ELEMENTS( varCriteria ); + const int nCrit = sizeof varCriteria / sizeof varCriteria[0]; // Create SafeArray Bounds and initialize the array SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index cdde095e21c0..24546b3b38f3 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -460,7 +460,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( for (sal_Int32 i = 1 ; i <= nCount ; ++i) { sColumnName = xMeta->getColumnName(i); - for (sal_uInt32 j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j) + for (sal_uInt32 j = 0 ; j < sizeof(sPrivs)/sizeof(sPrivs[0]); ++j) { if ( sPrivs[j] == sColumnName ) { diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx index 5530e2f8fb76..e24a0f08f5f3 100644 --- a/connectivity/source/drivers/mozab/MColumnAlias.cxx +++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx @@ -90,7 +90,7 @@ OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun:: "Notes", }; - for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i ) + for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i ) m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i ); initialize( _rxORB ); diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx index 89f2321b832c..29919df00a70 100644 --- a/connectivity/source/drivers/mozab/MDriver.cxx +++ b/connectivity/source/drivers/mozab/MDriver.cxx @@ -258,7 +258,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url ) { LDAP, "ldap" } }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aSchemeMap ); ++i ) + for ( size_t i=0; i < sizeof( aSchemeMap ) / sizeof( aSchemeMap[0] ); ++i ) { if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 ) return aSchemeMap[i].eType; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 68ca5ba71652..054efa3a33ac 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1409,7 +1409,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }, { OSQLParseNode::cast_spec, "cast_spec" } }; - size_t nRuleMapCount = SAL_N_ELEMENTS( aRuleDescriptions ); + size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] ); OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" ); for ( size_t mapEntry = 0; mapEntry < nRuleMapCount; ++mapEntry ) diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 8ff692ff8b43..3a92b8792522 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -144,7 +144,7 @@ LanguageType lcl_CheckLanguage( lang::Locale a3( SvxCreateLocale( aLangList[3] ) ); #endif - sal_Int32 nCount = SAL_N_ELEMENTS(aLangList); + sal_Int32 nCount = sizeof (aLangList) / sizeof (aLangList[0]); for (sal_Int32 i = 0; i < nCount; i++) { sal_Int16 nTmpLang = aLangList[i]; diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 9df1f7fef62a..9e82422d1025 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -341,7 +341,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create { FormulaMapGroupSpecialOffset::MACRO , ocMacro } , { FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName } }; - const size_t nCount = SAL_N_ELEMENTS(aMap); + const size_t nCount = sizeof(aMap)/sizeof(aMap[0]); // Preallocate vector elements. if (aVec.size() < nCount) { @@ -381,7 +381,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create SC_OPCODE_CLOSE, SC_OPCODE_SEP, }; - lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) ); + lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) ); } if ((nGroups & FormulaMapGroup::ARRAY_SEPARATORS) != 0) { @@ -391,7 +391,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create SC_OPCODE_ARRAY_ROW_SEP, SC_OPCODE_ARRAY_COL_SEP }; - lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) ); + lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) ); } if ((nGroups & FormulaMapGroup::UNARY_OPERATORS) != 0) { @@ -447,7 +447,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create SC_OPCODE_NOT, SC_OPCODE_NEG }; - lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) ); + lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) ); // functions with 2 or more parameters. for (sal_uInt16 nOp = SC_OPCODE_START_2_PAR; nOp < SC_OPCODE_STOP_2_PAR && nOp < mnSymbols; ++nOp) { diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 21bcf83daa0c..05ebab7c27c3 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -116,7 +116,7 @@ namespace svt }; // ................................................................ - static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions ); + static const sal_Int32 s_nControlCount = sizeof( aDescriptions ) / sizeof( aDescriptions[0] ); static ControlDescIterator s_pControls = aDescriptions; static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount; @@ -162,7 +162,7 @@ namespace svt }; // ................................................................ - static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties ); + static const int s_nPropertyCount = sizeof( aProperties ) / sizeof( aProperties[0] ); static ControlPropertyIterator s_pProperties = aProperties; static ControlPropertyIterator s_pPropertiesEnd = aProperties + s_nPropertyCount; diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 4de4a0c0bfb8..3209ad6bccf3 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -2526,7 +2526,7 @@ void SvtFileDialog::implArrangeControls() // loop through all these controls and adjust the z-order Window* pPreviousWin = NULL; Control** pCurrent = pControls; - for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pControls )); ++i, ++pCurrent ) + for ( sal_Int32 i = 0; i < sal_Int32(sizeof( pControls ) / sizeof( pControls[ 0 ] )); ++i, ++pCurrent ) { if ( !*pCurrent ) // this control is not available in the current operation mode -> skip @@ -2697,7 +2697,7 @@ void SvtFileDialog::Resize() _pImp->_pBtnAddPlace, _pImp->_pBtnRemovePlace }; Control** ppMoveControls = aMoveControlsVert; - Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsVert ); + Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsVert ) / sizeof( aMoveControlsVert[0] ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, 0, nDeltaY ); } @@ -2709,7 +2709,7 @@ void SvtFileDialog::Resize() _pImp->_pBtnFileOpen, _pImp->_pBtnCancel, _pImp->_pBtnHelp }; Control** ppMoveControls = aMoveControlsBoth; - Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsBoth ); + Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsBoth ) / sizeof( aMoveControlsBoth[0] ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, nDeltaX, nDeltaY ); } @@ -2722,7 +2722,7 @@ void SvtFileDialog::Resize() _pImp->_pBtnUp, _pImp->_pBtnNewFolder }; Control** ppMoveControls = aMoveControlsHor; - Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsHor ); + Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsHor ) / sizeof( aMoveControlsHor[0] ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, nDeltaX, 0 ); } @@ -2735,7 +2735,7 @@ void SvtFileDialog::Resize() _pImp->_pEdFileName, _pImp->_pLbFileVersion, _pImp->_pLbTemplates, _pImp->_pLbImageTemplates, _pImp->GetFilterListControl(), _pImp->_pEdCurrentPath, }; - sal_Int32 nSizeControls = SAL_N_ELEMENTS( aSizeControls ); + sal_Int32 nSizeControls = sizeof( aSizeControls ) / sizeof( aSizeControls[0] ); Control** ppSizeControls = aSizeControls; for ( sal_Int32 j=0; j<nSizeControls; ++j, ++ppSizeControls ) { diff --git a/fpicker/source/win32/filepicker/controlaccess.cxx b/fpicker/source/win32/filepicker/controlaccess.cxx index bd07ba357ca6..8a1df18d8c45 100644 --- a/fpicker/source/win32/filepicker/controlaccess.cxx +++ b/fpicker/source/win32/filepicker/controlaccess.cxx @@ -183,7 +183,8 @@ namespace // private stc2, // LISTBOX_FILTER_LABEL stc3 // LISTBOX_FILE_NAME_LABEL }; - const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = SAL_N_ELEMENTS(WindowsFileOpenCtrlIds); + const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = + sizeof(WindowsFileOpenCtrlIds)/sizeof(WindowsFileOpenCtrlIds[0]); }; // end namespace diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index d80fcfb88db5..2c50e0e07c97 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -126,7 +126,7 @@ MenuStyleItem MenuItemStyles[ ] = { }; -sal_Int32 nMenuStyleItemEntries = SAL_N_ELEMENTS( MenuItemStyles ); +sal_Int32 nMenuStyleItemEntries = (sizeof (MenuItemStyles) / sizeof (MenuItemStyles[0])); static void ExtractMenuParameters( const Sequence< PropertyValue > rProp, ::rtl::OUString& rCommandURL, diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 3ac73e238192..b3a22ae507ad 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -123,7 +123,7 @@ ToolboxStyleItem Styles[ ] = { { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT }, }; -sal_Int32 nStyleItemEntries = SAL_N_ELEMENTS( Styles ); +sal_Int32 nStyleItemEntries = sizeof (Styles) / sizeof (Styles[0]); struct ToolBarEntryProperty { diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 0b07e6fedec6..811e47c730c5 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -627,7 +627,7 @@ void BackingWindow::layoutButton( long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() ); nTextWidth += maButtonImageSize.Width() + 8 + i_nExtraWidth; // add some fuzz to be on the safe side - if( nColumn >= 0 && nColumn < static_cast<int>(SAL_N_ELEMENTS(mnColumnWidth)) ) + if( nColumn >= 0 && nColumn < static_cast<int>(sizeof (mnColumnWidth) / sizeof (mnColumnWidth[0])) ) { if( nTextWidth > mnColumnWidth[nColumn] ) mnColumnWidth[nColumn] = nTextWidth; diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index b356448844ee..316acef26740 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -232,7 +232,7 @@ void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu ) if ( pResMgr->IsAvailable( aResId )) { ImageList aImageList( aResId ); - for ( sal_uInt32 i=0; i < SAL_N_ELEMENTS(nConvertSlots); ++i ) + for ( sal_uInt32 i=0; i < sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i ) { // das entsprechende Image dran if ( m_bShowMenuImages ) @@ -283,7 +283,7 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve osl::ResettableMutexGuard aLock( m_aMutex ); sal_uInt16 nMenuId = 0; - for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i) + for (sal_uInt32 i=0; i < sizeof(aCommands) / sizeof (aCommands[0]); ++i) { if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] )) { @@ -401,7 +401,7 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star:: fillPopupMenu( m_xPopupMenu ); m_aURLToDispatchMap.free(); - for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i) + for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i) { aTargetURL.Complete = rtl::OUString::createFromAscii( aCommands[i] ); m_xURLTransformer->parseStrict( aTargetURL ); diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index bdd6ee3af79e..37e08d276d1c 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -137,7 +137,7 @@ static sal_Unicode aWhiteSpaces[] = 0xfffb /* INTERLINEAR ANNOTATION TERMINATOR */ }; -static int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces ); +static int nWhiteSpaces = sizeof( aWhiteSpaces ) / sizeof( aWhiteSpaces[0] ); static bool lcl_IsWhiteSpace( sal_Unicode cChar ) { diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index da17ba193acd..c29205ab8581 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -139,7 +139,7 @@ OUString LinguOptions::GetName( sal_Int32 nWID ) OUString aRes; - sal_Int32 nLen = SAL_N_ELEMENTS( aWID_Name ); + sal_Int32 nLen = sizeof (aWID_Name) / sizeof (aWID_Name[0]); if (0 <= nWID && nWID < nLen && aWID_Name[ nWID ].nWID == nWID) aRes = OUString::createFromAscii(aWID_Name[nWID].pPropertyName); else diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index 82a7c4d76142..730f35d325c9 100644 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -61,7 +61,7 @@ static const char *aCH[] = UPN_IS_USE_DICTIONARY_LIST, }; -static int nCHCount = SAL_N_ELEMENTS(aCH); +static int nCHCount = sizeof(aCH) / sizeof(aCH[0]); PropertyChgHelper::PropertyChgHelper( @@ -383,7 +383,7 @@ PropertyHelper_Spell::PropertyHelper_Spell( Reference< XPropertySet > &rxPropSet ) : PropertyChgHelper ( rxSource, rxPropSet, AE_SPELLCHECKER ) { - AddPropNames( aSP, SAL_N_ELEMENTS(aSP)); + AddPropNames( aSP, sizeof(aSP) / sizeof(aSP[0]) ); SetDefaultValues(); GetCurrentValues(); @@ -571,7 +571,7 @@ PropertyHelper_Hyphen::PropertyHelper_Hyphen( Reference< XPropertySet > &rxPropSet ) : PropertyChgHelper ( rxSource, rxPropSet, AE_HYPHENATOR ) { - AddPropNames( aHP, SAL_N_ELEMENTS(aHP)); + AddPropNames( aHP, sizeof(aHP) / sizeof(aHP[0]) ); SetDefaultValues(); GetCurrentValues(); } diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 59c3f3725773..1513371f44d1 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -686,7 +686,7 @@ static const sal_uInt32 the_aDigitZeroes [] = sal_Bool HasDigits( const OUString &rText ) { - static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes); + static const int nNumDigitZeroes = sizeof(the_aDigitZeroes) / sizeof(the_aDigitZeroes[0]); const sal_Int32 nLen = rText.getLength(); sal_Int32 i = 0; diff --git a/linguistic/workben/sprophelp.cxx b/linguistic/workben/sprophelp.cxx index 134b0d8d14ec..b5ca84245191 100644 --- a/linguistic/workben/sprophelp.cxx +++ b/linguistic/workben/sprophelp.cxx @@ -188,7 +188,7 @@ static const char *aSP[] = PropertyHelper_Spell::PropertyHelper_Spell( const Reference< XInterface > & rxSource, Reference< XPropertySet > &rxPropSet ) : - PropertyChgHelper ( rxSource, rxPropSet, aSP, SAL_N_ELEMENTS(aSP)) + PropertyChgHelper ( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) ) { SetDefault(); sal_Int32 nLen = GetPropNames().getLength(); diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 3b9cd949ee55..66a8bb8a365b 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -341,7 +341,7 @@ EventInfoHash& getEventTransInfo() { rtl::OUString sEventInfo = MAP_CHAR_LEN(""); TranslatePropMap* pTransProp = aTranslatePropMap_Impl; - int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl); + int nCount = sizeof(aTranslatePropMap_Impl) / sizeof(aTranslatePropMap_Impl[0]); int i = 0; while (i < nCount) diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 294cefb0c9ff..a735f2eaf3a2 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -213,7 +213,7 @@ static HMENU createSystrayMenu( ) OUString aEmpty; // insert the menu entries for launching the applications - for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i ) + for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) { if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) ) // the complete application is not even installed diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index 1dfecd0fe96c..e9f7852669c5 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -153,7 +153,7 @@ void SfxAlienWarningDialog::InitSize() &m_aSaveODFBtn, &m_aKeepCurrentBtn, &m_aMoreInfoBtn, &m_aOptionLine, &m_aWarningOnBox }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 45bbdbb161ac..2df1151feea1 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -43,6 +43,8 @@ static sal_uInt16 aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; static sal_Bool bOutputForPrinter = sal_True; +#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ])) + SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage( pParent, SfxResId( TP_COMMONPRINTOPTIONS ), rSet ), @@ -230,7 +232,7 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu aReduceBitmapsResolutionLB.SelectEntryPos( 0 ); else { - for( long i = ( SAL_N_ELEMENTS(aDPIArray) - 1 ); i >= 0; i-- ) + for( long i = ( DPI_COUNT - 1 ); i >= 0; i-- ) { if( nDPI >= aDPIArray[ i ] ) { @@ -359,7 +361,7 @@ void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOpt pCurrentOptions->SetReducedBitmapMode( aReduceBitmapsOptimalRB.IsChecked() ? PRINTER_BITMAP_OPTIMAL : ( aReduceBitmapsNormalRB.IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) ); pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ Min( (sal_uInt16) aReduceBitmapsResolutionLB.GetSelectEntryPos(), - (sal_uInt16)( SAL_N_ELEMENTS( aDPIArray ) - 1 ) ) ] ); + (sal_uInt16)( (sizeof (aDPIArray) / sizeof (aDPIArray[0])) - 1 ) ) ] ); pCurrentOptions->SetReducedBitmapIncludesTransparency( aReduceBitmapsTransparencyCB.IsChecked() ); pCurrentOptions->SetConvertToGreyscales( aConvertToGreyscalesCB.IsChecked() ); } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index c8f7f271868f..200de3942c84 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -438,7 +438,7 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo }; ::comphelper::NamedValueCollection aViewArgs; - for ( size_t i=0; i < SAL_N_ELEMENTS( pKnownViewArgs ); ++i ) + for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i ) { if ( io_rDescriptor.has( pKnownViewArgs[i] ) ) { diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx index 8b1782414d49..544f40dcbd4e 100644 --- a/shell/source/backends/gconfbe/gconfaccess.cxx +++ b/shell/source/backends/gconfbe/gconfaccess.cxx @@ -812,7 +812,8 @@ ConfigurationValue const ConfigurationValues[] = #endif // ENABLE_LOCKDOWN }; -std::size_t const nConfigurationValues = SAL_N_ELEMENTS(ConfigurationValues); +std::size_t const nConfigurationValues = + sizeof ConfigurationValues / sizeof ConfigurationValues[0]; css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data) { diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx index bce143baf016..b37d19adc460 100644 --- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx +++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx @@ -54,7 +54,7 @@ namespace /* private */ {{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT},VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"} }; - size_t ColumnInfoTableSize = SAL_N_ELEMENTS(ColumnInfoTable); + size_t ColumnInfoTableSize = sizeof(ColumnInfoTable)/sizeof(ColumnInfoTable[0]); } //---------------------------- diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index 3d7e60b4abfc..c9ea9b33f799 100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -70,7 +70,7 @@ PROPERTYMAP g_rgPROPERTYMAP[] = { PKEY_Comment, L"LibreOffice", L"Comments" }, }; -size_t gPropertyMapTableSize = SAL_N_ELEMENTS(g_rgPROPERTYMAP); +size_t gPropertyMapTableSize = sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]); //---------------------------- diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx index e097018f660f..60d0e7f92145 100644 --- a/shell/source/win32/shlxthandler/util/fileextensions.cxx +++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx @@ -66,7 +66,7 @@ FileExtensionEntry OOFileExtensionTable[] = { }; -size_t OOFileExtensionTableSize = SAL_N_ELEMENTS(OOFileExtensionTable); +size_t OOFileExtensionTableSize = sizeof(OOFileExtensionTable)/sizeof(OOFileExtensionTable[0]); //--------------------------------- /** Return the extension of a file diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index c7f623dbd541..867dc54638c6 100644 --- a/shell/source/win32/simplemail/senddoc.cxx +++ b/shell/source/win32/simplemail/senddoc.cxx @@ -200,7 +200,7 @@ const char* KnownParameter[] = "--mapi-logon-ui" }; -const size_t nKnownParameter = (SAL_N_ELEMENTS(KnownParameter)); +const size_t nKnownParameter = (sizeof(KnownParameter)/sizeof(KnownParameter[0])); /** @internal */ bool isKnownParameter(const char* aParameterName) diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 0ead6fa9755c..e098381db132 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -1824,7 +1824,7 @@ void BrokenRecoveryDialog::impl_askForSavePath() } // loop through all the other windows and adjust their size - for ( ; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { Size aSize = (*pCurrent)->GetSizePixel(); aSize.Width() -= nDelta; @@ -1895,7 +1895,7 @@ void BrokenRecoveryDialog::impl_askForSavePath() &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { Point aPos = (*pCurrent)->GetPosPixel(); aPos.Y() -= nDelta; diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 0a0fb37fe89f..eaaa637d759c 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -842,7 +842,7 @@ void SvxSearchDialog::CalculateDelta_Impl() if ( nOffset > 0 ) { long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height(); - for ( i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { if ( ( bCalcApp && i < nCalcCtrlCount ) || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() ) diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index d1c6efcc8d1c..4baebc946f65 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1694,7 +1694,7 @@ void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); Property aPropDesc; const ::rtl::OUString* pProps = aPropsListenedTo; - const ::rtl::OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo ); + const ::rtl::OUString* pPropsEnd = pProps + sizeof( aPropsListenedTo ) / sizeof( aPropsListenedTo[ 0 ] ); for (; pProps != pPropsEnd; ++pProps) { if ( xInfo->hasPropertyByName( *pProps ) ) @@ -1717,7 +1717,7 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol) }; Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); - for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(aPropsListenedTo); ++i) + for (sal_uInt16 i=0; i<sizeof(aPropsListenedTo)/sizeof(aPropsListenedTo[0]); ++i) if (xInfo->hasPropertyByName(aPropsListenedTo[i])) xCol->removePropertyChangeListener(aPropsListenedTo[i], this); } @@ -2763,7 +2763,7 @@ Sequence<sal_uInt16>& FmXGridPeer::getSupportedGridSlots() DbGridControl::NavigationBar::RECORD_NEW, SID_FM_RECORD_UNDO }; - aSupported.realloc(SAL_N_ELEMENTS(nSupported)); + aSupported.realloc(sizeof(nSupported)/sizeof(nSupported[0])); sal_uInt16* pSupported = aSupported.getArray(); for (sal_uInt16 i=0; i<aSupported.getLength(); ++i, ++pSupported) *pSupported = nSupported[i]; @@ -2785,7 +2785,7 @@ Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs() FMURL_RECORD_MOVETONEW, FMURL_RECORD_UNDO }; - aSupported.realloc(SAL_N_ELEMENTS(sSupported)); + aSupported.realloc(sizeof(sSupported)/sizeof(sSupported[0])); ::com::sun::star::util::URL* pSupported = aSupported.getArray(); sal_uInt16 i; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index f588de5aa94f..bd3bf23abbdd 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -733,7 +733,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if ( ( _eInitWhat & InitWritingMode ) != 0 ) { - for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i ) + for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) { if ( pWindows[i] ) pWindows[i]->EnableRTL( rParent.IsRTLEnabled() ); @@ -742,7 +742,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if ( ( _eInitWhat & InitFont ) != 0 ) { - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { if ( !pWindows[i] ) continue; @@ -774,7 +774,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni sal_Bool bTextLineColor = rParent.IsTextLineColor(); Color aTextLineColor( rParent.GetTextLineColor() ); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { if ( pWindows[i] ) { @@ -795,7 +795,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if (rParent.IsControlBackground()) { Color aColor( rParent.GetControlBackground()); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { if ( pWindows[i] ) { diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 10b940a7a980..9a5b5bb1cc2a 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -773,7 +773,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) case STATE_CHANGE_MIRRORING: { sal_Bool bIsRTLEnabled = IsRTLEnabled(); - for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i ) + for ( size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i ) pWindows[i]->EnableRTL( bIsRTLEnabled ); } break; @@ -787,7 +787,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { pWindows[i]->SetZoom(aZoom); pWindows[i]->SetZoomedPointFont(aFont); diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx index 1c7a03174cc7..0223e18b9a1a 100644 --- a/svx/source/form/ParseContext.cxx +++ b/svx/source/form/ParseContext.cxx @@ -148,7 +148,7 @@ IParseContext::InternationalKeyCode OSystemParseContext::getIntlKeyCode(const :: KEY_COLLECT, KEY_FUSION, KEY_INTERSECTION }; - sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID ); + sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0]; for (sal_uInt32 i = 0; i < nCount; i++) { ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index bf0710c3770e..ac70be037e9f 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -2902,7 +2902,7 @@ namespace svxform &m_aCalculateBtn }; Window** pCurrent = pWinsForHide; - for ( ; i < SAL_N_ELEMENTS( pWinsForHide ); ++i, ++pCurrent ) + for ( ; i < sizeof( pWinsForHide ) / sizeof( pWinsForHide[ 0 ] ); ++i, ++pCurrent ) (*pCurrent)->Hide(); Window* pWinsForMove[] = @@ -2910,7 +2910,7 @@ namespace svxform &m_aButtonsFL, &m_aOKBtn, &m_aEscBtn, &m_aHelpBtn }; pCurrent = pWinsForMove; - for ( i = 0; i < SAL_N_ELEMENTS( pWinsForMove ); ++i, ++pCurrent ) + for ( i = 0; i < sizeof( pWinsForMove ) / sizeof( pWinsForMove[ 0 ] ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index a355e819e56d..b55fbdc15a9a 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -300,7 +300,7 @@ FmPropBrw::~FmPropBrw() , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ) }; - for ( size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i ) + for ( size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i ) xName->removeByName( pProps[i] ); } } @@ -586,7 +586,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell ) ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ), makeAny( xControlMap ) ) }; m_xInspectorContext.set( - ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), + ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xOwnContext ) ); bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB ); diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index 13882b6268bb..b6fd672233f2 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -86,7 +86,7 @@ using namespace ::svxform; FM_SUN_COMPONENT_IMAGECONTROL }; - static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); + static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] ); ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount ); ::rtl::OUString* pStrings = aSeq.getArray(); diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index 7b251b0568db..b6cc1fee03d5 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -201,7 +201,7 @@ sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView, INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3, INET_PROT_VIM, INET_PROT_LDAP }; - for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(s_aQuickHelpSupported); ++i) + for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i) if (s_aQuickHelpSupported[i] == aProtocol) { aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 648c8572bf9a..9326e6ae868d 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1104,7 +1104,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU )); ImageList aImageList( SVX_RES( RID_SVXIMGLIST_FMEXPL) ); - for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) + for ( size_t i = 0; i < sizeof (nConvertSlots) / sizeof (nConvertSlots[0]); ++i ) { // das entsprechende Image dran pNewMenu->SetItemImage(nConvertSlots[i], aImageList.GetImage(nCreateSlots[i])); @@ -1116,7 +1116,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() //------------------------------------------------------------------------------ bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId ) { - for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) + for ( size_t i = 0; i < sizeof (nConvertSlots) / sizeof (nConvertSlots[0]); ++i ) if (nConvertSlots[i] == nSlotId) return true; return false; @@ -1152,7 +1152,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent OSL_ENSURE( isSolelySelected( _rxObject ), "FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" ); - for ( size_t lookupSlot = 0; lookupSlot < SAL_N_ELEMENTS( nConvertSlots ); ++lookupSlot ) + for ( size_t lookupSlot = 0; lookupSlot < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++lookupSlot ) { if (nConvertSlots[lookupSlot] == _nSlotId) { @@ -1367,10 +1367,10 @@ bool FmXFormShell::canConvertCurrentSelectionToControl( sal_Int16 nConversionSlo ) return false; // those types cannot be converted - DBG_ASSERT(SAL_N_ELEMENTS(nConvertSlots) == SAL_N_ELEMENTS(nObjectTypes), + DBG_ASSERT(sizeof(nConvertSlots)/sizeof(nConvertSlots[0]) == sizeof(nObjectTypes)/sizeof(nObjectTypes[0]), "FmXFormShell::canConvertCurrentSelectionToControl: nConvertSlots & nObjectTypes must have the same size !"); - for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) + for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i ) if (nConvertSlots[i] == nConversionSlot) return nObjectTypes[i] != nObjectType; @@ -2111,7 +2111,7 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection ) impl_updateCurrentForm( xNewCurrentForm ); // ensure some slots are updated - for ( size_t i = 0; i < SAL_N_ELEMENTS( SelObjectSlotMap ); ++i ) + for ( size_t i = 0; i < sizeof( SelObjectSlotMap ) / sizeof( SelObjectSlotMap[0] ); ++i ) InvalidateSlot( SelObjectSlotMap[i], sal_False); return true; @@ -2151,7 +2151,7 @@ void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurFo pPage->GetImpl().setCurForm( m_xCurrentForm ); // ensure the UI which depends on the current form is up-to-date - for ( size_t i = 0; i < SAL_N_ELEMENTS( DlgSlotMap ); ++i ) + for ( size_t i = 0; i < sizeof( DlgSlotMap ) / sizeof( DlgSlotMap[0] ); ++i ) InvalidateSlot( DlgSlotMap[i], sal_False ); } diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 9c8d9658fb22..72834cee1fd4 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -571,8 +571,8 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt) FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME, FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE }; - sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties); - OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps, + sal_Int32 nDefaultValueProps = sizeof(pDefaultValueProperties)/sizeof(pDefaultValueProperties[0]); + OSL_ENSURE(sizeof(aValueProperties)/sizeof(aValueProperties[0]) == nDefaultValueProps, "FmXUndoEnvironment::propertyChange: inconsistence!"); for (sal_Int32 i=0; i<nDefaultValueProps; ++i) { diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx index 35e87b547ce1..b3ed12601c6b 100644 --- a/svx/source/form/formcontrolling.cxx +++ b/svx/source/form/formcontrolling.cxx @@ -120,7 +120,7 @@ namespace svx { FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter }, { FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort } }; - for ( size_t i=0; i < SAL_N_ELEMENTS(aDescriptions); ++i ) + for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i ) s_aFeatureDescriptions.push_back( aDescriptions[i] ); } }; @@ -468,7 +468,7 @@ namespace svx SID_FM_FILTER_START, SID_FM_VIEW_AS_GRID }; - sal_Int32 nFeatureCount = SAL_N_ELEMENTS( pSupportedFeatures ); + sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] ); aSupportedFeatures.resize( nFeatureCount ); ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() ); diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index c46967269c38..41a813c48757 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -880,7 +880,7 @@ namespace { { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG }, { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG }, }; - for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++) + for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++) aImpl[rtl::OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id; bInited = true; } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index dac1972dfeb1..68d9edefdf96 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -543,7 +543,7 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con const rtl::OString aExt(rtl::OUStringToOString(rFileName.Copy(rFileName.Len() - 3), RTL_TEXTENCODING_ASCII_US)); - for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ ) + for( long i = 0, nCount = sizeof (aMapper) / sizeof (aMapper[0]); ( i < nCount ) && !aMimeType.Len(); i++ ) if( aExt.getStr() == aMapper[ i ].pExt ) aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US ); } diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index 5138eabf5dc6..1d05a2197426 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -635,7 +635,7 @@ namespace ucb { namespace ucp { namespace ext PropertyAttribute::BOUND | PropertyAttribute::READONLY ) }; - return Sequence< Property >( aProperties, SAL_N_ELEMENTS( aProperties )); + return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index 8b0ff7d918b2..fbaf0f198c4a 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -1258,7 +1258,7 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) }; - const int nProps = SAL_N_ELEMENTS(aGenericProperties); + const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]); return uno::Sequence< beans::Property > ( aGenericProperties, nProps ); } @@ -1300,7 +1300,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) ) }; - const int nProps = SAL_N_ELEMENTS(aCommandInfoTable); + const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]); return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2); } diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx index cb1bb50dea5e..7b0605a1cd33 100644 --- a/ucb/source/ucp/gvfs/gvfs_content.cxx +++ b/ucb/source/ucp/gvfs/gvfs_content.cxx @@ -1352,7 +1352,7 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) }; - const int nProps = SAL_N_ELEMENTS(aGenericProperties); + const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]); return uno::Sequence< beans::Property > ( aGenericProperties, nProps ); @@ -1396,7 +1396,8 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) ) }; - const int nProps = SAL_N_ELEMENTS( aCommandInfoTable ); + const int nProps + = sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] ); return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 ); } diff --git a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx index 5d7c4fbf8f2f..f8bca868a62d 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx @@ -77,10 +77,10 @@ using namespace hierarchy_ucp; //========================================================================= #define MAKEPROPSEQUENCE( a ) \ - uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) #define MAKECMDSEQUENCE( a ) \ - uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) //========================================================================= // diff --git a/ucb/source/ucp/package/pkgcontentcaps.cxx b/ucb/source/ucp/package/pkgcontentcaps.cxx index 02af0829f6ea..5eff46a369c6 100644 --- a/ucb/source/ucp/package/pkgcontentcaps.cxx +++ b/ucb/source/ucp/package/pkgcontentcaps.cxx @@ -78,10 +78,10 @@ using namespace package_ucp; //========================================================================= #define MAKEPROPSEQUENCE( a ) \ - uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) #define MAKECMDSEQUENCE( a ) \ - uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) //========================================================================= // diff --git a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx index 7f8e49a0b3c2..90d5cc13c50c 100644 --- a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx +++ b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx @@ -87,10 +87,10 @@ using namespace tdoc_ucp; //========================================================================= #define MAKEPROPSEQUENCE( a ) \ - uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< beans::Property >( a, (sizeof (a) / sizeof (a[0])) ) #define MAKECMDSEQUENCE( a ) \ - uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) ) + uno::Sequence< ucb::CommandInfo >( a, (sizeof (a) / sizeof (a[0])) ) //========================================================================= // diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx index 352d0b354f6b..5874cb9c6063 100644 --- a/uui/source/masterpasscrtdlg.cxx +++ b/uui/source/masterpasscrtdlg.cxx @@ -126,7 +126,7 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog aFTMasterPasswordWarning.SetPosSizePixel( aFTMasterPasswordWarning.GetPosPixel(), aNewWarningSize ); Window* pControls[] = { &aFL, &aOKBtn, &aCancelBtn, &aHelpBtn }; - const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls ); + const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] ); for ( int i = 0; i < nCCount; ++i ) { Point aNewPos =(*pControls[i]).GetPosPixel(); @@ -149,7 +149,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight() &aFTMasterPasswordRepeat, &aEDMasterPasswordRepeat, &aFTCautionText, &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn }; Window** pWindow = pWins; - const sal_Int32 nCount = SAL_N_ELEMENTS( pWins ); + const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] ); for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow ) { Point aNewPos = (*pWindow)->GetPosPixel(); @@ -168,7 +168,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight() nDelta += nTemp; Window* pWins[] = { &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn }; Window** pWindow = pWins; - const sal_Int32 nCount = SAL_N_ELEMENTS( pWins ); + const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] ); for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow ) { Point aNewPos = (*pWindow)->GetPosPixel(); diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx index 39531ae6f3c8..be18ad6e932f 100644 --- a/uui/source/secmacrowarnings.cxx +++ b/uui/source/secmacrowarnings.cxx @@ -226,7 +226,7 @@ void MacroWarning::InitControls() &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; @@ -324,7 +324,7 @@ void MacroWarning::FitControls() &maDescr2FI, &maAlwaysTrustCB, &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 195ee5e481e9..ecf1e50d2200 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -339,7 +339,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con // handle the arguments const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 }; - int nArg = SAL_N_ELEMENTS( aArgsPtrArray ); + int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] ); uno::Sequence< uno::Any > aArgs( nArg ); const uno::Any** pArg = aArgsPtrArray; diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx index 615c6f53d7e8..8e08ecb5b96f 100644 --- a/vbahelper/source/vbahelper/vbaglobalbase.cxx +++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx @@ -63,7 +63,9 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s }; // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and // some strange behavior - mxContext = ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), NULL ); + mxContext = ::cppu::createComponentContext( + aHandlerContextInfo, + ( sizeof ( aHandlerContextInfo ) / sizeof ( aHandlerContextInfo[0] ) ), NULL ); if ( aSrvMgr.is() ) { try @@ -161,7 +163,7 @@ VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException) // common ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ), }; - static uno::Sequence< rtl::OUString > serviceNames( names, SAL_N_ELEMENTS( names ) ); + static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) ); return serviceNames; } diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 90e46e3c49a5..6240b0c2d232 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3186,7 +3186,7 @@ namespace xmloff { namespace token { #endif DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" ); DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" ); - DBG_ASSERT(sal_uInt16(eToken) < SAL_N_ELEMENTS(aTokenList),"Illegal position!"); + DBG_ASSERT(sal_uInt16(eToken) < sizeof(aTokenList)/sizeof(aTokenList[0]),"Illegal position!"); XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken]; if (!pToken->pOUString) diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index de85ccfe1e42..06ad07bb9189 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -587,10 +587,11 @@ namespace xmloff { PROPERTY_LABEL, PROPERTY_TITLE }; - OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds), + OSL_ENSURE( sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) == + sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!"); - for (i=0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i) + for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i) if (nStringPropertyAttributeIds[i] & m_nIncludeCommon) { exportStringPropertyAttribute( @@ -621,13 +622,13 @@ namespace xmloff BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE }; #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); - sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags); + sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); + sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!"); #endif - for (i=0; i < SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i) + for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i) if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon) { exportBooleanPropertyAttribute( @@ -664,13 +665,13 @@ namespace xmloff exportedProperty(PROPERTY_MAXTEXTLENGTH); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); - sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults); + sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]); + sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]); + sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!"); #endif - for (i=0; i < SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i) + for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i) if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon) { exportInt16PropertyAttribute( @@ -1019,9 +1020,9 @@ namespace xmloff PROPERTY_STRICTFORMAT, PROPERTY_MULTILINE, PROPERTY_AUTOCOMPLETE, PROPERTY_MULTISELECTION, PROPERTY_DEFAULTBUTTON, PROPERTY_TRISTATE, PROPERTY_TOGGLE, PROPERTY_FOCUS_ON_CLICK }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); + sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); OSL_ENSURE((nIdCount == nNameCount), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!"); #endif @@ -1060,12 +1061,12 @@ namespace xmloff 10 }; - sal_Int32 nIdCount = SAL_N_ELEMENTS( nIntegerPropertyAttributeIds ); + sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] ); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS( pIntegerPropertyNames ); + sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] ); OSL_ENSURE( ( nIdCount == nNameCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" ); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS( nIntegerPropertyAttrDefaults ); + sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] ); OSL_ENSURE( ( nIdCount == nDefaultCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" ); #endif @@ -1211,9 +1212,9 @@ namespace xmloff PROPERTY_GROUP_NAME }; - sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds ); + sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] ); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS( pStringPropertyNames ); + sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] ); OSL_ENSURE( ( nIdCount == nNameCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" ); #endif @@ -2175,9 +2176,9 @@ namespace xmloff { PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds); + sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames); + sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]); OSL_ENSURE((nIdCount == nNameCount), "OFormExport::exportAttributes: somebody tampered with the maps (1)!"); #endif @@ -2224,10 +2225,10 @@ namespace xmloff { BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds); + sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); - sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); + sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount), "OFormExport::exportAttributes: somebody tampered with the maps (2)!"); #endif @@ -2263,12 +2264,12 @@ namespace xmloff { sal_False, sal_False, sal_False, sal_False, sal_True }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds); + sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults); - sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags); - sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps); + sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]); + sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]); + sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]); + sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount), "OFormExport::exportAttributes: somebody tampered with the maps (3)!"); #endif |