diff options
author | Kayo Hamid <revol.code@yahoo.com> | 2010-10-09 22:17:25 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-09 22:17:25 -0500 |
commit | d7f4b5a0fc1033b314b59e8b20efc6a06b1f8049 (patch) | |
tree | 7e50a26a7c8197db131c99af0723445de61f0c2d /dbaccess | |
parent | fa482813b4fadcde61410e8981fa011985c8b4c1 (diff) |
Use SAL_N_ELEMENTS macro
Diffstat (limited to 'dbaccess')
36 files changed, 75 insertions, 58 deletions
diff --git a/dbaccess/inc/dataview.hxx b/dbaccess/inc/dataview.hxx index 135866bec980..1c3b1c2ac259 100644 --- a/dbaccess/inc/dataview.hxx +++ b/dbaccess/inc/dataview.hxx @@ -30,6 +30,7 @@ #include <vcl/window.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <svtools/acceleratorexecute.hxx> +#include <sal/macros.h> #include <memory> #include "dbaccessdllapi.h" diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 151ef19039fc..f7342fc63e14 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1728,7 +1728,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL, PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT }; - for ( size_t i=0; i<sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i ) { if ( xInfo->hasPropertyByName( aPropertyNames[i] ) ) { diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx index a88879ca5eb8..ab91b7183d44 100644 --- a/dbaccess/source/core/api/columnsettings.cxx +++ b/dbaccess/source/core/api/columnsettings.cxx @@ -38,6 +38,7 @@ #include <comphelper/property.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> //........................................................................ namespace dbaccess @@ -163,7 +164,7 @@ namespace dbaccess { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) if ( !isDefaulted( aProps[i].nHandle, _rxColumn->getPropertyValue( aProps[i].sName ) ) ) diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 4620abd661f3..53886c346389 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -44,6 +44,7 @@ #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -230,7 +231,7 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME }, { PROPERTY_REALNAME, PROPERTY_ID_REALNAME } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _rxParserColumn->getPropertyValue( aProps[i].sName ) ); diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index e2e79e2809dc..fa74fe1cbcc7 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -372,7 +372,7 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons , ::rtl::OUString(PROPERTY_ROW_HEIGHT), ::rtl::OUString(PROPERTY_TEXTCOLOR) , ::rtl::OUString(PROPERTY_TEXTLINECOLOR), ::rtl::OUString(PROPERTY_TEXTEMPHASIS) , ::rtl::OUString(PROPERTY_TEXTRELIEF) }; - Sequence< ::rtl::OUString> aNames(s_pTableProps,sizeof(s_pTableProps)/sizeof(s_pTableProps[0])); + Sequence< ::rtl::OUString> aNames(s_pTableProps,SAL_N_ELEMENTS(s_pTableProps)); if ( bModified || !lcl_isPropertySetDefaulted(aNames,xTableDefinition) ) ::dbaccess::notifyDataSourceModified(m_xTableDefinitions,sal_True); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 75f40171e41a..ca9c4e735db9 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -89,6 +89,7 @@ #include <connectivity/dbtools.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +#include <sal/macros.h> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include "core_resource.hxx" #include "core_resource.hrc" @@ -1561,7 +1562,7 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property { "RecoveryStorage" }; - for ( size_t i=0; i < sizeof( pObjectDescriptorArgs ) / sizeof( pObjectDescriptorArgs[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pObjectDescriptorArgs ); ++i ) { if ( aOpenCommandArguments.has( pObjectDescriptorArgs[i] ) ) { diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx index 3730134a58e9..f191eee4b345 100644 --- a/dbaccess/source/core/inc/core_resource.hxx +++ b/dbaccess/source/core/inc/core_resource.hxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <osl/mutex.hxx> +#include <sal/macros.h> class ResMgr; //......................................................................... diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 802e052297f9..b07c86cfe39c 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -35,6 +35,7 @@ #include <connectivity/dbtools.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> +#include <sal/macros.h> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp> @@ -758,7 +759,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat { aRowLabels.push_back(::rtl::OUString::valueOf(h+1)); ::std::vector< double > aRow; - const sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]); + const sal_Int32 nSize = SAL_N_ELEMENTS(fDefaultData); for (sal_Int32 j = 0; j < (nCount-1); ++j,++k) { if ( k >= nSize ) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b21707cb3add..fc12f1a9d889 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" +#include <sal/macros.h> + #include "dsntypes.hxx" #include "dbamiscres.hrc" #include <unotools/confignode.hxx> @@ -440,7 +442,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const KnownPrefix( "sdbc:address:macab", DST_MACAB, true ) }; - for ( size_t i=0; i < sizeof( aKnowPrefixes ) / sizeof( aKnowPrefixes[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aKnowPrefixes ); ++i ) { USHORT nMatchLen = aKnowPrefixes[i].bMatchComplete ? sDsn.Len() : (USHORT)rtl_str_getLength( aKnowPrefixes[i].pAsciiPrefix ); if ( sDsn.EqualsIgnoreCaseAscii( aKnowPrefixes[i].pAsciiPrefix, 0, nMatchLen ) ) diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index 6f31f17682fd..8ac25ac01f10 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -48,6 +48,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> #include <algorithm> @@ -357,7 +358,7 @@ namespace dbaccess // read the map from sub storages to object names MapCompTypeToCompDescs aMapCompDescs; SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; - for ( size_t i = 0; i < sizeof( aKnownTypes ) / sizeof( aKnownTypes[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aKnownTypes ); ++i ) { if ( !xRecoveryStorage->hasByName( SubComponentRecovery::getComponentsStorageName( aKnownTypes[i] ) ) ) continue; diff --git a/dbaccess/source/ext/macromigration/dbmm_types.hxx b/dbaccess/source/ext/macromigration/dbmm_types.hxx index 49f5de86a98b..99639cd13417 100644 --- a/dbaccess/source/ext/macromigration/dbmm_types.hxx +++ b/dbaccess/source/ext/macromigration/dbmm_types.hxx @@ -29,6 +29,7 @@ #define DBACCESS_DBMM_TYPES_HXX #include <tools/string.hxx> +#include <sal/macros.h> //........................................................................ namespace dbmm diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 5dd3129452fd..7f5b7ab4241f 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -241,7 +241,7 @@ namespace dbmm LanguageMapping( "Python", ePython ), // TODO: is this correct? LanguageMapping( "Basic", eBasic ) }; - for ( size_t i=0; i < sizeof( aLanguageMapping ) / sizeof( aLanguageMapping[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aLanguageMapping ); ++i ) { if ( _rLanguage.equalsAscii( aLanguageMapping[i].pAsciiLanguage ) ) { @@ -1305,7 +1305,7 @@ namespace dbmm ScriptType aKnownStorageBasedTypes[] = { eBeanShell, eJavaScript, ePython, eJava }; - for ( size_t i=0; i<sizeof( aKnownStorageBasedTypes ) / sizeof( aKnownStorageBasedTypes[0] ); ++i ) + for ( size_t i=0; i< SAL_N_ELEMENTS( aKnownStorageBasedTypes ); ++i ) aElementNames.erase( lcl_getScriptsSubStorageName( aKnownStorageBasedTypes[i] ) ); if ( !aElementNames.empty() ) diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 9782ef9fb0d3..94969325dcbe 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -59,6 +59,7 @@ #include <tools/diagnose_ex.h> #include <connectivity/DriversConfig.hxx> #include <connectivity/dbtools.hxx> +#include <sal/macros.h> #include <boost/optional.hpp> @@ -370,7 +371,7 @@ void ODBExport::exportDataSource() }; bool bIsXMLDefault = false; - for ( size_t i=0; i < sizeof( aTokens ) / sizeof( aTokens[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aTokens ); ++i ) { if ( pProperties->Name == aTokens[i].sPropertyName ) { @@ -504,7 +505,7 @@ void ODBExport::exportApplicationConnectionSettings(const TSettingsMap& _aSettin ,XML_MAX_ROW_COUNT ,XML_SUPPRESS_VERSION_COLUMNS }; - for (size_t i = 0; i< sizeof(pSettings)/sizeof(pSettings[0]); ++i) + for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) { TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); if ( aFind != _aSettings.end() ) @@ -537,7 +538,7 @@ void ODBExport::exportDriverSettings(const TSettingsMap& _aSettings) ,XML_IS_FIRST_ROW_HEADER_LINE ,XML_PARAMETER_NAME_SUBSTITUTION }; - for (size_t i = 0; i< sizeof(pSettings)/sizeof(pSettings[0]); ++i) + for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) { TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); if ( aFind != _aSettings.end() ) @@ -640,7 +641,7 @@ void ODBExport::exportConnectionData() }; for ( size_t i=0; - i < sizeof( aProperties ) / sizeof( aProperties[0] ); + i < SAL_N_ELEMENTS( aProperties ); ++i ) { @@ -1160,7 +1161,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) }; ::std::vector< XMLPropertyState > aPropertyStates; - for (size_t i = 0 ; i < sizeof(pExportHelper)/sizeof(pExportHelper[0]); ++i) + for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) { aPropertyStates = pExportHelper[i].first->Filter(_xProp); if ( !aPropertyStates.empty() ) @@ -1204,7 +1205,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_COLUMN )) ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) }; - for (size_t i = 0 ; i < sizeof(pExportHelper)/sizeof(pExportHelper[0]); ++i) + for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) { ::std::vector< XMLPropertyState > aPropStates = pExportHelper[i].first->Filter( _xProp ); if ( !aPropStates.empty() ) diff --git a/dbaccess/source/sdbtools/connection/tablename.cxx b/dbaccess/source/sdbtools/connection/tablename.cxx index aedc62451300..a9d1106777e3 100644 --- a/dbaccess/source/sdbtools/connection/tablename.cxx +++ b/dbaccess/source/sdbtools/connection/tablename.cxx @@ -42,6 +42,7 @@ #include <connectivity/dbtools.hxx> #include <tools/diagnose_ex.h> #include <tools/string.hxx> +#include <sal/macros.h> //........................................................................ namespace sdbtools @@ -232,7 +233,7 @@ namespace sdbtools bool found = false; size_t i = 0; - for ( ; ( i < sizeof( TypeTable ) / sizeof( TypeTable[0] ) ) && !found; ++i ) + for ( ; ( i < SAL_N_ELEMENTS( TypeTable ) ) && !found; ++i ) if ( TypeTable[i].nCompositionType == _nType ) found = true; if ( !found ) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index ac064a7611fe..b7a70151c269 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1247,7 +1247,7 @@ IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/) , SID_DB_APP_VIEW_DOCINFO_PREVIEW }; - for(size_t i=0; i < sizeof(pActions)/sizeof(pActions[0]);++i) + for(size_t i=0; i < SAL_N_ELEMENTS(pActions);++i) { aMenu->CheckItem(pActions[i],m_aMenu->IsItemChecked(pActions[i])); } diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index 15bbf54f1dc1..5902f1f8da65 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -62,7 +62,7 @@ OApplicationIconControl::OApplicationIconControl(Window* _pParent) { RID_STR_FORMS_CONTAINER, E_FORM, IMG_FORMFOLDER_TREE_L, IMG_FORMFOLDER_TREE_LHC }, { RID_STR_REPORTS_CONTAINER, E_REPORT, IMG_REPORTFOLDER_TREE_L,IMG_REPORTFOLDER_TREE_LHC } }; - for ( size_t i=0; i < sizeof(aCategories)/sizeof(aCategories[0]); ++i) + for ( size_t i=0; i < SAL_N_ELEMENTS(aCategories); ++i) { SvxIconChoiceCtrlEntry* pEntry = InsertEntry( String( ModuleRes( aCategories[i].nLabelResId ) ), diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index 2b4feb558016..2e2f07f7a1ed 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -52,7 +52,7 @@ OTitleWindow::OTitleWindow(Window* _pParent,USHORT _nTitleId,WinBits _nBits,BOOL ImplInitSettings( sal_True, sal_True, sal_True ); Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle }; - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) pWindows[i]->Show(); } // ----------------------------------------------------------------------------- @@ -166,7 +166,7 @@ void OTitleWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_B Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle}; - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { Font aFont = pWindows[i]->GetFont(); aFont.SetWeight(WEIGHT_BOLD); diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 69130da08609..81d9f82b5f04 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -59,6 +59,7 @@ #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <vcl/svapp.hxx> +#include <sal/macros.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -216,7 +217,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: Reference< XController2 > xController; const ::rtl::OUString sComponentURL( aParser.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - for ( size_t i=0; i < sizeof( aImplementations ) / sizeof( aImplementations[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aImplementations ); ++i ) { if ( sComponentURL.equalsAscii( aImplementations[i].pAsciiServiceName ) ) { diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 70efc10c2b36..0cd38e5609d7 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -51,6 +51,7 @@ #include "UITools.hxx" #include "commontypes.hxx" +#include <sal/macros.h> #include <vcl/waitobj.hxx> #include <tools/urlobj.hxx> #include <svl/urihelper.hxx> @@ -1248,11 +1249,11 @@ namespace "com.sun.star.formula.FormularProperties", "smath", "com.sun.star.chart.ChartDocument", "schart" }; - OSL_ENSURE( ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) % 2 == 0, + OSL_ENSURE( ( SAL_N_ELEMENTS( pTransTable ) ) % 2 == 0, "lcl_getModuleHelpModuleName: odd size of translation table!" ); // loop through the table - sal_Int32 nTableEntries = ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) / 2; + sal_Int32 nTableEntries = ( SAL_N_ELEMENTS( pTransTable ) ) / 2; const sal_Char** pDocumentService = pTransTable; const sal_Char** pHelpModuleName = pTransTable + 1; for ( sal_Int32 j=0; j<nTableEntries; ++j ) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index c65055c582fc..9c746e2edf6b 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1194,7 +1194,7 @@ void SbaTableQueryBrowser::connectExternalDispatches() ID_BROWSER_INSERTCONTENT }; - for ( size_t i=0; i < sizeof( pURLs ) / sizeof( pURLs[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i ) { URL aURL; aURL.Complete = ::rtl::OUString::createFromAscii( pURLs[i] ); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index ded53304db14..51145c36a097 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -366,7 +366,7 @@ void OFieldDescControl::CheckScrollBars() // horizontal : long lMaxXPosition = 0; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) getMaxXPosition(ppAggregates[i],lMaxXPosition); if (m_pHorzScroll) @@ -484,9 +484,9 @@ void OFieldDescControl::ScrollAllAggregates() , pTextLenText, pLengthText , pScaleText, m_pColumnNameText , m_pTypeText, m_pAutoIncrementValueText}; - OSL_ENSURE(sizeof(ppAggregates)/sizeof(ppAggregates[0]) == sizeof(ppAggregatesText)/sizeof(ppAggregatesText[0]),"Lists are not identical!"); + OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!"); - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) ScrollAggregate(ppAggregatesText[i],ppAggregates[i],NULL,nDeltaX, nDeltaY); ScrollAggregate(pFormatText,pFormatSample,pFormat,nDeltaX, nDeltaY); @@ -498,7 +498,7 @@ sal_uInt16 OFieldDescControl::CountActiveAggregates() const { Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; sal_uInt16 nVisibleAggregates = 0; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) if (ppAggregates[i]) ++nVisibleAggregates; return nVisibleAggregates; @@ -508,7 +508,7 @@ sal_Int32 OFieldDescControl::GetMaxControlHeight() const { Size aHeight; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) { if ( ppAggregates[i] ) { @@ -539,9 +539,9 @@ void OFieldDescControl::SetReadOnly( sal_Bool bReadOnly ) , m_pTypeText, m_pAutoIncrementValueText , pFormatText}; - OSL_ENSURE(sizeof(ppAggregates)/sizeof(ppAggregates[0]) == sizeof(ppAggregatesText)/sizeof(ppAggregatesText[0]),"Lists are not identical!"); + OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!"); - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) { if ( ppAggregatesText[i] ) ppAggregatesText[i]->Enable( !bReadOnly ); @@ -833,7 +833,7 @@ void OFieldDescControl::ArrangeAggregates() }; long nMaxWidth = 0; - for (size_t i=0; i<sizeof(adAggregates)/sizeof(adAggregates[0]); i++) + for (size_t i=0; i < SAL_N_ELEMENTS(adAggregates); i++) { if (adAggregates[i].pctrlTextControl) { @@ -846,7 +846,7 @@ void OFieldDescControl::ArrangeAggregates() // und los ... int nCurrentControlPos = 0; Control* pZOrderPredecessor = NULL; - for (size_t i=0; i<sizeof(adAggregates)/sizeof(adAggregates[0]); i++) + for (size_t i=0; i < SAL_N_ELEMENTS(adAggregates); i++) { if (adAggregates[i].pctrlInputControl) { diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index c5074d7f0c6c..6169b95d5523 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -202,7 +202,7 @@ namespace dbaui //{ // String sDisplayName = m_pCollection->getTypeDisplayName(m_eType); // FixedText* ppTextControls[] ={&m_aFT_Connection}; - // for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i) + // for (size_t i = 0; i < SAL_N_ELEMENTS(ppTextControls); ++i) // { // ppTextControls[i]->SetText(sDisplayName); // } diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index f993c8ce0e32..52a20a787551 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -899,7 +899,7 @@ DBG_NAME(OFinalDBPageSetup) Point aPos(m_aFTFinalHeader.GetPosPixel()); Size aStart(m_aFTFinalHeader.GetSizePixel()); aPos.Y() += aStart.Height() + nUnrelatedHeight; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=0; i < nCount; ++i) { aPos.X() = pWindows[i].first->GetPosPixel().X(); diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 1c9ecf5bc948..0f8cf63aba08 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -152,7 +152,7 @@ DBG_NAME(OTextConnectionHelper) { 0, NULL } }; - for ( size_t section=0; section < sizeof( aSections ) / sizeof( aSections[0] ) - 1; ++section ) + for ( size_t section=0; section < SAL_N_ELEMENTS( aSections ) - 1; ++section ) { if ( ( m_nAvailableSections & aSections[section].nFlag ) != 0 ) { diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 1d5bb1cb167c..ec98bbf09176 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -475,7 +475,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0} }; - OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invalid Ids!"); + OSL_ENSURE(SAL_N_ELEMENTS(aItemInfos) == DSID_LAST_ITEM_ID,"Invalid Ids!"); _rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, aItemInfos, _rppDefaults); _rpPool->FreezeIdRanges(); diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index a9c3471ac782..735a8f13c167 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -113,7 +113,7 @@ namespace dbaui m_pAutoIncrementLabel, m_pAutoIncrement, m_pAutoRetrievingLabel, m_pAutoRetrieving }; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) { if ( pWindows[i] ) @@ -366,7 +366,7 @@ namespace dbaui ,m_pOptionsLabel,m_pOptions,&m_aUseCatalog }; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); } @@ -547,7 +547,7 @@ namespace dbaui &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver, m_pCharsetLabel, m_pCharset}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); @@ -679,7 +679,7 @@ namespace dbaui Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, &m_aPasswordRequired, m_pCharsetLabel, m_pCharset}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); @@ -819,7 +819,7 @@ namespace dbaui ,&m_CB_SHUTDB ,m_pCharsetLabel, m_pCharset,&m_PB_STAT}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); } diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx index 71763f91556e..4acbf1fe7cfd 100644 --- a/dbaccess/source/ui/dlg/dsselect.cxx +++ b/dbaccess/source/ui/dlg/dsselect.cxx @@ -34,6 +34,7 @@ #include <vcl/msgbox.hxx> #include "localresaccess.hxx" #include <tools/rcid.h> +#include <sal/macros.h> #include <com/sun/star/sdbcx/XCreateCatalog.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -99,7 +100,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB // move the buttons PushButton* pButtons[] = { &m_aOk, &m_aCancel, &m_aHelp ,&m_aCreateAdabasDB}; - for (size_t i=0; i<sizeof(pButtons)/sizeof(pButtons[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pButtons); ++i) { Point aOldPos = pButtons[i]->GetPosPixel(); pButtons[i]->SetPosPixel(Point(aOldPos.X() - nLostPixels, aOldPos.Y())); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 50658fb7811d..b65619916742 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -126,7 +126,7 @@ namespace dbaui &m_aTypePostLabel }; const long nOffset = m_aRB_OpenDocument.GetPosPixel().Y() - m_aRB_CreateDatabase.GetPosPixel().Y(); - for ( size_t i=0; i < sizeof( pWindowsToMove ) / sizeof( pWindowsToMove[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pWindowsToMove ); ++i ) { Point aPos( pWindowsToMove[i]->GetPosPixel() ); aPos.Y() -= nOffset; diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index fe8c886529d7..69b789556e00 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -28,6 +28,7 @@ #ifndef _DBAUI_DBADMIN_HXX_ #define _DBAUI_DBADMIN_HXX_ +#include <sal/macros.h> #include <sfx2/tabdlg.hxx> #include "dsntypes.hxx" #include "IItemSetHelper.hxx" diff --git a/dbaccess/source/ui/inc/moduledbu.hxx b/dbaccess/source/ui/inc/moduledbu.hxx index 143acf31631d..4ce94fec8f79 100644 --- a/dbaccess/source/ui/inc/moduledbu.hxx +++ b/dbaccess/source/ui/inc/moduledbu.hxx @@ -30,6 +30,7 @@ #include <osl/mutex.hxx> #include <tools/resid.hxx> +#include <sal/macros.h> class ResMgr; diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index f4ff8064181d..e8789f25468b 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -364,7 +364,7 @@ void ODatabaseExport::insertValueIntoColumn() ,NumberFormat::NUMBER ,NumberFormat::LOGICAL }; - for (size_t i = 0; i < sizeof(nFormats)/sizeof(nFormats[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(nFormats); ++i) { try { diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index b092fa750478..637a2d2c70cf 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1051,7 +1051,7 @@ sal_Bool callColumnFormatDialog(Window* _pParent, delete pFormatDescriptor; SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) delete pDefaults[i]; return bRet; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 4926a5f6aba6..267e8ba88bf1 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -167,7 +167,7 @@ void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObj const ::rtl::OUString aCopyProperties[] = { PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF }; - for ( size_t i=0; i < sizeof( aCopyProperties ) / sizeof( aCopyProperties[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aCopyProperties ); ++i ) { if ( m_xObjectPSI->hasPropertyByName( aCopyProperties[i] ) ) _rxObject->setPropertyValue( aCopyProperties[i], m_xObject->getPropertyValue( aCopyProperties[i] ) ); @@ -194,7 +194,7 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _ sStatement += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE 0=1")); - for ( i=0; i < sizeof( aProperties ) / sizeof( aProperties[0] ); ++i ) + for ( i=0; i < SAL_N_ELEMENTS( aProperties ); ++i ) { if ( m_xObjectPSI->hasPropertyByName( aProperties[i].first ) ) { diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 3860a84091d2..442fd556b320 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -211,12 +211,12 @@ void OSelectionBrowseBox::initialize() String sGroup = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount() - 1); m_aFunctionStrings = m_aFunctionStrings.GetToken(0); - for (size_t i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(eFunctions); ++i) { m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";")); m_aFunctionStrings += String(ByteString(rContext.getIntlKeywordAscii(eFunctions[i])),RTL_TEXTENCODING_UTF8); - } // for (sal_Int32 i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i) + } // for (sal_Int32 i = 0; i < SAL_N_ELEMENTS(eFunctions) ; ++i) m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";")); m_aFunctionStrings += sGroup; @@ -361,12 +361,12 @@ void OSelectionBrowseBox::Init() Size aHeight; const Control* pControls[] = { m_pTextCell,m_pVisibleCell,m_pTableCell,m_pFieldCell }; - for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i) + for(sal_Size i= 0; i < SAL_N_ELEMENTS(pControls);++i) { const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); - } // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i + } // for(int i= 0; i < SAL_N_ELEMENTS(pControls);++i SetDataRowHeight(aHeight.Height()); SetTitleLines(1); // Anzahl der sichtbaren Zeilen ermitteln @@ -2195,7 +2195,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const { sal_Int32 nErg(0); // only the first 11 row are interesting - sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + sal_Int32 nSize = SAL_N_ELEMENTS(nVisibleRowMask); for(sal_Int32 i=0;i<nSize;i++) { if(!m_bVisibleRow[i]) @@ -2207,7 +2207,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const void OSelectionBrowseBox::SetNoneVisbleRow(long nRows) { // only the first 11 row are interesting - sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + sal_Int32 nSize = SAL_N_ELEMENTS(nVisibleRowMask); for(sal_Int32 i=0;i< nSize;i++) m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]); } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 340399e144ae..5569f8a05c62 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -307,12 +307,12 @@ void OTableEditorCtrl::InitCellController() Size aHeight; const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell}; - for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i) + for(sal_Size i= 0; i < SAL_N_ELEMENTS(pControls);++i) { const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); - } // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i + } // for(int i= 0; i < SAL_N_ELEMENTS(pControls);++i SetDataRowHeight(aHeight.Height()); ClearModified(); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index be1cf5288b21..b7d5577ff6b6 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -746,7 +746,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X const ::rtl::OUString aSettings[] = { PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY }; - for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aSettings ); ++i ) { if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) { |