summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-11-09 15:38:59 +0100
committerVladimir Glazunov <vg@openoffice.org>2010-11-09 15:38:59 +0100
commit77fea6c32233915a1852b53f799233e92858cc63 (patch)
tree21b8004a19c179bf4296e990413e4c842ab71ace
parent6852907c749c74b533b6c3b0ddd4380c7f7836ee (diff)
parent5efdc86002c25f2041f97924749b6a6405ea6688 (diff)
CWS-TOOLING: integrate CWS fwk149ooo/DEV300_m94ooo/DEV300_m93
-rw-r--r--package/inc/ZipPackageFolder.hxx7
-rw-r--r--package/source/xstor/owriteablestream.cxx20
-rw-r--r--package/source/xstor/xstorage.cxx20
-rw-r--r--package/source/zippackage/ZipPackage.cxx16
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx15
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx15
-rw-r--r--package/source/zippackage/ZipPackageStream.hxx6
7 files changed, 37 insertions, 62 deletions
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index e8b814f3e..d2963f8e5 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -53,8 +53,6 @@ class ZipPackageFolder : public cppu::ImplInheritanceHelper2
::com::sun::star::container::XEnumerationAccess
>
{
- static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
-
protected:
ContentHash maContents;
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
@@ -82,10 +80,7 @@ public:
throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource);
- static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId()
- {
- return aImplementationId;
- }
+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index e17ffeeac..69eb7f093 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -54,6 +54,7 @@
#include <rtl/digest.h>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
// since the copying uses 32000 blocks usually, it makes sense to have a smaller size
#define MAX_STORCACHE_SIZE 30000
@@ -2173,25 +2174,14 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
return m_pData->m_pTypeCollection->getTypes() ;
}
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
+
//-----------------------------------------------
uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId()
throw( uno::RuntimeException )
{
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
-
- if ( pID == NULL )
- {
- static ::cppu::OImplementationId aID( sal_False ) ;
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-
+ ::cppu::OImplementationId &rId = lcl_ImplId::get();
+ return rId.getImplementationId();
}
//-----------------------------------------------
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index c6cc37f6f..40f493d28 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -49,6 +49,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
@@ -2368,25 +2369,14 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
return m_pData->m_pTypeCollection->getTypes() ;
}
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
+
//-----------------------------------------------
uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId()
throw( uno::RuntimeException )
{
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
-
- if ( pID == NULL )
- {
- static ::cppu::OImplementationId aID( sal_False ) ;
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-
+ ::cppu::OImplementationId &rID = lcl_ImplId::get();
+ return rID.getImplementationId();
}
//____________________________________________________________________________________________________
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index cb2224ba5..150345a4a 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -69,6 +69,7 @@
#include <rtl/uri.hxx>
#include <rtl/random.h>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include <osl/time.h>
#include <osl/file.hxx>
#include "com/sun/star/io/XAsyncOutputMonitor.hpp"
@@ -1607,21 +1608,14 @@ uno::Reference < XSingleServiceFactory > ZipPackage::createServiceFactory( uno::
static_getSupportedServiceNames());
}
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
+
// XUnoTunnel
Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void )
throw (RuntimeException)
{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ ::cppu::OImplementationId &rId = lcl_ImplId::get();
+ return rId.getImplementationId();
}
sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier )
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index b353504e4..d2c81b993 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <EncryptedDataHeader.hxx>
#include <rtl/random.h>
+#include <rtl/instance.hxx>
#include <memory>
using namespace com::sun::star::packages::zip::ZipConstants;
@@ -59,7 +60,7 @@ using namespace std;
using namespace ::com::sun::star;
using vos::ORef;
-Sequence < sal_Int8 > ZipPackageFolder::aImplementationId = Sequence < sal_Int8 > ();
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
sal_Int32 nFormat,
@@ -80,10 +81,9 @@ ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xF
aEntry.nCompressedSize = 0;
aEntry.nSize = 0;
aEntry.nOffset = -1;
- if ( !aImplementationId.getLength() )
- {
- aImplementationId = getImplementationId();
- }
+ Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
+ if ( !rCachedImplId.getLength() )
+ rCachedImplId = getImplementationId();
}
@@ -187,6 +187,11 @@ void ZipPackageFolder::copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource)
rDest.nExtraLen = rSource.nExtraLen;
}
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_getImplementationId()
+{
+ return lcl_CachedImplId::get();
+}
+
// XNameContainer
void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index ce97ba507..39a4fb8d0 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -46,6 +46,8 @@
#include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx>
+#include <rtl/instance.hxx>
+
#include <PackageConstants.hxx>
using namespace com::sun::star::packages::zip::ZipConstants;
@@ -56,8 +58,12 @@ using namespace com::sun::star;
using namespace cppu;
using namespace rtl;
-Sequence < sal_Int8 > ZipPackageStream::aImplementationId = Sequence < sal_Int8 > ();
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_getImplementationId()
+{
+ return lcl_CachedImplId::get();
+}
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
const Reference< XMultiServiceFactory >& xFactory,
@@ -92,10 +98,9 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
aEntry.nPathLen = -1;
aEntry.nExtraLen = -1;
- if ( !aImplementationId.getLength() )
- {
- aImplementationId = getImplementationId();
- }
+ Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
+ if ( !rCachedImplId.getLength() )
+ rCachedImplId = getImplementationId();
}
ZipPackageStream::~ZipPackageStream( void )
diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/source/zippackage/ZipPackageStream.hxx
index e6d3494cf..f83829782 100644
--- a/package/source/zippackage/ZipPackageStream.hxx
+++ b/package/source/zippackage/ZipPackageStream.hxx
@@ -55,7 +55,6 @@ class ZipPackageStream : public cppu::ImplInheritanceHelper2
::com::sun::star::packages::XDataSinkEncrSupport
>
{
- static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
protected:
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
@@ -146,10 +145,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData()
throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId()
- {
- return aImplementationId;
- }
+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
// XActiveDataSink
virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )