[Libreoffice-commits] core.git: 4 commits - bridges/source compilerplugins/clang sal/osl vcl/unx

Michael Stahl mstahl at redhat.com
Fri Oct 30 15:12:05 UTC 2015


 bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx |   12 +-
 bridges/source/cpp_uno/gcc3_linux_intel/except.cxx            |    4 
 compilerplugins/clang/salbool.cxx                             |    4 
 sal/osl/unx/profile.cxx                                       |    8 -
 vcl/unx/generic/window/screensaverinhibitor.cxx               |   46 ++++++++--
 5 files changed, 52 insertions(+), 22 deletions(-)

New commits:
commit 7ef698a47be841b9a5922a3a6251edd51ba57b25
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 13:32:00 2015 +0100

    compilerplugins: fix warning message copy-pasta
    
    Change-Id: I3b845ae46b0d0b14be90382727cc02a838a0392e

diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index 933f80f..fd7dc93 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -296,7 +296,7 @@ bool SalBool::VisitCXXStaticCastExpr(CXXStaticCastExpr * expr) {
     if (isSalBool(expr->getType())) {
         report(
             DiagnosticsEngine::Warning,
-            "CStyleCastExpr, suspicious cast from %0 to %1",
+            "CXXStaticCastExpr, suspicious cast from %0 to %1",
             expr->getLocStart())
             << expr->getSubExpr()->IgnoreParenImpCasts()->getType()
             << expr->getType() << expr->getSourceRange();
@@ -311,7 +311,7 @@ bool SalBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
     if (isSalBool(expr->getType())) {
         report(
             DiagnosticsEngine::Warning,
-            "CStyleCastExpr, suspicious cast from %0 to %1",
+            "CXXFunctionalCastExpr, suspicious cast from %0 to %1",
             expr->getLocStart())
             << expr->getSubExpr()->IgnoreParenImpCasts()->getType()
             << expr->getType() << expr->getSourceRange();
commit 0b6a0d4c3184794711e25d06b42a4be171c139a6
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 13:28:47 2015 +0100

    bridges: loplugin:cstylecast
    
    Change-Id: I8613f1f7f2155aa972fa4f841ebfcf6e07e45821

diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
index af20806..94d94d8 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
@@ -106,26 +106,26 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
             break;
         case typelib_TypeClass_HYPER:
         case typelib_TypeClass_UNSIGNED_HYPER:
-            ((long*)pRegisterReturn)[1] = edx;
+            static_cast<long*>(pRegisterReturn)[1] = edx;
         case typelib_TypeClass_LONG:
         case typelib_TypeClass_UNSIGNED_LONG:
         case typelib_TypeClass_CHAR:
         case typelib_TypeClass_ENUM:
-            ((long*)pRegisterReturn)[0] = eax;
+            static_cast<long*>(pRegisterReturn)[0] = eax;
             break;
         case typelib_TypeClass_SHORT:
         case typelib_TypeClass_UNSIGNED_SHORT:
-            *(unsigned short*)pRegisterReturn = eax;
+            *static_cast<unsigned short*>(pRegisterReturn) = eax;
             break;
         case typelib_TypeClass_BOOLEAN:
         case typelib_TypeClass_BYTE:
-            *(unsigned char*)pRegisterReturn = eax;
+            *static_cast<unsigned char*>(pRegisterReturn) = eax;
             break;
         case typelib_TypeClass_FLOAT:
-            asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) );
+            asm ( "fstps %0" : : "m"(*static_cast<char *>(pRegisterReturn)) );
             break;
         case typelib_TypeClass_DOUBLE:
-            asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) );
+            asm ( "fstpl %0\n\t" : : "m"(*static_cast<char *>(pRegisterReturn)) );
             break;
         default:
         {
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index f26e4ea..61ae307 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -168,7 +168,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
                 {
                     // ensure availability of base
                     type_info * base_rtti = getRTTI(
-                        (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
+                        pTypeDescr->pBaseTypeDescription);
                     rtti = new __si_class_type_info(
                         strdup( rttiName ), static_cast<__class_type_info *>(base_rtti) );
                 }
@@ -257,7 +257,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
 #endif
         }
     }
-    rtti = (type_info *)s_rtti->getRTTI( reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
+    rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr));
     TYPELIB_DANGER_RELEASE( pTypeDescr );
     assert(rtti && "### no rtti for throwing exception!");
     if (! rtti)
commit f76c3a1fb5ebc6684be6da3f32b80bd750688f81
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 13:26:30 2015 +0100

    sal: loplugin:salbool
    
    Change-Id: I8fa83df0bf5f6064dcdd3f830769d7626152c7ab

diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 7ea5afb..38ccda3 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -721,7 +721,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile,
 
     if ( pTmpProfile == 0 )
     {
-        return sal_False;
+        return 0;
 
     }
 
@@ -733,7 +733,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile,
 
         pthread_mutex_unlock(&(pTmpProfile->m_AccessLock));
 
-        return sal_False;
+        return 0;
     }
 
     pProfile = acquireProfile(Profile, false);
@@ -805,7 +805,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile,
 
     if ( pTmpProfile == 0 )
     {
-        return sal_False;
+        return 0;
     }
 
     pthread_mutex_lock(&(pTmpProfile->m_AccessLock));
