[Libreoffice-commits] core.git: canvas/source compilerplugins/clang connectivity/source embedserv/source vcl/win winaccessibility/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 19 20:02:13 UTC 2020


 canvas/source/directx/dx_canvasbitmap.cxx                 |    6 +++---
 compilerplugins/clang/test/cstylecast.cxx                 |    2 +-
 connectivity/source/drivers/ado/Aolevariant.cxx           |    6 +++---
 embedserv/source/embed/docholder.cxx                      |    6 +++---
 vcl/win/gdi/salbmp.cxx                                    |    2 +-
 winaccessibility/source/service/AccObjectManagerAgent.cxx |    2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit c4cec8647faf130111d67302e75998ddff4c0792
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 19 15:11:45 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Oct 19 22:01:31 2020 +0200

    clang-cl: Adapt Windows-specific code to extended loplugin:cstylecast
    
    ...after 1ebeacb20ad0165e399629fcfd7795ad0da3edf8 "Extend loplugin:cstylecast to
    certain function-style casts"
    
    Change-Id: I99bd383f5b3bee861d442d2e1be6ecd356b78315
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104523
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx
index b02ff2796813..adc4b741a4c3 100644
--- a/canvas/source/directx/dx_canvasbitmap.cxx
+++ b/canvas/source/directx/dx_canvasbitmap.cxx
@@ -98,7 +98,7 @@ namespace dxcanvas
                     mpBitmap->getBitmap()->GetHBITMAP(Gdiplus::Color(), &aHBmp );
 
                     uno::Sequence< uno::Any > args(1);
-                    args[0] <<= sal_Int64(aHBmp);
+                    args[0] <<= reinterpret_cast<sal_Int64>(aHBmp);
 
                     aRes <<= args;
                 }
@@ -154,7 +154,7 @@ namespace dxcanvas
                     pGDIPlusBitmap->UnlockBits( &aBmpData );
 
                     uno::Sequence< uno::Any > args(1);
-                    args[0] <<= sal_Int64(hBmpBitmap);
+                    args[0] <<= reinterpret_cast<sal_Int64>(hBmpBitmap);
 
                     aRes <<= args;
                 }
@@ -231,7 +231,7 @@ namespace dxcanvas
                                reinterpret_cast<PBITMAPINFO>(&aDIB), DIB_RGB_COLORS );
 
                     uno::Sequence< uno::Any > args(1);
-                    args[0] <<= sal_Int64(hBmpBitmap);
+                    args[0] <<= reinterpret_cast<sal_Int64>(hBmpBitmap);
 
                     aRes <<= args;
                 }
diff --git a/compilerplugins/clang/test/cstylecast.cxx b/compilerplugins/clang/test/cstylecast.cxx
index 916896d54db9..8d212700ae32 100644
--- a/compilerplugins/clang/test/cstylecast.cxx
+++ b/compilerplugins/clang/test/cstylecast.cxx
@@ -23,7 +23,7 @@ using T = unsigned int;
 
 void FunctionalCast(void* p)
 {
-    // expected-error at +1 {{Function-style cast from 'void *' to 'sal_IntPtr' (aka 'long') (performs: reinterpret_cast) (PointerToIntegral) [loplugin:cstylecast]}}
+    // expected-error-re at +1 {{Function-style cast from 'void *' to 'sal_IntPtr' (aka '{{.+}}') (performs: reinterpret_cast) (PointerToIntegral) [loplugin:cstylecast]}}
     auto n = sal_IntPtr(p);
     (void(n)); // no warning expected (outer parens to disambiguate expr vs. decl)
 }
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index f90a4ecc6ef2..ae7c3f30572c 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -80,7 +80,7 @@ OLEString& OLEString::operator=(const BSTR& _rSrc)
 }
 OUString OLEString::asOUString() const
 {
-    return (m_sStr != nullptr) ? OUString(o3tl::toU(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : OUString();
+    return (m_sStr != nullptr) ? OUString(o3tl::toU(m_sStr),::SysStringLen(m_sStr)) : OUString();
 }
 BSTR OLEString::asBSTR() const
 {
@@ -378,7 +378,7 @@ void OLEVariant::set(double n)
 OUString OLEVariant::getString() const
 {
     if (V_VT(this) == VT_BSTR)
-        return OUString(o3tl::toU(LPCOLESTR(V_BSTR(this))));
+        return OUString(o3tl::toU(V_BSTR(this)));
 
     if(isNull())
         return OUString();
@@ -387,7 +387,7 @@ OUString OLEVariant::getString() const
 
     varDest.ChangeType(VT_BSTR, this);
 
-    return OUString(o3tl::toU(LPCOLESTR(V_BSTR(&varDest))));
+    return OUString(o3tl::toU(V_BSTR(&varDest)));
 }
 
 
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index cb6f19b68e7e..ecaeede416b7 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -284,7 +284,7 @@ HRESULT DocumentHolder::InPlaceActivate(
 
             xWin.set(
                 xToolkit->createSystemChild(
-                    uno::Any(sal_Int64(hWndxWinParent)),
+                    uno::Any(reinterpret_cast<sal_Int64>(hWndxWinParent)),
                     aProcessIdent,
                     lang::SystemDependent::SYSTEM_WIN32),
                 uno::UNO_QUERY);
@@ -367,7 +367,7 @@ HRESULT DocumentHolder::InPlaceActivate(
                     aProcessIdent,lang::SystemDependent::SYSTEM_WIN32);
                 sal_Int64 tmp;
                 if( aAny >>= tmp )
-                    m_nMenuHandle = HMENU(tmp);
+                    m_nMenuHandle = reinterpret_cast<HMENU>(tmp);
                 m_xLayoutManager->hideElement(
                     "private:resource/menubar/menubar" );
             }
@@ -1205,7 +1205,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin
 
         xWin.set(
             xToolkit->createSystemChild(
-                uno::Any(sal_Int64(hWnd)),
+                uno::Any(reinterpret_cast<sal_Int64>(hWnd)),
                 aProcessIdent,
                 lang::SystemDependent::SYSTEM_WIN32),
             uno::UNO_QUERY);
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 33f450a07d16..43b322358b41 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -669,7 +669,7 @@ bool WinSalBitmap::Create( const css::uno::Reference< css::rendering::XBitmapCan
             sal_Int64 aHBmp64;
 
             if( args[0] >>= aHBmp64 ) {
-                return Create( HBITMAP(aHBmp64), false, false );
+                return Create( reinterpret_cast<HANDLE>(aHBmp64), false, false );
             }
         }
     }
diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx b/winaccessibility/source/service/AccObjectManagerAgent.cxx
index abc75f71c778..b3290075fb6b 100644
--- a/winaccessibility/source/service/AccObjectManagerAgent.cxx
+++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx
@@ -177,7 +177,7 @@ bool
 AccObjectManagerAgent::InsertChildrenAccObj(XAccessible* pXAcc, sal_Int64 pWnd)
 {
     if( pWinManager )
-        return pWinManager->InsertChildrenAccObj( pXAcc, HWND(reinterpret_cast<void*>(pWnd)) );
+        return pWinManager->InsertChildrenAccObj( pXAcc, reinterpret_cast<HWND>(pWnd) );
 
     return false;
 }


More information about the Libreoffice-commits mailing list