summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSet.cxx2
-rw-r--r--dbaccess/source/core/api/columnsettings.cxx4
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx4
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx6
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx4
-rw-r--r--dbaccess/source/ext/macromigration/migrationengine.cxx14
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx14
-rw-r--r--dbaccess/source/sdbtools/connection/tablename.cxx4
-rw-r--r--dbaccess/source/ui/app/AppController.cxx4
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx4
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx4
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx2
-rw-r--r--dbaccess/source/ui/browser/dbloader.cxx10
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx2
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx18
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.cxx2
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx4
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx2
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx7
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx2
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx2
23 files changed, 61 insertions, 60 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 8b1baa70590c..0e058ac78b0e 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1747,7 +1747,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS
OUString(PROPERTY_ALIGN), OUString(PROPERTY_RELATIVEPOSITION), OUString(PROPERTY_WIDTH), OUString(PROPERTY_HIDDEN), OUString(PROPERTY_CONTROLMODEL),
OUString(PROPERTY_HELPTEXT), OUString(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 9395b224ded7..87aba3e3e061 100644
--- a/dbaccess/source/core/api/columnsettings.cxx
+++ b/dbaccess/source/core/api/columnsettings.cxx
@@ -126,7 +126,7 @@ namespace dbaccess
OUString sName;
sal_Int32 nHandle;
};
- PropertyDescriptor aProps[] =
+ const PropertyDescriptor aProps[] =
{
{ OUString(PROPERTY_ALIGN), PROPERTY_ID_ALIGN },
{ OUString(PROPERTY_NUMBERFORMAT), PROPERTY_ID_NUMBERFORMAT },
@@ -138,7 +138,7 @@ namespace dbaccess
{ OUString(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 2cb8693976f2..d34d729d18f4 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -193,14 +193,14 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
OUString sName;
sal_Int32 nHandle;
};
- PropertyDescriptor aProps[] =
+ const PropertyDescriptor aProps[] =
{
{ OUString(PROPERTY_CATALOGNAME), PROPERTY_ID_CATALOGNAME },
{ OUString(PROPERTY_SCHEMANAME), PROPERTY_ID_SCHEMANAME },
{ OUString(PROPERTY_TABLENAME), PROPERTY_ID_TABLENAME },
{ OUString(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/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 9a1732f58abc..258be0fd9b18 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1472,11 +1472,11 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property
{
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
- const sal_Char* pObjectDescriptorArgs[] =
+ const char* pObjectDescriptorArgs[] =
{
"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/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 40a511ae7214..54494f171498 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -377,7 +377,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
{
}
- bool match( const OUString &url)
+ bool match( const OUString &url) const
{
if(bMatchComplete)
{
@@ -389,7 +389,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
}
}
};
- KnownPrefix aKnowPrefixes[] =
+ const KnownPrefix aKnowPrefixes[] =
{
KnownPrefix( "sdbc:calc:", DST_CALC, false ),
KnownPrefix( "sdbc:flat:", DST_FLAT, false ),
@@ -414,7 +414,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _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 )
{
if( aKnowPrefixes[i].match(sDsn) )
{
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index f7960e5e7a01..c706375626f2 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -307,8 +307,8 @@ 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 )
+ const SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN };
+ 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/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index 94dd12c650a1..c4f02cde15ac 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -190,16 +190,16 @@ namespace dbmm
{
struct LanguageMapping
{
- const sal_Char* pAsciiLanguage;
+ const char* pAsciiLanguage;
const ScriptType eScriptType;
- LanguageMapping( const sal_Char* _pAsciiLanguage, const ScriptType _eScriptType )
+ LanguageMapping( const char* _pAsciiLanguage, const ScriptType _eScriptType )
:pAsciiLanguage( _pAsciiLanguage )
,eScriptType( _eScriptType )
{
}
- }
- aLanguageMapping[] =
+ };
+ const LanguageMapping aLanguageMapping[] =
{
LanguageMapping( "JavaScript", eJavaScript ),
LanguageMapping( "BeanShell", eBeanShell ),
@@ -207,7 +207,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 ) )
{
@@ -1205,10 +1205,10 @@ namespace dbmm
}
::std::set< OUString > aElementNames( aDocStorage.getElementNames() );
- ScriptType aKnownStorageBasedTypes[] = {
+ const 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 7fcbd4a05ac1..0de7d581fb7d 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -347,7 +347,7 @@ void ODBExport::exportDataSource()
}
};
- PropertyMap aTokens[] =
+ const PropertyMap aTokens[] =
{
PropertyMap( INFO_TEXTFILEHEADER, XML_IS_FIRST_ROW_HEADER_LINE, s_sTrue ),
PropertyMap( INFO_SHOWDELETEDROWS, XML_SHOW_DELETED, s_sFalse ),
@@ -364,7 +364,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 )
{
@@ -498,7 +498,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() )
@@ -531,7 +531,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() )
@@ -1132,7 +1132,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() )
@@ -1173,11 +1173,11 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
}
else
{ // here I know I have a column
- TExportPropMapperPair pExportHelper[] = {
+ const TExportPropMapperPair pExportHelper[] = {
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 0ba45989a981..c4006a590814 100644
--- a/dbaccess/source/sdbtools/connection/tablename.cxx
+++ b/dbaccess/source/sdbtools/connection/tablename.cxx
@@ -180,7 +180,7 @@ namespace sdbtools
*/
EComposeRule lcl_translateCompositionType_throw( sal_Int32 _nType )
{
- struct
+ const struct
{
sal_Int32 nCompositionType;
EComposeRule eComposeRule;
@@ -196,7 +196,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/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 7a3de71fe8d8..1f7bc25fe65f 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2643,7 +2643,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
{
if ( m_xDataSource.is() )
{
- for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i )
{
m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this );
}
@@ -2666,7 +2666,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
{
if ( m_xDataSource.is() )
{
- for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i )
{
m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this );
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 68c231761b7c..7a5457b37d5c 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -1152,12 +1152,12 @@ IMPL_LINK_NOARG_TYPED(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
// execute the menu
std::unique_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
- sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW
+ const sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW
, SID_DB_APP_VIEW_DOC_PREVIEW
, 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 0fcf1e76b6a5..d0c0fde00dd5 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -36,7 +36,7 @@ OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent)
,m_pActionListener(nullptr)
{
- struct CategoryDescriptor
+ const struct CategoryDescriptor
{
sal_uInt16 nLabelResId;
ElementType eType;
@@ -47,7 +47,7 @@ OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent)
{ RID_STR_FORMS_CONTAINER, E_FORM, IMG_FORMFOLDER_TREE_L },
{ RID_STR_REPORTS_CONTAINER, E_REPORT, IMG_REPORTFOLDER_TREE_L }
};
- 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(
OUString( ModuleRes( aCategories[i].nLabelResId ) ) ,
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index c0126e115a66..cb2f0526295a 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -41,7 +41,7 @@ OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _n
const StyleSettings& rStyle = Application::GetSettings().GetStyleSettings();
vcl::Window* pWindows[] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() };
- for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
vcl::Font aFont = pWindows[i]->GetControlFont();
aFont.SetWeight(WEIGHT_BOLD);
diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx
index 51165c739459..72f27a2d5a3a 100644
--- a/dbaccess/source/ui/browser/dbloader.cxx
+++ b/dbaccess/source/ui/browser/dbloader.cxx
@@ -152,11 +152,11 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
m_aURL = rURL;
m_aArgs = rArgs;
- struct ServiceNameToImplName
+ const struct ServiceNameToImplName
{
- const sal_Char* pAsciiServiceName;
- const sal_Char* pAsciiImplementationName;
- ServiceNameToImplName( const sal_Char* _pService, const sal_Char* _pImpl )
+ const char* pAsciiServiceName;
+ const char* pAsciiImplementationName;
+ ServiceNameToImplName( const char* _pService, const char* _pImpl )
:pAsciiServiceName( _pService )
,pAsciiImplementationName( _pImpl )
{
@@ -174,7 +174,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
Reference< XController2 > xController;
const 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/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index b5000d0bfadb..1f04843d3ee6 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1284,7 +1284,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 = OUString::createFromAscii( pURLs[i] );
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 97ddddebab75..1065ace7d514 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -275,7 +275,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);
lMaxXPosition += m_pHorzScroll->GetThumbPos() * HSCROLL_STEP;
@@ -386,9 +386,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],nullptr,nDeltaX, nDeltaY);
ScrollAggregate(pFormatText,pFormatSample,pFormat,nDeltaX, nDeltaY);
@@ -399,7 +399,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;
@@ -409,7 +409,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] )
{
@@ -438,9 +438,9 @@ void OFieldDescControl::SetReadOnly( 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 );
@@ -662,7 +662,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)
{
@@ -675,7 +675,7 @@ void OFieldDescControl::ArrangeAggregates()
// And go ...
int nCurrentControlPos = 0;
Control* pZOrderPredecessor = nullptr;
- 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/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index 7a312f7d1452..ac71da227f04 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -112,7 +112,7 @@ namespace dbaui
{ 0, nullptr }
};
- 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/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 2be49341b1b8..4db1645904ea 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -337,7 +337,7 @@ void ODatabaseExport::insertValueIntoColumn()
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY);
- sal_Int16 nFormats[] = {
+ const sal_Int16 nFormats[] = {
NumberFormat::DATETIME
,NumberFormat::DATE
,NumberFormat::TIME
@@ -345,7 +345,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 7d62280bb731..475da808a231 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -893,7 +893,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
pFormatDescriptor.reset();
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 bfcdf2176c7b..169a0b8d8d89 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -143,7 +143,7 @@ void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObj
const OUString aCopyProperties[] = {
OUString(PROPERTY_FONT), OUString(PROPERTY_ROW_HEIGHT), OUString(PROPERTY_TEXTCOLOR),OUString(PROPERTY_TEXTLINECOLOR),OUString(PROPERTY_TEXTEMPHASIS),OUString(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] ) );
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b548783c3e78..255792cd56f3 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -173,7 +173,8 @@ void OSelectionBrowseBox::initialize()
if(xConnection.is())
{
const IParseContext& rContext = static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext();
- IParseContext::InternationalKeyCode eFunctions[] = { IParseContext::InternationalKeyCode::Avg,IParseContext::InternationalKeyCode::Count,IParseContext::InternationalKeyCode::Max
+ const IParseContext::InternationalKeyCode eFunctions[] = {
+ IParseContext::InternationalKeyCode::Avg,IParseContext::InternationalKeyCode::Count,IParseContext::InternationalKeyCode::Max
,IParseContext::InternationalKeyCode::Min,IParseContext::InternationalKeyCode::Sum
,IParseContext::InternationalKeyCode::Every
,IParseContext::InternationalKeyCode::Any
@@ -190,7 +191,7 @@ void OSelectionBrowseBox::initialize()
OUString sGroup = m_aFunctionStrings.getToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';') - 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 += ";";
m_aFunctionStrings += OStringToOUString(rContext.getIntlKeywordAscii(eFunctions[i]),
@@ -341,7 +342,7 @@ 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());
if ( aTemp.Height() > aHeight.Height() )
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 7586378bef0b..f784108e4719 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -234,7 +234,7 @@ 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());
if ( aTemp.Height() > aHeight.Height() )
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 9e6c9c26535d..925936eb0a74 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -691,7 +691,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
const OUString aSettings[] = {
OUString(PROPERTY_FILTER), OUString(PROPERTY_ORDER), OUString(PROPERTY_HAVING_CLAUSE), OUString(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] ) )
{