[Libreoffice-commits] core.git: svtools/source svx/source vcl/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Mon Jan 9 23:04:11 UTC 2017


 svtools/source/graphic/grfmgr2.cxx  |    6 +++---
 svtools/source/misc/transfer.cxx    |    2 +-
 svx/source/xml/xmlgrhlp.cxx         |    6 +++---
 vcl/source/filter/graphicfilter.cxx |    2 +-
 vcl/source/gdi/print2.cxx           |    4 ++--
 vcl/source/outdev/transparent.cxx   |   24 ++++++++++++------------
 6 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 5adab0927483d039037b0f93894627e41a2c72f2
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Mon Jan 2 21:57:23 2017 +0100

    replace C-style casts with const_cast
    
    Change-Id: Ica6522b4bfe2aa4517469e89cabe5d4d057cb6b7
    Reviewed-on: https://gerrit.libreoffice.org/32657
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 408bee5..e2608bb 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1622,9 +1622,9 @@ void GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, const Size&
     pOut->Push( PushFlags::CLIPREGION );
     pOut->IntersectClipRegion( Rectangle( aOutPt, aOutSz ) );
 
-    ( (GDIMetaFile&) rMtf ).WindStart();
-    ( (GDIMetaFile&) rMtf ).Play( pOut, aOutPt, aOutSz );
-    ( (GDIMetaFile&) rMtf ).WindStart();
+    const_cast<GDIMetaFile&>(rMtf).WindStart();
+    const_cast<GDIMetaFile&>(rMtf).Play( pOut, aOutPt, aOutSz );
+    const_cast<GDIMetaFile&>(rMtf).WindStart();
 
     pOut->Pop();
 }
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index ade1bc0..08195e6 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -690,7 +690,7 @@ bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf, const DataFlav
     {
         SvMemoryStream aMemStm( 65535, 65535 );
 
-        ( (GDIMetaFile&) rMtf ).Write( aMemStm );
+        const_cast<GDIMetaFile&>(rMtf).Write( aMemStm );
         maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
     }
 
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index e9271fb..0212dc9 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -134,7 +134,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
                 {
                     pStm->SetVersion( SOFFICE_FILEFORMAT_8 );
                     pStm->SetCompressMode( SvStreamCompressFlags::ZBITMAP );
-                    ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm );
+                    const_cast<GDIMetaFile&>( aGraphic.GetGDIMetaFile() ).Write( *pStm );
                     bRet = ( pStm->GetError() == 0 );
                 }
             }
@@ -581,7 +581,7 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName,
                     pStream->SetCompressMode( SvStreamCompressFlags::ZBITMAP );
 
                     // SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
-                    GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
+                    GDIMetaFile& rMtf(const_cast<GDIMetaFile&>( aGraphic.GetGDIMetaFile() ));
                     const MetaCommentAction* pComment = ImplCheckForEPS( rMtf );
                     if ( pComment )
                     {
@@ -706,7 +706,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
                     else if( aGrfObject.GetType() == GraphicType::GdiMetafile )
                     {
                         // SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
-                        GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
+                        GDIMetaFile& rMtf(const_cast<GDIMetaFile&>( aGraphic.GetGDIMetaFile() ));
                         if ( ImplCheckForEPS( rMtf ) )
                             aExtension = ".eps";
                         else
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 40c0e1c..50506fe 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -2058,7 +2058,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                                 SvMemoryStream aMemStm( 65535, 65535 );
 
                                 // #i119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
-                                ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm );
+                                const_cast<GDIMetaFile&>( aGraphic.GetGDIMetaFile() ).Write( aMemStm );
 
                                 xActiveDataSource->setOutputStream( css::uno::Reference< css::io::XOutputStream >(
                                     xStmIf, css::uno::UNO_QUERY ) );
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 5ee886c..0e909a0 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -667,9 +667,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
     if( ! bReduceTransparency || bTransparencyAutoMode )
     {
         // watch for transparent drawing actions
-        for( pCurrAct = ( (GDIMetaFile&) rInMtf ).FirstAction();
+        for( pCurrAct = const_cast<GDIMetaFile&>(rInMtf).FirstAction();
              pCurrAct && !bTransparent;
-             pCurrAct = ( (GDIMetaFile&) rInMtf ).NextAction() )
+             pCurrAct = const_cast<GDIMetaFile&>(rInMtf).NextAction() )
         {
             // #i10613# determine if the action is transparency capable
 
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index e1d8bc5..a473343 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -679,9 +679,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
     if( ( rTransparenceGradient.GetStartColor() == aBlack && rTransparenceGradient.GetEndColor() == aBlack ) ||
         ( mnDrawMode & ( DrawModeFlags::NoTransparency ) ) )
     {
-        ( (GDIMetaFile&) rMtf ).WindStart();
-        ( (GDIMetaFile&) rMtf ).Play( this, rPos, rSize );
-        ( (GDIMetaFile&) rMtf ).WindStart();
+        const_cast<GDIMetaFile&>(rMtf).WindStart();
+        const_cast<GDIMetaFile&>(rMtf).Play( this, rPos, rSize );
+        const_cast<GDIMetaFile&>(rMtf).WindStart();
     }
     else
     {
@@ -734,9 +734,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
 
                     // draw MetaFile to buffer
                     xVDev->EnableMapMode(bBufferMapModeEnabled);
-                    ((GDIMetaFile&)rMtf).WindStart();
-                    ((GDIMetaFile&)rMtf).Play(xVDev.get(), rPos, rSize);
-                    ((GDIMetaFile&)rMtf).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).Play(xVDev.get(), rPos, rSize);
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
 
                     // get content bitmap from buffer
                     xVDev->EnableMapMode(false);
@@ -771,9 +771,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
                     const bool bVDevOldMap = xVDev->IsMapModeEnabled();
 
                     // create paint bitmap
-                    ( (GDIMetaFile&) rMtf ).WindStart();
-                    ( (GDIMetaFile&) rMtf ).Play( xVDev.get(), rPos, rSize );
-                    ( (GDIMetaFile&) rMtf ).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).Play( xVDev.get(), rPos, rSize );
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
                     xVDev->EnableMapMode( false );
                     aPaint = xVDev->GetBitmap( Point(), xVDev->GetOutputSizePixel() );
                     xVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here!
@@ -784,9 +784,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
                     xVDev->DrawRect( Rectangle( xVDev->PixelToLogic( Point() ), xVDev->GetOutputSize() ) );
                     xVDev->SetDrawMode( DrawModeFlags::WhiteLine | DrawModeFlags::WhiteFill | DrawModeFlags::WhiteText |
                                         DrawModeFlags::WhiteBitmap | DrawModeFlags::WhiteGradient );
-                    ( (GDIMetaFile&) rMtf ).WindStart();
-                    ( (GDIMetaFile&) rMtf ).Play( xVDev.get(), rPos, rSize );
-                    ( (GDIMetaFile&) rMtf ).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
+                    const_cast<GDIMetaFile&>(rMtf).Play( xVDev.get(), rPos, rSize );
+                    const_cast<GDIMetaFile&>(rMtf).WindStart();
                     xVDev->EnableMapMode( false );
                     aMask = xVDev->GetBitmap( Point(), xVDev->GetOutputSizePixel() );
                     xVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here!


More information about the Libreoffice-commits mailing list