@@ -815,7 +815,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile,
         SAL_WARN_IF(!pTmpProfile->m_bIsValid, "sal.osl", "!pTmpProfile->m_bIsValid"); 
         pthread_mutex_unlock(&(pTmpProfile->m_AccessLock));
 
-        return sal_False;
+        return 0;
     }
 
     pProfile = acquireProfile(Profile, false);
commit d5d1815451adab8648c846b563e1b4962894e919
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 13:05:54 2015 +0100

    vcl: fix the --disable-dbus build
    
    Change-Id: I4562b029172e2dcef7d13bf2c1aa37410d18e25a

diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx
index 5346ac4..2d515f3 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -39,9 +39,9 @@
 #include <sal/log.hxx>
 
 void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
-                                    bool bIsX11, const boost::optional<guint> xid, boost::optional<Display*> pDisplay )
+                                    bool bIsX11, const boost::optional<unsigned int> xid, boost::optional<Display*> pDisplay )
 {
-    const gchar* appname = SalGenericSystem::getFrameClassName();
+    const char* appname = SalGenericSystem::getFrameClassName();
     const OString aReason = OUStringToOString( sReason, RTL_TEXTENCODING_UTF8 );
 
     inhibitFDO( bInhibit, appname, aReason.getStr() );
@@ -64,13 +64,13 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
     }
 }
 
+#ifdef ENABLE_DBUS
 void dbusInhibit( bool bInhibit,
                   const gchar* service, const gchar* path, const gchar* interface,
                   std::function<bool( DBusGProxy*, guint&, GError*& )> fInhibit,
                   std::function<bool( DBusGProxy*, const guint, GError*& )> fUnInhibit,
                   boost::optional<guint>& rCookie )
 {
-#ifdef ENABLE_DBUS
     if ( ( !bInhibit && ( rCookie == boost::none ) ) ||
          ( bInhibit && ( rCookie != boost::none ) ) )
     {
@@ -130,11 +130,12 @@ void dbusInhibit( bool bInhibit,
 
     g_object_unref( G_OBJECT( proxy ) );
 
-#endif // ENABLE_DBUS
 }
+#endif // ENABLE_DBUS
 
-void ScreenSaverInhibitor::inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason )
+void ScreenSaverInhibitor::inhibitFDO( bool bInhibit, const char* appname, const char* reason )
 {
+#ifdef ENABLE_DBUS
     dbusInhibit( bInhibit,
                  FDO_DBUS_SERVICE, FDO_DBUS_PATH, FDO_DBUS_INTERFACE,
                  [appname, reason] ( DBusGProxy *proxy, guint& nCookie, GError*& error ) -> bool {
@@ -154,10 +155,17 @@ void ScreenSaverInhibitor::inhibitFDO( bool bInhibit, const gchar* appname, cons
                                                G_TYPE_INVALID );
                  },
                  mnFDOCookie );
+#else
+    (void) this;
+    (void) bInhibit;
+    (void) appname;
+    (void) reason;
+#endif // ENABLE_DBUS
 }
 
-void ScreenSaverInhibitor::inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* reason )
+void ScreenSaverInhibitor::inhibitFDOPM( bool bInhibit, const char* appname, const char* reason )
 {
+#ifdef ENABLE_DBUS
     dbusInhibit( bInhibit,
                  FDOPM_DBUS_SERVICE, FDOPM_DBUS_PATH, FDOPM_DBUS_INTERFACE,
                  [appname, reason] ( DBusGProxy *proxy, guint& nCookie, GError*& error ) -> bool {
@@ -177,10 +185,17 @@ void ScreenSaverInhibitor::inhibitFDOPM( bool bInhibit, const gchar* appname, co
                                                G_TYPE_INVALID );
                  },
                  mnFDOPMCookie );
+#else
+    (void) this;
+    (void) bInhibit;
+    (void) appname;
+    (void) reason;
+#endif // ENABLE_DBUS
 }
 
-void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid )
+void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid )
 {
+#ifdef ENABLE_DBUS
     dbusInhibit( bInhibit,
                  GSM_DBUS_SERVICE, GSM_DBUS_PATH, GSM_DBUS_INTERFACE,
                  [appname, reason, xid] ( DBusGProxy *proxy, guint& nCookie, GError*& error ) -> bool {
@@ -202,10 +217,18 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const gchar* appname, cons
                                                G_TYPE_INVALID );
                  },
                  mnGSMCookie );
+#else
+    (void) this;
+    (void) bInhibit;
+    (void) appname;
+    (void) reason;
+    (void) xid;
+#endif // ENABLE_DBUS
 }
 
-void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid )
+void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid )
 {
+#ifdef ENABLE_DBUS
     dbusInhibit( bInhibit,
                  MSM_DBUS_SERVICE, MSM_DBUS_PATH, MSM_DBUS_INTERFACE,
                  [appname, reason, xid] ( DBusGProxy *proxy, guint& nCookie, GError*& error ) -> bool {
@@ -227,6 +250,13 @@ void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const gchar* appname, cons
                                                G_TYPE_INVALID );
                  },
                  mnMSMCookie );
+#else
+    (void) this;
+    (void) bInhibit;
+    (void) appname;
+    (void) reason;
+    (void) xid;
+#endif // ENABLE_DBUS
 }
 
 /**


More information about the Libreoffice-commits mailing list