include/vcl/outdev.hxx | 2 sc/qa/unit/ucalc.cxx | 8 +- svx/source/tbxctrls/tbcontrl.cxx | 8 -- sw/source/core/unocore/unochart.cxx | 4 - vcl/source/outdev/bitmap.cxx | 26 +++--- vcl/source/outdev/curvedshapes.cxx | 8 +- vcl/source/outdev/gradient.cxx | 22 +++-- vcl/source/outdev/hatch.cxx | 6 - vcl/source/outdev/line.cxx | 4 - vcl/source/outdev/mask.cxx | 8 +- vcl/source/outdev/nativecontrols.cxx | 2 vcl/source/outdev/outdevstate.cxx | 99 ++++++++++---------------- vcl/source/outdev/pixel.cxx | 8 +- vcl/source/outdev/polygon.cxx | 8 +- vcl/source/outdev/polyline.cxx | 8 +- vcl/source/outdev/rect.cxx | 8 +- vcl/source/outdev/text.cxx | 10 +- vcl/source/outdev/textline.cxx | 4 - vcl/source/outdev/transparent.cxx | 10 +- vcl/source/outdev/wallpaper.cxx | 10 +- vcl/source/window/splitwin.cxx | 22 +++++ vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 13 +-- 22 files changed, 151 insertions(+), 147 deletions(-)
New commits: commit 047857759995d4eccec5451db339ebd1f53fd285 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 31 20:59:24 2015 +0100 coverity#1302688 Resource leak Change-Id: I78ed5df0d18da9374092c8d2d4fca43cba0f8a88 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index c16dfb8..7eb21f5 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5931,10 +5931,10 @@ void testDataBarLengthImpl(ScDocument* pDoc, ScDataBarLengthData* pData, const S for (size_t i = 0; pData[i].nLength != -200; ++i) { - ScDataBarInfo* pInfo = pDatabar->GetDataBarInfo(ScAddress(nCol, i, 0)); - CPPUNIT_ASSERT(pInfo); - ASSERT_DOUBLES_EQUAL(pData[i].nLength, pInfo->mnLength); - ASSERT_DOUBLES_EQUAL(nZeroPos, pInfo->mnZero); + std::unique_ptr<ScDataBarInfo> xInfo(pDatabar->GetDataBarInfo(ScAddress(nCol, i, 0))); + CPPUNIT_ASSERT(xInfo.get()); + ASSERT_DOUBLES_EQUAL(pData[i].nLength, xInfo->mnLength); + ASSERT_DOUBLES_EQUAL(nZeroPos, xInfo->mnZero); } delete pFormat; } commit 52052e5b03a605f261ab041233a5c6b3c8a19143 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 31 20:55:11 2015 +0100 coverity#1302690 Uninitialized pointer field Change-Id: Idea6c8a988cdff9fd7c99fb0d37935f391ba0da2 diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 1f30392..e1c6498 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -39,36 +39,40 @@ #include "salgdi.hxx" #include "sallayout.hxx" -OutDevState::OutDevState() : - mnFlags(PushFlags::NONE) +OutDevState::OutDevState() + : mpMapMode(0) + , mbMapActive(false) + , mpClipRegion(0) + , mpLineColor(0) + , mpFillColor(0) + , mpFont(0) + , mpTextColor(0) + , mpTextFillColor(0) + , mpTextLineColor(0) + , mpOverlineColor(0) + , mpRefPoint(0) + , meTextAlign(ALIGN_TOP) + , meRasterOp(ROP_OVERPAINT) + , mnTextLayoutMode(TEXT_LAYOUT_DEFAULT) + , meTextLanguage(0) + , mnFlags(PushFlags::NONE) { } OutDevState::~OutDevState() { - if ( mnFlags & PushFlags::LINECOLOR ) - delete mpLineColor; - if ( mnFlags & PushFlags::FILLCOLOR ) - delete mpFillColor; - if ( mnFlags & PushFlags::FONT ) - delete mpFont; - if ( mnFlags & PushFlags::TEXTCOLOR ) - delete mpTextColor; - if ( mnFlags & PushFlags::TEXTFILLCOLOR ) - delete mpTextFillColor; - if ( mnFlags & PushFlags::TEXTLINECOLOR ) - delete mpTextLineColor; - if ( mnFlags & PushFlags::OVERLINECOLOR ) - delete mpOverlineColor; - if ( mnFlags & PushFlags::MAPMODE ) - delete mpMapMode; - if ( mnFlags & PushFlags::CLIPREGION ) - delete mpClipRegion; - if ( mnFlags & PushFlags::REFPOINT ) - delete mpRefPoint; + delete mpLineColor; + delete mpFillColor; + delete mpFont; + delete mpTextColor; + delete mpTextFillColor; + delete mpTextLineColor; + delete mpOverlineColor; + delete mpMapMode; + delete mpClipRegion; + delete mpRefPoint; } - void OutputDevice::Push( PushFlags nFlags ) { @@ -79,44 +83,29 @@ void OutputDevice::Push( PushFlags nFlags ) pState->mnFlags = nFlags; - if ( nFlags & PushFlags::LINECOLOR ) + if (nFlags & PushFlags::LINECOLOR && mbLineColor) { - if ( mbLineColor ) - pState->mpLineColor = new Color( maLineColor ); - else - pState->mpLineColor = NULL; + pState->mpLineColor = new Color( maLineColor ); } - if ( nFlags & PushFlags::FILLCOLOR ) + if (nFlags & PushFlags::FILLCOLOR && mbFillColor) { - if ( mbFillColor ) - pState->mpFillColor = new Color( maFillColor ); - else - pState->mpFillColor = NULL; + pState->mpFillColor = new Color( maFillColor ); } if ( nFlags & PushFlags::FONT ) pState->mpFont = new vcl::Font( maFont ); if ( nFlags & PushFlags::TEXTCOLOR ) pState->mpTextColor = new Color( GetTextColor() ); - if ( nFlags & PushFlags::TEXTFILLCOLOR ) + if (nFlags & PushFlags::TEXTFILLCOLOR && IsTextFillColor()) { - if ( IsTextFillColor() ) - pState->mpTextFillColor = new Color( GetTextFillColor() ); - else - pState->mpTextFillColor = NULL; + pState->mpTextFillColor = new Color( GetTextFillColor() ); } - if ( nFlags & PushFlags::TEXTLINECOLOR ) + if (nFlags & PushFlags::TEXTLINECOLOR && IsTextLineColor()) { - if ( IsTextLineColor() ) - pState->mpTextLineColor = new Color( GetTextLineColor() ); - else - pState->mpTextLineColor = NULL; + pState->mpTextLineColor = new Color( GetTextLineColor() ); } - if ( nFlags & PushFlags::OVERLINECOLOR ) + if (nFlags & PushFlags::OVERLINECOLOR && IsOverlineColor()) { - if ( IsOverlineColor() ) - pState->mpOverlineColor = new Color( GetOverlineColor() ); - else - pState->mpOverlineColor = NULL; + pState->mpOverlineColor = new Color( GetOverlineColor() ); } if ( nFlags & PushFlags::TEXTALIGN ) pState->meTextAlign = GetTextAlign(); @@ -131,19 +120,13 @@ void OutputDevice::Push( PushFlags nFlags ) pState->mpMapMode = new MapMode( maMapMode ); pState->mbMapActive = mbMap; } - if ( nFlags & PushFlags::CLIPREGION ) + if (nFlags & PushFlags::CLIPREGION && mbClipRegion) { - if ( mbClipRegion ) - pState->mpClipRegion = new vcl::Region( maRegion ); - else - pState->mpClipRegion = NULL; + pState->mpClipRegion = new vcl::Region( maRegion ); } - if ( nFlags & PushFlags::REFPOINT ) + if (nFlags & PushFlags::REFPOINT && mbRefPoint) { - if ( mbRefPoint ) - pState->mpRefPoint = new Point( maRefPoint ); - else - pState->mpRefPoint = NULL; + pState->mpRefPoint = new Point( maRefPoint ); } mpOutDevStateStack->push_back( pState ); commit 5f1a267c9a97059cbc8e77a0ed9b011dfe891df7 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 31 20:40:13 2015 +0100 coverity#1302689 Uninitialized scalar field Change-Id: I1515ab21370e70564f266cbaa21769d28716d85c diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index fa18d3d..69c14f8 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -98,8 +98,26 @@ public: bool mbCalcPix; }; -ImplSplitItem::ImplSplitItem() : - mpSet( NULL ) +ImplSplitItem::ImplSplitItem() + : mnSize(0) + , mnPixSize(0) + , mnLeft(0) + , mnTop(0) + , mnWidth(0) + , mnHeight(0) + , mnSplitPos(0) + , mnSplitSize(0) + , mnOldSplitPos(0) + , mnOldSplitSize(0) + , mnOldWidth(0) + , mnOldHeight(0) + , mpSet(0) + , mnId(0) + , mnBits(SplitWindowItemFlags::NONE) + , mbFixed(false) + , mbSubSize(false) + , mnMinSize(-1) + , mnMaxSize(-1) { } commit 7fd544da2ef2f472a3aaa825c3cacfe28961e9db Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 31 20:32:18 2015 +0100 coverity#1302664 Unchecked dynamic_cast and coverity#1302661 Unchecked dynamic_cast Change-Id: I29735d3627c9d600465c02482002134cd196e098 diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 161ee5f..33a0b27 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -2192,7 +2192,7 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData() // keep original cursor and make copy of it that gets handed // over to the SwXCellRange object which takes ownership and // thus will destroy the copy later. - SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get())->Clone(), *pTableFormat, aDesc ); + SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc ); aRange.GetDataSequence( 0, &aRes, 0 ); } } @@ -2221,7 +2221,7 @@ uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData() // keep original cursor and make copy of it that gets handed // over to the SwXCellRange object which takes ownership and // thus will destroy the copy later. - SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get())->Clone(), *pTableFormat, aDesc ); + SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc ); // get numerical values and make an effort to return the // numerical value for text formatted cells commit 7e5d98c427cdcd10566b8f5a7a35c0561ec82d72 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 31 20:28:06 2015 +0100 masses of coverity FORWARD_NULL warnings from copied assert Change-Id: I8f698bbcf4d53a4477cc0ee0c3f2c7f08e521f8a diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index b00f2d3..1754058 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -613,6 +613,8 @@ protected: SAL_DLLPRIVATE void drawOutDevDirect ( const OutputDevice* pSrcDev, SalTwoRect& rPosAry ); + SAL_DLLPRIVATE void assert_if_double_buffered_window() const; + private: // not implemented; to detect misuses of DrawOutDev(...OutputDevice&); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index f59e441..718cef9 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -36,7 +36,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); const Size aSizePix( rBitmap.GetSizePixel() ); DrawBitmap( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, MetaActionType::BMP ); @@ -44,7 +44,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); DrawBitmap( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, MetaActionType::BMPSCALE ); } @@ -54,7 +54,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap, const MetaActionType nAction ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -236,7 +236,7 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const BitmapEx& rBitmapEx ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -255,7 +255,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const BitmapEx& rBitmapEx ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -275,7 +275,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const BitmapEx& rBitmapEx, const MetaActionType nAction ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -492,7 +492,7 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize const Point& rSrcPtPixel, const Size& rSrcSizePixel, BitmapEx& rBitmapEx ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if (rBitmapEx.IsAlpha()) { @@ -622,7 +622,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); Point aOutPt(LogicToPixel(rDestPt)); Size aOutSz(LogicToPixel(rDestSize)); @@ -918,7 +918,7 @@ private: void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, const AlphaMask& rAlpha, Rectangle aDstRect, Rectangle aBmpRect, Size& aOutSize, Point& aOutPoint) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); VirtualDevice* pOldVDev = mpAlphaVDev; @@ -1036,7 +1036,7 @@ bool OutputDevice::DrawTransformBitmapExDirect( const basegfx::B2DHomMatrix& aFullTransform, const BitmapEx& rBitmapEx) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); bool bDone = false; @@ -1157,7 +1157,7 @@ void OutputDevice::DrawTransformedBitmapEx( const basegfx::B2DHomMatrix& rTransformation, const BitmapEx& rBitmapEx) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -1330,7 +1330,7 @@ namespace void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); DrawImage( rPos, Size(), rImage, nStyle ); } @@ -1338,7 +1338,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageF void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, const Image& rImage, DrawImageFlags nStyle ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0; diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx index db8f7d6..0190a4d 100644 --- a/vcl/source/outdev/curvedshapes.cxx +++ b/vcl/source/outdev/curvedshapes.cxx @@ -25,7 +25,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaEllipseAction( rRect ) ); @@ -73,7 +73,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect ) void OutputDevice::DrawArc( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) ); @@ -117,7 +117,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect, void OutputDevice::DrawPie( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) ); @@ -168,7 +168,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect, void OutputDevice::DrawChord( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) ); diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index ca0e949..41c2455 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -32,7 +32,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, const Gradient& rGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // Convert rectangle to a tools::PolyPolygon by first converting to a Polygon Polygon aPolygon ( rRect ); @@ -44,7 +44,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mnDrawMode & DrawModeFlags::NoGradient ) return; // nothing to draw! @@ -172,7 +172,7 @@ void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, cons void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( !mpMetaFile ) return; @@ -260,7 +260,7 @@ void OutputDevice::DrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClixPolyPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // get BoundRect of rotated rectangle Rectangle aRect; @@ -438,11 +438,19 @@ void OutputDevice::DrawLinearGradient( const Rectangle& rRect, } } +void OutputDevice::assert_if_double_buffered_window() const +{ +#ifndef NDEBUG + const vcl::Window *pWindow = dynamic_cast<const vcl::Window*>(this); + assert(!pWindow || !pWindow->SupportsDoubleBuffering()); +#endif +} + void OutputDevice::DrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClixPolyPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // Determine if we output via Polygon or PolyPolygon // For all rasteroperations other then Overpaint always use PolyPolygon, @@ -608,7 +616,7 @@ void OutputDevice::DrawComplexGradient( const Rectangle& rRect, void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect, const Gradient& rGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // get BoundRect of rotated rectangle Rectangle aRect; @@ -788,7 +796,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect, void OutputDevice::DrawComplexGradientToMetafile( const Rectangle& rRect, const Gradient& rGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // Determine if we output via Polygon or PolyPolygon // For all rasteroperations other then Overpaint always use PolyPolygon, diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index a33fae3..1ccdcc7 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -44,7 +44,7 @@ extern "C" int SAL_CALL HatchCmpFnc( const void* p1, const void* p2 ) void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); Hatch aHatch( rHatch ); @@ -139,7 +139,7 @@ void OutputDevice::AddHatchActions( const tools::PolyPolygon& rPolyPoly, const H void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if(rPolyPoly.Count()) { @@ -322,7 +322,7 @@ void OutputDevice::CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); double fX, fY; long nAdd, nPCounter = 0; diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx index f37280f..f8eba4a 100644 --- a/vcl/source/outdev/line.cxx +++ b/vcl/source/outdev/line.cxx @@ -35,7 +35,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( rLineInfo.IsDefault() ) { @@ -89,7 +89,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaLineAction( rStartPt, rEndPt ) ); diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx index 29737a1..facbb9a 100644 --- a/vcl/source/outdev/mask.cxx +++ b/vcl/source/outdev/mask.cxx @@ -34,7 +34,7 @@ extern const sal_uLong nVCLLut[ 256 ]; void OutputDevice::DrawMask( const Point& rDestPt, const Bitmap& rBitmap, const Color& rMaskColor ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); const Size aSizePix( rBitmap.GetSizePixel() ); DrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, MetaActionType::MASK ); @@ -43,7 +43,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Color& rMaskColor ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, MetaActionType::MASKSCALE ); } @@ -53,7 +53,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Color& rMaskColor, const MetaActionType nAction ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( ImplIsRecordLayout() ) return; @@ -108,7 +108,7 @@ void OutputDevice::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor, const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); const ImpBitmap* pImpBmp = rMask.ImplGetImpBitmap(); if ( pImpBmp ) diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index 6e9279c..0711021 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -273,7 +273,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType, const ImplControlValue& aValue, const OUString& aCaption ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( !EnableNativeWidget( *this ) ) return false; diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx index c4f6528..8310a72 100644 --- a/vcl/source/outdev/pixel.cxx +++ b/vcl/source/outdev/pixel.cxx @@ -57,7 +57,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const void OutputDevice::DrawPixel( const Point& rPt ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaPointAction( rPt ) ); @@ -87,7 +87,7 @@ void OutputDevice::DrawPixel( const Point& rPt ) void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); Color aColor = ImplDrawModeToColor( rColor ); @@ -116,7 +116,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( !pColors ) { @@ -163,7 +163,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( rColor != COL_TRANSPARENT && ! ImplIsRecordLayout() ) { diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index c25025c..9b703a0 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -33,7 +33,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) ); @@ -131,7 +131,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ) void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // AW: Do NOT paint empty polygons if(rB2DPolygon.count()) @@ -143,7 +143,7 @@ void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon) void OutputDevice::DrawPolygon( const Polygon& rPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) ); @@ -239,7 +239,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyPolygonAction( tools::PolyPolygon( rB2DPolyPoly ) ) ); diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index 236d2cd..3be82cf 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -31,7 +31,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyLineAction( rPoly ) ); @@ -101,7 +101,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( rLineInfo.IsDefault() ) { @@ -129,7 +129,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( mpMetaFile ) { @@ -275,7 +275,7 @@ bool OutputDevice::DrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon, css::drawing::LineCap eLineCap, bool bBypassAACheck ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // AW: Do NOT paint empty PolyPolygons if(!rB2DPolygon.count()) diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 4492352..a9ebc0a 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -29,7 +29,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRectAction( rRect ) ); @@ -68,7 +68,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) void OutputDevice::DrawRect( const Rectangle& rRect, sal_uLong nHorzRound, sal_uLong nVertRound ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) ); @@ -128,7 +128,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect, void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); const sal_uInt32 nMaxX(rPos.X() + rSize.Width()); const sal_uInt32 nMaxY(rPos.Y() + rSize.Height()); @@ -154,7 +154,7 @@ void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt3 void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); aDstRect.Intersection( rRect ); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 15e59bf..639151d 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -838,7 +838,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr, MetricVector* pVector, OUString* pDisplayText ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if(nLen == 0x0FFFF) { @@ -961,7 +961,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr, const long* pDXAry, sal_Int32 nIndex, sal_Int32 nLen, SalLayoutFlags flags ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if(nLen == 0x0FFFF) { @@ -1166,7 +1166,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if(nIndex < 0 || nIndex == 0x0FFFF || nLen == 0x0FFFF) { @@ -1840,7 +1840,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, D MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout* _pTextLayout ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if (mpOutDevData->mpRecordLayout) { @@ -2148,7 +2148,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen, DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if(nLen == 0x0FFFF) { diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 8e55eca..551e556 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -941,7 +941,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, FontUnderline eOverline, bool bUnderlineAbove ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline, eOverline ) ); @@ -985,7 +985,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) return; diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 7d4e027..6827fc3 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -218,7 +218,7 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // AW: Do NOT paint empty PolyPolygons if(!rB2DPolyPoly.count()) @@ -282,7 +282,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // short circuit if the polygon border is invisible too if( !mbLineColor ) @@ -298,7 +298,7 @@ void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly ) bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); bool bDrawn = false; @@ -607,7 +607,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // short circuit for drawing an opaque polygon if( (nTransparencePercent < 1) || (mnDrawMode & DrawModeFlags::NoTransparency) ) @@ -659,7 +659,7 @@ void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly, void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize, const Gradient& rTransparenceGradient ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); const Color aBlack( COL_BLACK ); diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx index c9f3c4c..367ecea 100644 --- a/vcl/source/outdev/wallpaper.cxx +++ b/vcl/source/outdev/wallpaper.cxx @@ -26,7 +26,7 @@ void OutputDevice::DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if ( mpMetaFile ) mpMetaFile->AddAction( new MetaWallpaperAction( rRect, rWallpaper ) ); @@ -54,7 +54,7 @@ void OutputDevice::DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); if( rWallpaper.IsBitmap() ) DrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); @@ -68,7 +68,7 @@ void OutputDevice::DrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); // draw wallpaper without border Color aOldLineColor = GetLineColor(); @@ -107,7 +107,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); BitmapEx aBmpEx; const BitmapEx* pCached = rWallpaper.ImplGetImpWallpaper()->ImplGetCachedBitmap(); @@ -345,7 +345,7 @@ void OutputDevice::DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ) { - assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering()); + assert_if_double_buffered_window(); Rectangle aBound; GDIMetaFile* pOldMetaFile = mpMetaFile; commit a08f0aa2857f4a5342cedf2038488fc98fb716fb Author: Caolán McNamara <caol...@redhat.com> Date: Sat May 30 21:22:21 2015 +0100 coverity#1302609 Division or modulo by zero Change-Id: Ia578a948b776c15372d3940b350f20048bb6124c diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 4741096..5fc515f 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -606,9 +606,9 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice* pDevice, const OUString& rStyleName, bool bIsNotSelected) { + unsigned int nId = rRect.GetHeight() != 0 ? (rRect.getY() / rRect.GetHeight()) : MAX_STYLES_ENTRIES; if (nItem == 0 || nItem == GetEntryCount() - 1) { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) m_pButtons[nId]->Hide(); } @@ -735,14 +735,12 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp // handle the push-button if (bIsNotSelected) { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); - if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) + if (nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) m_pButtons[nId]->Hide(); } else { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); - if(nId < MAX_STYLES_ENTRIES) + if (nId < MAX_STYLES_ENTRIES) { if(m_pButtons[nId] == nullptr) { commit 1abbba1d0980786b4bded6961a12da494cb93806 Author: Caolán McNamara <caol...@redhat.com> Date: Sat May 30 21:20:14 2015 +0100 coverity#1302608 gtk3 Logically dead code Change-Id: I7e727bc71a5fb02d89eb6b4fb35cda26bcfa617a diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index a782bf8..3b06626 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -87,11 +87,10 @@ enum { RENDER_SCROLLBAR = 9, RENDER_SPINBUTTON = 10, RENDER_COMBOBOX = 11, - RENDER_EXTENSION = 12, - RENDER_EXPANDER = 13, - RENDER_ICON = 14, - RENDER_PROGRESS = 15, - RENDER_FOCUS = 16, + RENDER_EXPANDER = 12, + RENDER_ICON = 13, + RENDER_PROGRESS = 14, + RENDER_FOCUS = 15, }; static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ) @@ -1089,9 +1088,6 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co gtk_render_frame(context, cr, nX, nY, nWidth, nHeight); } break; - case RENDER_EXTENSION: - gtk_render_extension(context, cr, nX, nY, nWidth, nHeight, GTK_POS_BOTTOM); - break; case RENDER_CHECK: case RENDER_RADIO: PaintCheckOrRadio(context, cr, rControlRegion, nType); commit 0b25823eced797ab039f26fe51df73c7aa3e1130 Author: Caolán McNamara <caol...@redhat.com> Date: Sat May 30 21:18:20 2015 +0100 coverity#1302691 gtk3 Unused value Change-Id: Iabd10ef2c77dc389c6afdba1d38064e54bf3198d diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 9cdf850..a782bf8 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1648,7 +1648,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break; case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break; } - aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "font name BEFORE system match: \"%s\"\n", aFamily.getStr() );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits