diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-10-03 16:41:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-10-03 17:00:54 +0100 |
commit | 424dcd6813acd267a2d686aaef185f9a6398fccb (patch) | |
tree | 247f841accd1fb489b517335c2669f7f5efe91af /cppu | |
parent | 28da0ea37f55885ba6e85a4cb58ef7b9b759f803 (diff) |
targeting gcc 4.6.1 gentoo strict-aliasing warnings
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/source/uno/copy.hxx | 84 |
1 files changed, 27 insertions, 57 deletions
diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index eee6363e6998..6416c22fb02c 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -184,72 +184,57 @@ 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; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) ); - *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource; - } + *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource; break; case typelib_TypeClass_FLOAT: if (sizeof(void *) >= sizeof(float)) - { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = *(float *)pSource; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(float) ); - *(float *)pDestAny->pData = *(float *)pSource; - } + *(float *)pDestAny->pData = *(float *)pSource; break; case typelib_TypeClass_DOUBLE: if (sizeof(void *) >= sizeof(double)) - { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = *(double *)pSource; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(double) ); - *(double *)pDestAny->pData = *(double *)pSource; - } + *(double *)pDestAny->pData = *(double *)pSource; break; 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_FAIL( "### unexpected nested any!" ); @@ -257,7 +242,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: @@ -318,7 +303,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 ); @@ -326,7 +311,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 ); @@ -393,82 +378,67 @@ 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; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) ); - *(sal_Int64 *)pDestAny->pData = 0; - } + *(sal_Int64 *)pDestAny->pData = 0; break; case typelib_TypeClass_FLOAT: if (sizeof(void *) >= sizeof(float)) - { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = 0.0; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(float) ); - *(float *)pDestAny->pData = 0.0; - } + *(float *)pDestAny->pData = 0.0; break; case typelib_TypeClass_DOUBLE: if (sizeof(void *) >= sizeof(double)) - { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = 0.0; - } else - { pDestAny->pData = ::rtl_allocateMemory( sizeof(double) ); - *(double *)pDestAny->pData = 0.0; - } + *(double *)pDestAny->pData = 0.0; break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)&pDestAny->pReserved = 0; - ::rtl_uString_new( (rtl_uString **)&pDestAny->pReserved ); + *(rtl_uString **)pDestAny->pData = 0; + ::rtl_uString_new( (rtl_uString **)pDestAny->pData ); 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; @@ -521,7 +491,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; |