diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-07 09:08:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-09 11:06:19 +0200 |
commit | 1501da01092d4ad4e5f3c8499fd8d1e18f87bc0c (patch) | |
tree | 38ddfacf96c179b45a9bcf8789d2f63afb29aea4 | |
parent | 7af90cc93b76996f0f338c6a1285997531281e75 (diff) |
loplugin:oncevar
Change-Id: Id295dc0db174a448ef73db9de34f2de07d47f09a
Reviewed-on: https://gerrit.libreoffice.org/57108
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | cppcanvas/source/mtfrenderer/textaction.cxx | 9 | ||||
-rw-r--r-- | extensions/source/propctrlr/browserlistbox.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/viewutil.cxx | 3 | ||||
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 6 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv1.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 98 | ||||
-rw-r--r-- | unotools/source/misc/fontcvt.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/salprn-gtk.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 3 |
14 files changed, 64 insertions, 80 deletions
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 41c2f4ac3557..c6f9c8ef0a41 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -917,8 +917,7 @@ namespace cppcanvas rRenderState ); //rhbz#1589029 non-transparent text fill background support - ::Color aEmptyColor( COL_AUTO ); - if (rTextFillColor != aEmptyColor) + if (rTextFillColor != COL_AUTO) { rendering::RenderState aLocalState( rRenderState ); aLocalState.DeviceColor = vcl::unotools::colorToDoubleSequence( @@ -1380,8 +1379,7 @@ namespace cppcanvas rRenderState ); //rhbz#1589029 non-transparent text fill background support - ::Color aEmptyColor( COL_AUTO ); - if (rTextFillColor != aEmptyColor) + if (rTextFillColor != COL_AUTO) { rendering::RenderState aLocalState(rRenderState); aLocalState.DeviceColor = vcl::unotools::colorToDoubleSequence( @@ -1438,8 +1436,7 @@ namespace cppcanvas rRenderState ); //rhbz#1589029 non-transparent text fill background support - ::Color aEmptyColor( COL_AUTO ); - if (rTextFillColor != aEmptyColor) + if (rTextFillColor != COL_AUTO) { rendering::RenderState aLocalState(rRenderState); aLocalState.DeviceColor = vcl::unotools::colorToDoubleSequence( diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index f737a075d130..bb333a15454f 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -638,7 +638,6 @@ namespace pcr sal_uInt16 OBrowserListBox::GetPropertyPos( const OUString& _rEntryName ) const { - sal_uInt16 nRet = EDITOR_LIST_ENTRY_NOTFOUND; sal_uInt16 nPos = 0; for (auto const& line : m_aLines) { @@ -649,7 +648,7 @@ namespace pcr ++nPos; } - return nRet; + return EDITOR_LIST_ENTRY_NOTFOUND; } diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 4a9759638584..60689970c0b4 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -328,14 +328,13 @@ void ScViewUtil::HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, sal bool ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont, SfxViewFrame& rFrame ) { - bool bRet = false; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() ); aSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) ); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, true)); pDlg->Execute(); - return bRet; + return false; } bool ScViewUtil::IsFullScreen( const SfxViewShell& rViewShell ) diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 171d2b345d63..c1cef8344c39 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -560,9 +560,7 @@ void SdDrawDocument::CreateDefaultCellStyles() pSheet->SetHelpId( OUString(), HID_SD_CELL_STYLE_DEFAULT ); SfxItemSet& rISet = pSheet->GetItemSet(); - Color aNullCol(COL_BLACK); - - XHatch aNullHatch(aNullCol); + XHatch aNullHatch(COL_BLACK); rISet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); rISet.Put(XFillColorItem(OUString(), Color(0x00ccccff))); diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 8f420d84395d..ef452582d980 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -637,9 +637,8 @@ bool ShutdownIcon::GetAutostart( ) { #if defined MACOSX return true; -#else +#elif defined ENABLE_QUICKSTART_APPLET bool bRet = false; -#ifdef ENABLE_QUICKSTART_APPLET OUString aShortcut( getShortcutName() ); OUString aShortcutUrl; osl::File::getFileURLFromSystemPath( aShortcut, aShortcutUrl ); @@ -650,8 +649,9 @@ bool ShutdownIcon::GetAutostart( ) f.close(); bRet = true; } -#endif // ENABLE_QUICKSTART_APPLET return bRet; +#else // ENABLE_QUICKSTART_APPLET + return false; #endif } diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index dfd73391ca65..9a1da4bed7bd 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -698,9 +698,8 @@ void MatchContext_Impl::ReadFolder( const OUString& rURL, try { uno::Reference< XDynamicResultSet > xDynResultSet; - ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS; - xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude ); + xDynResultSet = aCnt.createDynamicCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS ); uno::Reference < XAnyCompareFactory > xCompare; uno::Reference < XSortedDynamicResultSetFactory > xSRSFac = diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 666fac2edbe8..e8bb92aba1c0 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -964,7 +964,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) } if(bHasEEFeatureItems) { - OUString aMessage("SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); + const OUString aMessage("SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, VclMessageType::Info, VclButtonsType::Ok, aMessage)); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 2003ecf667b6..c9911d44809f 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2071,7 +2071,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) if(bHasEEFeatureItems) { - OUString aMessage("SdrObjEditView::SetAttributes(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); + const OUString aMessage("SdrObjEditView::SetAttributes(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, VclMessageType::Info, VclButtonsType::Ok, aMessage)); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index cb02ba7da976..167b8e50825e 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1697,9 +1697,8 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b } // build and set BaseRect (use scale) - Point aPoint = Point(); Size aSize(FRound(aScale.getX()), FRound(aScale.getY())); - tools::Rectangle aBaseRect(aPoint, aSize); + tools::Rectangle aBaseRect(Point(), aSize); SetSnapRect(aBaseRect); // flip? diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index f83f7fc9052b..b5e767c8d6f7 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -1020,7 +1020,7 @@ void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, bool bReplaceAll) if(bHasEEFeatureItems) { - OUString aMessage("SdrPaintView::SetDefaultAttr(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); + const OUString aMessage("SdrPaintView::SetDefaultAttr(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, VclMessageType::Info, VclButtonsType::Ok, aMessage)); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 6dd910fab9ee..de13c4d8b7b2 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -939,60 +939,56 @@ void paintGraphicUsingPrimitivesHelper( // -> the primitive renderer will create the needed pdf export data // -> if bitmap content, it will be cached system-dependent drawinglayer::primitive2d::Primitive2DContainer aContent(1); - bool bDone(false); - if(!bDone) + aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D( + rGraphicTransform, + rGrfObj, + rGraphicAttr); + + // RotateFlyFrame3: If ClipRegion is set at OutputDevice, we + // need to use that. Usually the renderer would be a VCL-based + // PrimitiveRenderer, but there are system-specific shortcuts that + // will *not* use the VCL-Paint of Bitmap and thus ignore this. + // Anyways, indirectly using a CLipRegion set at the target OutDev + // when using a PrimitiveRenderer is a non-valid implication. + // First tried only to use when HasPolyPolygonOrB2DPolyPolygon(), + // but there is an optimization at ClipRegion creation that detects + // a single Rectangle in a tools::PolyPolygon and forces to a simple + // RegionBand-based implementation, so cannot use it here. + if(rOutputDevice.IsClipRegion()) { - aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D( - rGraphicTransform, - rGrfObj, - rGraphicAttr); - - // RotateFlyFrame3: If ClipRegion is set at OutputDevice, we - // need to use that. Usually the renderer would be a VCL-based - // PrimitiveRenderer, but there are system-specific shortcuts that - // will *not* use the VCL-Paint of Bitmap and thus ignore this. - // Anyways, indirectly using a CLipRegion set at the target OutDev - // when using a PrimitiveRenderer is a non-valid implication. - // First tried only to use when HasPolyPolygonOrB2DPolyPolygon(), - // but there is an optimization at ClipRegion creation that detects - // a single Rectangle in a tools::PolyPolygon and forces to a simple - // RegionBand-based implementation, so cannot use it here. - if(rOutputDevice.IsClipRegion()) - { - const basegfx::B2DPolyPolygon aClip(rOutputDevice.GetClipRegion().GetAsB2DPolyPolygon()); + const basegfx::B2DPolyPolygon aClip(rOutputDevice.GetClipRegion().GetAsB2DPolyPolygon()); - if(0 != aClip.count()) - { - // tdf#114076: Expand ClipRange to next PixelBound - // Do this by going to basegfx::B2DRange, adding a - // single pixel size and using floor/ceil to go to - // full integer (as needed for pixels). Also need - // to go back to basegfx::B2DPolyPolygon for the - // creation of the needed MaskPrimitive2D. - // The general problem is that Writer is scrolling - // using blitting the unchanged parts, this forces - // this part of the scroll to pixel coordinate steps, - // while the ViewTransformation for paint nowadays has - // a sub-pixel precision. This results in an offset - // up to one pixel in radius. To solve this for now, - // we need to expand to the next outer pixel bound. - // Hopefully in the future we will someday be able to - // stay on the full available precision, but this - // will need a change in the repaint/scroll paradigm. - const basegfx::B2DRange aClipRange(aClip.getB2DRange()); - const basegfx::B2DVector aSinglePixelXY(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - const basegfx::B2DRange aExpandedClipRange( - floor(aClipRange.getMinX() - aSinglePixelXY.getX()), - floor(aClipRange.getMinY() - aSinglePixelXY.getY()), - ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), - ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); - - aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( - basegfx::B2DPolyPolygon( - basegfx::utils::createPolygonFromRect(aExpandedClipRange)), - aContent); - } + if(0 != aClip.count()) + { + // tdf#114076: Expand ClipRange to next PixelBound + // Do this by going to basegfx::B2DRange, adding a + // single pixel size and using floor/ceil to go to + // full integer (as needed for pixels). Also need + // to go back to basegfx::B2DPolyPolygon for the + // creation of the needed MaskPrimitive2D. + // The general problem is that Writer is scrolling + // using blitting the unchanged parts, this forces + // this part of the scroll to pixel coordinate steps, + // while the ViewTransformation for paint nowadays has + // a sub-pixel precision. This results in an offset + // up to one pixel in radius. To solve this for now, + // we need to expand to the next outer pixel bound. + // Hopefully in the future we will someday be able to + // stay on the full available precision, but this + // will need a change in the repaint/scroll paradigm. + const basegfx::B2DRange aClipRange(aClip.getB2DRange()); + const basegfx::B2DVector aSinglePixelXY(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0)); + const basegfx::B2DRange aExpandedClipRange( + floor(aClipRange.getMinX() - aSinglePixelXY.getX()), + floor(aClipRange.getMinY() - aSinglePixelXY.getY()), + ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), + ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); + + aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::utils::createPolygonFromRect(aExpandedClipRange)), + aContent); } } diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 616e1b23d813..4c043c072b20 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -1388,7 +1388,7 @@ FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rOrgName, if ( nFlags & FontToSubsFontFlags::IMPORT ) { - int nEntries = 2; // only StarMath+StarBats + const int nEntries = 2; // only StarMath+StarBats for( int i = 0; i < nEntries; ++i ) { const RecodeTable& r = aStarSymbolRecodeTable[i]; diff --git a/vcl/unx/gtk/salprn-gtk.cxx b/vcl/unx/gtk/salprn-gtk.cxx index 218109265332..0eba1ccee23e 100644 --- a/vcl/unx/gtk/salprn-gtk.cxx +++ b/vcl/unx/gtk/salprn-gtk.cxx @@ -224,8 +224,6 @@ GtkSalPrinter::StartJob( m_xImpl->m_pPrinter = aDialog.getPrinter(); m_xImpl->m_pSettings = aDialog.getSettings(); - bool bCollate = false; - //To-Do proper name, watch for encodings sFileName = OString("/tmp/hacking.ps"); m_xImpl->m_sSpoolFile = sFileName; @@ -234,7 +232,7 @@ GtkSalPrinter::StartJob( //To-Do, swap ps/pdf for gtk_printer_accepts_ps()/gtk_printer_accepts_pdf() ? - return impl_doJob(&aFileName, i_rJobName, i_rAppName, io_pSetupData, bCollate, io_rController); + return impl_doJob(&aFileName, i_rJobName, i_rAppName, io_pSetupData, /*bCollate*/false, io_rController); } bool diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 1e135f43c22a..cf79af44647c 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -109,10 +109,9 @@ sal_Int32 XInputStreamHelper::readSomeBytes( uno::Sequence<sal_Int8>& aData, sal nRet = nMaxBytesToRead; aData.realloc( nRet ); sal_Int8* pData = aData.getArray(); - sal_Int32 nHeaderRead = 0; if( nRet ) { - memcpy( pData + nHeaderRead, m_pBuffer + m_nPosition, nRet ); + memcpy( pData, m_pBuffer + m_nPosition, nRet ); m_nPosition += nRet; } } |