summaryrefslogtreecommitdiff
path: root/cppuhelper/inc
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-06-28 13:46:02 +0200
committersb <sb@openoffice.org>2010-06-28 13:46:02 +0200
commit2c5bdad1ea62253e987fc522868452e747da653c (patch)
treeb702c96436066e876e95169c3501405fecfbb693 /cppuhelper/inc
parente2a5cf6e3ad841a5e106450fb1da4d481f1c2ace (diff)
sb126: #i111793# make cppuhelper/interfacecontainer strict aliasing safe (patch by cmc, with slight modifications)
Diffstat (limited to 'cppuhelper/inc')
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h
index 3f5da6bd10dc..ee57127a4fca 100644
--- a/cppuhelper/inc/cppuhelper/interfacecontainer.h
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h
@@ -44,6 +44,17 @@
namespace cppu
{
+namespace detail {
+
+ union element_alias
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence;
+ ::com::sun::star::uno::XInterface * pAsInterface;
+ element_alias() : pAsInterface(0) {}
+ };
+
+}
+
//===================================================================
class OInterfaceContainerHelper;
/**
@@ -95,7 +106,9 @@ public:
private:
OInterfaceContainerHelper & rCont;
sal_Bool bIsList;
- void * pData;
+
+ detail::element_alias aData;
+
sal_Int32 nRemain;
OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) SAL_THROW( () );
@@ -222,14 +235,14 @@ public:
private:
friend class OInterfaceIteratorHelper;
/**
- bIsList == TRUE -> pData of type Sequence< XInterfaceSequence >,
- otherwise pData == of type (XEventListener *)
+ bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
+ otherwise aData.pAsInterface == of type (XEventListener *)
*/
- void * pData;
+ detail::element_alias aData;
::osl::Mutex & rMutex;
/** TRUE -> used by an iterator. */
sal_Bool bInUse;
- /** TRUE -> pData is of type Sequence< XInterfaceSequence >. */
+ /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
sal_Bool bIsList;
OInterfaceContainerHelper( const OInterfaceContainerHelper & ) SAL_THROW( () );