[Libreoffice-commits] core.git: 6 commits - bridges/source compilerplugins/clang include/sal sal/osl sal/qa sal/rtl sal/textenc

Stephan Bergmann sbergman at redhat.com
Wed Jan 7 05:42:38 PST 2015


 bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx |    2 
 bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx              |    2 
 bridges/source/jni_uno/jni_bridge.cxx                          |   14 
 bridges/source/jni_uno/jni_data.cxx                            |  156 ++++-----
 bridges/source/jni_uno/jni_info.cxx                            |  160 +++++-----
 bridges/source/jni_uno/jni_java2uno.cxx                        |    6 
 bridges/source/jni_uno/jni_uno2java.cxx                        |   16 -
 compilerplugins/clang/cstylecast.cxx                           |   20 -
 include/sal/config.h                                           |    6 
 sal/osl/unx/socket.cxx                                         |   70 +---
 sal/osl/unx/thread.cxx                                         |    6 
 sal/qa/rtl/textenc/rtl_textcvt.cxx                             |    2 
 sal/rtl/alloc_arena.cxx                                        |   15 
 sal/rtl/alloc_cache.cxx                                        |   18 -
 sal/textenc/textcvt.cxx                                        |    4 
 15 files changed, 235 insertions(+), 262 deletions(-)

New commits:
commit a4b0078ba9a455b4d9b0a684f63151f53342646a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 23:00:11 2015 +0100

    tools/solar.h already filtered out via filename.endsWith(".h")
    
    Change-Id: I8a4483a6425f51fea0eae5c809c6c41ef56388a2

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 19b0163..496fe90 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -97,8 +97,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         return true;
     }
     if (!compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
-        && (filename == SRCDIR "/include/tools/solar.h"
-            || filename.startswith(SRCDIR "/include/cppuhelper/")))
+        && filename.startswith(SRCDIR "/include/cppuhelper/"))
     {
         return true;
     }
commit 25fb44265113c670ac3aaedb5a46c39a8c2895c8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 22:55:00 2015 +0100

    loplugin:cstylecast: bridges
    
    Change-Id: I7c41b90c9af045fd452ee62ed0c5d9b261236855

diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx
index 6dae025..295596d 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx
@@ -68,7 +68,7 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
     // Get pointer to method
     sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
     pMethod += 8 * nVtableIndex;
-    data.pMethod = *((sal_uInt64 *)pMethod);
+    data.pMethod = *reinterpret_cast<sal_uInt64 *>(pMethod);
 
     // Load parameters to stack, if necessary
     sal_uInt64* pCallStack = NULL;
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
index 3f5292d..c43e0f9 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
@@ -132,7 +132,7 @@ std::type_info * RTTI::getRTTI(typelib_TypeDescription const & pTypeDescr)
                             std::type_info * base_rtti = getRTTI(
                                 ctd.pBaseTypeDescription->aBase);
                             rtti = new __cxxabiv1::__si_class_type_info(
-                                strdup( rttiName ), (__cxxabiv1::__class_type_info *)base_rtti );
+                                strdup( rttiName ), static_cast<__cxxabiv1::__class_type_info *>(base_rtti) );
                         }
                         else
                         {
diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx
index 7be6363..e1026c5 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -298,7 +298,7 @@ void JNI_context::java_exc_occurred() const
     JLocalAutoRef jo_Object( *this, jo_class );
     // method Object.toString()
     jmethodID method_Object_toString = m_env->GetMethodID(
-        (jclass) jo_Object.get(), "toString", "()Ljava/lang/String;" );
+        static_cast<jclass>(jo_Object.get()), "toString", "()Ljava/lang/String;" );
     if (JNI_FALSE != m_env->ExceptionCheck())
     {
         m_env->ExceptionClear();
@@ -319,12 +319,12 @@ void JNI_context::java_exc_occurred() const
             get_stack_trace() );
     }
 
