diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 16:15:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 19:54:14 +0100 |
commit | 2048cbbfad35dd30a0fadb61a64f5d5a1ef66b9b (patch) | |
tree | aa2bdd35190394a483458b316227d4f4b780ae7d /cppuhelper/inc | |
parent | 522faf9ccb25254e3c765425c74aee5c2aa6c950 (diff) |
#i111793# make cppuhelper/interfacecontainer strict aliasing safe
Diffstat (limited to 'cppuhelper/inc')
-rw-r--r-- | cppuhelper/inc/cppuhelper/interfacecontainer.h | 23 |
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( () ); |