diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-06 11:05:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-08 07:20:29 +0100 |
commit | 5c23459245f566831383934dd64d19e002bfcfcb (patch) | |
tree | 27d92a2167c6245c3be7844e2bbe7b6e624f0f9e /vcl | |
parent | 4a7771ffa8d98d08dffbba90fd42d1ab75e056fe (diff) |
new loplugin constvars
detect static variables that can be made const.
Thanks to mike kaganski for suggesting this.
Here I introduce a new plugin feature - using markers
in nearby comments to disable the plugin for specific
vars.
Some of this stuff was old debugging code. I removed the stuff
that was older than 5 years.
Change-Id: I6ec7742a7fdadf28fd128b592fcdf6da8257585c
Reviewed-on: https://gerrit.libreoffice.org/68807
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/svm/svmtest.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/png/pngread.cxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/wmadaptor.cxx | 15 |
5 files changed, 14 insertions, 24 deletions
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 55bdfc365c73..c8c6847b6ae0 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -172,7 +172,7 @@ static GDIMetaFile writeAndRead(GDIMetaFile& rMetaFile, const OUString& sUrl) // Turn on to output the SVM bitstreams to files (using the input URL) // to inspect the content or to create a reference file, otherwise leave // disabled for normal test runs. - static bool bOutputToFile = false; + static const bool bOutputToFile = false; if (bOutputToFile) { diff --git a/vcl/source/filter/png/pngread.cxx b/vcl/source/filter/png/pngread.cxx index a3f449b4f8ab..58acc12c8d60 100644 --- a/vcl/source/filter/png/pngread.cxx +++ b/vcl/source/filter/png/pngread.cxx @@ -1408,9 +1408,6 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else // no palette => truecolor { - // #i122985# Added fast-lane implementations using CopyScanline with direct supported mem formats - static bool bCkeckDirectScanline(true); - if( mbAlphaChannel ) { // has RGB + alpha @@ -1419,7 +1416,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) // ScanlineFormat::N32BitTcRgba // only use DirectScanline when we have no preview shifting stuff and accesses to content and alpha const bool bDoDirectScanline( - bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift && mpMaskAcc); + !nXStart && 1 == nXAdd && !mnPreviewShift && mpMaskAcc); const bool bCustomColorTable(mpColorTable != mpDefaultColorTable); if(bDoDirectScanline) @@ -1566,7 +1563,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) // ScanlineFormat::N24BitTcRgb // only use DirectScanline when we have no preview shifting stuff and access to content const bool bDoDirectScanline( - bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift); + !nXStart && 1 == nXAdd && !mnPreviewShift); const bool bCustomColorTable(mpColorTable != mpDefaultColorTable); if(bDoDirectScanline && !mpScanline) diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 4c6588460082..aad555dd5e02 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1179,10 +1179,9 @@ void OutputDevice::DrawTransformedBitmapEx( const bool bMirroredX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirroredY(basegfx::fTools::less(aScale.getY(), 0.0)); - static bool bForceToOwnTransformer(false); const bool bMetafile = mpMetaFile != nullptr; - if(!bForceToOwnTransformer && !bRotated && !bSheared && !bMirroredX && !bMirroredY) + if(!bRotated && !bSheared && !bMirroredX && !bMirroredY) { // with no rotation, shear or mirroring it can be mapped to DrawBitmapEx // do *not* execute the mirroring here, it's done in the fallback @@ -1215,7 +1214,7 @@ void OutputDevice::DrawTransformedBitmapEx( const basegfx::B2DHomMatrix aFullTransform(GetViewTransformation() * rTransformation); const bool bTryDirectPaint(!bInvert && !bBitmapChangedColor && !bMetafile ); - if(!bForceToOwnTransformer && bTryDirectPaint) + if(bTryDirectPaint) { bDone = DrawTransformBitmapExDirect(aFullTransform, rBitmapEx); } @@ -1223,7 +1222,7 @@ void OutputDevice::DrawTransformedBitmapEx( if(!bDone) { // take the fallback when no rotate and shear, but mirror (else we would have done this above) - if(!bForceToOwnTransformer && !bRotated && !bSheared) + if(!bRotated && !bSheared) { // with no rotation or shear it can be mapped to DrawBitmapEx // do *not* execute the mirroring here, it's done in the fallback @@ -1258,7 +1257,6 @@ void OutputDevice::DrawTransformedBitmapEx( if(!aVisibleRange.isEmpty()) { - static bool bDoSmoothAtAll(true); BitmapEx aTransformed(rBitmapEx); // #122923# when the result needs an alpha channel due to being rotated or sheared @@ -1279,7 +1277,7 @@ void OutputDevice::DrawTransformedBitmapEx( aFullTransform, aVisibleRange, fMaximumArea, - bDoSmoothAtAll); + /*bDoSmoothAtAll*/true); basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0); // get logic object target range diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 6f30a230b43a..33f70be753c9 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -222,8 +222,8 @@ void VclContainer::Command(const CommandEvent& rCEvt) if (bVisibleChildren) { - static bool bAddButtonsToMenu(true); - static bool bAddScreenshotButtonToMenu(true); + static bool bAddButtonsToMenu(true); // loplugin:constvars:ignore + static bool bAddScreenshotButtonToMenu(true); // loplugin:constvars:ignore if (bAddButtonsToMenu || bAddScreenshotButtonToMenu) { diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 8ebacc422016..5cdc914a5bff 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -976,18 +976,13 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const aWMLocale = pLang ? pLang : "C"; } - static bool bTrustXmb = true; - char* pT = const_cast<char*>(aTitle.getStr()); XTextProperty aProp = { nullptr, None, 0, 0 }; - if( bTrustXmb ) - { - XmbTextListToTextProperty( m_pDisplay, - &pT, - 1, - XStdICCTextStyle, - &aProp ); - } + XmbTextListToTextProperty( m_pDisplay, + &pT, + 1, + XStdICCTextStyle, + &aProp ); unsigned char const * pData = aProp.nitems ? aProp.value : reinterpret_cast<unsigned char const *>(aTitle.getStr()); Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; |