-    jsize len = m_env->GetStringLength( (jstring) jo_descr.get() );
+    jsize len = m_env->GetStringLength( static_cast<jstring>(jo_descr.get()) );
     std::unique_ptr< rtl_mem > ustr_mem(
         rtl_mem::allocate(
             sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
     rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
-    m_env->GetStringRegion( (jstring) jo_descr.get(), 0, len, ustr->buffer );
+    m_env->GetStringRegion( static_cast<jstring>(jo_descr.get()), 0, len, ustr->buffer );
     if (m_env->ExceptionCheck())
     {
         m_env->ExceptionClear();
@@ -383,7 +383,7 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const
     {
         // static method JNI_proxy.get_stack_trace()
         jmethodID method = m_env->GetStaticMethodID(
-            (jclass) jo_JNI_proxy.get(), "get_stack_trace",
+            static_cast<jclass>(jo_JNI_proxy.get()), "get_stack_trace",
             "(Ljava/lang/Throwable;)Ljava/lang/String;" );
         if (assert_no_exception() && (0 != method))
         {
@@ -391,17 +391,17 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const
             arg.l = jo_exc;
             JLocalAutoRef jo_stack_trace(
                 *this, m_env->CallStaticObjectMethodA(
-                    (jclass) jo_JNI_proxy.get(), method, &arg ) );
+                    static_cast<jclass>(jo_JNI_proxy.get()), method, &arg ) );
             if (assert_no_exception())
             {
                 jsize len =
-                    m_env->GetStringLength( (jstring) jo_stack_trace.get() );
+                    m_env->GetStringLength( static_cast<jstring>(jo_stack_trace.get()) );
                 std::unique_ptr< rtl_mem > ustr_mem(
                     rtl_mem::allocate(
                         sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
                 rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
                 m_env->GetStringRegion(
-                    (jstring) jo_stack_trace.get(), 0, len, ustr->buffer );
+                    static_cast<jstring>(jo_stack_trace.get()), 0, len, ustr->buffer );
                 if (assert_no_exception())
                 {
                     ustr->refCount = 1;
diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx
index 5e37302..6fa4d83 100644
--- a/bridges/source/jni_uno/jni_data.cxx
+++ b/bridges/source/jni_uno/jni_data.cxx
@@ -217,7 +217,7 @@ void Bridge::map_to_uno(
 {
     assert(
         !out_param ||
-        (1 == jni->GetArrayLength( (jarray) java_data.l )) );
+        (1 == jni->GetArrayLength( static_cast<jarray>(java_data.l) )) );
 
     switch (type->eTypeClass)
     {
@@ -225,7 +225,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetCharArrayRegion(
-                (jcharArray) java_data.l, 0, 1, (jchar *) uno_data );
+                static_cast<jcharArray>(java_data.l), 0, 1, (jchar *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -243,7 +243,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetBooleanArrayRegion(
-                (jbooleanArray) java_data.l, 0, 1, (jboolean *) uno_data );
+                static_cast<jbooleanArray>(java_data.l), 0, 1, (jboolean *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -261,7 +261,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetByteArrayRegion(
-                (jbyteArray) java_data.l, 0, 1, (jbyte *) uno_data );
+                static_cast<jbyteArray>(java_data.l), 0, 1, (jbyte *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -280,7 +280,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetShortArrayRegion(
-                (jshortArray) java_data.l, 0, 1, (jshort *) uno_data );
+                static_cast<jshortArray>(java_data.l), 0, 1, (jshort *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -299,7 +299,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetIntArrayRegion(
-                (jintArray) java_data.l, 0, 1, (jint *) uno_data );
+                static_cast<jintArray>(java_data.l), 0, 1, (jint *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -318,7 +318,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetLongArrayRegion(
-                (jlongArray) java_data.l, 0, 1, (jlong *) uno_data );
+                static_cast<jlongArray>(java_data.l), 0, 1, (jlong *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -336,7 +336,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetFloatArrayRegion(
-                (jfloatArray) java_data.l, 0, 1, (jfloat *) uno_data );
+                static_cast<jfloatArray>(java_data.l), 0, 1, (jfloat *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -354,7 +354,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jni->GetDoubleArrayRegion(
-                (jdoubleArray) java_data.l, 0, 1, (jdouble *) uno_data );
+                static_cast<jdoubleArray>(java_data.l), 0, 1, (jdouble *) uno_data );
             jni.ensure_no_exception();
         }
         else if (special_wrapped_integral_types)
@@ -374,7 +374,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -387,7 +387,7 @@ void Bridge::map_to_uno(
         if (! assign)
             *(rtl_uString **)uno_data = 0;
         jstring_to_ustring(
-            jni, (rtl_uString **)uno_data, (jstring) java_data.l );
+            jni, (rtl_uString **)uno_data, static_cast<jstring>(java_data.l) );
         break;
     }
     case typelib_TypeClass_TYPE:
@@ -396,7 +396,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -419,7 +419,7 @@ void Bridge::map_to_uno(
                 + jni.get_stack_trace() );
         }
         OUString type_name(
-            jstring_to_oustring( jni, (jstring) jo_type_name.get() ) );
+            jstring_to_oustring( jni, static_cast<jstring>(jo_type_name.get()) ) );
         ::com::sun::star::uno::TypeDescription td( type_name );
         if (! td.is())
         {
@@ -443,7 +443,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -484,7 +484,7 @@ void Bridge::map_to_uno(
         {
             // create type out of class
             JLocalAutoRef jo_class( jni, jni->GetObjectClass( java_data.l ) );
-            jo_type.reset( create_type( jni, (jclass) jo_class.get() ) );
+            jo_type.reset( create_type( jni, static_cast<jclass>(jo_class.get()) ) );
         }
 
         // get type name
@@ -493,7 +493,7 @@ void Bridge::map_to_uno(
                 jo_type.get(), getJniInfo()->m_field_Type__typeName ) );
         jni.ensure_no_exception();
         OUString type_name(
-            jstring_to_oustring( jni, (jstring) jo_type_name.get() ) );
+            jstring_to_oustring( jni, static_cast<jstring>(jo_type_name.get()) ) );
 
         ::com::sun::star::uno::TypeDescription value_td( type_name );
         if (! value_td.is())
@@ -613,7 +613,7 @@ void Bridge::map_to_uno(
                 pAny->pData = &pAny->pReserved;
                 jstring_to_ustring(
                     jni, (rtl_uString **)pAny->pData,
-                    (jstring) java_data.l );
+                    static_cast<jstring>(java_data.l) );
                 break;
             case typelib_TypeClass_TYPE:
             case typelib_TypeClass_ENUM:
@@ -664,7 +664,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -686,7 +686,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -955,7 +955,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -971,28 +971,28 @@ void Bridge::map_to_uno(
             ((typelib_IndirectTypeDescription *)td.get())->pType;
 
         std::unique_ptr< rtl_mem > seq;
-        sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l );
+        sal_Int32 nElements = jni->GetArrayLength( static_cast<jarray>(java_data.l) );
 
         switch (element_type->eTypeClass)
         {
         case typelib_TypeClass_CHAR:
             seq.reset( seq_allocate( nElements, sizeof (sal_Unicode) ) );
             jni->GetCharArrayRegion(
-                (jcharArray) java_data.l, 0, nElements,
+                static_cast<jcharArray>(java_data.l), 0, nElements,
                 (jchar *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
         case typelib_TypeClass_BOOLEAN:
             seq.reset( seq_allocate( nElements, sizeof (sal_Bool) ) );
             jni->GetBooleanArrayRegion(
-                (jbooleanArray) java_data.l, 0, nElements,
+                static_cast<jbooleanArray>(java_data.l), 0, nElements,
                 (jboolean *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
         case typelib_TypeClass_BYTE:
             seq.reset( seq_allocate( nElements, sizeof (sal_Int8) ) );
             jni->GetByteArrayRegion(
-                (jbyteArray) java_data.l, 0, nElements,
+                static_cast<jbyteArray>(java_data.l), 0, nElements,
                 (jbyte *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
@@ -1000,7 +1000,7 @@ void Bridge::map_to_uno(
         case typelib_TypeClass_UNSIGNED_SHORT:
             seq.reset( seq_allocate( nElements, sizeof (sal_Int16) ) );
             jni->GetShortArrayRegion(
-                (jshortArray) java_data.l, 0, nElements,
+                static_cast<jshortArray>(java_data.l), 0, nElements,
                 (jshort *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
@@ -1008,7 +1008,7 @@ void Bridge::map_to_uno(
         case typelib_TypeClass_UNSIGNED_LONG:
             seq.reset( seq_allocate( nElements, sizeof (sal_Int32) ) );
             jni->GetIntArrayRegion(
-                (jintArray) java_data.l, 0, nElements,
+                static_cast<jintArray>(java_data.l), 0, nElements,
                 (jint *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
@@ -1016,21 +1016,21 @@ void Bridge::map_to_uno(
         case typelib_TypeClass_UNSIGNED_HYPER:
             seq.reset( seq_allocate( nElements, sizeof (sal_Int64) ) );
             jni->GetLongArrayRegion(
-                (jlongArray) java_data.l, 0, nElements,
+                static_cast<jlongArray>(java_data.l), 0, nElements,
                 (jlong *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
         case typelib_TypeClass_FLOAT:
             seq.reset( seq_allocate( nElements, sizeof (float) ) );
             jni->GetFloatArrayRegion(
-                (jfloatArray) java_data.l, 0, nElements,
+                static_cast<jfloatArray>(java_data.l), 0, nElements,
                 (jfloat *)((uno_Sequence *)seq.get())->elements );
             jni.ensure_no_exception();
             break;
         case typelib_TypeClass_DOUBLE:
             seq.reset( seq_allocate( nElements, sizeof (double) ) );
             jni->GetDoubleArrayRegion(
-                (jdoubleArray) java_data.l, 0, nElements,
+                static_cast<jdoubleArray>(java_data.l), 0, nElements,
                 (jdouble *) ((uno_Sequence *) seq.get())->elements );
             jni.ensure_no_exception();
             break;
@@ -1065,7 +1065,7 @@ void Bridge::map_to_uno(
                 {
                     JLocalAutoRef jo(
                         jni, jni->GetObjectArrayElement(
-                            (jobjectArray) java_data.l, nPos ) );
+                            static_cast<jobjectArray>(java_data.l), nPos ) );
                     jni.ensure_no_exception();
                     jvalue val;
                     val.l = jo.get();
@@ -1113,7 +1113,7 @@ void Bridge::map_to_uno(
         if (out_param)
         {
             jo_out_holder.reset(
-                jni->GetObjectArrayElement( (jobjectArray) java_data.l, 0 ) );
+                jni->GetObjectArrayElement( static_cast<jobjectArray>(java_data.l), 0 ) );
             jni.ensure_no_exception();
             java_data.l = jo_out_holder.get();
         }
@@ -1176,7 +1176,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetCharArrayRegion(
-                        (jcharArray) jo_ar.get(), 0, 1, (jchar *) uno_data );
+                        static_cast<jcharArray>(jo_ar.get()), 0, 1, (jchar *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1186,7 +1186,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetCharArrayRegion(
-                        (jcharArray) java_data->l, 0, 1, (jchar *) uno_data );
+                        static_cast<jcharArray>(java_data->l), 0, 1, (jchar *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1215,7 +1215,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetBooleanArrayRegion(
-                        (jbooleanArray) jo_ar.get(),
+                        static_cast<jbooleanArray>(jo_ar.get()),
                         0, 1, (jboolean *) uno_data );
                     jni.ensure_no_exception();
                 }
@@ -1226,7 +1226,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetBooleanArrayRegion(
-                        (jbooleanArray) java_data->l,
+                        static_cast<jbooleanArray>(java_data->l),
                         0, 1, (jboolean *) uno_data );
                     jni.ensure_no_exception();
                 }
@@ -1256,7 +1256,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetByteArrayRegion(
-                        (jbyteArray) jo_ar.get(), 0, 1, (jbyte *) uno_data );
+                        static_cast<jbyteArray>(jo_ar.get()), 0, 1, (jbyte *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1266,7 +1266,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetByteArrayRegion(
-                        (jbyteArray) java_data->l, 0, 1, (jbyte *) uno_data );
+                        static_cast<jbyteArray>(java_data->l), 0, 1, (jbyte *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1296,7 +1296,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetShortArrayRegion(
-                        (jshortArray) jo_ar.get(), 0, 1, (jshort *) uno_data );
+                        static_cast<jshortArray>(jo_ar.get()), 0, 1, (jshort *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1306,7 +1306,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetShortArrayRegion(
-                        (jshortArray) java_data->l, 0, 1, (jshort *) uno_data );
+                        static_cast<jshortArray>(java_data->l), 0, 1, (jshort *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1336,7 +1336,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetIntArrayRegion(
-                        (jintArray) jo_ar.get(), 0, 1, (jint *) uno_data );
+                        static_cast<jintArray>(jo_ar.get()), 0, 1, (jint *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1346,7 +1346,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetIntArrayRegion(
-                        (jintArray) java_data->l, 0, 1, (jint *) uno_data );
+                        static_cast<jintArray>(java_data->l), 0, 1, (jint *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1376,7 +1376,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetLongArrayRegion(
-                        (jlongArray)jo_ar.get(), 0, 1, (jlong *) uno_data );
+                        static_cast<jlongArray>(jo_ar.get()), 0, 1, (jlong *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1386,7 +1386,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetLongArrayRegion(
-                        (jlongArray)java_data->l, 0, 1, (jlong *) uno_data );
+                        static_cast<jlongArray>(java_data->l), 0, 1, (jlong *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1415,7 +1415,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetFloatArrayRegion(
-                        (jfloatArray) jo_ar.get(), 0, 1, (jfloat *) uno_data );
+                        static_cast<jfloatArray>(jo_ar.get()), 0, 1, (jfloat *) uno_data );
                     jni.ensure_no_exception();
                 }
                 java_data->l = jo_ar.release();
@@ -1425,7 +1425,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetFloatArrayRegion(
-                        (jfloatArray) java_data->l, 0, 1, (jfloat *) uno_data );
+                        static_cast<jfloatArray>(java_data->l), 0, 1, (jfloat *) uno_data );
                     jni.ensure_no_exception();
                 }
             }
@@ -1454,7 +1454,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetDoubleArrayRegion(
-                        (jdoubleArray) jo_ar.get(),
+                        static_cast<jdoubleArray>(jo_ar.get()),
                         0, 1, (jdouble *) uno_data );
                     jni.ensure_no_exception();
                 }
@@ -1465,7 +1465,7 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     jni->SetDoubleArrayRegion(
-                        (jdoubleArray) java_data->l,
+                        static_cast<jdoubleArray>(java_data->l),
                         0, 1, (jdouble *) uno_data );
                     jni.ensure_no_exception();
                 }
@@ -1505,7 +1505,7 @@ void Bridge::map_to_java(
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_in.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_in.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -1539,7 +1539,7 @@ void Bridge::map_to_java(
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_in.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_in.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -1761,7 +1761,7 @@ void Bridge::map_to_java(
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_any.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_any.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -1789,7 +1789,7 @@ void Bridge::map_to_java(
             sig_buf.append( ';' );
             OString sig( sig_buf.makeStringAndClear() );
             jmethodID method_id = jni->GetStaticMethodID(
-                (jclass) jo_enum_class.get(), "fromInt", sig.getStr() );
+                static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() );
             jni.ensure_no_exception();
             assert( 0 != method_id );
 
@@ -1797,7 +1797,7 @@ void Bridge::map_to_java(
             arg.i = *(jint const *) uno_data;
             jo_enum.reset(
                 jni->CallStaticObjectMethodA(
-                    (jclass) jo_enum_class.get(), method_id, &arg ) );
+                    static_cast<jclass>(jo_enum_class.get()), method_id, &arg ) );
             jni.ensure_no_exception();
         }
         if (out_param)
@@ -1805,13 +1805,13 @@ void Bridge::map_to_java(
             if (0 == java_data->l)
             {
                 java_data->l = jni->NewObjectArray(
-                    1, (jclass) jo_enum_class.get(), jo_enum.get() );
+                    1, static_cast<jclass>(jo_enum_class.get()), jo_enum.get() );
                 jni.ensure_no_exception();
             }
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_enum.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_enum.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -2069,7 +2069,7 @@ void Bridge::map_to_java(
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_comp.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_comp.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -2108,7 +2108,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetCharArrayRegion(
-                    (jcharArray) jo_ar.get(),
+                    static_cast<jcharArray>(jo_ar.get()),
                     0, nElements, (jchar *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2119,7 +2119,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetBooleanArrayRegion(
-                    (jbooleanArray) jo_ar.get(),
+                    static_cast<jbooleanArray>(jo_ar.get()),
                     0, nElements, (jboolean *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2130,7 +2130,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetByteArrayRegion(
-                    (jbyteArray) jo_ar.get(),
+                    static_cast<jbyteArray>(jo_ar.get()),
                     0, nElements, (jbyte *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2142,7 +2142,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetShortArrayRegion(
-                    (jshortArray) jo_ar.get(),
+                    static_cast<jshortArray>(jo_ar.get()),
                     0, nElements, (jshort *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2154,7 +2154,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetIntArrayRegion(
-                    (jintArray) jo_ar.get(),
+                    static_cast<jintArray>(jo_ar.get()),
                     0, nElements, (jint *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2166,7 +2166,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetLongArrayRegion(
-                    (jlongArray) jo_ar.get(),
+                    static_cast<jlongArray>(jo_ar.get()),
                     0, nElements, (jlong *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2177,7 +2177,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetFloatArrayRegion(
-                    (jfloatArray) jo_ar.get(),
+                    static_cast<jfloatArray>(jo_ar.get()),
                     0, nElements, (jfloat *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2188,7 +2188,7 @@ void Bridge::map_to_java(
             if (0 < nElements)
             {
                 jni->SetDoubleArrayRegion(
-                    (jdoubleArray) jo_ar.get(),
+                    static_cast<jdoubleArray>(jo_ar.get()),
                     0, nElements, (jdouble *) seq->elements );
                 jni.ensure_no_exception();
             }
@@ -2207,7 +2207,7 @@ void Bridge::map_to_java(
                     JLocalAutoRef jo_string(
                         jni, ustring_to_jstring( jni, pp[ nPos ] ) );
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_string.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_string.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2228,7 +2228,7 @@ void Bridge::map_to_java(
                         true /* in */, false /* no out */ );
                     JLocalAutoRef jo_element( jni, val.l );
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_element.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_element.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2249,7 +2249,7 @@ void Bridge::map_to_java(
                         true /* in */, false /* no out */ );
                     JLocalAutoRef jo_element( jni, val.l );
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_element.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_element.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2266,7 +2266,7 @@ void Bridge::map_to_java(
 
             jo_ar.reset(
                 jni->NewObjectArray(
-                    nElements, (jclass) jo_enum_class.get(), 0 ) );
+                    nElements, static_cast<jclass>(jo_enum_class.get()), 0 ) );
             jni.ensure_no_exception();
 
             if (0 < nElements)
@@ -2278,7 +2278,7 @@ void Bridge::map_to_java(
                 sig_buf.append( ';' );
                 OString sig( sig_buf.makeStringAndClear() );
                 jmethodID method_id = jni->GetStaticMethodID(
-                    (jclass) jo_enum_class.get(), "fromInt", sig.getStr() );
+                    static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() );
                 jni.ensure_no_exception();
                 assert( 0 != method_id );
 
@@ -2289,10 +2289,10 @@ void Bridge::map_to_java(
                     arg.i = p[ nPos ];
                     JLocalAutoRef jo_enum(
                         jni, jni->CallStaticObjectMethodA(
-                            (jclass) jo_enum_class.get(), method_id, &arg ) );
+                            static_cast<jclass>(jo_enum_class.get()), method_id, &arg ) );
                     jni.ensure_no_exception();
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_enum.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_enum.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2321,7 +2321,7 @@ void Bridge::map_to_java(
                         true /* in */, false /* no out */ );
                     JLocalAutoRef jo_element( jni, val.l );
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_element.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_element.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2339,7 +2339,7 @@ void Bridge::map_to_java(
 
             jo_ar.reset(
                 jni->NewObjectArray(
-                    nElements, (jclass) jo_seq_class.get(), 0 ) );
+                    nElements, static_cast<jclass>(jo_seq_class.get()), 0 ) );
             jni.ensure_no_exception();
 
             if (0 < nElements)
@@ -2354,7 +2354,7 @@ void Bridge::map_to_java(
                         true /* in */, false /* no out */ );
                     JLocalAutoRef jo_seq( jni, java_data2.l );
                     jni->SetObjectArrayElement(
-                        (jobjectArray) jo_ar.get(), nPos, jo_seq.get() );
+                        static_cast<jobjectArray>(jo_ar.get()), nPos, jo_seq.get() );
                     jni.ensure_no_exception();
                 }
             }
@@ -2381,7 +2381,7 @@ void Bridge::map_to_java(
                         JLocalAutoRef jo_element(
                             jni, map_to_java( jni, pUnoI, iface_info ) );
                         jni->SetObjectArrayElement(
-                            (jobjectArray) jo_ar.get(),
+                            static_cast<jobjectArray>(jo_ar.get()),
                             nPos, jo_element.get() );
                         jni.ensure_no_exception();
                     }
@@ -2408,19 +2408,19 @@ void Bridge::map_to_java(
                 if (in_param)
                 {
                     java_data->l = jni->NewObjectArray(
-                        1, (jclass) jo_element_class.get(), jo_ar.get() );
+                        1, static_cast<jclass>(jo_element_class.get()), jo_ar.get() );
                 }
                 else
                 {
                     java_data->l = jni->NewObjectArray(
-                        1, (jclass) jo_element_class.get(), 0 );
+                        1, static_cast<jclass>(jo_element_class.get()), 0 );
                 }
                 jni.ensure_no_exception();
             }
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_ar.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_ar.get() );
                 jni.ensure_no_exception();
             }
         }
@@ -2458,7 +2458,7 @@ void Bridge::map_to_java(
             else
             {
                 jni->SetObjectArrayElement(
-                    (jobjectArray) java_data->l, 0, jo_iface.get() );
+                    static_cast<jobjectArray>(java_data->l), 0, jo_iface.get() );
                 jni.ensure_no_exception();
             }
         }
diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx
index 84ac6aa..6db961c 100644
--- a/bridges/source/jni_uno/jni_info.cxx
+++ b/bridges/source/jni_uno/jni_info.cxx
@@ -82,7 +82,7 @@ JNI_interface_type_info::JNI_interface_type_info(
             jni,
             ( OUStringToOString( uno_name, RTL_TEXTENCODING_JAVA_UTF8 ).
               getStr() ) ) );
-    JLocalAutoRef jo_type( jni, create_type( jni, (jclass) jo_class.get() ) );
+    JLocalAutoRef jo_type( jni, create_type( jni, static_cast<jclass>(jo_class.get()) ) );
 
     // get proxy ctor
     jvalue arg;
@@ -143,7 +143,7 @@ JNI_interface_type_info::JNI_interface_type_info(
                                            RTL_TEXTENCODING_JAVA_UTF8 ) );
 
                     m_methods[ nMethodIndex ] = jni->GetMethodID(
-                        (jclass) jo_class.get(), method_name.getStr(),
+                        static_cast<jclass>(jo_class.get()), method_name.getStr(),
                         method_signature.getStr() );
                     jni.ensure_no_exception();
                     assert( 0 != m_methods[ nMethodIndex ] );
@@ -181,7 +181,7 @@ JNI_interface_type_info::JNI_interface_type_info(
                             name_buf.makeStringAndClear(),
                             RTL_TEXTENCODING_JAVA_UTF8 ) );
                     m_methods[ nMethodIndex ] = jni->GetMethodID(
-                        (jclass) jo_class.get(), method_name.getStr(),
+                        static_cast<jclass>(jo_class.get()), method_name.getStr(),
                         method_signature.getStr() );
                     jni.ensure_no_exception();
                     assert( 0 != m_methods[ nMethodIndex ] );
@@ -201,7 +201,7 @@ JNI_interface_type_info::JNI_interface_type_info(
                             name_buf.makeStringAndClear(),
                             RTL_TEXTENCODING_JAVA_UTF8 );
                         m_methods[ nMethodIndex ] = jni->GetMethodID(
-                            (jclass) jo_class.get(), method_name.getStr(),
+                            static_cast<jclass>(jo_class.get()), method_name.getStr(),
                             method_signature.getStr() );
                         jni.ensure_no_exception();
                         assert( 0 != m_methods[ nMethodIndex ] );
@@ -216,7 +216,7 @@ JNI_interface_type_info::JNI_interface_type_info(
             throw;
         }
     }
-    m_class = (jclass) jni->NewGlobalRef( jo_class.get() );
+    m_class = static_cast<jclass>(jni->NewGlobalRef( jo_class.get() ));
     m_type = jni->NewGlobalRef( jo_type.get() );
     m_proxy_ctor = jni->NewGlobalRef( jo_proxy_ctor.get() );
 }
@@ -266,7 +266,7 @@ JNI_compound_type_info::JNI_compound_type_info(
     {
         // retrieve exc ctor( msg )
         m_exc_ctor = jni->GetMethodID(
-            (jclass) jo_class.get(), "<init>", "(Ljava/lang/String;)V" );
+            static_cast<jclass>(jo_class.get()), "<init>", "(Ljava/lang/String;)V" );
         jni.ensure_no_exception();
         assert( 0 != m_exc_ctor );
     }
@@ -295,7 +295,7 @@ JNI_compound_type_info::JNI_compound_type_info(
             m_fields[ 0 ] = 0; // special Throwable.getMessage()
             // field Context
             m_fields[ 1 ] = jni->GetFieldID(
-                (jclass) jo_class.get(), "Context", "Ljava/lang/Object;" );
+                static_cast<jclass>(jo_class.get()), "Context", "Ljava/lang/Object;" );
             jni.ensure_no_exception();
             assert( 0 != m_fields[ 1 ] );
         }
@@ -327,7 +327,7 @@ JNI_compound_type_info::JNI_compound_type_info(
                         RTL_TEXTENCODING_JAVA_UTF8 ) );
 
                 m_fields[ nPos ] = jni->GetFieldID(
-                    (jclass) jo_class.get(), member_name.getStr(),
+                    static_cast<jclass>(jo_class.get()), member_name.getStr(),
                     sig.getStr() );
                 jni.ensure_no_exception();
                 assert( 0 != m_fields[ nPos ] );
@@ -340,7 +340,7 @@ JNI_compound_type_info::JNI_compound_type_info(
         throw;
     }
 
-    m_class = (jclass) jni->NewGlobalRef( jo_class.get() );
+    m_class = static_cast<jclass>(jni->NewGlobalRef( jo_class.get() ));
 }
 
 
@@ -542,112 +542,112 @@ JNI_info::JNI_info(
 
     // method Object.toString()
     m_method_Object_toString = jni->GetMethodID(
-        (jclass) jo_Object.get(), "toString", "()Ljava/lang/String;" );
+        static_cast<jclass>(jo_Object.get()), "toString", "()Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Object_toString );
     // method Class.getName()
     m_method_Class_getName = jni->GetMethodID(
-        (jclass) jo_Class.get(), "getName", "()Ljava/lang/String;" );
+        static_cast<jclass>(jo_Class.get()), "getName", "()Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Class_getName );
 
     // method Throwable.getMessage()
     m_method_Throwable_getMessage = jni->GetMethodID(
-        (jclass) jo_Throwable.get(), "getMessage", "()Ljava/lang/String;" );
+        static_cast<jclass>(jo_Throwable.get()), "getMessage", "()Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Throwable_getMessage );
 
     // method Character.charValue()
     m_method_Character_charValue = jni->GetMethodID(
-        (jclass) jo_Character.get(), "charValue", "()C" );
+        static_cast<jclass>(jo_Character.get()), "charValue", "()C" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Character_charValue );
     // method Boolean.booleanValue()
     m_method_Boolean_booleanValue = jni->GetMethodID(
-        (jclass) jo_Boolean.get(), "booleanValue", "()Z" );
+        static_cast<jclass>(jo_Boolean.get()), "booleanValue", "()Z" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Boolean_booleanValue );
     // method Byte.byteValue()
     m_method_Byte_byteValue = jni->GetMethodID(
-        (jclass) jo_Byte.get(), "byteValue", "()B" );
+        static_cast<jclass>(jo_Byte.get()), "byteValue", "()B" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Byte_byteValue );
     // method Short.shortValue()
     m_method_Short_shortValue = jni->GetMethodID(
-        (jclass) jo_Short.get(), "shortValue", "()S" );
+        static_cast<jclass>(jo_Short.get()), "shortValue", "()S" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Short_shortValue );
     // method Integer.intValue()
     m_method_Integer_intValue = jni->GetMethodID(
-        (jclass) jo_Integer.get(), "intValue", "()I" );
+        static_cast<jclass>(jo_Integer.get()), "intValue", "()I" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Integer_intValue );
     // method Long.longValue()
     m_method_Long_longValue = jni->GetMethodID(
-        (jclass) jo_Long.get(), "longValue", "()J" );
+        static_cast<jclass>(jo_Long.get()), "longValue", "()J" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Long_longValue );
     // method Float.floatValue()
     m_method_Float_floatValue = jni->GetMethodID(
-        (jclass) jo_Float.get(), "floatValue", "()F" );
+        static_cast<jclass>(jo_Float.get()), "floatValue", "()F" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Float_floatValue );
     // method Double.doubleValue()
     m_method_Double_doubleValue = jni->GetMethodID(
-        (jclass) jo_Double.get(), "doubleValue", "()D" );
+        static_cast<jclass>(jo_Double.get()), "doubleValue", "()D" );
     jni.ensure_no_exception();
     assert( 0 != m_method_Double_doubleValue );
 
     // ctor Character( char )
     m_ctor_Character_with_char = jni->GetMethodID(
-        (jclass) jo_Character.get(), "<init>", "(C)V" );
+        static_cast<jclass>(jo_Character.get()), "<init>", "(C)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Character_with_char );
     // ctor Boolean( boolean )
     m_ctor_Boolean_with_boolean = jni->GetMethodID(
-        (jclass) jo_Boolean.get(), "<init>", "(Z)V" );
+        static_cast<jclass>(jo_Boolean.get()), "<init>", "(Z)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Boolean_with_boolean );
     // ctor Byte( byte )
     m_ctor_Byte_with_byte = jni->GetMethodID(
-        (jclass) jo_Byte.get(), "<init>", "(B)V" );
+        static_cast<jclass>(jo_Byte.get()), "<init>", "(B)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Byte_with_byte );
     // ctor Short( short )
     m_ctor_Short_with_short = jni->GetMethodID(
-        (jclass) jo_Short.get(), "<init>", "(S)V" );
+        static_cast<jclass>(jo_Short.get()), "<init>", "(S)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Short_with_short );
     // ctor Integer( int )
     m_ctor_Integer_with_int = jni->GetMethodID(
-        (jclass) jo_Integer.get(), "<init>", "(I)V" );
+        static_cast<jclass>(jo_Integer.get()), "<init>", "(I)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Integer_with_int );
     // ctor Long( long )
     m_ctor_Long_with_long = jni->GetMethodID(
-        (jclass) jo_Long.get(), "<init>", "(J)V" );
+        static_cast<jclass>(jo_Long.get()), "<init>", "(J)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Long_with_long );
     // ctor Float( float )
     m_ctor_Float_with_float = jni->GetMethodID(
-        (jclass) jo_Float.get(), "<init>", "(F)V" );
+        static_cast<jclass>(jo_Float.get()), "<init>", "(F)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Float_with_float );
     // ctor Double( double )
     m_ctor_Double_with_double = jni->GetMethodID(
-        (jclass) jo_Double.get(), "<init>", "(D)V" );
+        static_cast<jclass>(jo_Double.get()), "<init>", "(D)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Double_with_double );
 
     // static method UnoRuntime.generateOid()
     m_method_UnoRuntime_generateOid = jni->GetStaticMethodID(
-        (jclass) jo_UnoRuntime.get(),
+        static_cast<jclass>(jo_UnoRuntime.get()),
         "generateOid", "(Ljava/lang/Object;)Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_UnoRuntime_generateOid );
     // static method UnoRuntime.queryInterface()
     m_method_UnoRuntime_queryInterface = jni->GetStaticMethodID(
-        (jclass) jo_UnoRuntime.get(),
+        static_cast<jclass>(jo_UnoRuntime.get()),
         "queryInterface",
         "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)Ljava/lang/Object;" );
     jni.ensure_no_exception();
@@ -655,62 +655,62 @@ JNI_info::JNI_info(
 
     // field Enum.m_value
     m_field_Enum_m_value = jni->GetFieldID(
-        (jclass) jo_Enum.get(), "m_value", "I" );
+        static_cast<jclass>(jo_Enum.get()), "m_value", "I" );
     jni.ensure_no_exception();
     assert( 0 != m_field_Enum_m_value );
 
     // static method TypeClass.fromInt()
     m_method_TypeClass_fromInt = jni->GetStaticMethodID(
-        (jclass) jo_TypeClass.get(),
+        static_cast<jclass>(jo_TypeClass.get()),
         "fromInt", "(I)Lcom/sun/star/uno/TypeClass;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_TypeClass_fromInt );
 
     // ctor Type( Class )
     m_ctor_Type_with_Class = jni->GetMethodID(
-        (jclass) jo_Type.get(), "<init>", "(Ljava/lang/Class;)V" );
+        static_cast<jclass>(jo_Type.get()), "<init>", "(Ljava/lang/Class;)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Type_with_Class );
     // ctor Type( String, TypeClass )
     m_ctor_Type_with_Name_TypeClass = jni->GetMethodID(
-        (jclass) jo_Type.get(),
+        static_cast<jclass>(jo_Type.get()),
         "<init>", "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Type_with_Name_TypeClass );
     // field Type._typeName
     m_field_Type__typeName = jni->GetFieldID(
-        (jclass) jo_Type.get(), "_typeName", "Ljava/lang/String;" );
+        static_cast<jclass>(jo_Type.get()), "_typeName", "Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_field_Type__typeName );
 
     // ctor Any( Type, Object )
     m_ctor_Any_with_Type_Object = jni->GetMethodID(
-        (jclass) jo_Any.get(),
+        static_cast<jclass>(jo_Any.get()),
         "<init>", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_Any_with_Type_Object );
 
     // field Any._type
     m_field_Any__type = jni->GetFieldID(
-        (jclass) jo_Any.get(), "_type", "Lcom/sun/star/uno/Type;" );
+        static_cast<jclass>(jo_Any.get()), "_type", "Lcom/sun/star/uno/Type;" );
     jni.ensure_no_exception();
     assert( 0 != m_field_Any__type );
     // field Any._object
     m_field_Any__object = jni->GetFieldID(
-        (jclass) jo_Any.get(), "_object", "Ljava/lang/Object;" );
+        static_cast<jclass>(jo_Any.get()), "_object", "Ljava/lang/Object;" );
     jni.ensure_no_exception();
     assert( 0 != m_field_Any__object );
 
     // method IEnvironment.getRegisteredInterface()
     m_method_IEnvironment_getRegisteredInterface = jni->GetMethodID(
-        (jclass) jo_IEnvironment.get(),
+        static_cast<jclass>(jo_IEnvironment.get()),
         "getRegisteredInterface",
         "(Ljava/lang/String;Lcom/sun/star/uno/Type;)Ljava/lang/Object;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_IEnvironment_getRegisteredInterface );
     // method IEnvironment.registerInterface()
     m_method_IEnvironment_registerInterface = jni->GetMethodID(
-        (jclass) jo_IEnvironment.get(), "registerInterface",
+        static_cast<jclass>(jo_IEnvironment.get()), "registerInterface",
         "(Ljava/lang/Object;[Ljava/lang/String;Lcom/sun/star/uno/Type;)"
         "Ljava/lang/Object;" );
     jni.ensure_no_exception();
@@ -718,13 +718,13 @@ JNI_info::JNI_info(
 
     // static method JNI_proxy.get_proxy_ctor()
     m_method_JNI_proxy_get_proxy_ctor = jni->GetStaticMethodID(
-        (jclass) jo_JNI_proxy.get(), "get_proxy_ctor",
+        static_cast<jclass>(jo_JNI_proxy.get()), "get_proxy_ctor",
         "(Ljava/lang/Class;)Ljava/lang/reflect/Constructor;" );
     jni.ensure_no_exception();
     assert( 0 != m_method_JNI_proxy_get_proxy_ctor );
     // static method JNI_proxy.create()
     m_method_JNI_proxy_create = jni->GetStaticMethodID(
-        (jclass) jo_JNI_proxy.get(), "create",
+        static_cast<jclass>(jo_JNI_proxy.get()), "create",
         "(JLcom/sun/star/uno/IEnvironment;JJLcom/sun/star/uno/Type;Ljava/lang"
         "/String;Ljava/lang/reflect/Constructor;"
         "Lcom/sun/star/lib/util/AsynchronousFinalizer;)Ljava/lang/Object;" );
@@ -732,33 +732,33 @@ JNI_info::JNI_info(
     assert( 0 != m_method_JNI_proxy_create );
     // field JNI_proxy.m_receiver_handle
     m_field_JNI_proxy_m_receiver_handle = jni->GetFieldID(
-        (jclass) jo_JNI_proxy.get(), "m_receiver_handle", "J" );
+        static_cast<jclass>(jo_JNI_proxy.get()), "m_receiver_handle", "J" );
     jni.ensure_no_exception();
     assert( 0 != m_field_JNI_proxy_m_receiver_handle );
     // field JNI_proxy.m_td_handle
     m_field_JNI_proxy_m_td_handle = jni->GetFieldID(
-        (jclass) jo_JNI_proxy.get(), "m_td_handle", "J" );
+        static_cast<jclass>(jo_JNI_proxy.get()), "m_td_handle", "J" );
     jni.ensure_no_exception();
     assert( 0 != m_field_JNI_proxy_m_td_handle );
     // field JNI_proxy.m_type
     m_field_JNI_proxy_m_type = jni->GetFieldID(
-        (jclass) jo_JNI_proxy.get(), "m_type", "Lcom/sun/star/uno/Type;" );
+        static_cast<jclass>(jo_JNI_proxy.get()), "m_type", "Lcom/sun/star/uno/Type;" );
     jni.ensure_no_exception();
     assert( 0 != m_field_JNI_proxy_m_type );
     // field JNI_proxy.m_oid
     m_field_JNI_proxy_m_oid = jni->GetFieldID(
-        (jclass) jo_JNI_proxy.get(), "m_oid", "Ljava/lang/String;" );
+        static_cast<jclass>(jo_JNI_proxy.get()), "m_oid", "Ljava/lang/String;" );
     jni.ensure_no_exception();
     assert( 0 != m_field_JNI_proxy_m_oid );
 
     // ctor AsynchronousFinalizer
     m_ctor_AsynchronousFinalizer = jni->GetMethodID(
-        (jclass) jo_AsynchronousFinalizer.get(), "<init>", "()V" );
+        static_cast<jclass>(jo_AsynchronousFinalizer.get()), "<init>", "()V" );
     jni.ensure_no_exception();
     assert( 0 != m_ctor_AsynchronousFinalizer );
     // method AsynchronousFinalizer.drain()
     m_method_AsynchronousFinalizer_drain = jni->GetMethodID(
-        (jclass) jo_AsynchronousFinalizer.get(), "drain", "()V" );
+        static_cast<jclass>(jo_AsynchronousFinalizer.get()), "drain", "()V" );
     jni.ensure_no_exception();
     assert( 0 != m_method_AsynchronousFinalizer_drain );
 
@@ -770,86 +770,86 @@ JNI_info::JNI_info(
     args[ 0 ].l = jo_java.get();
     args[ 1 ].l = 0;
     jmethodID method_getEnvironment = jni->GetStaticMethodID(
-        (jclass) jo_UnoRuntime.get(), "getEnvironment",
+        static_cast<jclass>(jo_UnoRuntime.get()), "getEnvironment",
         "(Ljava/lang/String;Ljava/lang/Object;)"
         "Lcom/sun/star/uno/IEnvironment;" );
     jni.ensure_no_exception();
     assert( 0 != method_getEnvironment );
     JLocalAutoRef jo_java_env(
         jni, jni->CallStaticObjectMethodA(
-            (jclass) jo_UnoRuntime.get(), method_getEnvironment, args ) );
+            static_cast<jclass>(jo_UnoRuntime.get()), method_getEnvironment, args ) );
 
     // get com.sun.star.uno.Any.VOID
     jfieldID field_Any_VOID = jni->GetStaticFieldID(
-        (jclass) jo_Any.get(), "VOID", "Lcom/sun/star/uno/Any;" );
+        static_cast<jclass>(jo_Any.get()), "VOID", "Lcom/sun/star/uno/Any;" );
     jni.ensure_no_exception();
     assert( 0 != field_Any_VOID );
     JLocalAutoRef jo_Any_VOID(
         jni, jni->GetStaticObjectField(
-            (jclass) jo_Any.get(), field_Any_VOID ) );
+            static_cast<jclass>(jo_Any.get()), field_Any_VOID ) );
     // get com.sun.star.uno.Type.UNSIGNED_SHORT
     jfieldID field_Type_UNSIGNED_SHORT = jni->GetStaticFieldID(
-        (jclass) jo_Type.get(), "UNSIGNED_SHORT", "Lcom/sun/star/uno/Type;" );
+        static_cast<jclass>(jo_Type.get()), "UNSIGNED_SHORT", "Lcom/sun/star/uno/Type;" );
     jni.ensure_no_exception();
     assert( 0 != field_Type_UNSIGNED_SHORT );
     JLocalAutoRef jo_Type_UNSIGNED_SHORT(
         jni, jni->GetStaticObjectField(
-            (jclass) jo_Type.get(), field_Type_UNSIGNED_SHORT ) );
+            static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_SHORT ) );
     // get com.sun.star.uno.Type.UNSIGNED_LONG
     jfieldID field_Type_UNSIGNED_LONG = jni->GetStaticFieldID(
-        (jclass) jo_Type.get(), "UNSIGNED_LONG", "Lcom/sun/star/uno/Type;" );
+        static_cast<jclass>(jo_Type.get()), "UNSIGNED_LONG", "Lcom/sun/star/uno/Type;" );
     jni.ensure_no_exception();
     assert( 0 != field_Type_UNSIGNED_LONG );
     JLocalAutoRef jo_Type_UNSIGNED_LONG(
         jni, jni->GetStaticObjectField(
-            (jclass) jo_Type.get(), field_Type_UNSIGNED_LONG ) );
+            static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_LONG ) );
     // get com.sun.star.uno.Type.UNSIGNED_HYPER
     jfieldID field_Type_UNSIGNED_HYPER = jni->GetStaticFieldID(
-        (jclass) jo_Type.get(), "UNSIGNED_HYPER", "Lcom/sun/star/uno/Type;" );
+        static_cast<jclass>(jo_Type.get()), "UNSIGNED_HYPER", "Lcom/sun/star/uno/Type;" );
     jni.ensure_no_exception();
     assert( 0 != field_Type_UNSIGNED_HYPER );
     JLocalAutoRef jo_Type_UNSIGNED_HYPER(
         jni, jni->GetStaticObjectField(
-            (jclass) jo_Type.get(), field_Type_UNSIGNED_HYPER ) );
+            static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_HYPER ) );
 
     // make global refs
     m_class_UnoRuntime =
-        (jclass) jni->NewGlobalRef( jo_UnoRuntime.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_UnoRuntime.get() ));
     m_class_RuntimeException =
-        (jclass) jni->NewGlobalRef( jo_RuntimeException.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_RuntimeException.get() ));
     m_class_Any =
-        (jclass) jni->NewGlobalRef( jo_Any.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Any.get() ));
     m_class_Type =
