diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-04 00:17:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-07 08:56:50 +0100 |
commit | 04e20ca11b74f7482e563c21f8c9b708158d577c (patch) | |
tree | e7f56a30bb343567c91b794938368a2fbc7f76bb | |
parent | remove ifdef zeroed code (diff) | |
download | core-04e20ca11b74f7482e563c21f8c9b708158d577c.tar.gz core-04e20ca11b74f7482e563c21f8c9b708158d577c.zip |
use standard pattern for this
4 files changed, 33 insertions, 46 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 94017fe97286..33587ab59d0b 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -43,7 +43,7 @@ #include "securityenvironment_mscryptimpl.hxx" #include "x509certificate_mscryptimpl.hxx" -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> #include <xmlsec/xmlsec.h> #include <xmlsec/keysmngr.h> @@ -230,17 +230,15 @@ sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequen } /* XUnoTunnel extension */ + + +namespace +{ + class theSecurityEnvironment_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_MSCryptImplUnoTunnelId > {}; +} + const Sequence< sal_Int8>& SecurityEnvironment_MSCryptImpl :: getUnoTunnelId() { - static Sequence< sal_Int8 >* pSeq = 0 ; - if( !pSeq ) { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ; - if( !pSeq ) { - static Sequence< sal_Int8> aSeq( 16 ) ; - rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ; - pSeq = &aSeq ; - } - } - return *pSeq ; + return theSecurityEnvironment_MSCryptImplUnoTunnelId::get().getSeq(); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index 2f6f6f4cc6d5..ea2f8ce27e73 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlsecurity.hxx" #include <sal/config.h> -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> #include "x509certificate_mscryptimpl.hxx" #include "certificateextension_xmlsecimpl.hxx" #include "sanextension_mscryptimpl.hxx" @@ -489,17 +489,14 @@ sal_Int64 SAL_CALL X509Certificate_MSCryptImpl :: getSomething( const Sequence< } /* XUnoTunnel extension */ + +namespace +{ + class theX509Certificate_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theX509Certificate_MSCryptImplUnoTunnelId > {}; +} + const Sequence< sal_Int8>& X509Certificate_MSCryptImpl :: getUnoTunnelId() { - static Sequence< sal_Int8 >* pSeq = 0 ; - if( !pSeq ) { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ; - if( !pSeq ) { - static Sequence< sal_Int8> aSeq( 16 ) ; - rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ; - pSeq = &aSeq ; - } - } - return *pSeq ; + return theX509Certificate_MSCryptImplUnoTunnelId::get().getSeq(); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index ab08a5fd9938..cb740e5d3ede 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -40,7 +40,7 @@ #include <sal/macros.h> #include "securityenvironment_nssimpl.hxx" #include "x509certificate_nssimpl.hxx" -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> #include "../diagnose.hxx" #include <sal/types.h> @@ -242,17 +242,14 @@ sal_Int64 SAL_CALL SecurityEnvironment_NssImpl :: getSomething( const Sequence< } /* XUnoTunnel extension */ + +namespace +{ + class theSecurityEnvironment_NssImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_NssImplUnoTunnelId > {}; +} + const Sequence< sal_Int8>& SecurityEnvironment_NssImpl :: getUnoTunnelId() { - static Sequence< sal_Int8 >* pSeq = 0 ; - if( !pSeq ) { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ; - if( !pSeq ) { - static Sequence< sal_Int8> aSeq( 16 ) ; - rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ; - pSeq = &aSeq ; - } - } - return *pSeq ; + return theSecurityEnvironment_NssImplUnoTunnelId::get().getSeq(); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index c1ef726d5204..61a52adf7735 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -41,14 +41,12 @@ #include "pk11func.h" #include <sal/config.h> -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> #include "x509certificate_nssimpl.hxx" #include "certificateextension_xmlsecimpl.hxx" -#ifndef _SANEXTENSION_NSSIMPL_HXX_ #include "sanextension_nssimpl.hxx" -#endif using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::security ; @@ -327,17 +325,14 @@ sal_Int64 SAL_CALL X509Certificate_NssImpl :: getSomething( const Sequence< sal_ } /* XUnoTunnel extension */ + +namespace +{ + class theX509Certificate_NssImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theX509Certificate_NssImplUnoTunnelId > {}; +} + const Sequence< sal_Int8>& X509Certificate_NssImpl :: getUnoTunnelId() { - static Sequence< sal_Int8 >* pSeq = 0 ; - if( !pSeq ) { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ; - if( !pSeq ) { - static Sequence< sal_Int8> aSeq( 16 ) ; - rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ; - pSeq = &aSeq ; - } - } - return *pSeq ; + return theX509Certificate_NssImplUnoTunnelId::get().getSeq(); } /* XUnoTunnel extension */ |