summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-06 11:05:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-08 07:20:29 +0100
commit5c23459245f566831383934dd64d19e002bfcfcb (patch)
tree27d92a2167c6245c3be7844e2bbe7b6e624f0f9e /sw
parent4a7771ffa8d98d08dffbba90fd42d1ab75e056fe (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 'sw')
-rw-r--r--sw/source/core/crsr/paminit.cxx4
-rw-r--r--sw/source/core/doc/docredln.cxx2
-rw-r--r--sw/source/core/layout/flylay.cxx2
-rw-r--r--sw/source/core/ole/ndole.cxx2
-rw-r--r--sw/source/core/text/txtpaint.cxx8
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx30
6 files changed, 8 insertions, 40 deletions
diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx
index c5d5124fc9f3..bbc975acf565 100644
--- a/sw/source/core/crsr/paminit.cxx
+++ b/sw/source/core/crsr/paminit.cxx
@@ -21,7 +21,7 @@
#include <pamtyp.hxx>
#include <cshtyp.hxx>
-static SwMoveFnCollection aFwrd = {
+static const SwMoveFnCollection aFwrd = {
/* fnNd */ &GoNext,
/* fnNds */ &GoNextNds,
/* fnDoc */ &GoEndDoc,
@@ -32,7 +32,7 @@ static SwMoveFnCollection aFwrd = {
/* fnSection */ &SwNodes::GoStartOfSection
};
-static SwMoveFnCollection aBwrd = {
+static const SwMoveFnCollection aBwrd = {
/* fnNd */ &GoPrevious,
/* fnNds */ &GoPreviousNds,
/* fnDoc */ &GoStartDoc,
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index eeba3836e663..986b48e48de2 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -68,7 +68,7 @@ using namespace com::sun::star;
void sw_DebugRedline( const SwDoc* pDoc )
{
- static SwRedlineTable::size_type nWatch = 0;
+ static SwRedlineTable::size_type nWatch = 0; // loplugin:constvars:ignore
const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n )
{
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 680632625da7..c0b0219f0167 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -301,7 +301,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
bool SwFlyFreeFrame::supportsAutoContour() const
{
- static bool bOverrideHandleContourToAlwaysOff(true);
+ static bool bOverrideHandleContourToAlwaysOff(true); // loplugin:constvars:ignore
// RotateFlyFrameFix: For LO6.0 we need to deactivate the AutoContour feature again, it is simply
// not clear how/if to use and save/load it in ODF. This has to be discussed.
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index a41bcc7497b5..f0a89b4095c3 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -1055,7 +1055,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & SwOLEObj::tryToGetChartC
if(aXModel.is())
{
// disabled for now, need to check deeper
- static bool bAsynchronousLoadingAllowed = false;
+ static bool bAsynchronousLoadingAllowed = false; // loplugin:constvars:ignore
if(bSynchron ||
!bAsynchronousLoadingAllowed)
diff --git a/sw/source/core/text/txtpaint.cxx b/sw/source/core/text/txtpaint.cxx
index 4a1c24a22afd..5609a17b2895 100644
--- a/sw/source/core/text/txtpaint.cxx
+++ b/sw/source/core/text/txtpaint.cxx
@@ -94,14 +94,6 @@ void SwSaveClip::ChgClip_( const SwRect &rRect, const SwTextFrame* pFrame,
const vcl::Region aClipRegion( aRect );
pOut->SetClipRegion( aClipRegion );
}
-#ifdef DBG_UTIL
- static bool bDbg = false;
- if( bDbg )
- {
- DbgBackColor aDbg( pOut, bDbg );
- pOut->DrawRect( aRect );
- }
-#endif
}
bChg = true;
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 7eb2341dc3f7..d8dd205ea660 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -953,13 +953,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY );
Reference <XNameAccess> xCols = xColsSupp->getColumns();
- static bool isSelectionBookmarks = true; // TODO is this always true here?
- uno::Reference<sdbcx::XRowLocate> xRowLocate;
- if (isSelectionBookmarks)
- {
- xRowLocate.set(xResultSet, uno::UNO_QUERY);
- assert(xRowLocate.is());
- }
+ uno::Reference<sdbcx::XRowLocate> xRowLocate(xResultSet, uno::UNO_QUERY_THROW);
do{ // middle checked loop!!
if( bAsTable ) // fill in data as table
@@ -1038,16 +1032,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
{
if(pSelection)
{
- if (isSelectionBookmarks)
- {
- bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
- }
- else
- {
- sal_Int32 nPos = 0;
- pSelection[i] >>= nPos;
- bBreak = !xResultSet->absolute(nPos);
- }
+ bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
}
else if(!i)
bBreak = !xResultSet->first();
@@ -1237,16 +1222,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
{
if(pSelection)
{
- if (isSelectionBookmarks)
- {
- bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
- }
- else
- {
- sal_Int32 nPos = 0;
- pSelection[i] >>= nPos;
- bBreak = !xResultSet->absolute(nPos);
- }
+ bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
}
else if(!i)
bBreak = !xResultSet->first();