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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 21 20:49:14 UTC 2021


 vcl/source/outdev/clipping.cxx       |    1 +
 vcl/source/outdev/curvedshapes.cxx   |    4 ++++
 vcl/source/outdev/font.cxx           |    6 +++++-
 vcl/source/outdev/hatch.cxx          |    1 +
 vcl/source/outdev/line.cxx           |    2 ++
 vcl/source/outdev/nativecontrols.cxx |    4 ++++
 vcl/source/outdev/outdev.cxx         |   13 +++++++++++++
 vcl/source/outdev/outdevstate.cxx    |    3 +++
 vcl/source/outdev/pixel.cxx          |    3 +++
 vcl/source/outdev/polygon.cxx        |    5 ++++-
 vcl/source/outdev/polyline.cxx       |    4 ++++
 vcl/source/outdev/rect.cxx           |    5 +++++
 vcl/source/outdev/text.cxx           |    4 ++++
 vcl/source/outdev/textline.cxx       |    1 +
 vcl/source/outdev/transparent.cxx    |    2 ++
 vcl/source/window/window2.cxx        |    1 +
 16 files changed, 57 insertions(+), 2 deletions(-)

New commits:
commit f2c457c99ae3f0e364830a7642b4db9e7fb4c586
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Mar 21 15:27:09 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 21 21:48:29 2021 +0100

    cid#1473858 silence bogus Dereference after null check
    
    Change-Id: Iec344c1194e34538bedd5aa5bb8df3e6b233dfee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112850
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index b1c116bb31f4..0570719a15fa 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -80,6 +80,7 @@ bool OutputDevice::SelectClipRegion( const vcl::Region& rRegion, SalGraphics* pG
     {
         if( !mpGraphics && !AcquireGraphics() )
             return false;
+        assert(mpGraphics);
         pGraphics = mpGraphics;
     }
 
diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx
index ef2ccc72f756..de7379dd32bb 100644
--- a/vcl/source/outdev/curvedshapes.cxx
+++ b/vcl/source/outdev/curvedshapes.cxx
@@ -43,6 +43,7 @@ void OutputDevice::DrawEllipse( const tools::Rectangle& rRect )
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -88,6 +89,7 @@ void OutputDevice::DrawArc( const tools::Rectangle& rRect,
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -129,6 +131,7 @@ void OutputDevice::DrawPie( const tools::Rectangle& rRect,
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -177,6 +180,7 @@ void OutputDevice::DrawChord( const tools::Rectangle& rRect,
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index e145d2bebbad..45a4e514e04f 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -141,6 +141,7 @@ bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFo
 
     if( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     bool bRC = mpGraphics->AddTempDevFont( mxFontCollection.get(), rFileURL, rFontName );
     if( !bRC )
@@ -489,7 +490,7 @@ void OutputDevice::RefreshFontData( const bool bNewFontLists )
 void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
 {
     if (bNewFontLists && AcquireGraphics())
-            mpGraphics->GetDevFontList( mxFontCollection.get() );
+        mpGraphics->GetDevFontList( mxFontCollection.get() );
 }
 
 void OutputDevice::ImplUpdateFontData()
@@ -864,6 +865,7 @@ void OutputDevice::ImplInitFontList() const
 
     if( !(mpGraphics || AcquireGraphics()) )
         return;
+    assert(mpGraphics);
 
     SAL_INFO( "vcl.gdi", "OutputDevice::ImplInitFontList()" );
     mpGraphics->GetDevFontList(mxFontCollection.get());
@@ -895,6 +897,7 @@ bool OutputDevice::InitFont() const
     else if (!mbInitFont)
         return true;
 
+    assert(mpGraphics);
     mpGraphics->SetFont(mpFontInstance.get(), 0);
     mbInitFont = false;
     return true;
@@ -929,6 +932,7 @@ bool OutputDevice::ImplNewFont() const
         SAL_WARN("vcl.gdi", "OutputDevice::ImplNewFont(): no Graphics, no Font");
         return false;
     }
+    assert(mpGraphics);
 
     ImplInitFontList();
 
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 775253bbba9a..8b62fcf10375 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -87,6 +87,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
 
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index 12e32fe0553e..e7e84b58ad54 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -52,6 +52,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
 
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -97,6 +98,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index 4df8328dc921..8e0d54708391 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -137,6 +137,7 @@ bool OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPar
 
     if ( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     return mpGraphics->IsNativeControlSupported(nType, nPart);
 }
@@ -152,6 +153,7 @@ bool OutputDevice::HitTestNativeScrollbar(
 
     if ( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     Point aWinOffs( mnOutOffX, mnOutOffY );
     tools::Rectangle screenRegion( rControlRegion );
@@ -265,6 +267,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType,
     // make sure the current clip region is initialized correctly
     if ( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -299,6 +302,7 @@ bool OutputDevice::GetNativeControlRegion(  ControlType nType,
 
     if ( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     // Convert the coordinates from relative to Window-absolute, so we draw
     // in the correct place in platform code
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 6eab1dc7356d..f2618c285b36 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -219,6 +219,7 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
 {
     if (!mpGraphics && !AcquireGraphics())
         return SystemGraphicsData();
+    assert(mpGraphics);
 
     return mpGraphics->GetGraphicsData();
 }
@@ -229,6 +230,7 @@ bool OutputDevice::SupportsCairo() const
 {
     if (!mpGraphics && !AcquireGraphics())
         return false;
+    assert(mpGraphics);
 
     return mpGraphics->SupportsCairo();
 }
@@ -237,6 +239,7 @@ cairo::SurfaceSharedPtr OutputDevice::CreateSurface(const cairo::CairoSurfaceSha
 {
     if (!mpGraphics && !AcquireGraphics())
         return cairo::SurfaceSharedPtr();
+    assert(mpGraphics);
     return mpGraphics->CreateSurface(rSurface);
 }
 
@@ -244,6 +247,7 @@ cairo::SurfaceSharedPtr OutputDevice::CreateSurface(int x, int y, int width, int
 {
     if (!mpGraphics && !AcquireGraphics())
         return cairo::SurfaceSharedPtr();
+    assert(mpGraphics);
     return mpGraphics->CreateSurface(*this, x, y, width, height);
 }
 
@@ -251,6 +255,7 @@ cairo::SurfaceSharedPtr OutputDevice::CreateBitmapSurface(const BitmapSystemData
 {
     if (!mpGraphics && !AcquireGraphics())
         return cairo::SurfaceSharedPtr();
+    assert(mpGraphics);
     return mpGraphics->CreateBitmapSurface(*this, rData, rSize);
 }
 
@@ -258,6 +263,7 @@ css::uno::Any OutputDevice::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSur
 {
     if (!mpGraphics && !AcquireGraphics())
         return css::uno::Any();
+    assert(mpGraphics);
     return mpGraphics->GetNativeSurfaceHandle(rSurface, rSize);
 }
 
@@ -304,6 +310,7 @@ sal_uInt16 OutputDevice::GetBitCount() const
     // we need a graphics instance
     if ( !mpGraphics && !AcquireGraphics() )
         return 0;
+    assert(mpGraphics);
 
     return mpGraphics->GetBitCount();
 }
@@ -336,6 +343,7 @@ bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const
 {
     if( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
     const bool bHasSupport = mpGraphics->supportsOperation( eType );
     return bHasSupport;
 }
@@ -365,6 +373,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -426,6 +435,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -472,6 +482,7 @@ void OutputDevice::CopyArea( const Point& rDestPt,
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -526,6 +537,7 @@ void OutputDevice::drawOutDevDirect(const OutputDevice& rSrcDev, SalTwoRect& rPo
 
     if (!mpGraphics && !AcquireGraphics())
         return;
+    assert(mpGraphics);
 
     // #102532# Offset only has to be pseudo window offset
 
@@ -669,6 +681,7 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
         {
             if( !mpGraphics && !AcquireGraphics() )
                 return bDrawn;
+            assert(mpGraphics);
 
             if( mbInitClipRegion )
                 InitClipRegion();
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 22b6b9c63d3b..c34e9fcf95e0 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -299,7 +299,10 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp )
         mbInitLineColor = mbInitFillColor = true;
 
         if( mpGraphics || AcquireGraphics() )
+        {
+            assert(mpGraphics);
             mpGraphics->SetXORMode( (RasterOp::Invert == meRasterOp) || (RasterOp::Xor == meRasterOp), RasterOp::Invert == meRasterOp );
+        }
     }
 
     if( mpAlphaVDev )
diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx
index 0c021a722452..148c44113714 100644
--- a/vcl/source/outdev/pixel.cxx
+++ b/vcl/source/outdev/pixel.cxx
@@ -32,6 +32,7 @@ Color OutputDevice::GetPixel(const Point& rPoint) const
 
     if (mpGraphics || AcquireGraphics())
     {
+        assert(mpGraphics);
         if (mbInitClipRegion)
             const_cast<OutputDevice*>(this)->InitClipRegion();
 
@@ -65,6 +66,7 @@ void OutputDevice::DrawPixel( const Point& rPt )
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -97,6 +99,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 5f48bacfa6a5..e59ec9630690 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -47,7 +47,8 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
 
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
-            return;
+        return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -167,6 +168,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly )
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -275,6 +277,7 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index b48adfa5cace..5da5ccdd8033 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -45,6 +45,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -159,6 +160,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
@@ -251,6 +253,7 @@ void OutputDevice::drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLi
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -339,6 +342,7 @@ bool OutputDevice::DrawPolyLineDirectInternal(
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return false;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index b768025f57cb..ead68bdfd2f7 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -67,6 +67,7 @@ void OutputDevice::DrawRect( const tools::Rectangle& rRect )
 
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -108,6 +109,7 @@ void OutputDevice::DrawRect( const tools::Rectangle& rRect,
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -159,6 +161,7 @@ void OutputDevice::Invert( const tools::Rectangle& rRect, InvertFlags nFlags )
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -190,6 +193,7 @@ void OutputDevice::Invert( const tools::Polygon& rPoly, InvertFlags nFlags )
     // we need a graphics
     if ( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
@@ -244,6 +248,7 @@ void OutputDevice::DrawGrid( const tools::Rectangle& rRect, const Size& rDist, D
 
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1b8d021d0fe1..c0a47d0cecd8 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -932,6 +932,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
         return;
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
     if( mbInitClipRegion )
         InitClipRegion();
     if( mbOutputClipped )
@@ -1727,6 +1728,7 @@ void OutputDevice::AddTextRectActions( const tools::Rectangle& rRect,
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
     if( mbInitClipRegion )
         InitClipRegion();
 
@@ -1770,6 +1772,7 @@ void OutputDevice::DrawText( const tools::Rectangle& rRect, const OUString& rOri
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
     if( mbInitClipRegion )
         InitClipRegion();
     if( mbOutputClipped && !bDecomposeTextRectAction )
@@ -2073,6 +2076,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
     if( mbInitClipRegion )
         InitClipRegion();
     if ( mbOutputClipped )
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 9189f4e9c8e5..046952cf403a 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -946,6 +946,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if ( mbInitClipRegion )
         InitClipRegion();
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 3d37b8fe47ba..4d983c37f72c 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -125,6 +125,7 @@ void OutputDevice::DrawTransparent(
     // we need a graphics
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     if( mbInitClipRegion )
         InitClipRegion();
@@ -580,6 +581,7 @@ void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
     // get the device graphics as drawing target
     if( !mpGraphics && !AcquireGraphics() )
         return;
+    assert(mpGraphics);
 
     // try hard to draw it directly, because the emulation layers are slower
     bDrawn = DrawTransparentNatively( rPolyPoly, nTransparencePercent );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 2fd523a18b45..63cfca1b4291 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -177,6 +177,7 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag
             if ( !pOutDev->AcquireGraphics() )
                 return;
         }
+        assert(mpGraphics);
 
         if ( mbInitClipRegion )
             InitClipRegion();


More information about the Libreoffice-commits mailing list