-        (jclass) jni->NewGlobalRef( jo_Type.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Type.get() ));
     m_class_TypeClass =
-        (jclass) jni->NewGlobalRef( jo_TypeClass.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_TypeClass.get() ));
     m_class_JNI_proxy =
-        (jclass) jni->NewGlobalRef( jo_JNI_proxy.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_JNI_proxy.get() ));
     m_class_AsynchronousFinalizer =
-        (jclass) jni->NewGlobalRef( jo_AsynchronousFinalizer.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_AsynchronousFinalizer.get() ));
 
     m_class_Character =
-        (jclass) jni->NewGlobalRef( jo_Character.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Character.get() ));
     m_class_Boolean =
-        (jclass) jni->NewGlobalRef( jo_Boolean.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Boolean.get() ));
     m_class_Byte =
-        (jclass) jni->NewGlobalRef( jo_Byte.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Byte.get() ));
     m_class_Short =
-        (jclass) jni->NewGlobalRef( jo_Short.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Short.get() ));
     m_class_Integer =
-        (jclass) jni->NewGlobalRef( jo_Integer.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Integer.get() ));
     m_class_Long =
-        (jclass) jni->NewGlobalRef( jo_Long.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Long.get() ));
     m_class_Float =
-        (jclass) jni->NewGlobalRef( jo_Float.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Float.get() ));
     m_class_Double =
