Kaydet (Commit) 26655d09 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Reduce to static_cast any reinterpret_cast from void pointers

Change-Id: I19b86fba87df57c4c65c658d051b664c527214eb
üst 14a4390b
...@@ -306,7 +306,7 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_ ...@@ -306,7 +306,7 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_
n = classify_argument( pTypeRef, classes, 0 ); n = classify_argument( pTypeRef, classes, 0 );
sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct ); sal_uInt64 *pStructAlign = static_cast<sal_uInt64 *>( pStruct );
for ( n--; n >= 0; n-- ) for ( n--; n >= 0; n-- )
switch ( classes[n] ) switch ( classes[n] )
{ {
......
...@@ -125,25 +125,25 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( ...@@ -125,25 +125,25 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
{ {
case typelib_TypeClass_HYPER: case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_UNSIGNED_HYPER:
*reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = data.rax; *static_cast<sal_uInt64 *>( pRegisterReturn ) = data.rax;
break; break;
case typelib_TypeClass_LONG: case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM: case typelib_TypeClass_ENUM:
*reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &data.rax ); *static_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &data.rax );
break; break;
case typelib_TypeClass_CHAR: case typelib_TypeClass_CHAR:
case typelib_TypeClass_SHORT: case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_UNSIGNED_SHORT:
*reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &data.rax ); *static_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &data.rax );
break; break;
case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE: case typelib_TypeClass_BYTE:
*reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &data.rax ); *static_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &data.rax );
break; break;
case typelib_TypeClass_FLOAT: case typelib_TypeClass_FLOAT:
case typelib_TypeClass_DOUBLE: case typelib_TypeClass_DOUBLE:
*reinterpret_cast<double *>( pRegisterReturn ) = data.xmm0; *static_cast<double *>( pRegisterReturn ) = data.xmm0;
break; break;
default: default:
{ {
......
...@@ -339,7 +339,7 @@ typelib_TypeClass cpp_vtable_call( ...@@ -339,7 +339,7 @@ typelib_TypeClass cpp_vtable_call(
case 0: // queryInterface() opt case 0: // queryInterface() opt
{ {
typelib_TypeDescription * pTD = 0; typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( gpreg[2] )->getTypeLibType() ); TYPELIB_DANGER_GET( &pTD, static_cast<Type *>( gpreg[2] )->getTypeLibType() );
if ( pTD ) if ( pTD )
{ {
XInterface * pInterface = 0; XInterface * pInterface = 0;
...@@ -351,7 +351,7 @@ typelib_TypeClass cpp_vtable_call( ...@@ -351,7 +351,7 @@ typelib_TypeClass cpp_vtable_call(
if ( pInterface ) if ( pInterface )
{ {
::uno_any_construct( reinterpret_cast<uno_Any *>( gpreg[0] ), ::uno_any_construct( static_cast<uno_Any *>( gpreg[0] ),
&pInterface, pTD, cpp_acquire ); &pInterface, pTD, cpp_acquire );
pInterface->release(); pInterface->release();
......
...@@ -412,7 +412,7 @@ void unoInterfaceProxyDispatch( ...@@ -412,7 +412,7 @@ void unoInterfaceProxyDispatch(
case 0: // queryInterface() opt case 0: // queryInterface() opt
{ {
typelib_TypeDescription * pTD = 0; typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() ); TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pArgs[0] )->getTypeLibType() );
if (pTD) if (pTD)
{ {
uno_Interface * pInterface = 0; uno_Interface * pInterface = 0;
...@@ -423,7 +423,7 @@ void unoInterfaceProxyDispatch( ...@@ -423,7 +423,7 @@ void unoInterfaceProxyDispatch(
if (pInterface) if (pInterface)
{ {
::uno_any_construct( ::uno_any_construct(
reinterpret_cast< uno_Any * >( pReturn ), static_cast< uno_Any * >( pReturn ),
&pInterface, pTD, 0 ); &pInterface, pTD, 0 );
(*pInterface->release)( pInterface ); (*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD ); TYPELIB_DANGER_RELEASE( pTD );
......
...@@ -56,8 +56,8 @@ void cpp2unoMapping( ...@@ -56,8 +56,8 @@ void cpp2unoMapping(
assert(ppUnoI && pTypeDescr); assert(ppUnoI && pTypeDescr);
if (*ppUnoI) if (*ppUnoI)
{ {
(*reinterpret_cast< uno_Interface * >( *ppUnoI )->release)( (*static_cast< uno_Interface * >( *ppUnoI )->release)(
reinterpret_cast< uno_Interface * >( *ppUnoI ) ); static_cast< uno_Interface * >( *ppUnoI ) );
*ppUnoI = 0; *ppUnoI = 0;
} }
if (pCppI) if (pCppI)
......
...@@ -100,7 +100,7 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) ...@@ -100,7 +100,7 @@ static void s_stub_computeObjectIdentifier(va_list * pParam)
{ {
::com::sun::star::uno::Reference< ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface > xHome( ::com::sun::star::uno::XInterface > xHome(
reinterpret_cast< ::com::sun::star::uno::XInterface * >( static_cast< ::com::sun::star::uno::XInterface * >(
pInterface ), pInterface ),
::com::sun::star::uno::UNO_QUERY ); ::com::sun::star::uno::UNO_QUERY );
assert(xHome.is() && "### query to XInterface failed!"); assert(xHome.is() && "### query to XInterface failed!");
...@@ -142,7 +142,7 @@ static void s_stub_acquireInterface(va_list * pParam) ...@@ -142,7 +142,7 @@ static void s_stub_acquireInterface(va_list * pParam)
/*uno_ExtEnvironment * pExtEnv = */va_arg(*pParam, uno_ExtEnvironment *); /*uno_ExtEnvironment * pExtEnv = */va_arg(*pParam, uno_ExtEnvironment *);
void * pCppI = va_arg(*pParam, void *); void * pCppI = va_arg(*pParam, void *);
reinterpret_cast< ::com::sun::star::uno::XInterface * >( pCppI )->acquire(); static_cast< ::com::sun::star::uno::XInterface * >( pCppI )->acquire();
} }
static void SAL_CALL acquireInterface( uno_ExtEnvironment * pExtEnv, void * pCppI ) static void SAL_CALL acquireInterface( uno_ExtEnvironment * pExtEnv, void * pCppI )
...@@ -155,7 +155,7 @@ static void s_stub_releaseInterface(va_list * pParam) ...@@ -155,7 +155,7 @@ static void s_stub_releaseInterface(va_list * pParam)
/*uno_ExtEnvironment * pExtEnv = */va_arg(*pParam, uno_ExtEnvironment *); /*uno_ExtEnvironment * pExtEnv = */va_arg(*pParam, uno_ExtEnvironment *);
void * pCppI = va_arg(*pParam, void *); void * pCppI = va_arg(*pParam, void *);
reinterpret_cast< ::com::sun::star::uno::XInterface * >( pCppI )->release(); static_cast< ::com::sun::star::uno::XInterface * >( pCppI )->release();
} }
static void SAL_CALL releaseInterface( uno_ExtEnvironment * pExtEnv, void * pCppI ) static void SAL_CALL releaseInterface( uno_ExtEnvironment * pExtEnv, void * pCppI )
......
...@@ -32,7 +32,7 @@ void freeUnoInterfaceProxy(uno_ExtEnvironment * pEnv, void * pProxy) ...@@ -32,7 +32,7 @@ void freeUnoInterfaceProxy(uno_ExtEnvironment * pEnv, void * pProxy)
{ {
UnoInterfaceProxy * pThis = UnoInterfaceProxy * pThis =
static_cast< UnoInterfaceProxy * >( static_cast< UnoInterfaceProxy * >(
reinterpret_cast< uno_Interface * >( pProxy ) ); static_cast< uno_Interface * >( pProxy ) );
if (pEnv != pThis->pBridge->getUnoEnv()) { if (pEnv != pThis->pBridge->getUnoEnv()) {
assert(false); assert(false);
} }
......
...@@ -94,14 +94,14 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const ...@@ -94,14 +94,14 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const
{ {
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// append java stack trace to Message member // append java stack trace to Message member
reinterpret_cast< ::com::sun::star::uno::Exception * >( static_cast< ::com::sun::star::uno::Exception * >(
uno_exc->pData )->Message += jni.get_stack_trace(); uno_exc->pData )->Message += jni.get_stack_trace();
#endif #endif
SAL_INFO( SAL_INFO(
"bridges", "bridges",
"exception occurred java->uno: [" "exception occurred java->uno: ["
<< OUString::unacquired(&uno_exc->pType->pTypeName) << "] " << OUString::unacquired(&uno_exc->pType->pTypeName) << "] "
<< reinterpret_cast<css::uno::Exception const *>( << static_cast<css::uno::Exception const *>(
uno_exc->pData)->Message); uno_exc->pData)->Message);
// signal exception // signal exception
jvalue java_exc; jvalue java_exc;
......
...@@ -114,7 +114,7 @@ void Bridge::handle_java_exc( ...@@ -114,7 +114,7 @@ void Bridge::handle_java_exc(
SAL_INFO( SAL_INFO(
"bridges", "bridges",
"exception occurred uno->java: [" << exc_name << "] " "exception occurred uno->java: [" << exc_name << "] "
<< (reinterpret_cast<css::uno::Exception const *>(uno_exc->pData) << (static_cast<css::uno::Exception const *>(uno_exc->pData)
->Message)); ->Message));
} }
...@@ -520,7 +520,7 @@ extern "C" ...@@ -520,7 +520,7 @@ extern "C"
void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy ) void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy )
SAL_THROW_EXTERN_C() SAL_THROW_EXTERN_C()
{ {
UNO_proxy * that = reinterpret_cast< UNO_proxy * >( proxy ); UNO_proxy * that = static_cast< UNO_proxy * >( proxy );
Bridge const * bridge = that->m_bridge; Bridge const * bridge = that->m_bridge;
assert(env == bridge->m_uno_env); (void) env; assert(env == bridge->m_uno_env); (void) env;
...@@ -655,7 +655,7 @@ void SAL_CALL UNO_proxy_dispatch( ...@@ -655,7 +655,7 @@ void SAL_CALL UNO_proxy_dispatch(
case 0: // queryInterface() case 0: // queryInterface()
{ {
TypeDescr demanded_td( TypeDescr demanded_td(
*reinterpret_cast< typelib_TypeDescriptionReference ** >( *static_cast< typelib_TypeDescriptionReference ** >(
uno_args[ 0 ] ) ); uno_args[ 0 ] ) );
if (typelib_TypeClass_INTERFACE != if (typelib_TypeClass_INTERFACE !=
demanded_td.get()->eTypeClass) demanded_td.get()->eTypeClass)
...@@ -733,7 +733,7 @@ void SAL_CALL UNO_proxy_dispatch( ...@@ -733,7 +733,7 @@ void SAL_CALL UNO_proxy_dispatch(
else // object does not support demanded interface else // object does not support demanded interface
{ {
uno_any_construct( uno_any_construct(
reinterpret_cast< uno_Any * >( uno_ret ), static_cast< uno_Any * >( uno_ret ),
0, 0, 0 ); 0, 0, 0 );
} }
// no exception occurred // no exception occurred
...@@ -743,7 +743,7 @@ void SAL_CALL UNO_proxy_dispatch( ...@@ -743,7 +743,7 @@ void SAL_CALL UNO_proxy_dispatch(
else else
{ {
uno_any_construct( uno_any_construct(
reinterpret_cast< uno_Any * >( uno_ret ), static_cast< uno_Any * >( uno_ret ),
&pInterface, demanded_td.get(), 0 ); &pInterface, demanded_td.get(), 0 );
(*pInterface->release)( pInterface ); (*pInterface->release)( pInterface );
*uno_exc = 0; *uno_exc = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment