diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-02 19:20:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-02 19:20:26 +0200 |
commit | f4796210b4955019a4f51b29549646fa067e9ae8 (patch) | |
tree | 4f58a9e02fb885824fa879cbc639d31d60b56e7b | |
parent | 54e87df11faf697d3b2666198a3d20b3ee091419 (diff) |
loplugin:redundantcast
Change-Id: I43264a975febf0d62271ab4e7d8cc96246956124
4 files changed, 55 insertions, 41 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx index bdcc8183f56a..36de6daa6f14 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx @@ -306,7 +306,7 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_ 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-- ) switch ( classes[n] ) { diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.cxx index 86a81dc8c4e7..edae16edd6f9 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.cxx @@ -133,25 +133,25 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( { case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = data.rax; + *static_cast<sal_uInt64 *>( pRegisterReturn ) = data.rax; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: 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; case typelib_TypeClass_CHAR: case typelib_TypeClass_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; case typelib_TypeClass_BOOLEAN: 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; case typelib_TypeClass_FLOAT: case typelib_TypeClass_DOUBLE: - *reinterpret_cast<double *>( pRegisterReturn ) = data.xmm0; + *static_cast<double *>( pRegisterReturn ) = data.xmm0; break; default: { diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx index ae877ac31012..22e38bccea44 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx @@ -340,7 +340,7 @@ typelib_TypeClass cpp_vtable_call( case 0: // queryInterface() opt { 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 ) { XInterface * pInterface = 0; @@ -352,7 +352,7 @@ typelib_TypeClass cpp_vtable_call( 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->release(); diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx index 8b7ac55111ff..6516fcd64493 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx @@ -40,7 +40,9 @@ using namespace ::com::sun::star::uno; -// Macros for easier insertion of values to registers or stack +namespace { + +// Functions for easier insertion of values to registers or stack // pSV - pointer to the source // nr - order of the value [will be increased if stored to register] // pFPR, pGPR - pointer to the registers @@ -48,38 +50,50 @@ using namespace ::com::sun::star::uno; // The value in %xmm register is already prepared to be retrieved as a float, // thus we treat float and double the same -#define INSERT_FLOAT_DOUBLE( pSV, nr, pFPR, pDS ) \ - if ( nr < x86_64::MAX_SSE_REGS ) \ - pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \ - else \ - *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim! - -#define INSERT_INT64( pSV, nr, pGPR, pDS ) \ - if ( nr < x86_64::MAX_GPR_REGS ) \ - pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \ - else \ - *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); - -#define INSERT_INT32( pSV, nr, pGPR, pDS ) \ - if ( nr < x86_64::MAX_GPR_REGS ) \ - pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ - else \ - *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV ); - -#define INSERT_INT16( pSV, nr, pGPR, pDS ) \ - if ( nr < x86_64::MAX_GPR_REGS ) \ - pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \ - else \ - *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV ); - -#define INSERT_INT8( pSV, nr, pGPR, pDS ) \ - if ( nr < x86_64::MAX_GPR_REGS ) \ - pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \ - else \ - *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV ); +void INSERT_FLOAT_DOUBLE( + void const * pSV, sal_uInt32 & nr, double * pFPR, sal_uInt64 *& pDS) +{ + if ( nr < x86_64::MAX_SSE_REGS ) + pFPR[nr++] = *static_cast<double const *>( pSV ); + else + *pDS++ = *static_cast<sal_uInt64 const *>( pSV ); // verbatim! +} +void INSERT_INT64( + void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS) +{ + if ( nr < x86_64::MAX_GPR_REGS ) + pGPR[nr++] = *static_cast<sal_uInt64 const *>( pSV ); + else + *pDS++ = *static_cast<sal_uInt64 const *>( pSV ); +} -namespace { +void INSERT_INT32( + void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS) +{ + if ( nr < x86_64::MAX_GPR_REGS ) + pGPR[nr++] = *static_cast<sal_uInt32 const *>( pSV ); + else + *pDS++ = *static_cast<sal_uInt32 const *>( pSV ); +} + +void INSERT_INT16( + void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS) +{ + if ( nr < x86_64::MAX_GPR_REGS ) + pGPR[nr++] = *static_cast<sal_uInt16 const *>( pSV ); + else + *pDS++ = *static_cast<sal_uInt16 const *>( pSV ); +} + +void INSERT_INT8( + void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS) +{ + if ( nr < x86_64::MAX_GPR_REGS ) + pGPR[nr++] = *static_cast<sal_uInt8 const *>( pSV ); + else + *pDS++ = *static_cast<sal_uInt8 const *>( pSV ); +} void appendCString(OUStringBuffer & buffer, char const * text) { if (text != 0) { @@ -390,7 +404,7 @@ void unoInterfaceProxyDispatch( case 0: // queryInterface() opt { 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) { uno_Interface * pInterface = 0; @@ -401,7 +415,7 @@ void unoInterfaceProxyDispatch( if (pInterface) { ::uno_any_construct( - reinterpret_cast< uno_Any * >( pReturn ), + static_cast< uno_Any * >( pReturn ), &pInterface, pTD, 0 ); (*pInterface->release)( pInterface ); TYPELIB_DANGER_RELEASE( pTD ); |