-        (jclass) jni->NewGlobalRef( jo_Double.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Double.get() ));
     m_class_String =
-        (jclass) jni->NewGlobalRef( jo_String.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_String.get() ));
     m_class_Object =
-        (jclass) jni->NewGlobalRef( jo_Object.get() );
+        static_cast<jclass>(jni->NewGlobalRef( jo_Object.get() ));
     m_class_Class =
-        (jclass) jni->NewGlobalRef( m_class_Class );
+        static_cast<jclass>(jni->NewGlobalRef( m_class_Class ));
 
     m_object_Any_VOID =
         jni->NewGlobalRef( jo_Any_VOID.get() );
@@ -943,14 +943,14 @@ JNI_info const * JNI_info::get_jni_info(
     // field JNI_info_holder.m_jni_info_handle
     jfieldID field_s_jni_info_handle =
         jni->GetStaticFieldID(
-            (jclass) jo_JNI_info_holder.get(), "s_jni_info_handle", "J" );
+            static_cast<jclass>(jo_JNI_info_holder.get()), "s_jni_info_handle", "J" );
     jni.ensure_no_exception();
     assert( 0 != field_s_jni_info_handle );
 
     JNI_info const * jni_info =
         reinterpret_cast< JNI_info const * >(
             jni->GetStaticLongField(
-                (jclass) jo_JNI_info_holder.get(), field_s_jni_info_handle ) );
+                static_cast<jclass>(jo_JNI_info_holder.get()), field_s_jni_info_handle ) );
     if (0 == jni_info) // un-initialized?
     {
         JNI_info * new_info = new JNI_info(
@@ -961,12 +961,12 @@ JNI_info const * JNI_info::get_jni_info(
         jni_info =
             reinterpret_cast< JNI_info const * >(
                 jni->GetStaticLongField(
-                    (jclass) jo_JNI_info_holder.get(),
+                    static_cast<jclass>(jo_JNI_info_holder.get()),
                     field_s_jni_info_handle ) );
         if (0 == jni_info) // still un-initialized?
         {
             jni->SetStaticLongField(
-                (jclass) jo_JNI_info_holder.get(), field_s_jni_info_handle,
+                static_cast<jclass>(jo_JNI_info_holder.get()), field_s_jni_info_handle,
                 reinterpret_cast< jlong >( new_info ) );
             jni_info = new_info;
         }
diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx
index 8d432cd..a3887f7 100644
--- a/bridges/source/jni_uno/jni_java2uno.cxx
+++ b/bridges/source/jni_uno/jni_java2uno.cxx
@@ -119,7 +119,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const
         uno_any_destruct( uno_exc, 0 );
 
         JLocalAutoRef jo_exc( jni, java_exc.l );
-        jint res = jni->Throw( (jthrowable) jo_exc.get() );
+        jint res = jni->Throw( static_cast<jthrowable>(jo_exc.get()) );
         if (0 != res)
         {
             // call toString()
@@ -129,7 +129,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const
             jni.ensure_no_exception();
             throw BridgeRuntimeError(
                 "throwing java exception failed: "
-                + jstring_to_oustring( jni, (jstring) jo_descr.get() )
+                + jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) )
                 + jni.get_stack_trace() );
         }
     }
