summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-25 09:59:16 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-12 22:06:19 -0400
commitc5cdfe39d3afca716e7b11f8f8e169ce378861ea (patch)
tree5b804fa2e78405afe16db734f88f24a7b9714209 /dbaccess
parent0c4c31576fe03b3b59217bf9990b75f32d193d0d (diff)
update loplugin stylepolice to check local pointers vars
are actually pointer vars. Also convert from regex to normal code, so we can enable this plugin all the time. Reviewed-on: https://gerrit.libreoffice.org/24391 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> (cherry picked from commit e8fd5a07eca70912ddee45aaa34d434809b59fb7) Change-Id: Ie36a25ecba61c18f99c77c77646d6459a443cbd1
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx47
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx46
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx4
3 files changed, 48 insertions, 49 deletions
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 14bf274a63af..f7a4682e393a 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -54,6 +54,7 @@
#include <boost/optional.hpp>
#include <memory>
+#include <iterator>
namespace dbaxml
{
@@ -346,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 ),
@@ -363,14 +364,14 @@ void ODBExport::exportDataSource()
};
bool bIsXMLDefault = false;
- for ( size_t i=0; i < sizeof( aTokens ) / sizeof( aTokens[0] ); ++i )
+ for (const auto & aToken : aTokens)
{
- if ( pProperties->Name == aTokens[i].sPropertyName )
+ if ( pProperties->Name == aToken.sPropertyName )
{
- eToken = aTokens[i].eAttributeToken;
+ eToken = aToken.eAttributeToken;
- if ( !!aTokens[i].aXMLDefault
- && ( sValue == *aTokens[i].aXMLDefault )
+ if ( !!aToken.aXMLDefault
+ && ( sValue == *aToken.aXMLDefault )
)
{
bIsXMLDefault = true;
@@ -497,9 +498,9 @@ 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 (::xmloff::token::XMLTokenEnum i : pSettings)
{
- TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]);
+ TSettingsMap::const_iterator aFind = _aSettings.find(i);
if ( aFind != _aSettings.end() )
AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second);
}
@@ -530,9 +531,9 @@ 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 (::xmloff::token::XMLTokenEnum nSetting : pSettings)
{
- TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]);
+ TSettingsMap::const_iterator aFind = _aSettings.find(nSetting);
if ( aFind != _aSettings.end() )
AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second);
}
@@ -661,7 +662,7 @@ void ODBExport::exportDataSourceSettings()
SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTINGS, true, true);
::std::vector< TypedPropertyValue >::iterator aIter = m_aDataSourceSettings.begin();
- ::std::vector< TypedPropertyValue >::iterator aEnd = m_aDataSourceSettings.end();
+ ::std::vector< TypedPropertyValue >::const_iterator aEnd = m_aDataSourceSettings.end();
for ( ; aIter != aEnd; ++aIter )
{
bool bIsSequence = TypeClass_SEQUENCE == aIter->Type.getTypeClass();
@@ -905,7 +906,7 @@ void ODBExport::exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt)
void ODBExport::exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const uno::Reference<beans::XPropertySet>& _xProp,SvXMLAttributeList& _rAtt,TPropertyStyleMap& _rMap)
{
- TPropertyStyleMap::iterator aFind = _rMap.find(_xProp);
+ TPropertyStyleMap::const_iterator aFind = _rMap.find(_xProp);
if ( aFind != _rMap.end() )
{
_rAtt.AddAttribute( GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DB, GetXMLToken(_eToken) ),
@@ -962,7 +963,7 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
if ( !xNameAccess->hasElements() )
{
Reference< XPropertySet > xComponent(_xColSup,UNO_QUERY);
- TTableColumnMap::iterator aFind = m_aTableDummyColumns.find(xComponent);
+ TTableColumnMap::const_iterator aFind = m_aTableDummyColumns.find(xComponent);
if ( aFind != m_aTableDummyColumns.end() )
{
SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, true, true);
@@ -1131,11 +1132,11 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
};
::std::vector< XMLPropertyState > aPropertyStates;
- for (size_t i = 0 ; i < sizeof(pExportHelper)/sizeof(pExportHelper[0]); ++i)
+ for (const auto & i : pExportHelper)
{
- aPropertyStates = pExportHelper[i].first->Filter(_xProp);
+ aPropertyStates = i.first->Filter(_xProp);
if ( !aPropertyStates.empty() )
- pExportHelper[i].second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( pExportHelper[i].second.second, aPropertyStates )));
+ i.second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( i.second.second, aPropertyStates )));
}
Reference< XNameAccess > xCollection;
@@ -1172,18 +1173,18 @@ 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 (const auto & i : pExportHelper)
{
- ::std::vector< XMLPropertyState > aPropStates = pExportHelper[i].first->Filter( _xProp );
+ ::std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp );
if ( !aPropStates.empty() )
{
::std::vector< XMLPropertyState >::iterator aItr = aPropStates.begin();
- ::std::vector< XMLPropertyState >::iterator aEnd = aPropStates.end();
- const rtl::Reference < XMLPropertySetMapper >& pStyle = pExportHelper[i].first->getPropertySetMapper();
+ ::std::vector< XMLPropertyState >::const_iterator aEnd = aPropStates.end();
+ const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper();
while ( aItr != aEnd )
{
if ( aItr->mnIndex != -1 )
@@ -1207,10 +1208,10 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
}
}
- if ( XML_STYLE_FAMILY_TABLE_CELL == pExportHelper[i].second.second )
+ if ( XML_STYLE_FAMILY_TABLE_CELL == i.second.second )
::std::copy( m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end(), ::std::back_inserter( aPropStates ));
if ( !aPropStates.empty() )
- pExportHelper[i].second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( pExportHelper[i].second.second, aPropStates )));
+ i.second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( i.second.second, aPropStates )));
}
}
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index c2b063f8f0e3..533574a4c180 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -219,8 +219,8 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview );
SetUniqueId(UID_APP_DETAILPAGE_HELPER);
- for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
- m_pLists[i] = nullptr;
+ for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
+ rpBox = nullptr;
ImplInitSettings();
}
@@ -235,21 +235,21 @@ void OAppDetailPageHelper::dispose()
{
Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
if ( xCloseable.is() )
- xCloseable->close(sal_True);
+ xCloseable->close(true);
}
catch(const Exception&)
{
OSL_FAIL("Exception thrown while disposing preview frame!");
}
- for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
+ for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
{
- if ( m_pLists[i] )
+ if ( rpBox )
{
- m_pLists[i]->clearCurrentSelection();
- m_pLists[i]->Hide();
- m_pLists[i]->clearCurrentSelection(); // why a second time?
- m_pLists[i].disposeAndClear();
+ rpBox->clearCurrentSelection();
+ rpBox->Hide();
+ rpBox->clearCurrentSelection(); // why a second time?
+ rpBox.disposeAndClear();
}
}
m_aMenu.reset();
@@ -429,8 +429,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _e
pEntry = pList->NextSelected(pEntry);
}
- _out_rSelectedObjects.realloc( aSelected.size() );
- ::std::copy( aSelected.begin(), aSelected.end(), _out_rSelectedObjects.getArray() );
+ _out_rSelectedObjects = comphelper::containerToSequence( aSelected );
}
void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames)
@@ -686,7 +685,7 @@ namespace
namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
- static sal_Int32 lcl_getFolderIndicatorForType( const ElementType _eType )
+ sal_Int32 lcl_getFolderIndicatorForType( const ElementType _eType )
{
const sal_Int32 nFolderIndicator =
( _eType == E_FORM ) ? DatabaseObjectContainer::FORMS_FOLDER
@@ -772,10 +771,10 @@ DBTreeListBox* OAppDetailPageHelper::createTree( DBTreeListBox* _pTreeView, cons
void OAppDetailPageHelper::clearPages()
{
showPreview(nullptr);
- for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
+ for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
{
- if ( m_pLists[i] )
- m_pLists[i]->Clear();
+ if ( rpBox )
+ rpBox->Clear();
}
}
@@ -794,7 +793,6 @@ void OAppDetailPageHelper::elementReplaced(ElementType _eType
DBTreeListBox* pTreeView = getCurrentView();
if ( pTreeView )
{
- OUString sNewName = _rNewName;
SvTreeListEntry* pEntry = nullptr;
switch( _eType )
{
@@ -816,7 +814,7 @@ void OAppDetailPageHelper::elementReplaced(ElementType _eType
OSL_ENSURE(pEntry,"Do you know that the name isn't existence!");
if ( pEntry )
{
- pTreeView->SetEntryText(pEntry,sNewName);
+ pTreeView->SetEntryText(pEntry,_rNewName);
}
}
}
@@ -1119,10 +1117,10 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
pDispatcher->setTargetFrame( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW) );
::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Preview", sal_True );
- aArgs.put( "ReadOnly", sal_True );
- aArgs.put( "AsTemplate", sal_False );
- aArgs.put( OUString(PROPERTY_SHOWMENU), sal_False );
+ aArgs.put( "Preview", true );
+ aArgs.put( "ReadOnly", true );
+ aArgs.put( "AsTemplate", false );
+ aArgs.put( OUString(PROPERTY_SHOWMENU), false );
Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
bool bClearPreview = !xPreview.is();
@@ -1160,14 +1158,14 @@ 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(unsigned short nAction : pActions)
{
- aMenu->CheckItem(pActions[i],m_aMenu->IsItemChecked(pActions[i]));
+ aMenu->CheckItem(nAction,m_aMenu->IsItemChecked(nAction));
}
aMenu->EnableItem( SID_DB_APP_VIEW_DOCINFO_PREVIEW, getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) );
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index d7a0fd7cd1a0..0db7db70d60d 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -196,9 +196,9 @@ namespace dbaui
{ std::addressof(m_pRespectDriverResultSetType), "resulttype", DSID_RESPECTRESULTSETTYPE, false }
};
- for ( const BooleanSettingDesc& pCopy : aSettings )
+ for ( const BooleanSettingDesc& rDesc : aSettings )
{
- m_aBooleanSettings.push_back( pCopy );
+ m_aBooleanSettings.push_back( rDesc );
}
}