diff options
author | Pedro Giffuni <pfg@apache.org> | 2017-02-08 15:21:17 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2017-02-08 15:21:17 +0000 |
commit | da844070351493b0a4e60db14a1546fb346c1db7 (patch) | |
tree | c7f7e1c11213cf038189c442c95c32d4ee45896c /cppu/source/uno | |
parent | f4d433e226052e82002ea7012047bf9f6297b0a3 (diff) |
i101100 - Fix some aliasing issues.
This is a very small part of a patch submitted by Caolan McNamara on
2009 to help OOo work with -fstrict-aliasing. It is not complete and for
now I omitted adding -fno-strict-aliasing to many makefiles.
This does require a lot more attention and will have to be completed at
some point because newer versions of GCC enable strict-aliasing with most
optimization levels.
Notes
Notes:
prefer: 11513ddf5b05cb7b3c1e91f9728159b9be3a5da2
Diffstat (limited to 'cppu/source/uno')
-rw-r--r-- | cppu/source/uno/copy.hxx | 52 | ||||
-rw-r--r-- | cppu/source/uno/data.cxx | 10 | ||||
-rw-r--r-- | cppu/source/uno/destr.hxx | 2 | ||||
-rw-r--r-- | cppu/source/uno/lbenv.cxx | 16 |
4 files changed, 40 insertions, 40 deletions
diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index fb4887c1d917..0248f501ee1c 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -179,32 +179,32 @@ inline void _copyConstructAnyFromData( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)&pDestAny->pReserved = *(sal_Unicode *)pSource; + *(sal_Unicode *)pDestAny->pData = *(sal_Unicode *)pSource; break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)&pDestAny->pReserved = (*(sal_Bool *)pSource != sal_False); + *(sal_Bool *)pDestAny->pData = (*(sal_Bool *)pSource != sal_False); break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)&pDestAny->pReserved = *(sal_Int8 *)pSource; + *(sal_Int8 *)pDestAny->pData = *(sal_Int8 *)pSource; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)&pDestAny->pReserved = *(sal_Int16 *)pSource; + *(sal_Int16 *)pDestAny->pData = *(sal_Int16 *)pSource; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource; + *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: if (sizeof(void *) >= sizeof(sal_Int64)) { pDestAny->pData = &pDestAny->pReserved; - *(sal_Int64 *)&pDestAny->pReserved = *(sal_Int64 *)pSource; + *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource; } else { @@ -216,7 +216,7 @@ inline void _copyConstructAnyFromData( if (sizeof(void *) >= sizeof(float)) { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = *(float *)pSource; + *(float *)pDestAny->pData = *(float *)pSource; } else { @@ -228,7 +228,7 @@ inline void _copyConstructAnyFromData( if (sizeof(void *) >= sizeof(double)) { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = *(double *)pSource; + *(double *)pDestAny->pData = *(double *)pSource; } else { @@ -239,12 +239,12 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_STRING: ::rtl_uString_acquire( *(rtl_uString **)pSource ); pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)&pDestAny->pReserved = *(rtl_uString **)pSource; + *(rtl_uString **)pDestAny->pData = *(rtl_uString **)pSource; break; case typelib_TypeClass_TYPE: TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource ); pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)&pDestAny->pReserved = *(typelib_TypeDescriptionReference **)pSource; + *(typelib_TypeDescriptionReference **)pDestAny->pData = *(typelib_TypeDescriptionReference **)pSource; break; case typelib_TypeClass_ANY: OSL_ENSURE( 0, "### unexpected nested any!" ); @@ -252,7 +252,7 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; // enum is forced to 32bit long - *(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource; + *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: @@ -313,7 +313,7 @@ inline void _copyConstructAnyFromData( pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(uno_Sequence **)&pDestAny->pReserved = copyConstructSequence( + *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, acquire, mapping ); @@ -321,7 +321,7 @@ inline void _copyConstructAnyFromData( else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(uno_Sequence **)&pDestAny->pReserved = copyConstructSequence( + *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, acquire, mapping ); @@ -388,32 +388,32 @@ inline void _copyConstructAny( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)&pDestAny->pReserved = '\0'; + *(sal_Unicode *)pDestAny->pData = '\0'; break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)&pDestAny->pReserved = sal_False; + *(sal_Bool *)pDestAny->pData = sal_False; break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)&pDestAny->pReserved = 0; + *(sal_Int8 *)pDestAny->pData = 0; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)&pDestAny->pReserved = 0; + *(sal_Int16 *)pDestAny->pData = 0; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)&pDestAny->pReserved = 0; + *(sal_Int32 *)pDestAny->pData = 0; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: if (sizeof(void *) >= sizeof(sal_Int64)) { pDestAny->pData = &pDestAny->pReserved; - *(sal_Int64 *)&pDestAny->pReserved = 0; + *(sal_Int64 *)pDestAny->pData = 0; } else { @@ -425,7 +425,7 @@ inline void _copyConstructAny( if (sizeof(void *) >= sizeof(float)) { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = 0.0; + *(float *)pDestAny->pData = 0.0; } else { @@ -437,7 +437,7 @@ inline void _copyConstructAny( if (sizeof(void *) >= sizeof(double)) { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = 0.0; + *(double *)pDestAny->pData = 0.0; } else { @@ -447,23 +447,23 @@ inline void _copyConstructAny( break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)&pDestAny->pReserved = 0; + *(rtl_uString **)pDestAny->pData = 0; ::rtl_uString_new( (rtl_uString **)&pDestAny->pReserved ); break; case typelib_TypeClass_TYPE: pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)&pDestAny->pReserved = _getVoidType(); + *(typelib_TypeDescriptionReference **)pDestAny->pData = _getVoidType(); break; case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(sal_Int32 *)&pDestAny->pReserved = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(sal_Int32 *)&pDestAny->pReserved = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -516,7 +516,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_SEQUENCE: pDestAny->pData = &pDestAny->pReserved; - *(uno_Sequence **)&pDestAny->pReserved = createEmptySequence(); + *(uno_Sequence **)pDestAny->pData = createEmptySequence(); break; case typelib_TypeClass_INTERFACE: pDestAny->pData = &pDestAny->pReserved; diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index be4e38129a8b..fe212c14e7e3 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -64,12 +64,12 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p { typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); - OSL_ASSERT( pTXInterfaceDescr->ppAllMembers ); + typelib_TypeDescription * pTXInterfaceDescr = 0; + TYPELIB_DANGER_GET( &pTXInterfaceDescr, type_XInterface ); + OSL_ASSERT( ((typelib_InterfaceTypeDescription*)pTXInterfaceDescr)->ppAllMembers ); typelib_typedescriptionreference_getDescription( - &g_pQITD, pTXInterfaceDescr->ppAllMembers[ 0 ] ); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); + &g_pQITD, ((typelib_InterfaceTypeDescription*)pTXInterfaceDescr)->ppAllMembers[ 0 ] ); + TYPELIB_DANGER_RELEASE( pTXInterfaceDescr ); } } diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 3922d18e1603..5b7151547944 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -171,7 +171,7 @@ inline void _destructAny( case typelib_TypeClass_SEQUENCE: { destructSequence( - *(uno_Sequence **) &pAny->pReserved, pType, 0, release ); + *(uno_Sequence **) pAny->pData, pType, 0, release ); break; } case typelib_TypeClass_INTERFACE: diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 0a6a32f2cbc3..b02ad3ab1bc9 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -257,7 +257,7 @@ static void SAL_CALL defenv_registerInterface( rtl_uString * pOId, typelib_InterfaceTypeDescription * pTypeDescr ) { OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr, "### null ptr!" ); - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); @@ -265,10 +265,10 @@ static void SAL_CALL defenv_registerInterface( // try to insert dummy 0: std::pair<OId2ObjectMap::iterator, bool> const insertion( - that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( rOId, 0 ) ) ); + that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( sOId, 0 ) ) ); if (insertion.second) { - ObjectEntry * pOEntry = new ObjectEntry( rOId ); + ObjectEntry * pOEntry = new ObjectEntry( sOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); @@ -305,7 +305,7 @@ static void SAL_CALL defenv_registerProxyInterface( { OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr && freeProxy, "### null ptr!" ); - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); @@ -313,10 +313,10 @@ static void SAL_CALL defenv_registerProxyInterface( // try to insert dummy 0: std::pair<OId2ObjectMap::iterator, bool> const insertion( - that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( rOId, 0 ) ) ); + that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( sOId, 0 ) ) ); if (insertion.second) { - ObjectEntry * pOEntry = new ObjectEntry( rOId ); + ObjectEntry * pOEntry = new ObjectEntry( sOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object pOEntry->append( that, *ppInterface, pTypeDescr, freeProxy ); @@ -494,13 +494,13 @@ static void SAL_CALL defenv_getRegisteredInterface( *ppInterface = 0; } - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); ::osl::MutexGuard guard( that->mutex ); OId2ObjectMap::const_iterator const iFind - ( that->aOId2ObjectMap.find( rOId ) ); + ( that->aOId2ObjectMap.find( sOId ) ); if (iFind != that->aOId2ObjectMap.end()) { InterfaceEntry const * pIEntry = iFind->second->find( pTypeDescr ); |