@@ -421,7 +421,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call(
                     jni.get_stack_trace() );
             }
             OUString type_name(
-                jstring_to_oustring( jni, (jstring) jo_type_name.get() ) );
+                jstring_to_oustring( jni, static_cast<jstring>(jo_type_name.get()) ) );
             JNI_type_info const * info =
                 jni_info->get_type_info( jni, type_name );
             if (typelib_TypeClass_INTERFACE != info->m_td.get()->eTypeClass)
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx
index 1885c88..29ef813 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -78,7 +78,7 @@ void Bridge::handle_java_exc(
             jo_class.get(), getJniInfo()->m_method_Class_getName, 0 ) );
     jni.ensure_no_exception();
     OUString exc_name(
-        jstring_to_oustring( jni, (jstring) jo_class_name.get() ) );
+        jstring_to_oustring( jni, static_cast<jstring>(jo_class_name.get()) ) );
 
     ::com::sun::star::uno::TypeDescription td( exc_name.pData );
     if (!td.is() || (typelib_TypeClass_EXCEPTION != td.get()->eTypeClass))
@@ -90,7 +90,7 @@ void Bridge::handle_java_exc(
         jni.ensure_no_exception();
         throw BridgeRuntimeError(
             "non-UNO exception occurred: "
-            + jstring_to_oustring( jni, (jstring) jo_descr.get() )
+            + jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) )
             + jni.get_stack_trace( jo_exc.get() ) );
     }
 
