summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /dbaccess
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/qa/unit/embeddeddb_performancetest.cxx6
-rw-r--r--dbaccess/source/core/api/FilteredContainer.cxx10
-rw-r--r--dbaccess/source/core/api/View.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx2
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx2
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx4
-rw-r--r--dbaccess/source/filter/xml/xmlservices.cxx6
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx6
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx2
-rw-r--r--dbaccess/source/ui/control/SqlNameEdit.cxx2
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx2
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx2
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx2
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx8
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx4
-rw-r--r--dbaccess/source/ui/misc/uiservices.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx2
18 files changed, 41 insertions, 33 deletions
diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
index 444f283d9630..28d8417c1223 100644
--- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx
+++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
@@ -38,13 +38,13 @@ using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
-void normaliseTimeValue(TimeValue* pVal)
+static void normaliseTimeValue(TimeValue* pVal)
{
pVal->Seconds += pVal->Nanosec / 1000000000;
pVal->Nanosec %= 1000000000;
}
-void getTimeDifference(const TimeValue* pTimeStart,
+static void getTimeDifference(const TimeValue* pTimeStart,
const TimeValue* pTimeEnd,
TimeValue* pTimeDifference)
{
@@ -56,7 +56,7 @@ void getTimeDifference(const TimeValue* pTimeStart,
normaliseTimeValue(pTimeDifference);
}
-OUString getPrintableTimeValue(const TimeValue* pTimeValue)
+static OUString getPrintableTimeValue(const TimeValue* pTimeValue)
{
return OUString::number(
(sal_uInt64(pTimeValue->Seconds) * SAL_CONST_UINT64(1000000000)
diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx
index 5f47da9e9da9..1e75ea7d747b 100644
--- a/dbaccess/source/core/api/FilteredContainer.cxx
+++ b/dbaccess/source/core/api/FilteredContainer.cxx
@@ -48,7 +48,7 @@ namespace dbaccess
/** creates a vector of WildCards and reduce the _rTableFilter of the length of WildsCards
*/
-sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector< WildCard >& _rOut)
+static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector< WildCard >& _rOut)
{
// for wildcard search : remove all table filters which are a wildcard expression and build a WildCard
// for them
@@ -75,7 +75,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector<
return nShiftPos;
}
- bool lcl_isElementAllowed( const OUString& _rName,
+ static bool lcl_isElementAllowed( const OUString& _rName,
const Sequence< OUString >& _rTableFilter,
const std::vector< WildCard >& _rWCSearch )
{
@@ -124,7 +124,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector<
};
typedef std::vector< TableInfo > TableInfos;
- void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData )
+ static void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData )
{
if ( !_metaData.is() )
throw RuntimeException();
@@ -140,7 +140,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector<
}
}
- void lcl_ensureType( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer )
+ static void lcl_ensureType( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer )
{
if ( !!_io_tableInfo.sType )
return;
@@ -163,7 +163,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector<
_io_tableInfo.sType = OptionalString( sTypeName );
}
- ::std::vector< OUString> lcl_filter( const TableInfos& _unfilteredTables,
+ static ::std::vector< OUString> lcl_filter( const TableInfos& _unfilteredTables,
const Sequence< OUString >& _tableFilter, const Sequence< OUString >& _tableTypeFilter,
const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer )
{
diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx
index 3207dd5a1188..32bb4fd624f7 100644
--- a/dbaccess/source/core/api/View.cxx
+++ b/dbaccess/source/core/api/View.cxx
@@ -38,7 +38,7 @@ namespace dbaccess
using ::com::sun::star::sdbc::XConnection;
using ::com::sun::star::lang::XMultiServiceFactory;
- OUString lcl_getServiceNameForSetting(const Reference< css::sdbc::XConnection >& _xConnection,const OUString& i_sSetting)
+ static OUString lcl_getServiceNameForSetting(const Reference< css::sdbc::XConnection >& _xConnection,const OUString& i_sSetting)
{
OUString sSupportService;
Any aValue;
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 6e972e9c0ce0..1229f7a16942 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -348,7 +348,7 @@ static const char sPictures[] = "Pictures";
// I could check anyway )
/// @throws RuntimeException
-void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibraryContainer >& xDlgCont, const Reference< XStorage >& xStorage, const Reference< XModel >& rxModel, const Reference<XComponentContext >& rxContext )
+static void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibraryContainer >& xDlgCont, const Reference< XStorage >& xStorage, const Reference< XModel >& rxModel, const Reference<XComponentContext >& rxContext )
{
Sequence< OUString > sLibraries = xDlgCont->getElementNames();
Reference< XStorage > xTmpPic = xStorage->openStorageElement( "tempPictures", ElementModes::READWRITE );
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index a2d09c768271..11e3c9768e9f 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -134,7 +134,7 @@ namespace dbaxml
return aSupported;
}
- OUString lcl_implGetPropertyXMLType(const Type& _rType)
+ static OUString lcl_implGetPropertyXMLType(const Type& _rType)
{
// possible types we can write (either because we recognize them directly or because we convert _rValue
// into one of these types)
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 45718f7ee5ae..b99d19d905ee 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -77,7 +77,7 @@ namespace dbaxml
{
using namespace ::com::sun::star::util;
/// read a component (file + filter version)
-ErrCode ReadThroughComponent(
+static ErrCode ReadThroughComponent(
const uno::Reference<XInputStream>& xInputStream,
const uno::Reference<XComponent>& xModelComponent,
const uno::Reference<XComponentContext> & rxContext,
@@ -140,7 +140,7 @@ ErrCode ReadThroughComponent(
/// read a component (storage version)
-ErrCode ReadThroughComponent(
+static ErrCode ReadThroughComponent(
const uno::Reference< embed::XStorage >& xStorage,
const uno::Reference<XComponent>& xModelComponent,
const sal_Char* pStreamName,
diff --git a/dbaccess/source/filter/xml/xmlservices.cxx b/dbaccess/source/filter/xml/xmlservices.cxx
index 7e5051234889..3e52d0ac4fca 100644
--- a/dbaccess/source/filter/xml/xmlservices.cxx
+++ b/dbaccess/source/filter/xml/xmlservices.cxx
@@ -26,7 +26,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
-extern "C" void createRegistryInfo_dbaxml()
+extern "C" {
+
+static void createRegistryInfo_dbaxml()
{
static bool bInit = false;
if (!bInit)
@@ -41,6 +43,8 @@ extern "C" void createRegistryInfo_dbaxml()
}
}
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT void* dbaxml_component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 2fea1658a8f5..9c34ca666b09 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -166,14 +166,14 @@ namespace dbaui
namespace DatabaseObject = css::sdb::application::DatabaseObject;
namespace DatabaseObjectContainer = css::sdb::application::DatabaseObjectContainer;
-void SafeAddPropertyListener(const Reference< XPropertySet > & xSet, const OUString& rPropName, XPropertyChangeListener* pListener)
+static void SafeAddPropertyListener(const Reference< XPropertySet > & xSet, const OUString& rPropName, XPropertyChangeListener* pListener)
{
Reference< XPropertySetInfo > xInfo = xSet->getPropertySetInfo();
if (xInfo->hasPropertyByName(rPropName))
xSet->addPropertyChangeListener(rPropName, pListener);
}
-void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const OUString& rPropName, XPropertyChangeListener* pListener)
+static void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const OUString& rPropName, XPropertyChangeListener* pListener)
{
Reference< XPropertySetInfo > xInfo = xSet->getPropertySetInfo();
if (xInfo->hasPropertyByName(rPropName))
@@ -794,7 +794,7 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
}
}
-Reference<XPropertySet> getColumnHelper(SvTreeListEntry const * _pCurrentlyDisplayed, const Reference<XPropertySet>& _rxSource)
+static Reference<XPropertySet> getColumnHelper(SvTreeListEntry const * _pCurrentlyDisplayed, const Reference<XPropertySet>& _rxSource)
{
Reference<XPropertySet> xRet;
if(_pCurrentlyDisplayed)
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 068db126efff..aea44e1b4bc7 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -627,7 +627,7 @@ namespace dbaui
m_pRC_Tables->m_ops.clear();
}
- void fillEntryAndDisable(ListBox& _rListBox,const OUString& _sEntry)
+ static void fillEntryAndDisable(ListBox& _rListBox,const OUString& _sEntry)
{
_rListBox.InsertEntry(_sEntry);
_rListBox.SelectEntryPos(0);
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx
index 585c4398d1b1..d890a8a476fb 100644
--- a/dbaccess/source/ui/control/SqlNameEdit.cxx
+++ b/dbaccess/source/ui/control/SqlNameEdit.cxx
@@ -22,7 +22,7 @@
namespace dbaui
{
- bool isCharOk(sal_Unicode _cChar,bool _bFirstChar, const OUString& _sAllowedChars)
+ static bool isCharOk(sal_Unicode _cChar,bool _bFirstChar, const OUString& _sAllowedChars)
{
return (
(_cChar >= 'A' && _cChar <= 'Z') ||
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index d5b169be3feb..580bb79b89bc 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -385,7 +385,7 @@ bool DBTreeListBox::DoubleClickHdl()
return !aDoubleClickHdl.Call( this );
}
-void scrollWindow(DBTreeListBox* _pListBox, const Point& _rPos,bool _bUp)
+static void scrollWindow(DBTreeListBox* _pListBox, const Point& _rPos,bool _bUp)
{
SvTreeListEntry* pEntry = _pListBox->GetEntry( _rPos );
if( pEntry && pEntry != _pListBox->Last() )
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index bc0f8b4813ee..0ec0c4136eaa 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -870,7 +870,7 @@ OString ODbDataSourceAdministrationHelper::translatePropertyId( sal_Int32 _nId )
OString aReturn( aString.getStr(), aString.getLength(), RTL_TEXTENCODING_ASCII_US );
return aReturn;
}
-template<class T> bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;}
+template<class T> static bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;}
void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue )
{
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 864d4c02480e..78c025be49bf 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -274,7 +274,7 @@ IMPL_LINK_NOARG(ODbTypeWizDialogSetup, OnTypeSelected, OGeneralPage&, void)
activateDatabasePath();
}
-void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::comphelper::NamedValueCollection& _aNew,::comphelper::NamedValueCollection& _rDSInfo)
+static void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::comphelper::NamedValueCollection& _aNew,::comphelper::NamedValueCollection& _rDSInfo)
{
_rDSInfo.merge(_aNew,true);
uno::Sequence< beans::NamedValue > aOldValues = _aOld.getNamedValues();
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index a4a460e6947d..4934f79d886a 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -50,18 +50,18 @@ namespace dbaui
using namespace ::dbtools;
// helper
- bool operator ==(const OIndexField& _rLHS, const OIndexField& _rRHS)
+ static bool operator ==(const OIndexField& _rLHS, const OIndexField& _rRHS)
{
return (_rLHS.sFieldName == _rRHS.sFieldName)
&& (_rLHS.bSortAscending == _rRHS.bSortAscending);
}
- bool operator !=(const OIndexField& _rLHS, const OIndexField& _rRHS)
+ static bool operator !=(const OIndexField& _rLHS, const OIndexField& _rRHS)
{
return !(_rLHS == _rRHS);
}
- bool operator ==(const IndexFields& _rLHS, const IndexFields& _rRHS)
+ static bool operator ==(const IndexFields& _rLHS, const IndexFields& _rRHS)
{
if (_rLHS.size() != _rRHS.size())
return false;
@@ -77,7 +77,7 @@ namespace dbaui
return true;
}
- bool operator !=(const IndexFields& _rLHS, const IndexFields& _rRHS)
+ static bool operator !=(const IndexFields& _rLHS, const IndexFields& _rRHS)
{
return !(_rLHS == _rRHS);
}
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 66f9c8c1d4fd..8b98159dde37 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -49,13 +49,13 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
-void Replace_OS_PlaceHolder(OUString& aString)
+static void Replace_OS_PlaceHolder(OUString& aString)
{
aString = aString.replaceAll( "*", "%" );
aString = aString.replaceAll( "?", "_" );
}
-void Replace_SQL_PlaceHolder(OUString& aString)
+static void Replace_SQL_PlaceHolder(OUString& aString)
{
aString = aString.replaceAll( "%", "*" );
aString = aString.replaceAll( "_", "?" );
diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx
index 26eec900d1fd..a3d6c8db83e8 100644
--- a/dbaccess/source/ui/misc/uiservices.cxx
+++ b/dbaccess/source/ui/misc/uiservices.cxx
@@ -26,7 +26,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
-extern "C" void createRegistryInfo_DBU()
+extern "C" {
+
+static void createRegistryInfo_DBU()
{
static bool bInit = false;
if (!bInit)
@@ -59,6 +61,8 @@ extern "C" void createRegistryInfo_DBU()
}
}
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT void* dbu_component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 158b6c88beea..f9aaceaabdfe 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -191,14 +191,14 @@ tools::Rectangle OConnectionLine::GetBoundingRect()
return aBoundingRect;
}
-void calcPointX1(const OTableWindow* _pWin,Point& _rNewConPos,Point& _rNewDescrPos)
+static void calcPointX1(const OTableWindow* _pWin,Point& _rNewConPos,Point& _rNewDescrPos)
{
_rNewConPos.setX( _pWin->GetPosPixel().X() + _pWin->GetSizePixel().Width() );
_rNewDescrPos.setX( _rNewConPos.X() );
_rNewConPos.AdjustX(DESCRIPT_LINE_WIDTH );
}
-void calcPointX2(const OTableWindow* _pWin,Point& _rNewConPos,Point& _rNewDescrPos)
+static void calcPointX2(const OTableWindow* _pWin,Point& _rNewConPos,Point& _rNewDescrPos)
{
_rNewConPos.setX( _pWin->GetPosPixel().X() );
_rNewDescrPos.setX( _rNewConPos.X() );
@@ -292,7 +292,7 @@ bool OConnectionLine::IsValid() const
return m_pData.is();
}
-double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q)
+static double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q)
{
Point v(p2 - p1);
Point w(pM - p1);
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 58d0fe320cb4..81573f0498a7 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -363,7 +363,7 @@ void OQueryTableView::AddTabWin(const OUString& _rTableName, const OUString& _rA
}
// find the table which has a foreign key with this referencedTable name
-Reference<XPropertySet> getKeyReferencedTo(const Reference<XIndexAccess>& _rxKeys,const OUString& _rReferencedTable)
+static Reference<XPropertySet> getKeyReferencedTo(const Reference<XIndexAccess>& _rxKeys,const OUString& _rReferencedTable)
{
if(!_rxKeys.is())
return Reference<XPropertySet>();