summaryrefslogtreecommitdiff
path: root/ucb
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 /ucb
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 'ucb')
-rw-r--r--ucb/source/core/ucbstore.cxx2
-rw-r--r--ucb/source/ucp/file/filrow.cxx2
-rw-r--r--ucb/source/ucp/ftp/ftpdirp.cxx2
-rw-r--r--ucb/source/ucp/ftp/ftploaderthread.cxx4
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydata.cxx2
-rw-r--r--ucb/source/ucp/webdav-neon/LinkSequence.cxx9
-rw-r--r--ucb/source/ucp/webdav-neon/LockEntrySequence.cxx9
-rw-r--r--ucb/source/ucp/webdav-neon/LockSequence.cxx9
-rw-r--r--ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx12
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx22
-rw-r--r--ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx9
12 files changed, 56 insertions, 28 deletions
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index fa123e6c9c65..e4b13acaa379 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -61,7 +61,7 @@ using namespace comphelper;
using namespace cppu;
-OUString makeHierarchalNameSegment( const OUString & rIn )
+static OUString makeHierarchalNameSegment( const OUString & rIn )
{
OUStringBuffer aBuffer;
aBuffer.append( "['" );
diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx
index 9701a5501972..d8cf74af53b3 100644
--- a/ucb/source/ucp/file/filrow.cxx
+++ b/ucb/source/ucp/file/filrow.cxx
@@ -39,7 +39,7 @@ using namespace css::uno;
// Function for TypeConverting
template< class _type_ >
-bool convert( TaskManager* pShell,
+static bool convert( TaskManager* pShell,
uno::Reference< script::XTypeConverter >& xConverter,
uno::Any& rValue,
_type_& aReturn )
diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx
index ca439aa31a8a..b7270ac91e2a 100644
--- a/ucb/source/ucp/ftp/ftpdirp.cxx
+++ b/ucb/source/ucp/ftp/ftpdirp.cxx
@@ -29,7 +29,7 @@
using namespace ftp;
-inline bool ascii_isWhitespace( sal_Unicode ch )
+static inline bool ascii_isWhitespace( sal_Unicode ch )
{
return ((ch <= 0x20) && ch);
}
diff --git a/ucb/source/ucp/ftp/ftploaderthread.cxx b/ucb/source/ucp/ftp/ftploaderthread.cxx
index 315ccb79e7fa..0b2777393873 100644
--- a/ucb/source/ucp/ftp/ftploaderthread.cxx
+++ b/ucb/source/ucp/ftp/ftploaderthread.cxx
@@ -36,12 +36,12 @@ using namespace ftp;
extern "C" {
- int memory_write_dummy(void *,size_t,size_t,void *)
+ static int memory_write_dummy(void *,size_t,size_t,void *)
{
return 0;
}
- void delete_CURL(void *pData)
+ static void delete_CURL(void *pData)
{
// Otherwise response for QUIT will be sent to already destroyed
// MemoryContainer via non-dummy memory_write function.
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 6a671ddd291c..3c6036115e06 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -613,7 +613,7 @@ FTPDirentry FTPURL::direntry() const
extern "C" {
- size_t memory_read(void *ptr,size_t size,size_t nmemb,void *stream)
+ static size_t memory_read(void *ptr,size_t size,size_t nmemb,void *stream)
{
sal_Int32 nRequested = sal_Int32(size*nmemb);
CurlInput *curlInput = static_cast<CurlInput*>(stream);
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index e211d125ab93..7be61954aae2 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -60,7 +60,7 @@ struct HierarchyEntry::iterator_Impl
};
-void makeXMLName( const OUString & rIn, OUStringBuffer & rBuffer )
+static void makeXMLName( const OUString & rIn, OUStringBuffer & rBuffer )
{
sal_Int32 nCount = rIn.getLength();
for ( sal_Int32 n = 0; n < nCount; ++n )
diff --git a/ucb/source/ucp/webdav-neon/LinkSequence.cxx b/ucb/source/ucp/webdav-neon/LinkSequence.cxx
index 6cbf9f0df915..da0bd63aebd1 100644
--- a/ucb/source/ucp/webdav-neon/LinkSequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LinkSequence.cxx
@@ -54,7 +54,9 @@ struct LinkSequenceParseContext
#define STATE_SRC (STATE_TOP + 2)
-extern "C" int LinkSequence_startelement_callback(
+extern "C" {
+
+static int LinkSequence_startelement_callback(
void *,
int parent,
const char * /*nspace*/,
@@ -82,7 +84,7 @@ extern "C" int LinkSequence_startelement_callback(
}
-extern "C" int LinkSequence_chardata_callback(
+static int LinkSequence_chardata_callback(
void *userdata,
int state,
const char *buf,
@@ -111,7 +113,7 @@ extern "C" int LinkSequence_chardata_callback(
}
-extern "C" int LinkSequence_endelement_callback(
+static int LinkSequence_endelement_callback(
void *userdata,
int state,
const char *,
@@ -132,6 +134,7 @@ extern "C" int LinkSequence_endelement_callback(
return 0; // zero to continue, non-zero to abort parsing
}
+}
// static
bool LinkSequence::createFromXML( const OString & rInData,
diff --git a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
index 263211347820..0023769bcc9a 100644
--- a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
@@ -56,7 +56,9 @@ struct LockEntrySequenceParseContext
#define STATE_WRITE (STATE_TOP + 5)
-extern "C" int LockEntrySequence_startelement_callback(
+extern "C" {
+
+static int LockEntrySequence_startelement_callback(
void *,
int parent,
const char * /*nspace*/,
@@ -121,7 +123,7 @@ extern "C" int LockEntrySequence_startelement_callback(
}
-extern "C" int LockEntrySequence_chardata_callback(
+static int LockEntrySequence_chardata_callback(
void *,
int,
const char *,
@@ -131,7 +133,7 @@ extern "C" int LockEntrySequence_chardata_callback(
}
-extern "C" int LockEntrySequence_endelement_callback(
+static int LockEntrySequence_endelement_callback(
void *userdata,
int state,
const char *,
@@ -180,6 +182,7 @@ extern "C" int LockEntrySequence_endelement_callback(
return 0; // zero to continue, non-zero to abort parsing
}
+}
// static
bool LockEntrySequence::createFromXML( const OString & rInData,
diff --git a/ucb/source/ucp/webdav-neon/LockSequence.cxx b/ucb/source/ucp/webdav-neon/LockSequence.cxx
index 210a52ceb88d..917945824d11 100644
--- a/ucb/source/ucp/webdav-neon/LockSequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LockSequence.cxx
@@ -65,7 +65,9 @@ struct LockSequenceParseContext
#define STATE_HREF (STATE_TOP + 10)
-extern "C" int LockSequence_startelement_callback(
+extern "C" {
+
+static int LockSequence_startelement_callback(
void *,
int parent,
const char * /*nspace*/,
@@ -122,7 +124,7 @@ extern "C" int LockSequence_startelement_callback(
}
-extern "C" int LockSequence_chardata_callback(
+static int LockSequence_chardata_callback(
void *userdata,
int state,
const char *buf,
@@ -231,7 +233,7 @@ extern "C" int LockSequence_chardata_callback(
}
-extern "C" int LockSequence_endelement_callback(
+static int LockSequence_endelement_callback(
void *userdata,
int state,
const char *,
@@ -295,6 +297,7 @@ extern "C" int LockSequence_endelement_callback(
return 0; // zero to continue, non-zero to abort parsing
}
+}
// static
bool LockSequence::createFromXML( const OString & rInData,
diff --git a/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx
index 3e25121d28fa..531ab229f976 100644
--- a/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx
@@ -80,7 +80,9 @@ namespace
}
}
-extern "C" int NPFR_propfind_iter( void* userdata,
+extern "C" {
+
+static int NPFR_propfind_iter( void* userdata,
const NeonPropName* pname,
const char* value,
const HttpStatus* status )
@@ -188,7 +190,7 @@ extern "C" int NPFR_propfind_iter( void* userdata,
return 0; // Go on.
}
-extern "C" void NPFR_propfind_results( void* userdata,
+static void NPFR_propfind_results( void* userdata,
const ne_uri* uri,
const NeonPropFindResultSet* set )
{
@@ -205,7 +207,7 @@ extern "C" void NPFR_propfind_results( void* userdata,
theResources->push_back( theResource );
}
-extern "C" int NPFR_propnames_iter( void* userdata,
+static int NPFR_propnames_iter( void* userdata,
const NeonPropName* pname,
const char* /*value*/,
const HttpStatus* /*status*/ )
@@ -220,7 +222,7 @@ extern "C" int NPFR_propnames_iter( void* userdata,
return 0;
}
-extern "C" void NPFR_propnames_results( void* userdata,
+static void NPFR_propnames_results( void* userdata,
const ne_uri* /*uri*/,
const NeonPropFindResultSet* results )
{
@@ -237,6 +239,8 @@ extern "C" void NPFR_propnames_results( void* userdata,
theResources->push_back( theResource );
}
+}
+
NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession,
const char* inPath,
const Depth inDepth,
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index e17c1f03cfcc..81fa6adca3ad 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -199,7 +199,9 @@ struct NeonRequestContext
};
// A simple Neon response_block_reader for use with an XInputStream
-extern "C" int NeonSession_ResponseBlockReader(void * inUserData,
+extern "C" {
+
+static int NeonSession_ResponseBlockReader(void * inUserData,
const char * inBuf,
size_t inLen )
{
@@ -213,7 +215,7 @@ extern "C" int NeonSession_ResponseBlockReader(void * inUserData,
}
// A simple Neon response_block_reader for use with an XOutputStream
-extern "C" int NeonSession_ResponseBlockWriter( void * inUserData,
+static int NeonSession_ResponseBlockWriter( void * inUserData,
const char * inBuf,
size_t inLen )
{
@@ -226,7 +228,7 @@ extern "C" int NeonSession_ResponseBlockWriter( void * inUserData,
return 0;
}
-extern "C" int NeonSession_NeonAuth( void * inUserData,
+static int NeonSession_NeonAuth( void * inUserData,
#if defined NE_FEATURE_SSPI && ! defined SYSTEM_NEON
const char * inAuthProtocol,
#endif
@@ -256,6 +258,8 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
return theSession->NeonAuth(pAuthProtocol, inRealm, attempt, inoutUserName, inoutPassWord);
}
+}
+
int NeonSession::NeonAuth(const char* inAuthProtocol, const char* inRealm,
int attempt, char* inoutUserName, char * inoutPassWord)
{
@@ -376,7 +380,9 @@ namespace {
}
} // namespace
-extern "C" int NeonSession_CertificationNotify( void *userdata,
+extern "C" {
+
+static int NeonSession_CertificationNotify( void *userdata,
int,
const ne_ssl_certificate *cert )
{
@@ -384,6 +390,8 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
return pSession->CertificationNotify(cert);
}
+}
+
int NeonSession::CertificationNotify(const ne_ssl_certificate *cert)
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
@@ -528,7 +536,9 @@ int NeonSession::CertificationNotify(const ne_ssl_certificate *cert)
return 1;
}
-extern "C" void NeonSession_PreSendRequest( ne_request * req,
+extern "C" {
+
+static void NeonSession_PreSendRequest( ne_request * req,
void * userdata,
ne_buffer * headers )
{
@@ -539,6 +549,8 @@ extern "C" void NeonSession_PreSendRequest( ne_request * req,
pSession->PreSendRequest(req, headers);
}
+}
+
void NeonSession::PreSendRequest(ne_request* req, ne_buffer* headers)
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
index 3ef49ddf0f94..173c3f9c4c20 100644
--- a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
+++ b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
@@ -68,7 +68,9 @@ static const char aXMLEnd[] = "</value></ucbprop>";
#define STATE_VALUE (STATE_TOP + 2)
-extern "C" int UCBDeadPropertyValue_startelement_callback(
+extern "C" {
+
+static int UCBDeadPropertyValue_startelement_callback(
void *,
int parent,
const char * /*nspace*/,
@@ -96,7 +98,7 @@ extern "C" int UCBDeadPropertyValue_startelement_callback(
}
-extern "C" int UCBDeadPropertyValue_chardata_callback(
+static int UCBDeadPropertyValue_chardata_callback(
void *userdata,
int state,
const char *buf,
@@ -125,7 +127,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback(
}
-extern "C" int UCBDeadPropertyValue_endelement_callback(
+static int UCBDeadPropertyValue_endelement_callback(
void *userdata,
int state,
const char *,
@@ -154,6 +156,7 @@ extern "C" int UCBDeadPropertyValue_endelement_callback(
return 0; // zero to continue, non-zero to abort parsing
}
+}
static OUString encodeValue( const OUString & rValue )
{