@@ -221,20 +221,20 @@ void Bridge::call_java(
         jni, jni->CallObjectMethodA(
             jo_method.get(), getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
-    trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
+    trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) );
     trace_buf.append( " on " );
     jo_descr.reset(
         jni->CallObjectMethodA(
             javaI, getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
-    trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
+    trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) );
     trace_buf.append( " (" );
     JLocalAutoRef jo_class( jni, jni->GetObjectClass( javaI ) );
     jo_descr.reset(
         jni->CallObjectMethodA(
             jo_class.get(), getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
-    trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
+    trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) );
     trace_buf.append( ")" );
     SAL_INFO("bridges", trace_buf.makeStringAndClear());
 #endif
@@ -441,7 +441,7 @@ inline UNO_proxy::UNO_proxy(
     jni.ensure_no_exception();
 
     m_javaI = jni->NewGlobalRef( jo_iface );
-    m_jo_oid = (jstring) jni->NewGlobalRef( jo_oid );
+    m_jo_oid = static_cast<jstring>(jni->NewGlobalRef( jo_oid ));
     bridge->acquire();
     m_bridge = bridge;
 
@@ -485,7 +485,7 @@ uno_Interface * Bridge::map_to_uno(
     jobject javaI, JNI_interface_type_info const * info ) const
 {
     JLocalAutoRef jo_oid( jni, compute_oid( jni, javaI ) );
-    OUString oid( jstring_to_oustring( jni, (jstring) jo_oid.get() ) );
+    OUString oid( jstring_to_oustring( jni, static_cast<jstring>(jo_oid.get()) ) );
 
     uno_Interface * pUnoI = 0;
     (*m_uno_env->getRegisteredInterface)(
@@ -497,7 +497,7 @@ uno_Interface * Bridge::map_to_uno(
         // refcount initially 1
         pUnoI = new UNO_proxy(
             jni, const_cast< Bridge * >( this ),
-            javaI, (jstring) jo_oid.get(), oid, info );
+            javaI, static_cast<jstring>(jo_oid.get()), oid, info );
 
         (*m_uno_env->registerProxyInterface)(
             m_uno_env, (void **)&pUnoI,
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 6fbf60b..19b0163 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -96,15 +96,11 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     if ( filename.endswith(".h") ) {
         return true;
     }
-    if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation) ) {
-        if (filename.startswith(SRCDIR "/bridges/")) { // I'm not messing with this code - far too dangerous
-            return true;
-        }
-    } else {
-        if (filename == SRCDIR "/include/tools/solar.h"
-           || filename.startswith(SRCDIR "/include/cppuhelper/")) {
-            return true;
-        }
+    if (!compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
+        && (filename == SRCDIR "/include/tools/solar.h"
+            || filename.startswith(SRCDIR "/include/cppuhelper/")))
+    {
+        return true;
     }
     report(
         DiagnosticsEngine::Warning,
commit 7b1261f6f956271ec2a545f635e11432a5e64fa1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 22:21:33 2015 +0100

    loplugin:cstylecast: sal
    
    Change-Id: I0ad9681a8b31d78cefce5b66040415154a1c7a99

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index c14436d..6fbf60b 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -97,19 +97,12 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         return true;
     }
     if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation) ) {
-        if (filename.startswith(SRCDIR "/sal/") // sal has tons of weird stuff going on that I don't understand enough to fix
-           || filename.startswith(SRCDIR "/bridges/")) { // I'm not messing with this code - far too dangerous
+        if (filename.startswith(SRCDIR "/bridges/")) { // I'm not messing with this code - far too dangerous
             return true;
         }
     } else {
         if (filename == SRCDIR "/include/tools/solar.h"
-           || filename.startswith(SRCDIR "/include/cppuhelper/")
-           || ((StringRef(
-                    compiler.getSourceManager().getFileEntryForID(
-                        compiler.getSourceManager().getMainFileID())
-                    ->getName())
-                == SRCDIR "/jurt/source/pipe/staticsalhack.cxx")
-               && filename.startswith(SRCDIR "/sal/"))) {
+           || filename.startswith(SRCDIR "/include/cppuhelper/")) {
             return true;
         }
     }
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index f58fcc9..b32987e 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -2322,18 +2322,18 @@ oslSocketError SAL_CALL osl_getLastSocketError(oslSocket pSocket)
     return ERROR_FROM_NATIVE(pSocket->m_nLastError);
 }
 
-typedef struct _TSocketSetImpl
+struct oslSocketSetImpl
 {
     int     m_MaxHandle;    /* for select(), the largest descriptor in the set */
     fd_set  m_Set;          /* the set of descriptors */
 
-} TSocketSetImpl;
+};
 
 oslSocketSet SAL_CALL osl_createSocketSet()
 {
-    TSocketSetImpl* pSet;
+    oslSocketSetImpl* pSet;
 
-    pSet= (TSocketSetImpl*)malloc(sizeof(TSocketSetImpl));
+    pSet= (oslSocketSetImpl*)malloc(sizeof(oslSocketSetImpl));
 
     OSL_ASSERT(pSet);
 
@@ -2354,23 +2354,19 @@ void SAL_CALL osl_destroySocketSet(oslSocketSet Set)
 
 void SAL_CALL osl_clearSocketSet(oslSocketSet Set)
 {
-    TSocketSetImpl* pSet;
     OSL_ASSERT(Set);
     if ( Set == 0 )
     {
         return;
     }
 
-    pSet= (TSocketSetImpl*)Set;
-    pSet->m_MaxHandle= 0;
+    Set->m_MaxHandle= 0;
 
-    FD_ZERO(&pSet->m_Set);
+    FD_ZERO(&Set->m_Set);
 }
 
 void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket pSocket)
 {
-    TSocketSetImpl* pSet;
-
     OSL_ASSERT(Set);
     OSL_ASSERT(pSocket);
 
@@ -2379,19 +2375,15 @@ void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket pSocket)
         return;
     }
 
