summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-28 19:05:27 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-28 19:09:23 +0100
commit8375ac018628a7619c6719dd6fb5761a007e069e (patch)
treef9fadaf8f60b7115c4f47af4453bbab76283147f /pyuno
parentd0c9cb0c253ea9cff472a811dafb80043d7889a8 (diff)
Clean up C-style casts from pointers to void
Change-Id: I3676d56e65dd2d5b36882073c63e571a79819fee
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx2
-rw-r--r--pyuno/source/module/pyuno.cxx38
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx2
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx10
-rw-r--r--pyuno/source/module/pyuno_type.cxx4
5 files changed, 28 insertions, 28 deletions
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index d23349d7e8ce..913954ec8361 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -73,7 +73,7 @@ static void raiseRuntimeExceptionWhenNeeded() throw ( RuntimeException )
OUStringBuffer buf;
buf.appendAscii( "python-loader:" );
if( a.hasValue() )
- buf.append( ((com::sun::star::uno::Exception *)a.getValue())->Message );
+ buf.append( static_cast<com::sun::star::uno::Exception const *>(a.getValue())->Message );
throw RuntimeException( buf.makeStringAndClear() );
}
}
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index cc9555c0062a..1d990d035eeb 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -84,10 +84,10 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
case typelib_TypeClass_INTERFACE:
{
buf.append( "0x" );
- buf.append( reinterpret_cast< sal_IntPtr >(*(void **)pVal), 16 );
+ buf.append( reinterpret_cast< sal_IntPtr >(*static_cast<void * const *>(pVal)), 16 );
if( VAL2STR_MODE_DEEP == mode )
{
- buf.append( "{" ); Reference< XInterface > r = *( Reference< XInterface > * ) pVal;
+ buf.append( "{" ); Reference< XInterface > r = *static_cast<Reference< XInterface > const *>(pVal);
Reference< XServiceInfo > serviceInfo( r, UNO_QUERY);
Reference< XTypeProvider > typeProvider(r,UNO_QUERY);
if( serviceInfo.is() )
@@ -150,7 +150,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
buf.append( " = " );
typelib_TypeDescription * pMemberType = 0;
TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[nPos] );
- buf.append( val2str( (char *)pVal + pMemberOffsets[nPos], pMemberType->pWeakRef, mode ) );
+ buf.append( val2str( static_cast<char const *>(pVal) + pMemberOffsets[nPos], pMemberType->pWeakRef, mode ) );
TYPELIB_DANGER_RELEASE( pMemberType );
if (nPos < (nDescr -1))
buf.append( ", " );
@@ -166,7 +166,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
- uno_Sequence * pSequence = *(uno_Sequence **)pVal;
+ uno_Sequence * pSequence = *static_cast<uno_Sequence * const *>(pVal);
typelib_TypeDescription * pElementTypeDescr = 0;
TYPELIB_DANGER_GET( &pElementTypeDescr, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType );
@@ -195,17 +195,17 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
}
case typelib_TypeClass_ANY:
buf.append( "{ " );
- buf.append( val2str( ((uno_Any *)pVal)->pData,
- ((uno_Any *)pVal)->pType ,
+ buf.append( val2str( static_cast<uno_Any const *>(pVal)->pData,
+ static_cast<uno_Any const *>(pVal)->pType ,
mode) );
buf.append( " }" );
break;
case typelib_TypeClass_TYPE:
- buf.append( (*(typelib_TypeDescriptionReference **)pVal)->pTypeName );
+ buf.append( (*static_cast<typelib_TypeDescriptionReference * const *>(pVal))->pTypeName );
break;
case typelib_TypeClass_STRING:
buf.append( '\"' );
- buf.append( *(rtl_uString **)pVal );
+ buf.append( *static_cast<rtl_uString * const *>(pVal) );
buf.append( '\"' );
break;
case typelib_TypeClass_ENUM:
@@ -217,7 +217,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
sal_Int32 nPos = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nEnumValues;
while (nPos--)
{
- if (pValues[nPos] == *(int *)pVal)
+ if (pValues[nPos] == *static_cast<int const *>(pVal))
break;
}
if (nPos >= 0)
@@ -229,41 +229,41 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
break;
}
case typelib_TypeClass_BOOLEAN:
- if (*(sal_Bool *)pVal)
+ if (*static_cast<sal_Bool const *>(pVal))
buf.append( "true" );
else
buf.append( "false" );
break;
case typelib_TypeClass_CHAR:
buf.append( '\'' );
- buf.append( *(sal_Unicode *)pVal );
+ buf.append( *static_cast<sal_Unicode const *>(pVal) );
buf.append( '\'' );
break;
case typelib_TypeClass_FLOAT:
- buf.append( *(float *)pVal );
+ buf.append( *static_cast<float const *>(pVal) );
break;
case typelib_TypeClass_DOUBLE:
- buf.append( *(double *)pVal );
+ buf.append( *static_cast<double const *>(pVal) );
break;
case typelib_TypeClass_BYTE:
buf.append( "0x" );
- buf.append( (sal_Int32)*(sal_Int8 *)pVal, 16 );
+ buf.append( (sal_Int32)*static_cast<sal_Int8 const *>(pVal), 16 );
break;
case typelib_TypeClass_SHORT:
buf.append( "0x" );
- buf.append( (sal_Int32)*(sal_Int16 *)pVal, 16 );
+ buf.append( (sal_Int32)*static_cast<sal_Int16 const *>(pVal), 16 );
break;
case typelib_TypeClass_UNSIGNED_SHORT:
buf.append( "0x" );
- buf.append( (sal_Int32)*(sal_uInt16 *)pVal, 16 );
+ buf.append( (sal_Int32)*static_cast<sal_uInt16 const *>(pVal), 16 );
break;
case typelib_TypeClass_LONG:
buf.append( "0x" );
- buf.append( *(sal_Int32 *)pVal, 16 );
+ buf.append( *static_cast<sal_Int32 const *>(pVal), 16 );
break;
case typelib_TypeClass_UNSIGNED_LONG:
buf.append( "0x" );
- buf.append( (sal_Int64)*(sal_uInt32 *)pVal, 16 );
+ buf.append( (sal_Int64)*static_cast<sal_uInt32 const *>(pVal), 16 );
break;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
@@ -278,7 +278,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
buf.append( aVal, 16 );
}
#else
- buf.append( *(sal_Int64 *)pVal, 16 );
+ buf.append( *static_cast<sal_Int64 const *>(pVal), 16 );
#endif
break;
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index 9c5fade9f870..b57f6dfd9043 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -86,7 +86,7 @@ void raiseInvocationTargetExceptionWhenNeeded( const Runtime &runtime )
PyErr_Fetch(reinterpret_cast<PyObject **>(&excType), reinterpret_cast<PyObject**>(&excValue), reinterpret_cast<PyObject**>(&excTraceback));
Any unoExc( runtime.extractUnoException( excType, excValue, excTraceback ) );
throw InvocationTargetException(
- ((com::sun::star::uno::Exception*)unoExc.getValue())->Message,
+ static_cast<com::sun::star::uno::Exception const *>(unoExc.getValue())->Message,
Reference<XInterface>(), unoExc );
}
}
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index cafd84b1047b..c58682cd006b 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -380,7 +380,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
}
case typelib_TypeClass_CHAR:
{
- sal_Unicode c = *(sal_Unicode*)a.getValue();
+ sal_Unicode c = *static_cast<sal_Unicode const *>(a.getValue());
return PyRef( PyUNO_char_new( c , *this ), SAL_NO_ACQUIRE );
}
case typelib_TypeClass_BOOLEAN:
@@ -454,7 +454,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
}
case typelib_TypeClass_ENUM:
{
- sal_Int32 l = *(sal_Int32 *) a.getValue();
+ sal_Int32 l = *static_cast<sal_Int32 const *>(a.getValue());
TypeDescription desc( a.getValueType() );
if( desc.is() )
{
@@ -500,7 +500,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
// assuming that the Message is always the first member, wuuuu
void *pData = (void*)a.getValue();
- OUString message = *(OUString * )pData;
+ OUString message = *static_cast<OUString *>(pData);
PyRef pymsg = ustring2PyString( message );
PyTuple_SetItem( args.get(), 0 , pymsg.getAcquired() );
// the exception base functions want to have an "args" tuple,
@@ -1024,7 +1024,7 @@ PyThreadAttach::~PyThreadAttach()
PyObject *value =
PyDict_GetItemString( PyThreadState_GetDict( ), g_NUMERICID );
if( value )
- setlocale( LC_NUMERIC, (const char * ) PyLong_AsVoidPtr( value ) );
+ setlocale( LC_NUMERIC, static_cast<const char *>(PyLong_AsVoidPtr( value )) );
PyThreadState_Clear( tstate );
PyEval_ReleaseThread( tstate );
PyThreadState_Delete( tstate );
@@ -1037,7 +1037,7 @@ PyThreadDetach::PyThreadDetach() throw ( com::sun::star::uno::RuntimeException )
PyObject *value =
PyDict_GetItemString( PyThreadState_GetDict( ), g_NUMERICID );
if( value )
- setlocale( LC_NUMERIC, (const char * ) PyLong_AsVoidPtr( value ) );
+ setlocale( LC_NUMERIC, static_cast<const char *>(PyLong_AsVoidPtr( value )) );
PyEval_ReleaseThread( tstate );
}
diff --git a/pyuno/source/module/pyuno_type.cxx b/pyuno/source/module/pyuno_type.cxx
index 7b48e6c97d97..d2230e4d114a 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -222,13 +222,13 @@ Type PyType2Type( PyObject * o ) throw(RuntimeException )
buf.appendAscii( "type " ).append(name).appendAscii( " is unknown" );
throw RuntimeException( buf.makeStringAndClear() );
}
- if( desc.get()->eTypeClass != (typelib_TypeClass) *(sal_Int32*)enumValue.getValue() )
+ if( desc.get()->eTypeClass != (typelib_TypeClass) *static_cast<sal_Int32 const *>(enumValue.getValue()) )
{
OUStringBuffer buf;
buf.appendAscii( "pyuno.checkType: " ).append(name).appendAscii( " is a " );
buf.appendAscii( typeClassToString( (TypeClass) desc.get()->eTypeClass) );
buf.appendAscii( ", but type got construct with typeclass " );
- buf.appendAscii( typeClassToString( (TypeClass) *(sal_Int32*)enumValue.getValue() ) );
+ buf.appendAscii( typeClassToString( (TypeClass) *static_cast<sal_Int32 const *>(enumValue.getValue()) ) );
throw RuntimeException( buf.makeStringAndClear() );
}
return desc.get()->pWeakRef;