[Libreoffice-commits] core.git: bridges/source

Stephan Bergmann sbergman at redhat.com
Tue Apr 7 01:46:54 PDT 2015


 bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx |   16 ++++++++--------
 bridges/source/cpp_uno/gcc3_linux_intel/except.cxx  |    4 ++--
 bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx |   12 ++++++------
 3 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 93b4ec39e23aa0662fd4638074af74bda3934f91
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 7 10:46:18 2015 +0200

    loplugin:cstylecast, loplugin:redundantcast
    
    Change-Id: If5d839b05c1babecc84b76d2bcdf47009d0f713c

diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
index 39455a9..88fc904 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
@@ -45,7 +45,7 @@ void cpp2uno_call(
     void * pReturnValue )
 {
     // pCallStack: ret, [return ptr], this, params
-    char * pCppStack = (char *)(pCallStack +1);
+    char * pCppStack = reinterpret_cast<char *>(pCallStack +1);
 
     // return
     typelib_TypeDescription * pReturnTypeDescr = 0;
@@ -78,12 +78,12 @@ void cpp2uno_call(
     // stack space
     static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
     // parameters
-    void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
+    void ** pUnoArgs = static_cast<void **>(alloca( 4 * sizeof(void *) * nParams ));
     void ** pCppArgs = pUnoArgs + nParams;
     // indices of values this have to be converted (interface conversion cpp<=>uno)
-    sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+    sal_Int32 * pTempIndices = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams));
     // type descriptions for reconversions
-    typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
+    typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast<typelib_TypeDescription **>(pUnoArgs + (3 * nParams));
 
     sal_Int32 nTempIndices   = 0;
 
@@ -248,7 +248,7 @@ extern "C" void cpp_vtable_call(
             ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
              + " vtable index " + OUString::number(nFunctionIndex) + "/"
              + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
-            (XInterface *)pThis);
+            static_cast<XInterface *>(pThis));
     }
 
     // determine called method
@@ -301,7 +301,7 @@ extern "C" void cpp_vtable_call(
         case 0: // queryInterface() opt
         {
             typelib_TypeDescription * pTD = 0;
-            TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pCallStack[3] )->getTypeLibType() );
+            TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pCallStack[3] )->getTypeLibType() );
             if (pTD)
             {
                 XInterface * pInterface = 0;
@@ -313,7 +313,7 @@ extern "C" void cpp_vtable_call(
                 if (pInterface)
                 {
                     ::uno_any_construct(
-                        reinterpret_cast< uno_Any * >( pCallStack[1] ),
+                        static_cast< uno_Any * >( pCallStack[1] ),
                         &pInterface, pTD, cpp_acquire );
                     pInterface->release();
                     TYPELIB_DANGER_RELEASE( pTD );
@@ -335,7 +335,7 @@ extern "C" void cpp_vtable_call(
     }
     default:
     {
-        throw RuntimeException( "no member description found!", (XInterface *)pThis );
+        throw RuntimeException( "no member description found!", static_cast<XInterface *>(pThis) );
     }
     }
 }
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index ba6fb5e..f26e4ea 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -142,7 +142,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
 #if defined(FREEBSD) && __FreeBSD_version < 702104 /* #i22253# */
         rtti = (type_info *)dlsym( RTLD_DEFAULT, symName.getStr() );
 #else
-        rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
+        rtti = static_cast<type_info *>(dlsym( m_hApp, symName.getStr() ));
 #endif
 
         if (rtti)
@@ -200,7 +200,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
 extern "C" {
 static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
 {
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
+    __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1;
     typelib_TypeDescription * pTD = 0;
     OUString unoName( toUNOname( header->exceptionType->name() ) );
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
index 9191bb2..351bac1 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
@@ -46,7 +46,7 @@ static void cpp_call(
 {
       // max space for: [complex ret ptr], values|ptr ...
       char * pCppStack      =
-          (char *)alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) );
+          static_cast<char *>(alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) ));
       char * pCppStackStart = pCppStack;
 
     // return
@@ -84,11 +84,11 @@ static void cpp_call(
     // stack space
     static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
     // args
-    void ** pCppArgs  = (void **)alloca( 3 * sizeof(void *) * nParams );
+    void ** pCppArgs  = static_cast<void **>(alloca( 3 * sizeof(void *) * nParams ));
     // indices of values this have to be converted (interface conversion cpp<=>uno)
-    sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
+    sal_Int32 * pTempIndices = reinterpret_cast<sal_Int32 *>(pCppArgs + nParams);
     // type descriptions for reconversions
-    typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
+    typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast<typelib_TypeDescription **>(pCppArgs + (2 * nParams));
 
     sal_Int32 nTempIndices   = 0;
 
@@ -328,7 +328,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;
@@ -339,7 +339,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 );


More information about the Libreoffice-commits mailing list