[Libreoffice-commits] core.git: vcl/osx vcl/quartz

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 14:39:31 UTC 2018


 vcl/osx/salinst.cxx        |    2 +-
 vcl/osx/salprn.cxx         |    2 +-
 vcl/quartz/salgdiutils.cxx |    4 ++--
 vcl/quartz/salvd.cxx       |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit c3c88d6bbe4109fcf1a6d53e947faec775c96e42
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Oct 4 10:04:12 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Oct 4 16:39:06 2018 +0200

    loplugin:redundantcast
    
    "static_cast from 'CGContextRef' (aka 'CGContext *') prvalue to 'CGContextRef'
    (aka 'CGContext *') prvalue is redundant" with
    --with-macosx-version-min-required=10.14 at least.  (Not exactly sure why this
    warning only starts to appear now.  Presumably something changed in the system
    headers.  Lets see whether older baseline builds are happy with the dropped
    casts, too.)
    
    Change-Id: Id52d1891e5e33f7c37d095440339980b4000ca4e
    Reviewed-on: https://gerrit.libreoffice.org/61353
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 426aa2972ec6..46a52bd9b213 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -953,7 +953,7 @@ NSImage* CreateNSImage( const Image& rImage )
     {
         [pImage lockFocusFlipped:YES];
         NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
-        CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
+        CGContextRef rCGContext = [pContext CGContext];
 
         const CGRect aDstRect = { {0, 0}, { static_cast<CGFloat>(aSize.Width()), static_cast<CGFloat>(aSize.Height()) } };
         CGContextDrawImage( rCGContext, aDstRect, xImage );
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 7fdd072e836f..34f8cbb60e26 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -547,7 +547,7 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_b
     if( i_bNewJobData && i_pSetupData )
         SetPrinterData( i_pSetupData );
 
-    CGContextRef rContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+    CGContextRef rContext = [[NSGraphicsContext currentContext] CGContext];
 
     SetupPrinterGraphics( rContext );
 
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 7e0562b0fed2..22a2ad041f65 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -118,7 +118,7 @@ bool AquaSalGraphics::CheckContext()
         {
             const CGSize aLayerSize = { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) };
             NSGraphicsContext* pNSGContext = [NSGraphicsContext graphicsContextWithWindow: mpFrame->getNSWindow()];
-            CGContextRef xCGContext = static_cast<CGContextRef>([pNSGContext graphicsPort]);
+            CGContextRef xCGContext = [pNSGContext CGContext];
             mxLayer = CGLayerCreateWithContext( xCGContext, aLayerSize, nullptr );
             SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << xCGContext << "," << aLayerSize << ",NULL) = " << mxLayer );
             if( mxLayer )
@@ -192,7 +192,7 @@ void AquaSalGraphics::UpdateWindow( NSRect& )
     NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
     if( (mxLayer != nullptr) && (pContext != nullptr) )
     {
-        CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
+        CGContextRef rCGContext = [pContext CGContext];
         SAL_INFO( "vcl.cg", "[[NSGraphicsContext currentContext] graphicsPort] = " << rCGContext );
 
         CGMutablePathRef rClip = mpFrame->getClipPath();
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 4f7c41acc38e..7b3c68155ffe 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -270,7 +270,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
                 NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pNSWindow];
                 if( pNSContext )
                 {
-                    xCGContext = static_cast<CGContextRef>([pNSContext graphicsPort]);
+                    xCGContext = [pNSContext CGContext];
                 }
             }
             else


More information about the Libreoffice-commits mailing list