-    pSet= (TSocketSetImpl*)Set;
-
     /* correct max handle */
-    if(pSocket->m_Socket > pSet->m_MaxHandle)
-        pSet->m_MaxHandle= pSocket->m_Socket;
-    FD_SET(pSocket->m_Socket, &pSet->m_Set);
+    if(pSocket->m_Socket > Set->m_MaxHandle)
+        Set->m_MaxHandle= pSocket->m_Socket;
+    FD_SET(pSocket->m_Socket, &Set->m_Set);
 
 }
 
 void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket pSocket)
 {
-    TSocketSetImpl* pSet;
-
     OSL_ASSERT(Set);
     OSL_ASSERT(pSocket);
 
@@ -2400,27 +2392,23 @@ void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket pSocket)
         return;
     }
 
-    pSet= (TSocketSetImpl*)Set;
-
     /* correct max handle */
-    if(pSocket->m_Socket == pSet->m_MaxHandle)
+    if(pSocket->m_Socket == Set->m_MaxHandle)
     {
         /* not optimal, since the next used descriptor might be */
         /* much smaller than m_Socket-1, but it will do */
-        pSet->m_MaxHandle--;
-        if(pSet->m_MaxHandle < 0)
+        Set->m_MaxHandle--;
+        if(Set->m_MaxHandle < 0)
         {
-            pSet->m_MaxHandle= 0;   /* avoid underflow */
+            Set->m_MaxHandle= 0;   /* avoid underflow */
         }
     }
 
-    FD_CLR(pSocket->m_Socket, &pSet->m_Set);
+    FD_CLR(pSocket->m_Socket, &Set->m_Set);
 }
 
 sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket)
 {
-    TSocketSetImpl* pSet;
-
     OSL_ASSERT(Set);
     OSL_ASSERT(pSocket);
     if ( Set == 0 || pSocket == 0 )
@@ -2428,9 +2416,7 @@ sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket)
         return sal_False;
     }
 
-    pSet= (TSocketSetImpl*)Set;
-
-    return bool(FD_ISSET(pSocket->m_Socket, &pSet->m_Set));
+    return bool(FD_ISSET(pSocket->m_Socket, &Set->m_Set));
 }
 
 sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
@@ -2440,9 +2426,6 @@ sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
 {
     int MaxHandle= 0;
     struct timeval  tv;
-    TSocketSetImpl* pInSet;
-    TSocketSetImpl* pOutSet;
-    TSocketSetImpl* pOOBSet;
 
     if (pTimeout)
     {
@@ -2451,25 +2434,20 @@ sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
         tv.tv_usec = pTimeout->Nanosec / 1000L;
     }
 
-    /* map opaque data to impl-types */
-    pInSet=  (TSocketSetImpl*)IncomingSet;
-    pOutSet= (TSocketSetImpl*)OutgoingSet;
-    pOOBSet= (TSocketSetImpl*)OutOfBandSet;
-
     /* get max handle from all sets */
-    if (pInSet)
-        MaxHandle= pInSet->m_MaxHandle;
+    if (IncomingSet)
+        MaxHandle= IncomingSet->m_MaxHandle;
 
-    if (pOutSet && (pOutSet->m_MaxHandle > MaxHandle))
-        MaxHandle= pOutSet->m_MaxHandle;
+    if (OutgoingSet && (OutgoingSet->m_MaxHandle > MaxHandle))
+        MaxHandle= OutgoingSet->m_MaxHandle;
 
-    if (pOOBSet && (pOOBSet->m_MaxHandle > MaxHandle))
-        MaxHandle= pOOBSet->m_MaxHandle;
+    if (OutOfBandSet && (OutOfBandSet->m_MaxHandle > MaxHandle))
+        MaxHandle= OutOfBandSet->m_MaxHandle;
 
     return select(MaxHandle+1,
-                  pInSet  ? PTR_FD_SET(pInSet->m_Set)  : 0,
-                  pOutSet ? PTR_FD_SET(pOutSet->m_Set) : 0,
-                  pOOBSet ? PTR_FD_SET(pOOBSet->m_Set) : 0,
+                  IncomingSet  ? PTR_FD_SET(IncomingSet->m_Set)  : 0,
+                  OutgoingSet ? PTR_FD_SET(OutgoingSet->m_Set) : 0,
+                  OutOfBandSet ? PTR_FD_SET(OutOfBandSet->m_Set) : 0,
                   pTimeout ? &tv : 0);
 }
 
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index c2f2fc9..0ca4113 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -538,7 +538,7 @@ void SAL_CALL osl_yieldThread()
 
 void SAL_CALL osl_setThreadName(char const * name) {
 #if defined LINUX && ! defined __FreeBSD_kernel__
-    if (prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0) != 0) {
+    if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name), 0, 0, 0) != 0) {
         int e = errno;
         SAL_WARN("sal.osl", "prctl(PR_SET_NAME) failed with errno " << e);
     }
@@ -1022,7 +1022,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding()
 
     /* check for thread specific encoding, use default if not set */
     threadEncoding = static_cast<rtl_TextEncoding>(
-        (sal_uIntPtr) pthread_getspecific(g_thread.m_textencoding.m_key));
+        reinterpret_cast<sal_uIntPtr>(pthread_getspecific(g_thread.m_textencoding.m_key)));
     if (0 == threadEncoding)
         threadEncoding = g_thread.m_textencoding.m_default;
 
@@ -1036,7 +1036,7 @@ rtl_TextEncoding osl_setThreadTextEncoding(rtl_TextEncoding Encoding)
     /* save encoding in thread local storage */
     pthread_setspecific (
         g_thread.m_textencoding.m_key,
-        (void*) static_cast<sal_uIntPtr>(Encoding));
+        reinterpret_cast<void*>(static_cast<sal_uIntPtr>(Encoding)));
 
     return oldThreadEncoding;
 }
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 9aa6630..7a14239 100644
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx
@@ -239,7 +239,7 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
         rtl_TextToUnicodeContext aContext
             = rtl_createTextToUnicodeContext(aConverter);
         CPPUNIT_ASSERT_MESSAGE("rtl_createTextToUnicodeContext failed", aContext != NULL);
