summaryrefslogtreecommitdiff
path: root/xmlsecurity
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 /xmlsecurity
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 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/errorcallback.cxx7
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx5
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx6
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx6
-rw-r--r--xmlsecurity/source/xmlsec/xmlstreamio.cxx16
7 files changed, 26 insertions, 20 deletions
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index e4961377099a..dc97143f0029 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -82,7 +82,7 @@ int compareVersions(
}
}
-void ImplFillElementList(
+static void ImplFillElementList(
std::vector< OUString >& rList, const Reference < css::embed::XStorage >& rxStore,
const OUString& rRootStorageName, const bool bRecursive,
const DocumentSignatureAlgorithm mode)
diff --git a/xmlsecurity/source/xmlsec/errorcallback.cxx b/xmlsecurity/source/xmlsec/errorcallback.cxx
index ac9b72511458..3cbe0ac1142e 100644
--- a/xmlsecurity/source/xmlsec/errorcallback.cxx
+++ b/xmlsecurity/source/xmlsec/errorcallback.cxx
@@ -29,8 +29,9 @@
#include <comphelper/windowserrorstring.hxx>
#endif
-extern "C"
-void errorCallback(const char* file,
+extern "C" {
+
+static void errorCallback(const char* file,
int line,
const char* func,
const char* errorObject,
@@ -50,6 +51,8 @@ void errorCallback(const char* file,
SAL_WARN("xmlsecurity.xmlsec", file << ":" << line << ": " << func << "() '" << pErrorObject << "' '" << pErrorSubject << "' " << reason << " '" << pMsg << "'" << systemErrorString);
}
+}
+
XSECXMLSEC_DLLPUBLIC void setErrorRecorder()
{
xmlSecErrorsSetCallback(errorCallback);
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 3fb94bd256c5..e79e3db09e9a 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -54,8 +54,11 @@ using namespace com::sun::star;
#define ROOT_CERTS "Root Certs for OpenOffice.org"
-extern "C" void nsscrypto_finalize();
+extern "C" {
+static void nsscrypto_finalize();
+
+}
namespace
{
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 7ccc70c85955..5fd173689ba9 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -57,8 +57,8 @@ using ::com::sun::star::lang::XSingleServiceFactory ;
using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
using ::com::sun::star::security::XCertificate ;
-extern X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ;
-extern X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
+static X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ;
+static X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
struct UsageDescription
@@ -78,7 +78,7 @@ struct UsageDescription
};
-char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ )
+static char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ )
{
uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < task::XInteractionHandler2 > xInteractionHandler(
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 0cf8c17d3303..53449e9c0900 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -350,7 +350,7 @@ const Sequence< sal_Int8>& X509Certificate_NssImpl::getUnoTunnelId() {
return theX509Certificate_NssImplUnoTunnelId::get().getSeq();
}
-OUString getAlgorithmDescription(SECAlgorithmID const *aid)
+static OUString getAlgorithmDescription(SECAlgorithmID const *aid)
{
SECOidTag tag;
tag = SECOID_GetAlgorithmTag(aid);
@@ -360,7 +360,7 @@ OUString getAlgorithmDescription(SECAlgorithmID const *aid)
return OUString::createFromAscii( pDesc ) ;
}
-css::uno::Sequence< sal_Int8 > getThumbprint(CERTCertificate const *pCert, SECOidTag id)
+static css::uno::Sequence< sal_Int8 > getThumbprint(CERTCertificate const *pCert, SECOidTag id)
{
if( pCert != nullptr )
{
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index 028edbcf547b..7be5fbfce752 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -35,7 +35,7 @@ namespace cssxcsax = com::sun::star::xml::csax;
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_xmlstr( const OUString& oustr )
+static xmlChar* ous_to_xmlstr( const OUString& oustr )
{
OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), static_cast<int>(ostr.getLength()) ) ;
@@ -45,7 +45,7 @@ xmlChar* ous_to_xmlstr( const OUString& oustr )
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length )
+static xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length )
{
OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
length = ostr.getLength();
@@ -57,7 +57,7 @@ xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length )
* The return value and the referenced value must be NULL terminated.
* The application has the responsibilty to deallocte the return value.
*/
-const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
+static const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
{
xmlChar* attname = nullptr ;
xmlChar* attvalue = nullptr ;
diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
index 7cd44219d2f5..be48ae34b232 100644
--- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx
+++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
@@ -33,8 +33,9 @@ static bool g_bInputCallbacksRegistered = false;
static css::uno::Reference< css::xml::crypto::XUriBinding > m_xUriBinding ;
-extern "C"
-int xmlStreamMatch( const char* uri )
+extern "C" {
+
+static int xmlStreamMatch( const char* uri )
{
css::uno::Reference< css::io::XInputStream > xInputStream ;
@@ -65,8 +66,7 @@ int xmlStreamMatch( const char* uri )
return 0 ;
}
-extern "C"
-void* xmlStreamOpen( const char* uri )
+static void* xmlStreamOpen( const char* uri )
{
css::uno::Reference< css::io::XInputStream > xInputStream ;
@@ -99,8 +99,7 @@ void* xmlStreamOpen( const char* uri )
return nullptr ;
}
-extern "C"
-int xmlStreamRead( void* context, char* buffer, int len )
+static int xmlStreamRead( void* context, char* buffer, int len )
{
int numbers ;
css::uno::Reference< css::io::XInputStream > xInputStream ;
@@ -124,8 +123,7 @@ int xmlStreamRead( void* context, char* buffer, int len )
return numbers ;
}
-extern "C"
-int xmlStreamClose( void * context )
+static int xmlStreamClose( void * context )
{
if (g_bInputCallbacksEnabled && g_bInputCallbacksRegistered)
{
@@ -139,6 +137,8 @@ int xmlStreamClose( void * context )
return 0 ;
}
+}
+
XSECXMLSEC_DLLPUBLIC int xmlEnableStreamInputCallbacks()
{
if (!g_bInputCallbacksEnabled)