summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Giffuni <pfg@apache.org>2017-02-08 15:21:17 +0000
committerPedro Giffuni <pfg@apache.org>2017-02-08 15:21:17 +0000
commitda844070351493b0a4e60db14a1546fb346c1db7 (patch)
treec7f7e1c11213cf038189c442c95c32d4ee45896c
parentf4d433e226052e82002ea7012047bf9f6297b0a3 (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
-rw-r--r--basctl/source/dlged/dlged.cxx8
-rw-r--r--bridges/source/jni_uno/jni_data.cxx35
-rw-r--r--cppu/inc/com/sun/star/uno/Any.hxx95
-rw-r--r--cppu/source/threadpool/threadident.cxx9
-rw-r--r--cppu/source/uno/copy.hxx52
-rw-r--r--cppu/source/uno/data.cxx10
-rw-r--r--cppu/source/uno/destr.hxx2
-rw-r--r--cppu/source/uno/lbenv.cxx16
-rw-r--r--sal/osl/unx/pipe.c40
-rw-r--r--sal/osl/unx/sockimpl.h6
-rw-r--r--sw/source/filter/xml/swxml.cxx1
-rw-r--r--tools/source/stream/stream.cxx29
12 files changed, 165 insertions, 138 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 296a3f3009b5..646071095495 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -967,7 +967,7 @@ void DlgEditor::Paste()
uno::UNO_QUERY );
bool bSourceIsLocalized = false;
- Sequence< sal_Int8 > DialogModelBytes;
+ rtl::ByteSequence DialogModelBytes;
Sequence< sal_Int8 > aResData;
if( bLocalized && xTransf->isDataFlavorSupported( m_ClipboardDataFlavorsResource[1] ) )
{
@@ -1001,7 +1001,9 @@ void DlgEditor::Paste()
else
{
Any aAny = xTransf->getTransferData( m_ClipboardDataFlavors[0] );
- aAny >>= DialogModelBytes;
+ Sequence< sal_Int8 > aTmp;
+ aAny >>= aTmp;
+ DialogModelBytes = rtl::ByteSequence( aTmp.getArray(), aTmp.getLength() );
}
if ( xClipDialogModel.is() )
@@ -1010,7 +1012,7 @@ void DlgEditor::Paste()
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( DialogModelBytes ) , xClipDialogModel, xContext );
}
// get control models from clipboard dialog model
diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx
index 56f27161440f..fbae7058cb8e 100644
--- a/bridges/source/jni_uno/jni_data.cxx
+++ b/bridges/source/jni_uno/jni_data.cxx
@@ -556,45 +556,46 @@ void Bridge::map_to_uno(
pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_CHAR:
- *(jchar *) &pAny->pReserved = jni->CallCharMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jchar *) pAny->pData = jni->CallCharMethodA(
java_data.l, m_jni_info->m_method_Character_charValue, 0 );
jni.ensure_no_exception();
pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_BOOLEAN:
- *(jboolean *) &pAny->pReserved = jni->CallBooleanMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jboolean *) pAny->pData = jni->CallBooleanMethodA(
java_data.l, m_jni_info->m_method_Boolean_booleanValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_BYTE:
- *(jbyte *) &pAny->pReserved = jni->CallByteMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jbyte *) pAny->pData = jni->CallByteMethodA(
java_data.l, m_jni_info->m_method_Byte_byteValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
- *(jshort *) &pAny->pReserved = jni->CallShortMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jshort *) pAny->pData = jni->CallShortMethodA(
java_data.l, m_jni_info->m_method_Short_shortValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
- *(jint *) &pAny->pReserved = jni->CallIntMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jint *) pAny->pData = jni->CallIntMethodA(
java_data.l, m_jni_info->m_method_Integer_intValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
break;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
if (sizeof (sal_Int64) <= sizeof (void *))
{
- *(jlong *) &pAny->pReserved = jni->CallLongMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jlong *) pAny->pData = jni->CallLongMethodA(
java_data.l, m_jni_info->m_method_Long_longValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
}
else
{
@@ -609,10 +610,10 @@ void Bridge::map_to_uno(
case typelib_TypeClass_FLOAT:
if (sizeof (float) <= sizeof (void *))
{
- *(jfloat *) &pAny->pReserved = jni->CallFloatMethodA(
+ pAny->pData = &pAny->pReserved;
+ *(jfloat *) pAny->pData = jni->CallFloatMethodA(
java_data.l, m_jni_info->m_method_Float_floatValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
}
else
{
@@ -627,12 +628,12 @@ void Bridge::map_to_uno(
case typelib_TypeClass_DOUBLE:
if (sizeof (double) <= sizeof (void *))
{
- *(jdouble *) &pAny->pReserved =
+ pAny->pData = &pAny->pReserved;
+ *(jdouble *) pAny->pData =
jni->CallDoubleMethodA(
java_data.l,
m_jni_info->m_method_Double_doubleValue, 0 );
jni.ensure_no_exception();
- pAny->pData = &pAny->pReserved;
}
else
{
@@ -1653,7 +1654,7 @@ void Bridge::map_to_java(
case typelib_TypeClass_UNSIGNED_SHORT:
{
jvalue args[ 2 ];
- args[ 0 ].s = *(jshort const *) &pAny->pReserved;
+ args[ 0 ].s = *(jshort const *) pAny->pData;
JLocalAutoRef jo_val(
jni, jni->NewObjectA(
m_jni_info->m_class_Short,
@@ -1672,7 +1673,7 @@ void Bridge::map_to_java(
case typelib_TypeClass_UNSIGNED_LONG:
{
jvalue args[ 2 ];
- args[ 0 ].i = *(jint const *) &pAny->pReserved;
+ args[ 0 ].i = *(jint const *) pAny->pData;
JLocalAutoRef jo_val(
jni, jni->NewObjectA(
m_jni_info->m_class_Integer,
diff --git a/cppu/inc/com/sun/star/uno/Any.hxx b/cppu/inc/com/sun/star/uno/Any.hxx
index 4e3e7d35dfc1..4246880423d6 100644
--- a/cppu/inc/com/sun/star/uno/Any.hxx
+++ b/cppu/inc/com/sun/star/uno/Any.hxx
@@ -230,7 +230,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny,
{
if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
{
- value = (* reinterpret_cast< const sal_Bool * >( &rAny.pReserved ) != sal_False);
+ value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
return sal_True;
}
return sal_False;
@@ -239,7 +239,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny,
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW( () )
{
return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
- (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( &rAny.pReserved ) != sal_False));
+ (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
}
//______________________________________________________________________________
@@ -250,7 +250,7 @@ inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
{
value = *reinterpret_cast< sal_Bool const * >(
- &rAny.pReserved ) != sal_False;
+ rAny.pData ) != sal_False;
return true;
}
return false;
@@ -263,7 +263,7 @@ inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
{
return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
(value ==
- (*reinterpret_cast< sal_Bool const * >( &rAny.pReserved )
+ (*reinterpret_cast< sal_Bool const * >( rAny.pData )
!= sal_False)));
}
@@ -273,7 +273,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny,
{
if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
{
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
}
return sal_False;
@@ -285,11 +285,11 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SA
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
default:
return sal_False;
@@ -301,11 +301,11 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) S
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
default:
return sal_False;
@@ -318,17 +318,17 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SA
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
- value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
return sal_True;
default:
return sal_False;
@@ -340,17 +340,17 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) S
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
- value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
return sal_True;
default:
return sal_False;
@@ -363,24 +363,23 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SA
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_LONG:
- value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_LONG:
- value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
- value = * reinterpret_cast< const sal_Int64 * >(
- (sizeof(void *) >= sizeof(sal_Int64)) ? (void *)&rAny.pReserved : rAny.pData );
+ value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
return sal_True;
default:
@@ -393,24 +392,23 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) S
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_LONG:
- value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_LONG:
- value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
- value = * reinterpret_cast< const sal_uInt64 * >(
- (sizeof(void *) >= sizeof(sal_uInt64)) ? (void *)&rAny.pReserved : rAny.pData );
+ value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
return sal_True;
default:
@@ -424,17 +422,16 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_TH
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_FLOAT:
- value = * reinterpret_cast< const float * >(
- (sizeof(void *) >= sizeof(float)) ? (void *)&rAny.pReserved : rAny.pData );
+ value = * reinterpret_cast< const float * >( rAny.pData );
return sal_True;
default:
@@ -448,27 +445,25 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_T
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
- value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_SHORT:
- value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_SHORT:
- value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_LONG:
- value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_UNSIGNED_LONG:
- value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved );
+ value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
return sal_True;
case typelib_TypeClass_FLOAT:
- value = * reinterpret_cast< const float * >(
- (sizeof(void *) >= sizeof(float)) ? (void *)&rAny.pReserved : rAny.pData );
+ value = * reinterpret_cast< const float * >( rAny.pData );
return sal_True;
case typelib_TypeClass_DOUBLE:
- value = * reinterpret_cast< const double * >(
- (sizeof(void *) >= sizeof(double)) ? (void *)&rAny.pReserved : rAny.pData );
+ value = * reinterpret_cast< const double * >( rAny.pData );
return sal_True;
default:
@@ -481,7 +476,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & valu
{
if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
{
- value = * reinterpret_cast< const ::rtl::OUString * >( &rAny.pReserved );
+ value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
return sal_True;
}
return sal_False;
@@ -490,7 +485,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & valu
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW( () )
{
return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
- value.equals( * reinterpret_cast< const ::rtl::OUString * >( &rAny.pReserved ) ));
+ value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
}
// type
//__________________________________________________________________________________________________
@@ -498,7 +493,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THR
{
if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
{
- value = * reinterpret_cast< const Type * >( &rAny.pReserved );
+ value = * reinterpret_cast< const Type * >( rAny.pData );
return sal_True;
}
return sal_False;
@@ -507,7 +502,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THR
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW( () )
{
return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
- value.equals( * reinterpret_cast< const Type * >( &rAny.pReserved ) ));
+ value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
}
// any
//__________________________________________________________________________________________________
@@ -527,7 +522,7 @@ inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & v
{
if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
{
- return reinterpret_cast< const BaseReference * >( &rAny.pReserved )->operator == ( value );
+ return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
}
return sal_False;
}
diff --git a/cppu/source/threadpool/threadident.cxx b/cppu/source/threadpool/threadident.cxx
index 2b2161f98dd2..73095892f254 100644
--- a/cppu/source/threadpool/threadident.cxx
+++ b/cppu/source/threadpool/threadident.cxx
@@ -24,6 +24,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppu.hxx"
#include <stdio.h>
+#include <string.h>
#include <list>
@@ -47,10 +48,12 @@ using namespace ::cppu;
static inline void createLocalId( sal_Sequence **ppThreadId )
{
- rtl_byte_sequence_constructNoDefault( ppThreadId , 4 + 16 );
- *((sal_Int32*) ((*ppThreadId)->elements)) = osl_getThreadIdentifier(0);
+ rtl_byte_sequence_constructNoDefault( ppThreadId , sizeof(oslThreadIdentifier) + 16 );
- rtl_getGlobalProcessId( (sal_uInt8 * ) &( (*ppThreadId)->elements[4]) );
+ oslThreadIdentifier hIdent = osl_getThreadIdentifier(0);
+ memcpy((*ppThreadId)->elements, &hIdent, sizeof(oslThreadIdentifier));
+
+ rtl_getGlobalProcessId( (sal_uInt8 * ) &( (*ppThreadId)->elements[sizeof(oslThreadIdentifier)]) );
}
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 );
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index eb48daea299e..298ce8528296 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -163,7 +163,11 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
{
int Flags;
size_t len;
- struct sockaddr_un addr;
+ union
+ {
+ struct sockaddr addr;
+ struct sockaddr_un addr_un;
+ } s;
sal_Char name[PATH_MAX + 1];
const sal_Char *pPath;
@@ -218,16 +222,16 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
}
}
- memset(&addr, 0, sizeof(addr));
+ memset(&s.addr_un, 0, sizeof(s.addr_un));
OSL_TRACE("osl_createPipe : Pipe Name '%s'",name);
- addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, name, sizeof(addr.sun_path));
+ s.addr_un.sun_family = AF_UNIX;
+ strncpy(s.addr_un.sun_path, name, sizeof(s.addr_un.sun_path));
#if defined(FREEBSD)
- len = SUN_LEN(&addr);
+ len = SUN_LEN(&s.addr_un);
#else
- len = sizeof(addr);
+ len = sizeof(s.addr_un);
#endif
if ( Options & osl_Pipe_CREATE )
@@ -238,7 +242,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
if ( ( stat(name, &status) == 0) &&
( S_ISSOCK(status.st_mode) || S_ISFIFO(status.st_mode) ) )
{
- if ( connect(pPipe->m_Socket,(struct sockaddr *)&addr,len) >= 0 )
+ if ( connect(pPipe->m_Socket,&s.addr,len) >= 0 )
{
OSL_TRACE("osl_createPipe : Pipe already in use. Errno: %d; %s\n",errno,strerror(errno));
close (pPipe->m_Socket);
@@ -250,7 +254,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
}
/* ok, fs clean */
- if ( bind(pPipe->m_Socket, (struct sockaddr *)&addr, len) < 0 )
+ if ( bind(pPipe->m_Socket, &s.addr, len) < 0 )
{
OSL_TRACE("osl_createPipe : failed to bind socket. Errno: %d; %s\n",errno,strerror(errno));
close (pPipe->m_Socket);
@@ -282,7 +286,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
{ /* osl_pipe_OPEN */
if ( access(name, F_OK) != -1 )
{
- if ( connect( pPipe->m_Socket, (struct sockaddr *)&addr, len) >= 0 )
+ if ( connect( pPipe->m_Socket, &s.addr, len) >= 0 )
{
return (pPipe);
}
@@ -321,7 +325,11 @@ void SAL_CALL osl_closePipe( oslPipe pPipe )
int nRet;
#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
size_t len;
- struct sockaddr_un addr;
+ union
+ {
+ struct sockaddr_un addr_un;
+ struct sockaddr addr;
+ } s;
int fd;
#endif
int ConnFD;
@@ -348,19 +356,19 @@ void SAL_CALL osl_closePipe( oslPipe pPipe )
pPipe->m_bIsInShutdown = sal_True;
pPipe->m_Socket = -1;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
- memset(&addr, 0, sizeof(addr));
+ memset(&s.addr_un, 0, sizeof(s.addr_un));
OSL_TRACE("osl_destroyPipe : Pipe Name '%s'",pPipe->m_Name);
- addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path));
+ s.addr_un.sun_family = AF_UNIX;
+ strncpy(s.addr_un.sun_path, pPipe->m_Name, sizeof(s.addr_un.sun_path));
#if defined(FREEBSD)
- len = SUN_LEN(&addr);
+ len = SUN_LEN(&s.addr_un);
#else
- len = sizeof(addr);
+ len = sizeof(s.addr_un);
#endif
- nRet = connect( fd, (struct sockaddr *)&addr, len);
+ nRet = connect( fd, &s.addr, len);
#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h
index 2e80c9f9a921..7af97330343f 100644
--- a/sal/osl/unx/sockimpl.h
+++ b/sal/osl/unx/sockimpl.h
@@ -55,7 +55,11 @@ struct oslSocketImpl {
struct oslSocketAddrImpl
{
sal_Int32 m_nRefCount;
- struct sockaddr m_sockaddr;
+ union
+ {
+ struct sockaddr m_sockaddr;
+ struct sockaddr_in m_sockaddr_in;
+ };
};
struct oslPipeImpl {
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 1f449281e682..2086fd2abf71 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -1084,7 +1084,6 @@ sal_uInt16 XMLReader::GetSectionList( SfxMedium& rMedium,
{
// get filter
// #110680#
- // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( rStrings );
uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings );
// connect parser and filter
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index a0c8428bbd76..810dbd09d6b7 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -91,7 +91,15 @@ inline static void SwapLongUInt( unsigned int& r )
#ifdef UNX
inline static void SwapFloat( float& r )
{
- *((sal_uInt32*)(void*)&r) = SWAPLONG( *((sal_uInt32*)(void*)&r) );
+ union
+ {
+ float f;
+ sal_uInt32 c;
+ } s;
+
+ s.f = r;
+ s.c = SWAPLONG( s.c );
+ r = s.f;
}
inline static void SwapDouble( double& r )
{
@@ -101,12 +109,19 @@ inline static void SwapDouble( double& r )
}
else
{
- sal_uInt32* c = (sal_uInt32*)(void*)&r;
- c[0] ^= c[1]; // zwei 32-Bit-Werte in situ vertauschen
- c[1] ^= c[0];
- c[0] ^= c[1];
- c[0] = SWAPLONG(c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
- c[1] = SWAPLONG(c[1]);
+ union
+ {
+ double d;
+ sal_uInt32 c[2];
+ } s;
+
+ s.d = r;
+ s.c[0] ^= s.c[1]; // zwei 32-Bit-Werte in situ vertauschen
+ s.c[1] ^= s.c[0];
+ s.c[0] ^= s.c[1];
+ s.c[0] = SWAPLONG(s.c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
+ s.c[1] = SWAPLONG(s.c[1]);
+ r = s.d;
}
}
#endif