-        if (aContext != (rtl_TextToUnicodeContext) 1) {
+        if (aContext != reinterpret_cast<rtl_TextToUnicodeContext>(1)) {
             sal_Size nInput = 0;
             sal_Size nOutput = 0;
             for (bool bFlush = true; nInput < rTest.m_nTextSize || bFlush;) {
diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx
index b826f13..9f3b2d2 100644
--- a/sal/rtl/alloc_arena.cxx
+++ b/sal/rtl/alloc_arena.cxx
@@ -137,7 +137,7 @@ rtl_arena_segment_populate (
         /* insert onto reserve span list */
         QUEUE_INSERT_TAIL_NAMED(&(arena->m_segment_reserve_span_head), span, s);
         QUEUE_START_NAMED(span, f);
-        span->m_addr = (sal_uIntPtr)(span);
+        span->m_addr = reinterpret_cast<sal_uIntPtr>(span);
         span->m_size = size;
         span->m_type = RTL_ARENA_SEGMENT_TYPE_SPAN;
 
@@ -499,8 +499,9 @@ rtl_arena_segment_create (
                 RTL_MEMORY_LOCK_RELEASE(&(arena->m_lock));
 
                 span->m_size = size;
-                span->m_addr = (sal_uIntPtr)(arena->m_source_alloc)(
-                    arena->m_source_arena, &(span->m_size));
+                span->m_addr = reinterpret_cast<sal_uIntPtr>(
+                    (arena->m_source_alloc)(
+                        arena->m_source_arena, &(span->m_size)));
 
                 RTL_MEMORY_LOCK_ACQUIRE(&(arena->m_lock));
                 if (span->m_addr != 0)
@@ -851,7 +852,7 @@ rtl_arena_deactivate (
         QUEUE_REMOVE_NAMED(segment, s);
 
         /* return span to g_machdep_arena */
-        rtl_machdep_free (gp_machdep_arena, (void*)(segment->m_addr), segment->m_size);
+        rtl_machdep_free (gp_machdep_arena, reinterpret_cast<void*>(segment->m_addr), segment->m_size);
     }
 }
 
@@ -992,7 +993,7 @@ SAL_CALL rtl_arena_alloc (
                 rtl_arena_hash_insert (arena, segment);
 
                 (*pSize) = segment->m_size;
-                addr = (void*)(segment->m_addr);
+                addr = reinterpret_cast<void*>(segment->m_addr);
             }
             RTL_MEMORY_LOCK_RELEASE(&(arena->m_lock));
         }
@@ -1035,7 +1036,7 @@ SAL_CALL rtl_arena_free (
 
             RTL_MEMORY_LOCK_ACQUIRE(&(arena->m_lock));
 
-            segment = rtl_arena_hash_remove (arena, (sal_uIntPtr)(addr), size);
+            segment = rtl_arena_hash_remove (arena, reinterpret_cast<sal_uIntPtr>(addr), size);
             if (segment != 0)
             {
                 rtl_arena_segment_type *next, *prev;
@@ -1057,7 +1058,7 @@ SAL_CALL rtl_arena_free (
 
                     if (arena->m_source_free)
                     {
-                        addr = (void*)(prev->m_addr);
+                        addr = reinterpret_cast<void*>(prev->m_addr);
                         size = prev->m_size;
 
                         /* remove from segment list */
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index a8db5c2..e85f752 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -229,7 +229,7 @@ rtl_cache_hash_remove (
 /** RTL_CACHE_SLAB()
  */
 #define RTL_CACHE_SLAB(addr, size) \
-    (((rtl_cache_slab_type*)(RTL_MEMORY_P2END((sal_uIntPtr)(addr), (size)))) - 1)
+    ((reinterpret_cast<rtl_cache_slab_type*>(RTL_MEMORY_P2END(reinterpret_cast<sal_uIntPtr>(addr), (size)))) - 1)
 
 /** rtl_cache_slab_constructor()
  */
@@ -288,7 +288,7 @@ rtl_cache_slab_create (
         }
         if (slab != 0)
         {
-            slab->m_data = (sal_uIntPtr)(addr);
+            slab->m_data = reinterpret_cast<sal_uIntPtr>(addr);
 
             /* dynamic freelist initialization */
             slab->m_bp = slab->m_data;
@@ -312,7 +312,7 @@ rtl_cache_slab_destroy (
     rtl_cache_slab_type * slab
 )
 {
-    void *   addr   = (void*)(slab->m_data);
+    void *   addr   = reinterpret_cast<void*>(slab->m_data);
     sal_Size refcnt = slab->m_ntypes; slab->m_ntypes = 0;
 
     if (cache->m_features & RTL_CACHE_FEATURE_HASH)
@@ -422,12 +422,12 @@ rtl_cache_slab_alloc (
                 }
 
                 bufctl->m_addr = slab->m_bp;
-                bufctl->m_slab = (sal_uIntPtr)(slab);
+                bufctl->m_slab = reinterpret_cast<sal_uIntPtr>(slab);
             }
             else
             {
                 /* embedded bufctl */
-                bufctl = (rtl_cache_bufctl_type*)(slab->m_bp);
+                bufctl = reinterpret_cast<rtl_cache_bufctl_type*>(slab->m_bp);
             }
             bufctl->m_next = 0;
 
@@ -457,7 +457,7 @@ rtl_cache_slab_alloc (
         cache->m_slab_stats.m_mem_alloc += cache->m_type_size;
 
         if (cache->m_features & RTL_CACHE_FEATURE_HASH)
-            addr = (void*)rtl_cache_hash_insert (cache, bufctl);
+            addr = reinterpret_cast<void*>(rtl_cache_hash_insert (cache, bufctl));
         else
             addr = bufctl;
     }
@@ -484,8 +484,8 @@ rtl_cache_slab_free (
     /* determine slab from addr */
     if (cache->m_features & RTL_CACHE_FEATURE_HASH)
     {
-        bufctl = rtl_cache_hash_remove (cache, (sal_uIntPtr)(addr));
-        slab = (bufctl != 0) ? (rtl_cache_slab_type*)(bufctl->m_slab) : 0;
+        bufctl = rtl_cache_hash_remove (cache, reinterpret_cast<sal_uIntPtr>(addr));
+        slab = (bufctl != 0) ? reinterpret_cast<rtl_cache_slab_type*>(bufctl->m_slab) : 0;
     }
     else
     {
@@ -1326,7 +1326,7 @@ rtl_cache_wsupdate_init()
     g_cache_list.m_update_done = 0;
     (void) pthread_cond_init (&(g_cache_list.m_update_cond), NULL);
     if (pthread_create (
-            &(g_cache_list.m_update_thread), NULL, rtl_cache_wsupdate_all, (void*)(10)) != 0)
+            &(g_cache_list.m_update_thread), NULL, rtl_cache_wsupdate_all, reinterpret_cast<void*>(10)) != 0)
     {
         /* failure */
         g_cache_list.m_update_thread = (pthread_t)(0);
diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx
index 2710973..cda7faa 100644
--- a/sal/textenc/textcvt.cxx
+++ b/sal/textenc/textcvt.cxx
@@ -127,7 +127,7 @@ rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnic
     else if ( pConverter->mpCreateTextToUnicodeContext )
         return (rtl_TextToUnicodeContext)pConverter->mpCreateTextToUnicodeContext();
     else
-        return (rtl_TextToUnicodeContext)1;
+        return reinterpret_cast<rtl_TextToUnicodeContext>(1);
 }
 
 /* ----------------------------------------------------------------------- */
@@ -205,7 +205,7 @@ rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToT
     else if ( pConverter->mpCreateUnicodeToTextContext )
         return (rtl_UnicodeToTextContext)pConverter->mpCreateUnicodeToTextContext();
     else
-        return (rtl_UnicodeToTextContext)1;
+        return reinterpret_cast<rtl_UnicodeToTextContext>(1);
 }
 
 /* ----------------------------------------------------------------------- */
commit d1a74c273d10e6ab228acac2b8ebc151362a41b3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 22:17:02 2015 +0100

    Silence unhelpful -Wpotentially-evaluated-expression
    
    ...on Clang trunk towards 3.6, firing for typeid(*e) where e is a side-effecting
    expression (of polymorphic pointer type).  Simpler to disable it via #if in
    sal/config.h than to disable it in solenv/gbuild/platform/com_GCC_defs.mk with
    an additional feature test in configure.ac.
    
    Change-Id: If94692a9e06ff2659bf168b4968200aeee9ebb0a

diff --git a/include/sal/config.h b/include/sal/config.h
index edac79d..93a4898 100644
--- a/include/sal/config.h
+++ b/include/sal/config.h
@@ -86,6 +86,12 @@
 #define SAL_CONFIGFILE( name ) name "rc"
 #endif
 
+#if defined __clang__
+#if __has_warning("-Wpotentially-evaluated-expression")
+#pragma GCC diagnostic ignored "-Wpotentially-evaluated-expression"
+#endif
+#endif
+
 #endif // INCLUDED_SAL_CONFIG_H
 
 
commit 1887d4f5e98960183ebac61d4ac931915e6f8d8d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 21:43:56 2015 +0100

    Minor beautification
    
    Change-Id: I1300d1d696878c1b646decc2841f13d489d3cadc

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index d6c4636..c14436d 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -98,11 +98,11 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     }
     if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation) ) {
         if (filename.startswith(SRCDIR "/sal/") // sal has tons of weird stuff going on that I don't understand enough to fix
-           || filename.startswith(SRCDIR "/bridges")) { // I'm not messing with this code - far too dangerous
+           || filename.startswith(SRCDIR "/bridges/")) { // I'm not messing with this code - far too dangerous
             return true;
         }
     } else {
-        if (filename.startswith(SRCDIR "/include/tools/solar.h")
+        if (filename == SRCDIR "/include/tools/solar.h"
            || filename.startswith(SRCDIR "/include/cppuhelper/")
            || ((StringRef(
                     compiler.getSourceManager().getFileEntryForID(
commit 52e5b6e38a16c902fd5d0b24a1755b934eb37881
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 21:42:28 2015 +0100

    loplugin:cstylecast: Exclude only sal, not salhelper
    
    Change-Id: Ib09f2b794ce7a1e650275750a67c6c8ad5d7c808

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 7c41073..d6c4636 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -97,7 +97,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         return true;
     }
     if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation) ) {
-        if (filename.startswith(SRCDIR "/sal") // sal has tons of weird stuff going on that I don't understand enough to fix
+        if (filename.startswith(SRCDIR "/sal/") // sal has tons of weird stuff going on that I don't understand enough to fix
            || filename.startswith(SRCDIR "/bridges")) { // I'm not messing with this code - far too dangerous
             return true;
         }


More information about the Libreoffice-commits mailing list