summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/dlged/dlgedobj.cxx4
-rw-r--r--basic/source/classes/sbunoobj.cxx3
-rw-r--r--basic/source/comp/exprgen.cxx2
-rw-r--r--chart2/source/view/charttypes/NetChart.cxx5
-rw-r--r--chart2/source/view/main/ChartView.cxx2
-rw-r--r--compilerplugins/clang/test/writeonlyvars.cxx147
-rw-r--r--compilerplugins/clang/writeonlyvars.cxx1148
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx35
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx5
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx3
-rw-r--r--connectivity/source/drivers/mork/MorkParser.cxx3
-rw-r--r--cui/source/dialogs/hldocntp.cxx6
-rw-r--r--cui/source/options/treeopt.cxx5
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx2
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx5
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx2
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx4
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx2
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx2
-rw-r--r--filter/source/flash/swffilter.cxx6
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.cxx2
-rw-r--r--filter/source/odfflatxml/OdfFlatXml.cxx3
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx9
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx5
-rw-r--r--framework/source/uielement/menubarmanager.cxx3
-rw-r--r--framework/source/uielement/statusbarmanager.cxx5
-rw-r--r--framework/source/uielement/toolbarmerger.cxx2
-rw-r--r--framework/source/uielement/uicommanddescription.cxx3
-rw-r--r--l10ntools/source/idxdict/idxdict.cxx2
-rw-r--r--oox/source/export/shapes.cxx6
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx3
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/ui/unoobj/PivotTableDataProvider.cxx15
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx2
-rw-r--r--sc/source/ui/view/gridwin5.cxx3
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx2
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx2
-rw-r--r--sdext/source/presenter/PresenterSlidePreview.cxx15
-rw-r--r--sdext/source/presenter/PresenterTextView.cxx9
-rw-r--r--sdext/source/presenter/PresenterToolBar.cxx3
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx5
-rw-r--r--sfx2/source/dialog/backingwindow.cxx12
-rw-r--r--sfx2/source/notebookbar/NotebookbarTabControl.cxx3
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--soltools/mkdepend/main.c7
-rw-r--r--soltools/mkdepend/pr.c4
-rw-r--r--stoc/source/inspect/introspection.cxx4
-rw-r--r--svtools/source/contnr/fileview.cxx8
-rw-r--r--svtools/source/contnr/imivctl1.cxx6
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx14
-rw-r--r--svx/source/form/fmshimp.cxx2
-rw-r--r--sw/source/core/unocore/unochart.cxx5
-rw-r--r--sw/source/filter/docx/swdocxreader.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx3
-rw-r--r--sw/source/filter/xml/xmltexte.cxx10
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx8
-rw-r--r--sw/source/uibase/app/apphdl.cxx3
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx5
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx2
-rw-r--r--toolkit/source/awt/vclxwindow.cxx6
-rw-r--r--ucb/source/ucp/file/filtask.cxx4
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/source/window/printdlg.cxx8
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx8
-rw-r--r--vcl/unx/gtk/salprn-gtk.cxx6
-rw-r--r--writerfilter/source/dmapper/FontTable.cxx8
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.cxx4
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx3
70 files changed, 1335 insertions, 313 deletions
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 29aabd49a6d2..8d2b42010fdd 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -236,11 +236,9 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformControlToSdrCoordinates: no form property set!" );
if ( !xPSetForm.is() )
return false;
- sal_Int32 nFormX = 0, nFormY = 0, nFormWidth, nFormHeight;
+ sal_Int32 nFormX = 0, nFormY = 0;
xPSetForm->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormX;
xPSetForm->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormY;
- xPSetForm->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidth;
- xPSetForm->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeight;
Size aFormPos( nFormX, nFormY );
// convert logic units to pixel
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 0449b2e4f40c..553c6be7360d 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4630,12 +4630,9 @@ void SbUnoStructRefObject::initMemberCache()
{
if ( mbMemberCacheInit )
return;
- sal_Int32 nAll = 0;
typelib_TypeDescription * pTD = nullptr;
maMemberInfo.getType().getDescription(&pTD);
typelib_CompoundTypeDescription * pCompTypeDescr = reinterpret_cast<typelib_CompoundTypeDescription *>(pTD);
- for ( ; pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
- nAll += pCompTypeDescr->nMembers;
for ( pCompTypeDescr = reinterpret_cast<typelib_CompoundTypeDescription *>(pTD); pCompTypeDescr;
pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
{
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index e3615f91f4e7..4cf496b2f966 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -209,7 +209,6 @@ void SbiExprList::Gen(SbiCodeGen& rGen)
{
rGen.Gen( SbiOpcode::ARGC_ );
// Type adjustment at DECLARE
- sal_uInt16 nCount = 1;
for( auto& pExpr: aData )
{
@@ -249,7 +248,6 @@ void SbiExprList::Gen(SbiCodeGen& rGen)
{
rGen.Gen( SbiOpcode::ARGV_ );
}
- nCount++;
}
}
}
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index 56e46bf1d791..c2d1026f5d9f 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -346,8 +346,6 @@ void NetChart::createShapes()
//better performance for big data
std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
m_bPointsWereSkipped = false;
- sal_Int32 nSkippedPoints = 0;
- sal_Int32 nCreatedPoints = 0;
bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
@@ -487,7 +485,6 @@ void NetChart::createShapes()
aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
, aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
{
- ++nSkippedPoints;
m_bPointsWereSkipped = true;
continue;
}
@@ -535,8 +532,6 @@ void NetChart::createShapes()
uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
{
- nCreatedPoints++;
-
//create data point
drawing::Direction3D aSymbolSize(0,0,0);
if (bCreateSymbol) // implies pSymbolProperties
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a989552ffe90..b2e493e8d46e 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -952,7 +952,6 @@ drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
{
drawing::Direction3D aPreferredAspectRatio(1.0,1.0,1.0);
- sal_Int32 nPlotterCount=0;
//get a list of all preferred aspect ratios and combine them
//first with special demands wins (less or equal zero <-> arbitrary)
double fx, fy, fz;
@@ -985,7 +984,6 @@ drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
if( fx>0 && fy>0 && fz>0 )
break;
- ++nPlotterCount;
}
aPreferredAspectRatio = drawing::Direction3D(fx, fy, fz);
return aPreferredAspectRatio;
diff --git a/compilerplugins/clang/test/writeonlyvars.cxx b/compilerplugins/clang/test/writeonlyvars.cxx
new file mode 100644
index 000000000000..719ad26ea870
--- /dev/null
+++ b/compilerplugins/clang/test/writeonlyvars.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vector>
+#include <ostream>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace Bar
+{
+void test()
+{
+ // check that we DON'T see reads here
+ // expected-error@+1 {{write m_bar3 [loplugin:writeonlyvars]}}
+ int* m_bar3;
+ // expected-error@+1 {{write m_bar3b [loplugin:writeonlyvars]}}
+ int* m_bar3b;
+ m_bar3 = nullptr;
+ m_bar3b = m_bar3 = nullptr;
+
+ // check that we see reads of field when passed to a function pointer
+ // check that we see read of a field that is a function pointer
+ // expected-error@+2 {{write m_bar4 [loplugin:writeonlyvars]}}
+ // expected-error@+1 {{read m_bar4 [loplugin:writeonlyvars]}}
+ int m_bar4;
+ // expected-error@+1 {{read m_barfunctionpointer [loplugin:writeonlyvars]}}
+ void (*m_barfunctionpointer)(int&) = nullptr;
+ m_barfunctionpointer(m_bar4);
+
+ // check that we see reads of a field when used in variable init
+ // expected-error@+1 {{read m_bar5 [loplugin:writeonlyvars]}}
+ int m_bar5 = 1;
+ int x = m_bar5;
+ (void)x;
+
+ // check that we see reads of a field when used in ranged-for
+ // expected-error@+1 {{read m_bar6 [loplugin:writeonlyvars]}}
+ std::vector<int> m_bar6;
+ for (auto i : m_bar6)
+ {
+ (void)i;
+ }
+
+ // check that we see writes of array fields
+ // expected-error@+1 {{write m_bar7 [loplugin:writeonlyvars]}}
+ int m_bar7[5];
+ m_bar7[3] = 1;
+
+ // check that we see reads when a field is used in an array expression
+ // expected-error@+1 {{read m_bar8 [loplugin:writeonlyvars]}}
+ int m_bar8 = 1;
+ // expected-error@+1 {{read tmp [loplugin:writeonlyvars]}}
+ char tmp[5];
+ auto x2 = tmp[m_bar8];
+ (void)x2;
+
+ // check that we don't see reads when calling operator>>=
+ // expected-error@+1 {{write m_bar9 [loplugin:writeonlyvars]}}
+ int m_bar9;
+ // expected-error@+1 {{read any [loplugin:writeonlyvars]}}
+ css::uno::Any any;
+ any >>= m_bar9;
+
+ // check that we see don't see writes when calling operator<<=
+ // expected-error@+1 {{read m_bar10 [loplugin:writeonlyvars]}}
+ int m_bar10;
+ // expected-error@+2 {{write any2 [loplugin:writeonlyvars]}}
+ // expected-error@+1 {{read any2 [loplugin:writeonlyvars]}}
+ css::uno::Any any2;
+ any2 <<= m_bar10;
+};
+};
+
+struct ReadOnly1
+{
+ ReadOnly1(int&);
+};
+
+namespace ReadOnlyAnalysis
+{
+void method1(int&);
+
+void test()
+{
+ // check that we see a write when we pass by non-const ref
+ // expected-error@+2 {{read m_f2 [loplugin:writeonlyvars]}}
+ // expected-error@+1 {{write m_f2 [loplugin:writeonlyvars]}}
+ int m_f2;
+ method1(m_f2);
+
+ // expected-error@+1 {{write m_f4 [loplugin:writeonlyvars]}}
+ std::vector<int> m_f4;
+ m_f4.push_back(1);
+
+ // check that we see a write when we pass by non-const ref
+ // expected-error@+2 {{read m_f5 [loplugin:writeonlyvars]}}
+ // expected-error@+1 {{write m_f5 [loplugin:writeonlyvars]}}
+ int m_f5;
+ ReadOnly1 a(m_f5);
+
+ // check that we see a write when we pass by non-const ref
+ // expected-error@+2 {{read m_f6 [loplugin:writeonlyvars]}}
+ // expected-error@+1 {{write m_f6 [loplugin:writeonlyvars]}}
+ int m_f6;
+ // expected-error@+1 {{write r [loplugin:writeonlyvars]}}
+ int& r = m_f6;
+ r = 1;
+};
+};
+
+void ReadOnlyAnalysis3()
+{
+ // expected-error@+1 {{read m_f1 [loplugin:writeonlyvars]}}
+ int m_f1 = 0;
+
+ if (m_f1)
+ m_f1 = 1;
+};
+
+// Verify the special logic for container fields that only contains mutations that
+// add elements.
+void ReadOnlyAnalysis4()
+{
+ // expected-error@+1 {{read m_readonly [loplugin:writeonlyvars]}}
+ std::vector<int> m_readonly;
+ // expected-error@+1 {{write m_writeonly [loplugin:writeonlyvars]}}
+ std::vector<int> m_writeonly;
+ // expected-error@+1 {{read m_readonlyCss [loplugin:writeonlyvars]}}
+ css::uno::Sequence<sal_Int32> m_readonlyCss;
+
+ // expected-error@+1 {{write x [loplugin:writeonlyvars]}}
+ int x = m_readonly[0];
+ (void)x;
+ *m_readonly.begin() = 1; // TODO?
+
+ m_writeonly.push_back(0);
+
+ x = m_readonlyCss.getArray()[0];
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/writeonlyvars.cxx b/compilerplugins/clang/writeonlyvars.cxx
new file mode 100644
index 000000000000..d9a02898ca10
--- /dev/null
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -0,0 +1,1148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#if !defined _WIN32 //TODO, #include <sys/file.h>
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <unordered_set>
+#include <vector>
+#include <algorithm>
+#include <sys/file.h>
+#include <unistd.h>
+#include "plugin.hxx"
+#include "compat.hxx"
+#include "check.hxx"
+
+/**
+ Finds variables that are effectively write-only.
+
+ Largely the same as the unusedfields.cxx loplugin.
+*/
+
+namespace
+{
+struct MyVarInfo
+{
+ const VarDecl* varDecl;
+ std::string parent;
+ std::string varName;
+ std::string varType;
+ std::string sourceLocation;
+};
+bool operator<(const MyVarInfo& lhs, const MyVarInfo& rhs)
+{
+ return std::tie(lhs.parent, lhs.varName) < std::tie(rhs.parent, rhs.varName);
+}
+
+// try to limit the voluminous output a little
+static std::set<MyVarInfo> readFromSet;
+static std::set<MyVarInfo> writeToSet;
+static std::set<MyVarInfo> definitionSet;
+
+/**
+ * Wrap the different kinds of callable and callee objects in the clang AST so I can define methods that handle everything.
+ */
+class CallerWrapper
+{
+ const CallExpr* m_callExpr;
+ const CXXConstructExpr* m_cxxConstructExpr;
+
+public:
+ CallerWrapper(const CallExpr* callExpr)
+ : m_callExpr(callExpr)
+ , m_cxxConstructExpr(nullptr)
+ {
+ }
+ CallerWrapper(const CXXConstructExpr* cxxConstructExpr)
+ : m_callExpr(nullptr)
+ , m_cxxConstructExpr(cxxConstructExpr)
+ {
+ }
+ unsigned getNumArgs() const
+ {
+ return m_callExpr ? m_callExpr->getNumArgs() : m_cxxConstructExpr->getNumArgs();
+ }
+ const Expr* getArg(unsigned i) const
+ {
+ return m_callExpr ? m_callExpr->getArg(i) : m_cxxConstructExpr->getArg(i);
+ }
+};
+class CalleeWrapper
+{
+ const FunctionDecl* m_calleeFunctionDecl = nullptr;
+ const CXXConstructorDecl* m_cxxConstructorDecl = nullptr;
+ const FunctionProtoType* m_functionPrototype = nullptr;
+
+public:
+ explicit CalleeWrapper(const FunctionDecl* calleeFunctionDecl)
+ : m_calleeFunctionDecl(calleeFunctionDecl)
+ {
+ }
+ explicit CalleeWrapper(const CXXConstructExpr* cxxConstructExpr)
+ : m_cxxConstructorDecl(cxxConstructExpr->getConstructor())
+ {
+ }
+ explicit CalleeWrapper(const FunctionProtoType* functionPrototype)
+ : m_functionPrototype(functionPrototype)
+ {
+ }
+ unsigned getNumParams() const
+ {
+ if (m_calleeFunctionDecl)
+ return m_calleeFunctionDecl->getNumParams();
+ else if (m_cxxConstructorDecl)
+ return m_cxxConstructorDecl->getNumParams();
+ else if (m_functionPrototype->param_type_begin() == m_functionPrototype->param_type_end())
+ // FunctionProtoType will assert if we call getParamTypes() and it has no params
+ return 0;
+ else
+ return m_functionPrototype->getParamTypes().size();
+ }
+ const QualType getParamType(unsigned i) const
+ {
+ if (m_calleeFunctionDecl)
+ return m_calleeFunctionDecl->getParamDecl(i)->getType();
+ else if (m_cxxConstructorDecl)
+ return m_cxxConstructorDecl->getParamDecl(i)->getType();
+ else
+ return m_functionPrototype->getParamTypes()[i];
+ }
+ std::string getNameAsString() const
+ {
+ if (m_calleeFunctionDecl)
+ return m_calleeFunctionDecl->getNameAsString();
+ else if (m_cxxConstructorDecl)
+ return m_cxxConstructorDecl->getNameAsString();
+ else
+ return "";
+ }
+ CXXMethodDecl const* getAsCXXMethodDecl() const
+ {
+ if (m_calleeFunctionDecl)
+ return dyn_cast<CXXMethodDecl>(m_calleeFunctionDecl);
+ return nullptr;
+ }
+};
+
+class WriteOnlyVars : public loplugin::FilteringPlugin<WriteOnlyVars>
+{
+public:
+ explicit WriteOnlyVars(loplugin::InstantiationData const& data)
+ : FilteringPlugin(data)
+ {
+ }
+
+ virtual void run() override;
+
+ bool shouldVisitTemplateInstantiations() const { return true; }
+ bool shouldVisitImplicitCode() const { return true; }
+
+ bool VisitVarDecl(const VarDecl*);
+ bool VisitDeclRefExpr(const DeclRefExpr*);
+ bool TraverseIfStmt(IfStmt*);
+
+private:
+ MyVarInfo niceName(const VarDecl*);
+ void checkIfReadFrom(const VarDecl* varDecl, const Expr* memberExpr);
+ void checkIfWrittenTo(const VarDecl* varDecl, const Expr* memberExpr);
+ bool checkForWriteWhenUsingCollectionType(const CXXMethodDecl* calleeMethodDecl);
+ bool IsPassedByNonConst(const VarDecl* varDecl, const Stmt* child, CallerWrapper callExpr,
+ CalleeWrapper calleeFunctionDecl);
+ llvm::Optional<CalleeWrapper> getCallee(CallExpr const*);
+
+ // For reasons I do not understand, parentFunctionDecl() is not reliable, so
+ // we store the parent function on the way down the AST.
+ FunctionDecl* insideFunctionDecl = nullptr;
+ std::vector<VarDecl const*> insideConditionalCheckOfMemberSet;
+};
+
+void WriteOnlyVars::run()
+{
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+ if (!isUnitTestMode())
+ {
+ StringRef fn(handler.getMainFileName());
+ // playing paging-in games with volatile
+ if (loplugin::isSamePathname(fn, SRCDIR "/sal/osl/unx/file.cxx"))
+ return;
+ // playing paging-in games with volatile
+ if (loplugin::isSamePathname(fn, SRCDIR "/desktop/unx/source/file_image_unx.c"))
+ return;
+ // false+
+ if (loplugin::isSamePathname(fn, SRCDIR "/store/source/storpage.cxx"))
+ return;
+ // yydebug?
+ if (loplugin::isSamePathname(fn, SRCDIR "/idlc/source/idlccompile.cxx"))
+ return;
+ if (fn.contains("/qa/"))
+ return;
+ if (fn.contains("/vcl/workben/"))
+ return;
+ // preload
+ if (loplugin::isSamePathname(fn, SRCDIR "/cppuhelper/source/servicemanager.cxx"))
+ return;
+ // doing a "free items outside lock" thing
+ if (loplugin::isSamePathname(fn, SRCDIR "/unotools/source/config/itemholder1.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/config/itemholder2.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/config/itemholder2.cxx"))
+ return;
+ // doiing a "keep objects alive" thing
+ if (loplugin::isSamePathname(fn, SRCDIR "/jvmfwk/source/framework.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/jvmfwk/plugins/sunmajor/pluginlib/util.cxx"))
+ return;
+ // debug code
+ if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/items/style.cxx"))
+ return;
+ // ok
+ if (loplugin::isSamePathname(fn, SRCDIR "/stoc/source/inspect/introspection.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/package/source/zippackage/ZipPackage.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/hwpreader.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/treelist/transfer.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/app/brand.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/igif/gifread.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/gdi/metaact.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/fontsubset/sft.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/ipdf/pdfdocument.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/ipdf/pdfdocument2.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/app/sm.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/jpeg/JpegWriter.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/dtrans/X11_selection.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/jpeg/jpegc.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/window/FWS.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/toolkit/source/awt/vclxspinbutton.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/toolkit/source/controls/formattedcontrol.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/config/helpopt.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/filter/SvFilterOptionsDialog.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/uno/generictoolboxcontroller.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/java/javainteractionhandler.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/basic/source/classes/sbunoobj.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/accessibility/source/standard/vclxaccessiblebox.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/cppcanvas/source/mtfrenderer/implrenderer.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/doc/guisaveas.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/appl/newhelp.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/control/thumbnailview.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/control/recentdocsview.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/view/viewfrm.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/framework/source/services/desktop.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/framework/source/uielement/generictoolbarcontroller.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/framework/source/uielement/complextoolbarcontroller.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/framework/source/interaction/quietinteraction.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/editdoc.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/impedit4.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/editobj.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/items/frmitems.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/binaryurp/source/bridge.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/tbxctrls/fontworkgallery.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/basctl/source/basicide/moduldl2.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/canvas/source/cairo/cairo_spritecanvas.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/DiagramHelper.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/chart2/source/tools/ExplicitCategoriesProvider.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/LegendHelper.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/OPropertySet.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/CommonConverters.cxx"))
+ return;
+ if (loplugin::isSamePathname(
+ fn,
+ SRCDIR "/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/DataSourceHelper.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/oox/source/export/shapes.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/oox/source/export/chartexport.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/filter/source/storagefilterdetect/filterdetect.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/pdf/pdfexport.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/svg/svgexport.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/msfilter/svdfppt.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/dbaccess/source/core/recovery/subcomponentrecovery.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/dbaccess/source/core/dataaccess/documentcontainer.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/dbaccess/source/core/dataaccess/databasedocument.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/dbaccess/source/ui/browser/genericcontroller.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/ucb/source/core/ucbcmds.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/desktop/source/deployment/manager/dp_manager.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/desktop/source/deployment/registry/package/dp_package.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/desktop/source/lib/init.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/extensions/source/propctrlr/formcomponenthandler.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/embeddedobj/source/general/docholder.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/extensions/source/propctrlr/stringrepresentation.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpcontent.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpdivinfo.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpdoc.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/pdf/impdialog.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwplayout.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpoleobject.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwprowlayout.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpfoundry.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpparastyle.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpnotes.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpfont.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwptblcell.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpusrdicts.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpverdocument.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwptblformula.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vbahelper/source/vbahelper/vbafontbase.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vbahelper/source/vbahelper/vbadocumentbase.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/docsh8.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/docsh6.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/core/data/table3.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/unoobj/cellsuno.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/excel/xelink.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/lotus/lotus.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbaworkbooks.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbaworksheets.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbarange.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/view/drviews2.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/ppt/pptin.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/app/sdxfer.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/view/drviewsf.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/xml/sdxmlwrp.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/html/pubdlg.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/txtnode/thints.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/doc/docbm.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/crsr/crsrsh.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/xml/swxml.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/doc/docredln.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par2.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/uibase/shells/drformsh.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par6.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/ui/dbui/dbinsdlg.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/minimizer/impoptimizer.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/presenter/PresenterTheme.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/pdfimport/wrapper/wrapper.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/slideshow/source/engine/animationnodes/generateevent.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/starmath/source/mathmlimport.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/starmath/source/eqnolefilehdr.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svgio/source/svgreader/svgmarkernode.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/uui/source/iahndl-locking.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/shell/source/sessioninstall/SyncDbusSessionHelper.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/slideshow/source/engine/opengl/TransitionerImpl.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/forms/source/component/FormattedField.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/forms/source/component/DatabaseForm.cxx"))
+ return;
+ if (loplugin::isSamePathname(fn,
+ SRCDIR "/reportdesign/source/ui/report/ReportController.cxx"))
+ return;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/test/"))
+ return;
+ if (loplugin::isSamePathname(fn, SRCDIR "/i18npool/source/localedata/LocaleNode.cxx"))
+ return;
+
+ // yynerrs?
+ if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/grammar.cxx"))
+ return;
+
+ for (MyVarInfo const& v : definitionSet)
+ {
+ bool read = readFromSet.find(v) != readFromSet.end();
+ bool write = writeToSet.find(v) != writeToSet.end();
+ if (!read && write)
+ report(DiagnosticsEngine::Warning, "write-only %0", compat::getBeginLoc(v.varDecl))
+ << v.varName;
+ }
+ }
+ else
+ {
+ for (const MyVarInfo& s : readFromSet)
+ report(DiagnosticsEngine::Warning, "read %0", compat::getBeginLoc(s.varDecl))
+ << s.varName;
+ for (const MyVarInfo& s : writeToSet)
+ report(DiagnosticsEngine::Warning, "write %0", compat::getBeginLoc(s.varDecl))
+ << s.varName;
+ }
+}
+
+MyVarInfo WriteOnlyVars::niceName(const VarDecl* varDecl)
+{
+ MyVarInfo aInfo;
+
+ aInfo.varDecl = varDecl->getCanonicalDecl();
+ aInfo.varName = varDecl->getNameAsString();
+ // sometimes the name (if it's an anonymous thing) contains the full path of the build folder, which we don't need
+ size_t idx = aInfo.varName.find(SRCDIR);
+ if (idx != std::string::npos)
+ {
+ aInfo.varName = aInfo.varName.replace(idx, strlen(SRCDIR), "");
+ }
+ aInfo.varType = varDecl->getType().getAsString();
+
+ SourceLocation expansionLoc
+ = compiler.getSourceManager().getExpansionLoc(varDecl->getLocation());
+ StringRef filename = compiler.getSourceManager().getFilename(expansionLoc);
+ aInfo.sourceLocation
+ = std::string(filename.substr(strlen(SRCDIR) + 1)) + ":"
+ + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
+ loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
+ aInfo.parent = filename;
+
+ return aInfo;
+}
+
+static bool contains(std::string const& s, std::string const& needle)
+{
+ return s.find(needle) != std::string::npos;
+}
+
+bool WriteOnlyVars::VisitVarDecl(const VarDecl* varDecl)
+{
+ if (varDecl->isImplicit() || varDecl->isExternC() || isa<ParmVarDecl>(varDecl))
+ return true;
+ auto tc = loplugin::TypeCheck(varDecl->getType());
+ if (tc.Pointer() || tc.LvalueReference() || tc.Class("shared_ptr").StdNamespace()
+ || tc.Class("unique_ptr").StdNamespace())
+ return true;
+ if (tc.Typedef("BitmapScopedWriteAccess"))
+ return true;
+ std::string typeName = varDecl->getType().getAsString();
+ if (contains(typeName, "Guard") || contains(typeName, "Reader") || contains(typeName, "Stream")
+ || contains(typeName, "Parser") || contains(typeName, "Codec")
+ || contains(typeName, "Exception"))
+ return true;
+ varDecl = varDecl->getCanonicalDecl();
+ if (!varDecl->getLocation().isValid() || ignoreLocation(varDecl))
+ return true;
+ if (!compiler.getSourceManager().isInMainFile(varDecl->getLocation()))
+ return true;
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(varDecl)))
+ return true;
+ if (compiler.getSourceManager().isMacroArgExpansion(compat::getBeginLoc(varDecl)))
+ return true;
+ // ignore stuff that forms part of the stable URE interface
+ if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())))
+ return true;
+
+ definitionSet.insert(niceName(varDecl));
+ return true;
+}
+
+static char easytolower(char in)
+{
+ if (in <= 'Z' && in >= 'A')
+ return in - ('Z' - 'z');
+ return in;
+}
+
+bool startswith(const std::string& rStr, const char* pSubStr)
+{
+ return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
+}
+
+bool WriteOnlyVars::TraverseIfStmt(IfStmt* ifStmt)
+{
+ VarDecl const* varDecl = nullptr;
+ Expr const* cond = ifStmt->getCond()->IgnoreParenImpCasts();
+ if (auto declRefExpr = dyn_cast<DeclRefExpr>(cond))
+ {
+ if ((varDecl = dyn_cast<VarDecl>(declRefExpr->getDecl())))
+ insideConditionalCheckOfMemberSet.push_back(varDecl);
+ }
+ bool ret = RecursiveASTVisitor::TraverseIfStmt(ifStmt);
+ if (varDecl)
+ insideConditionalCheckOfMemberSet.pop_back();
+ return ret;
+}
+
+void WriteOnlyVars::checkIfReadFrom(const VarDecl* varDecl, const Expr* memberExpr)
+{
+ auto parentsRange = compiler.getASTContext().getParents(*memberExpr);
+ const Stmt* child = memberExpr;
+ const Stmt* parent
+ = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
+ // walk up the tree until we find something interesting
+ bool bPotentiallyReadFrom = false;
+ bool bDump = false;
+ auto walkupUp = [&]() {
+ child = parent;
+ auto parentsRange = compiler.getASTContext().getParents(*parent);
+ parent = parentsRange.begin() == parentsRange.end() ? nullptr
+ : parentsRange.begin()->get<Stmt>();
+ };
+ do
+ {
+ if (!parent)
+ {
+ // check if we're inside a CXXCtorInitializer or a VarDecl
+ auto parentsRange = compiler.getASTContext().getParents(*child);
+ if (parentsRange.begin() != parentsRange.end())
+ {
+ const Decl* decl = parentsRange.begin()->get<Decl>();
+ if (decl && (isa<CXXConstructorDecl>(decl) || isa<VarDecl>(decl)))
+ bPotentiallyReadFrom = true;
+ }
+ if (!bPotentiallyReadFrom)
+ return;
+ break;
+ }
+ if (isa<CXXReinterpretCastExpr>(parent))
+ {
+ // once we see one of these, there is not much useful we can know
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent)
+ || isa<ParenListExpr>(parent) || isa<ArrayInitLoopExpr>(parent)
+ || isa<ExprWithCleanups>(parent))
+ {
+ walkupUp();
+ }
+ else if (auto unaryOperator = dyn_cast<UnaryOperator>(parent))
+ {
+ UnaryOperator::Opcode op = unaryOperator->getOpcode();
+ if (memberExpr->getType()->isArrayType() && op == UO_Deref)
+ {
+ // ignore, deref'ing an array does not count as a read
+ }
+ else if (op == UO_AddrOf || op == UO_Deref || op == UO_Plus || op == UO_Minus
+ || op == UO_Not || op == UO_LNot)
+ {
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ /* The following are technically reads, but from a code-sense they're more of a write/modify, so
+ ignore them to find interesting fields that only modified, not usefully read:
+ UO_PreInc / UO_PostInc / UO_PreDec / UO_PostDec
+ But we still walk up in case the result of the expression is used in a read sense.
+ */
+ walkupUp();
+ }
+ else if (auto caseStmt = dyn_cast<CaseStmt>(parent))
+ {
+ bPotentiallyReadFrom = caseStmt->getLHS() == child || caseStmt->getRHS() == child;
+ break;
+ }
+ else if (auto ifStmt = dyn_cast<IfStmt>(parent))
+ {
+ bPotentiallyReadFrom = ifStmt->getCond() == child;
+ break;
+ }
+ else if (auto doStmt = dyn_cast<DoStmt>(parent))
+ {
+ bPotentiallyReadFrom = doStmt->getCond() == child;
+ break;
+ }
+ else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent))
+ {
+ if (arraySubscriptExpr->getIdx() == child)
+ {
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ walkupUp();
+ }
+ else if (auto callExpr = dyn_cast<CXXMemberCallExpr>(parent))
+ {
+ // check for calls to ReadXXX() type methods and the operator>>= methods on Any.
+ auto callee = getCallee(callExpr);
+ if (callee && *callExpr->child_begin() == child)
+ {
+ // FIXME perhaps a better solution here would be some kind of SAL_PARAM_WRITEONLY attribute
+ // which we could scatter around.
+ std::string name = callee->getNameAsString();
+ std::transform(name.begin(), name.end(), name.begin(), easytolower);
+ if (startswith(name, "read"))
+ // this is a write-only call
+ ;
+ else if (startswith(name, "emplace") || name == "insert" || name == "erase"
+ || name == "remove" || name == "remove_if" || name == "sort"
+ || name == "push_back" || name == "pop_back" || name == "push_front"
+ || name == "pop_front" || name == "reserve" || name == "resize"
+ || name == "clear" || name == "fill")
+ // write-only modifications to collections
+ ;
+ else if (name.find(">>=") != std::string::npos && callExpr->getArg(1) == child)
+ // this is a write-only call
+ ;
+ else if (name == "dispose" || name == "disposeAndClear" || name == "swap")
+ // we're abusing the write-only analysis here to look for vars which don't have anything useful
+ // being done to them, so we're ignoring things like std::vector::clear, std::vector::swap,
+ // and VclPtr::disposeAndClear
+ ;
+ else
+ bPotentiallyReadFrom = true;
+ }
+ else
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ else if (auto callExpr = dyn_cast<CallExpr>(parent))
+ {
+ // check for calls to ReadXXX() type methods and the operator>>= methods on Any.
+ auto callee = getCallee(callExpr);
+ if (callee)
+ {
+ // FIXME perhaps a better solution here would be some kind of SAL_PARAM_WRITEONLY attribute
+ // which we could scatter around.
+ std::string name = callee->getNameAsString();
+ std::transform(name.begin(), name.end(), name.begin(), easytolower);
+ if (startswith(name, "read"))
+ // this is a write-only call
+ ;
+ else if (name.find(">>=") != std::string::npos && callExpr->getArg(1) == child)
+ // this is a write-only call
+ ;
+ else
+ bPotentiallyReadFrom = true;
+ }
+ else
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ else if (auto binaryOp = dyn_cast<BinaryOperator>(parent))
+ {
+ BinaryOperator::Opcode op = binaryOp->getOpcode();
+ // If the child is on the LHS and it is an assignment op, we are obviously not reading from it
+ const bool assignmentOp = op == BO_Assign || op == BO_MulAssign || op == BO_DivAssign
+ || op == BO_RemAssign || op == BO_AddAssign
+ || op == BO_SubAssign || op == BO_ShlAssign
+ || op == BO_ShrAssign || op == BO_AndAssign
+ || op == BO_XorAssign || op == BO_OrAssign;
+ if (!(binaryOp->getLHS() == child && assignmentOp))
+ {
+ bPotentiallyReadFrom = true;
+ }
+ break;
+ }
+ else if (isa<ReturnStmt>(parent) || isa<CXXConstructExpr>(parent)
+ || isa<ConditionalOperator>(parent) || isa<SwitchStmt>(parent)
+ || isa<DeclStmt>(parent) || isa<WhileStmt>(parent) || isa<CXXNewExpr>(parent)
+ || isa<ForStmt>(parent) || isa<InitListExpr>(parent)
+ || isa<CXXDependentScopeMemberExpr>(parent) || isa<UnresolvedMemberExpr>(parent)
+ || isa<MaterializeTemporaryExpr>(parent))
+ {
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ else if (isa<CXXDeleteExpr>(parent) || isa<UnaryExprOrTypeTraitExpr>(parent)
+ || isa<CXXUnresolvedConstructExpr>(parent) || isa<CompoundStmt>(parent)
+ || isa<LabelStmt>(parent) || isa<CXXForRangeStmt>(parent)
+ || isa<CXXTypeidExpr>(parent) || isa<DefaultStmt>(parent)
+ || isa<GCCAsmStmt>(parent) || isa<VAArgExpr>(parent)
+#if CLANG_VERSION >= 80000
+ || isa<ConstantExpr>(parent)
+#endif
+ || isa<CXXDefaultArgExpr>(parent) || isa<LambdaExpr>(parent))
+ {
+ break;
+ }
+ else
+ {
+ bPotentiallyReadFrom = true;
+ bDump = true;
+ break;
+ }
+ } while (true);
+
+ if (bDump)
+ {
+ report(DiagnosticsEngine::Warning, "oh dear, what can the matter be?",
+ compat::getBeginLoc(memberExpr))
+ << memberExpr->getSourceRange();
+ report(DiagnosticsEngine::Note, "parent over here", compat::getBeginLoc(parent))
+ << parent->getSourceRange();
+ parent->dump();
+ memberExpr->dump();
+ }
+
+ MyVarInfo varInfo = niceName(varDecl);
+ if (bPotentiallyReadFrom)
+ {
+ readFromSet.insert(varInfo);
+ }
+}
+
+void WriteOnlyVars::checkIfWrittenTo(const VarDecl* varDecl, const Expr* memberExpr)
+{
+ // if we're inside a block that looks like
+ // if (varDecl)
+ // ....
+ // then writes to this var don't matter, because unless we find another write to this var, this var is dead
+ if (std::find(insideConditionalCheckOfMemberSet.begin(),
+ insideConditionalCheckOfMemberSet.end(), varDecl)
+ != insideConditionalCheckOfMemberSet.end())
+ return;
+
+ auto parentsRange = compiler.getASTContext().getParents(*memberExpr);
+ const Stmt* child = memberExpr;
+ const Stmt* parent
+ = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
+ // walk up the tree until we find something interesting
+ bool bPotentiallyWrittenTo = false;
+ bool bDump = false;
+ auto walkupUp = [&]() {
+ child = parent;
+ auto parentsRange = compiler.getASTContext().getParents(*parent);
+ parent = parentsRange.begin() == parentsRange.end() ? nullptr
+ : parentsRange.begin()->get<Stmt>();
+ };
+ do
+ {
+ if (!parent)
+ {
+ // check if we have an expression like
+ // int& r = var;
+ auto parentsRange = compiler.getASTContext().getParents(*child);
+ if (parentsRange.begin() != parentsRange.end())
+ {
+ auto varDecl = dyn_cast_or_null<VarDecl>(parentsRange.begin()->get<Decl>());
+ // The isImplicit() call is to avoid triggering when we see the vardecl which is part of a for-range statement,
+ // which is of type 'T&&' and also an l-value-ref ?
+ if (varDecl && !varDecl->isImplicit()
+ && loplugin::TypeCheck(varDecl->getType()).LvalueReference().NonConst())
+ {
+ bPotentiallyWrittenTo = true;
+ }
+ }
+ break;
+ }
+ if (isa<CXXReinterpretCastExpr>(parent))
+ {
+ // once we see one of these, there is not much useful we can know
+ bPotentiallyWrittenTo = true;
+ break;
+ }
+ else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent)
+ || isa<ParenListExpr>(parent) || isa<ArrayInitLoopExpr>(parent)
+ || isa<ExprWithCleanups>(parent))
+ {
+ walkupUp();
+ }
+ else if (auto unaryOperator = dyn_cast<UnaryOperator>(parent))
+ {
+ UnaryOperator::Opcode op = unaryOperator->getOpcode();
+ if (op == UO_AddrOf || op == UO_PostInc || op == UO_PostDec || op == UO_PreInc
+ || op == UO_PreDec)
+ {
+ bPotentiallyWrittenTo = true;
+ }
+ break;
+ }
+ else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent))
+ {
+ if (arraySubscriptExpr->getIdx() == child)
+ break;
+ walkupUp();
+ }
+ else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent))
+ {
+ auto callee = getCallee(operatorCallExpr);
+ if (callee)
+ {
+ // if calling a non-const operator on the var
+ auto calleeMethodDecl = callee->getAsCXXMethodDecl();
+ if (calleeMethodDecl && operatorCallExpr->getArg(0) == child)
+ {
+ if (!calleeMethodDecl->isConst())
+ bPotentiallyWrittenTo
+ = checkForWriteWhenUsingCollectionType(calleeMethodDecl);
+ }
+ else if (IsPassedByNonConst(varDecl, child, operatorCallExpr, *callee))
+ {
+ bPotentiallyWrittenTo = true;
+ }
+ }
+ else
+ bPotentiallyWrittenTo = true; // conservative, could improve
+ break;
+ }
+ else if (auto cxxMemberCallExpr = dyn_cast<CXXMemberCallExpr>(parent))
+ {
+ const CXXMethodDecl* calleeMethodDecl = cxxMemberCallExpr->getMethodDecl();
+ if (calleeMethodDecl)
+ {
+ // if calling a non-const method on the var
+ const Expr* tmp = dyn_cast<Expr>(child);
+ if (tmp->isBoundMemberFunction(compiler.getASTContext()))
+ {
+ tmp = dyn_cast<MemberExpr>(tmp)->getBase();
+ }
+ if (cxxMemberCallExpr->getImplicitObjectArgument() == tmp)
+ {
+ if (!calleeMethodDecl->isConst())
+ bPotentiallyWrittenTo
+ = checkForWriteWhenUsingCollectionType(calleeMethodDecl);
+ break;
+ }
+ else if (IsPassedByNonConst(varDecl, child, cxxMemberCallExpr,
+ CalleeWrapper(calleeMethodDecl)))
+ bPotentiallyWrittenTo = true;
+ }
+ else
+ bPotentiallyWrittenTo = true; // can happen in templates
+ break;
+ }
+ else if (auto cxxConstructExpr = dyn_cast<CXXConstructExpr>(parent))
+ {
+ if (IsPassedByNonConst(varDecl, child, cxxConstructExpr,
+ CalleeWrapper(cxxConstructExpr)))
+ bPotentiallyWrittenTo = true;
+ break;
+ }
+ else if (auto callExpr = dyn_cast<CallExpr>(parent))
+ {
+ auto callee = getCallee(callExpr);
+ if (callee)
+ {
+ if (IsPassedByNonConst(varDecl, child, callExpr, *callee))
+ bPotentiallyWrittenTo = true;
+ }
+ else
+ bPotentiallyWrittenTo = true; // conservative, could improve
+ break;
+ }
+ else if (auto binaryOp = dyn_cast<BinaryOperator>(parent))
+ {
+ BinaryOperator::Opcode op = binaryOp->getOpcode();
+ const bool assignmentOp = op == BO_Assign || op == BO_MulAssign || op == BO_DivAssign
+ || op == BO_RemAssign || op == BO_AddAssign
+ || op == BO_SubAssign || op == BO_ShlAssign
+ || op == BO_ShrAssign || op == BO_AndAssign
+ || op == BO_XorAssign || op == BO_OrAssign;
+ if (assignmentOp)
+ {
+ if (binaryOp->getLHS() == child)
+ bPotentiallyWrittenTo = true;
+ else if (loplugin::TypeCheck(binaryOp->getLHS()->getType())
+ .LvalueReference()
+ .NonConst())
+ // if the LHS is a non-const reference, we could write to the var later on
+ bPotentiallyWrittenTo = true;
+ }
+ break;
+ }
+ else if (isa<ReturnStmt>(parent))
+ {
+ if (insideFunctionDecl)
+ {
+ auto tc = loplugin::TypeCheck(insideFunctionDecl->getReturnType());
+ if (tc.LvalueReference().NonConst())
+ bPotentiallyWrittenTo = true;
+ }
+ break;
+ }
+ else if (isa<ConditionalOperator>(parent) || isa<SwitchStmt>(parent)
+ || isa<DeclStmt>(parent) || isa<WhileStmt>(parent) || isa<CXXNewExpr>(parent)
+ || isa<ForStmt>(parent) || isa<InitListExpr>(parent)
+ || isa<CXXDependentScopeMemberExpr>(parent) || isa<UnresolvedMemberExpr>(parent)
+ || isa<MaterializeTemporaryExpr>(parent) || isa<IfStmt>(parent)
+ || isa<DoStmt>(parent) || isa<CXXDeleteExpr>(parent)
+ || isa<UnaryExprOrTypeTraitExpr>(parent) || isa<CXXUnresolvedConstructExpr>(parent)
+ || isa<CompoundStmt>(parent) || isa<LabelStmt>(parent)
+ || isa<CXXForRangeStmt>(parent) || isa<CXXTypeidExpr>(parent)
+ || isa<DefaultStmt>(parent)
+#if CLANG_VERSION >= 80000
+ || isa<ConstantExpr>(parent)
+#endif
+ || isa<GCCAsmStmt>(parent) || isa<VAArgExpr>(parent)
+ || isa<CXXDefaultArgExpr>(parent) || isa<LambdaExpr>(parent))
+ {
+ break;
+ }
+ else
+ {
+ bPotentiallyWrittenTo = true;
+ bDump = true;
+ break;
+ }
+ } while (true);
+
+ if (bDump)
+ {
+ report(DiagnosticsEngine::Warning, "oh dear2, what can the matter be? writtenTo=%0",
+ compat::getBeginLoc(memberExpr))
+ << bPotentiallyWrittenTo << memberExpr->getSourceRange();
+ if (parent)
+ {
+ report(DiagnosticsEngine::Note, "parent over here", compat::getBeginLoc(parent))
+ << parent->getSourceRange();
+ parent->dump();
+ }
+ memberExpr->dump();
+ varDecl->getType()->dump();
+ }
+
+ MyVarInfo varInfo = niceName(varDecl);
+ if (bPotentiallyWrittenTo)
+ {
+ writeToSet.insert(varInfo);
+ }
+}
+
+// return true if this not a collection type, or if it is a collection type, and we might be writing to it
+bool WriteOnlyVars::checkForWriteWhenUsingCollectionType(const CXXMethodDecl* calleeMethodDecl)
+{
+ auto const tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
+ bool listLike = false, setLike = false, mapLike = false, cssSequence = false;
+ if (tc.Class("deque").StdNamespace() || tc.Class("list").StdNamespace()
+ || tc.Class("queue").StdNamespace() || tc.Class("vector").StdNamespace())
+ {
+ listLike = true;
+ }
+ else if (tc.Class("set").StdNamespace() || tc.Class("unordered_set").StdNamespace())
+ {
+ setLike = true;
+ }
+ else if (tc.Class("map").StdNamespace() || tc.Class("unordered_map").StdNamespace())
+ {
+ mapLike = true;
+ }
+ else if (tc.Class("Sequence")
+ .Namespace("uno")
+ .Namespace("star")
+ .Namespace("sun")
+ .Namespace("com")
+ .GlobalNamespace())
+ {
+ cssSequence = true;
+ }
+ else
+ return true;
+
+ if (calleeMethodDecl->isOverloadedOperator())
+ {
+ auto oo = calleeMethodDecl->getOverloadedOperator();
+ if (oo == OO_Equal)
+ return true;
+ // This is operator[]. We only care about things that add elements to the collection.
+ // if nothing modifies the size of the collection, then nothing useful
+ // is stored in it.
+ if (listLike)
+ return false;
+ return true;
+ }
+
+ auto name = calleeMethodDecl->getName();
+ if (listLike || setLike || mapLike)
+ {
+ if (name == "reserve" || name == "shrink_to_fit" || name == "clear" || name == "erase"
+ || name == "pop_back" || name == "pop_front" || name == "front" || name == "back"
+ || name == "data" || name == "remove" || name == "remove_if" || name == "unique"
+ || name == "sort" || name == "begin" || name == "end" || name == "rbegin"
+ || name == "rend" || name == "at" || name == "find" || name == "equal_range"
+ || name == "lower_bound" || name == "upper_bound")
+ return false;
+ }
+ if (cssSequence)
+ {
+ if (name == "getArray" || name == "begin" || name == "end")
+ return false;
+ }
+
+ return true;
+}
+
+bool WriteOnlyVars::IsPassedByNonConst(const VarDecl* varDecl, const Stmt* child,
+ CallerWrapper callExpr, CalleeWrapper calleeFunctionDecl)
+{
+ unsigned len = std::min(callExpr.getNumArgs(), calleeFunctionDecl.getNumParams());
+ // if it's an array, passing it by value to a method typically means the
+ // callee takes a pointer and can modify the array
+ if (varDecl->getType()->isConstantArrayType())
+ {
+ for (unsigned i = 0; i < len; ++i)
+ if (callExpr.getArg(i) == child)
+ if (loplugin::TypeCheck(calleeFunctionDecl.getParamType(i)).Pointer().NonConst())
+ return true;
+ }
+ else
+ {
+ for (unsigned i = 0; i < len; ++i)
+ if (callExpr.getArg(i) == child)
+ if (loplugin::TypeCheck(calleeFunctionDecl.getParamType(i))
+ .LvalueReference()
+ .NonConst())
+ return true;
+ }
+ return false;
+}
+
+bool WriteOnlyVars::VisitDeclRefExpr(const DeclRefExpr* declRefExpr)
+{
+ const Decl* decl = declRefExpr->getDecl();
+ const VarDecl* varDecl = dyn_cast<VarDecl>(decl);
+ if (!varDecl)
+ return true;
+ if (varDecl->isImplicit() || isa<ParmVarDecl>(varDecl))
+ return true;
+ varDecl = varDecl->getCanonicalDecl();
+ if (ignoreLocation(varDecl))
+ return true;
+ // ignore stuff that forms part of the stable URE interface
+ if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())))
+ return true;
+
+ checkIfReadFrom(varDecl, declRefExpr);
+
+ checkIfWrittenTo(varDecl, declRefExpr);
+
+ return true;
+}
+
+llvm::Optional<CalleeWrapper> WriteOnlyVars::getCallee(CallExpr const* callExpr)
+{
+ FunctionDecl const* functionDecl = callExpr->getDirectCallee();
+ if (functionDecl)
+ return CalleeWrapper(functionDecl);
+
+ // Extract the functionprototype from a type
+ clang::Type const* calleeType = callExpr->getCallee()->getType().getTypePtr();
+ if (auto pointerType = calleeType->getUnqualifiedDesugaredType()->getAs<clang::PointerType>())
+ {
+ if (auto prototype = pointerType->getPointeeType()
+ ->getUnqualifiedDesugaredType()
+ ->getAs<FunctionProtoType>())
+ {
+ return CalleeWrapper(prototype);
+ }
+ }
+
+ return llvm::Optional<CalleeWrapper>();
+}
+
+loplugin::Plugin::Registration<WriteOnlyVars> X("writeonlyvars", false);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 767f4d99ac99..e84494bb8f3d 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2332,11 +2332,10 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
{
OUString sTempName = createTempFile();
- ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference< XPropertySet > xHold = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+ rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
+ xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
{
- Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
+ Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
// copy the structure
for(sal_Int32 i=0;i < m_xColumns->getCount();++i)
@@ -2361,7 +2360,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
}
// construct the new table
- if(!pNewTable->CreateImpl())
+ if(!xNewTable->CreateImpl())
{
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_COLUMN_NOT_ADDABLE,
@@ -2370,16 +2369,16 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
::dbtools::throwGenericSQLException( sError, *this );
}
- pNewTable->construct();
+ xNewTable->construct();
// copy the data
- copyData(pNewTable,pNewTable->m_xColumns->getCount());
+ copyData(xNewTable.get(),xNewTable->m_xColumns->getCount());
// drop the old table
if(DropImpl())
{
- pNewTable->renameImpl(m_Name);
+ xNewTable->renameImpl(m_Name);
// release the temp file
}
- xHold.clear();
+ xNewTable.clear();
FileClose();
construct();
@@ -2391,11 +2390,10 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos)
{
OUString sTempName = createTempFile();
- ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference< XPropertySet > xHold = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+ rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
+ xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
{
- Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
+ Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
// copy the structure
for(sal_Int32 i=0;i < m_xColumns->getCount();++i)
@@ -2419,24 +2417,23 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos)
}
// construct the new table
- if(!pNewTable->CreateImpl())
+ if(!xNewTable->CreateImpl())
{
- xHold.clear();
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_COLUMN_NOT_DROP,
"$position$", OUString::number(_nPos)
) );
::dbtools::throwGenericSQLException( sError, *this );
}
- pNewTable->construct();
+ xNewTable->construct();
// copy the data
- copyData(pNewTable,_nPos);
+ copyData(xNewTable.get(),_nPos);
// drop the old table
if(DropImpl())
- pNewTable->renameImpl(m_Name);
+ xNewTable->renameImpl(m_Name);
// release the temp file
- xHold.clear();
+ xNewTable.clear();
FileClose();
construct();
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 82e682c5a01d..877f83830b9b 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -135,7 +135,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
// the database may be stored as an
// fdb file in older versions
bool bIsFdbStored = false;
- OUString aStorageURL;
if (url == "sdbc:embedded:firebird")
{
m_bIsEmbedded = true;
@@ -149,10 +148,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
{
m_xEmbeddedStorage.set(pIter->Value,UNO_QUERY);
}
- else if ( pIter->Name == "URL" )
- {
- pIter->Value >>= aStorageURL;
- }
else if ( pIter->Name == "Document" )
{
pIter->Value >>= m_xParentDocument;
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 0381128357da..13bb595d5692 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -195,8 +195,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bDefaultChanged)
{
- OUString sOldDefault, sNewDefault;
- xColumn->getPropertyValue("DefaultValue") >>= sOldDefault;
+ OUString sNewDefault;
rDescriptor->getPropertyValue("DefaultValue") >>= sNewDefault;
OUString sSql;
diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx
index 989455c37593..676488cb209d 100644
--- a/connectivity/source/drivers/mork/MorkParser.cxx
+++ b/connectivity/source/drivers/mork/MorkParser.cxx
@@ -100,13 +100,10 @@ bool MorkParser::parse()
// Run over mork chars and parse each term
char cur = nextChar();
- int i = 0;
-
while ( Result && cur )
{
if ( !isWhiteSpace( cur ) )
{
- i++;
// Figure out what a term
switch ( cur )
{
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index eba5f9c7bd69..def0a72ea767 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -177,7 +177,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
{
uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ];
- OUString aDocumentUrl, aTitle, aImageId, aTargetName;
+ OUString aDocumentUrl, aTitle;
for ( int e = 0; e < rDynamicMenuEntry.getLength(); e++ )
{
@@ -185,10 +185,6 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
rDynamicMenuEntry[ e ].Value >>= aDocumentUrl;
else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TITLE )
rDynamicMenuEntry[e].Value >>= aTitle;
- else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER )
- rDynamicMenuEntry[e].Value >>= aImageId;
- else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME )
- rDynamicMenuEntry[e].Value >>= aTargetName;
}
//#i96822# business cards, labels and database should not be inserted here
if( aDocumentUrl == "private:factory/swriter?slot=21051" ||
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 0555cc339caf..c1383ea4e16b 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1840,16 +1840,13 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
if ( xNodeAccess.is() )
{
- OUString sNodeId, sLabel, sPageURL, sGroupId;
+ OUString sNodeId, sLabel, sPageURL;
bool bAllModules = false;
- sal_Int32 nGroupIndex = 0;
sNodeId = seqNames[i];
xNodeAccess->getByName( "Label" ) >>= sLabel;
xNodeAccess->getByName( "OptionsPage" ) >>= sPageURL;
xNodeAccess->getByName( "AllModules" ) >>= bAllModules;
- xNodeAccess->getByName( "GroupId" ) >>= sGroupId;
- xNodeAccess->getByName( "GroupIndex" ) >>= nGroupIndex;
if ( sLabel.isEmpty() )
sLabel = sGroupName;
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 1915b6815b91..53363f09d6fd 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -398,8 +398,6 @@ void ODBExport::exportDataSource()
// special handlings
if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE )
{
- sal_Int32 nValue = 0;
- aValue >>= nValue;
if ( sValue == "0" )
sValue = "equal-integer";
else if ( sValue == "1" )
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 2be6e6d7be65..a0fabc0d02d8 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -159,7 +159,6 @@ static ErrCode ReadThroughComponent(
try
{
- bool bEncrypted = false;
// open stream (and set parser input)
OUString sStreamName = OUString::createFromAscii(pStreamName);
if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
@@ -179,10 +178,6 @@ static ErrCode ReadThroughComponent(
// get input stream
xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
-
- uno::Reference< beans::XPropertySet > xProps( xDocStream, uno::UNO_QUERY_THROW );
- uno::Any aAny = xProps->getPropertyValue("Encrypted");
- aAny >>= bEncrypted;
}
catch (const packages::WrongPasswordException&)
{
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index e4528d487620..d366b3a4618f 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2963,8 +2963,6 @@ void SbaTableQueryBrowser::unloadAndCleanup( bool _bDisposeConnection )
{
// get the active connection. We need to dispose it.
Reference< XPropertySet > xRowSetProps(getRowSet(),UNO_QUERY);
- Reference< XConnection > xConn;
- xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION) >>= xConn;
#if OSL_DEBUG_LEVEL > 0
{
Reference< XComponent > xComp(
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 12964ce0d786..8b596b137839 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -121,8 +121,6 @@ bool ORowSetImportExport::Read()
{
Reference<XPropertySet> xProp(m_xResultSet,UNO_QUERY);
sal_Int32 nRowCount = 0;
- sal_Int32 nCurrentRow = 0;
- sal_Int32 nRowFilterIndex = 0;
if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISROWCOUNTFINAL) )
{
bool bFinal = false;
@@ -141,8 +139,6 @@ bool ORowSetImportExport::Read()
while(m_xResultSet.is() && m_xResultSet->next() && bContinue && nRowCount )
{
--nRowCount;
- ++nCurrentRow;
- ++nRowFilterIndex;
bContinue = insertNewRow();
}
}
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 029856bb066e..28a316ac7621 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -815,7 +815,6 @@ void OHTMLImportExport::WriteTables()
// 2. and now the data
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
- sal_Int32 j=1;
sal_Int32 kk=0;
m_xResultSet->beforeFirst(); // set back before the first row
while(m_xResultSet->next())
@@ -846,7 +845,6 @@ void OHTMLImportExport::WriteTables()
}
WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
}
- ++j;
TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
}
}
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 226cf4bb9c19..e07197ff734a 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -311,8 +311,6 @@ bool ORelationTableConnectionData::Update()
OSL_ENSURE(xKey.is(),"Key is not valid!");
if ( xKey.is() )
{
- sal_Int32 nType = 0;
- xKey->getPropertyValue(PROPERTY_TYPE) >>= nType;
OUString sReferencedTable;
xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
if ( sReferencedTable == getReferencedTable()->GetTableName() )
diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx
index 77ba50328163..4448def2d09e 100644
--- a/filter/source/flash/swffilter.cxx
+++ b/filter/source/flash/swffilter.cxx
@@ -354,8 +354,7 @@ void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& a
swfdirpath = sPath + "/" + sPresentationName + ".sxi-swf-files";
- oslFileError err;
- err = osl_createDirectory( swfdirpath.pData );
+ osl_createDirectory( swfdirpath.pData );
fullpath = swfdirpath + "/backgroundconfig.txt";
@@ -370,11 +369,10 @@ void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& a
osl_openFile( fullpath.pData, &aBackgroundConfig, osl_File_OpenFlag_Create | osl_File_OpenFlag_Write );
sal_uInt64 bytesWritten;
- err = osl_writeFile(aBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
+ osl_writeFile(aBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
}
// TODO: check for errors
- (void) err;
FlashExporter aFlashExporter(
mxContext,
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index 1f70f450bda2..d4335024c26d 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -681,7 +681,6 @@ void DXF2GDIMetaFile::DrawEntities(const DXFEntities & rEntities,
return;
rEntities.mbBeingDrawn = true;
- sal_uLong nCount=0;
DXFTransform aET;
const DXFTransform * pT;
@@ -744,7 +743,6 @@ void DXF2GDIMetaFile::DrawEntities(const DXFEntities & rEntities,
}
}
pE=pE->pSucc;
- nCount++;
}
rEntities.mbBeingDrawn = false;
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index 5e9b78e3516b..db483ffef04b 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -170,7 +170,6 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
const Sequence< OUString >& /*msUserData*/)
{
OUString paramName;
- OUString targetURL;
Reference<XOutputStream> outputStream;
// Read output stream and target URL from the parameters given in sourceData.
@@ -180,8 +179,6 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
paramName = sourceData[paramIdx].Name;
if ( paramName == "OutputStream" )
sourceData[paramIdx].Value >>= outputStream;
- else if ( paramName == "URL" )
- sourceData[paramIdx].Value >>= targetURL;
}
if (!getDelegate().is())
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index a82b6db15f54..3e5164e7af4d 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -283,7 +283,7 @@ namespace XSLT
// is most important here since we need to supply it to
// the sax parser that drives the supplied document handler
sal_Int32 nLength = aSourceData.getLength();
- OUString aName, aFileName, aURL;
+ OUString aName, aURL;
css::uno::Reference<XInputStream> xInputStream;
css::uno::Reference<XInteractionHandler> xInterActionHandler;
for (sal_Int32 i = 0; i < nLength; i++)
@@ -292,8 +292,6 @@ namespace XSLT
Any value = aSourceData[i].Value;
if ( aName == "InputStream" )
value >>= xInputStream;
- else if ( aName == "FileName" )
- value >>= aFileName;
else if ( aName == "URL" )
value >>= aURL;
else if ( aName == "InteractionHandler" )
@@ -430,18 +428,15 @@ namespace XSLT
// since that is where our xml-writer will push the data
// from its data-source interface
OUString aName, sURL;
- bool bIndent = false;
OUString aDoctypePublic;
// css::uno::Reference<XOutputStream> rOutputStream;
sal_Int32 nLength = aSourceData.getLength();
for (sal_Int32 i = 0; i < nLength; i++)
{
aName = aSourceData[i].Name;
- if ( aName == "Indent" )
- aSourceData[i].Value >>= bIndent;
if ( aName == "DocType_Public" )
aSourceData[i].Value >>= aDoctypePublic;
- if ( aName == "OutputStream" )
+ else if ( aName == "OutputStream" )
aSourceData[i].Value >>= m_rOutputStream;
else if ( aName == "URL" )
aSourceData[i].Value >>= sURL;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 749562d29245..ae58c71deb72 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -2662,11 +2662,6 @@ IMPL_LINK_NOARG(LayoutManager, AsyncLayoutHdl, Timer *, void)
if( !m_xContainerWindow.is() )
return;
- awt::Rectangle aDockingArea( m_aDockingArea );
- ::Size aStatusBarSize( implts_getStatusBarSize() );
-
- // Subtract status bar height
- aDockingArea.Height -= aStatusBarSize.Height();
aReadLock.clear();
implts_setDockingAreaWindowSizes();
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 530977a590f1..2638f9a8c022 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1415,7 +1415,6 @@ void MenuBarManager::FillMenu(
Sequence< PropertyValue > aProp;
OUString aCommandURL;
OUString aLabel;
- OUString aHelpURL;
OUString aModuleIdentifier( rModuleIdentifier );
sal_uInt16 nType = 0;
Reference< XIndexAccess > xIndexContainer;
@@ -1433,8 +1432,6 @@ void MenuBarManager::FillMenu(
OUString aPropName = aProp[i].Name;
if ( aPropName == "CommandURL" )
aProp[i].Value >>= aCommandURL;
- else if ( aPropName == "HelpURL" )
- aProp[i].Value >>= aHelpURL;
else if ( aPropName == "ItemDescriptorContainer" )
aProp[i].Value >>= xIndexContainer;
else if ( aPropName == "Label" )
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 0ab6b555ad9f..219f54cc2016 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -413,7 +413,6 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
{
uno::Sequence< beans::PropertyValue > aProp;
OUString aCommandURL;
- OUString aHelpURL;
sal_Int16 nOffset( 0 );
sal_Int16 nStyle( 0 );
sal_Int16 nWidth( 0 );
@@ -429,10 +428,6 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
{
aProp[i].Value >>= aCommandURL;
}
- else if ( aProp[i].Name == "HelpURL" )
- {
- aProp[i].Value >>= aHelpURL;
- }
else if ( aProp[i].Name == "Style" )
{
aProp[i].Value >>= nStyle;
diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx
index 75cce49b15a2..83416bc5daea 100644
--- a/framework/source/uielement/toolbarmerger.cxx
+++ b/framework/source/uielement/toolbarmerger.cxx
@@ -435,7 +435,6 @@ void ToolBarMerger::MergeItems(
{
const sal_Int32 nSize( rAddonToolbarItems.size() );
- sal_uInt16 nIndex( 0 );
for ( sal_Int32 i = 0; i < nSize; i++ )
{
const AddonToolbarItem& rItem = rAddonToolbarItems[i];
@@ -469,7 +468,6 @@ void ToolBarMerger::MergeItems(
ToolBarMerger::CreateToolbarItem( pToolbar, nInsPos, rItemId, rItem );
}
- ++nIndex;
++rItemId;
}
}
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 547a035b088e..02e41f47fcb3 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -182,8 +182,6 @@ ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand()
// XNameAccess
Any ConfigurationAccess_UICommand::getByNameImpl( const OUString& rCommandURL )
{
- static sal_Int32 nRequests = 0;
-
osl::MutexGuard g(m_aMutex);
if ( !m_bConfigAccessInitialized )
{
@@ -210,7 +208,6 @@ Any ConfigurationAccess_UICommand::getByNameImpl( const OUString& rCommandURL )
else
{
// SAFE
- ++nRequests;
return getInfoFromCommand( rCommandURL );
}
}
diff --git a/l10ntools/source/idxdict/idxdict.cxx b/l10ntools/source/idxdict/idxdict.cxx
index 38955a5b8258..0a4a6ddb0216 100644
--- a/l10ntools/source/idxdict/idxdict.cxx
+++ b/l10ntools/source/idxdict/idxdict.cxx
@@ -34,7 +34,6 @@ int main(int argc, char *argv[])
multimap<string, size_t> entries;
multimap<string,size_t>::iterator ret(entries.begin());
- int line(1);
cin.getline(inputBuffer, MAXLINE);
const string encoding(inputBuffer);
size_t currentOffset(encoding.size()+1);
@@ -70,7 +69,6 @@ int main(int argc, char *argv[])
{
cin.getline(inputBuffer, MAXLINE);
currentOffset += strlen(inputBuffer)+1;
- ++line;
}
}
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index e16944af5b06..856aef4b3f9e 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -675,9 +675,7 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa
sal_uInt16 nHandles = rHandles.getLength();
for ( k = 0; k < nHandles ; k++ )
{
- const OUString sSwitched( "Switched" );
const OUString sPosition( "Position" );
- bool bSwitched = false;
bool bPosition = false;
EnhancedCustomShapeParameterPair aPosition;
EnhancedCustomShapeParameterPair aPolar;
@@ -689,10 +687,6 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa
if ( rPropVal.Value >>= aPosition )
bPosition = true;
}
- else if ( rPropVal.Name == sSwitched )
- {
- rPropVal.Value >>= bSwitched ;
- }
}
if ( bPosition )
{
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 077a0cdee96b..c1d1699d8835 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -2054,10 +2054,6 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co
{
uno::Reference< style::XStyle> xStyle = new OStyle();
xStyle->setName("Default");
- uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY);
- OUString sTray;
- xProp->getPropertyValue("PrinterPaperTray")>>= sTray;
-
return xStyle.get();
}
else if ( aServiceSpecifier == "com.sun.star.document.Settings" )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a97dbc389a90..d2395cdbb0fb 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1241,7 +1241,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
const ScChangeAction* pFound = nullptr;
const ScChangeAction* pFoundContent = nullptr;
const ScChangeAction* pFoundMove = nullptr;
- long nModified = 0;
const ScChangeAction* pAction = pTrack->GetFirst();
while (pAction)
{
@@ -1271,7 +1270,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
default:
break;
}
- ++nModified;
}
}
if ( eType == SC_CAT_MOVE )
@@ -1282,7 +1280,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
if ( aRange.In( aCellPos ) )
{
pFound = pAction;
- ++nModified;
}
}
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 0b5e07497a27..eb2d1d9c4857 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3133,9 +3133,7 @@ SCSIZE ScTable::Query(const ScQueryParam& rParamOrg, bool bKeepSub)
aStr = aBuf.makeStringAndClear();
}
- std::pair<StrSetType::iterator, bool> r = aStrSet.insert(aStr);
- bool bIsUnique = r.second; // unique if inserted.
- bResult = bIsUnique;
+ bResult = aStrSet.insert(aStr).second; // unique if inserted.
}
}
else
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index b8e8eb73ce7d..c72ab042b4cf 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -197,13 +197,8 @@ uno::Reference<chart2::data::XDataSource> SAL_CALL
if (!m_pDocument)
throw uno::RuntimeException();
- bool bLabel = true;
- bool bCategories = false;
bool bOrientCol = true;
OUString aRangeRepresentation;
- OUString sPivotTable;
- uno::Sequence<sal_Int32> aSequenceMapping;
- bool bTimeBased = false;
for (beans::PropertyValue const & rProperty : aArguments)
{
@@ -218,18 +213,8 @@ uno::Reference<chart2::data::XDataSource> SAL_CALL
}
bOrientCol = (eSource == chart::ChartDataRowSource_COLUMNS);
}
- else if (rProperty.Name == "FirstCellAsLabel")
- rProperty.Value >>= bLabel;
- else if (rProperty.Name == "HasCategories")
- rProperty.Value >>= bCategories;
else if (rProperty.Name == "CellRangeRepresentation")
rProperty.Value >>= aRangeRepresentation;
- else if (rProperty.Name == "SequenceMapping")
- rProperty.Value >>= aSequenceMapping;
- else if (rProperty.Name == "TimeBased")
- rProperty.Value >>= bTimeBased;
- else if (rProperty.Name == "ConnectedPivotTable")
- rProperty.Value >>= sPivotTable;
}
uno::Reference<chart2::data::XDataSource> xResult;
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 6793bf70bc66..57dfaddeccda 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -368,8 +368,6 @@ ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con
setFilterPropsFromFormat( nFileFormat, storeProps );
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
- OUString sFilterName;
- storeProps[0].Value >>= sFilterName;
xStor->storeAsURL( sURL, storeProps );
}
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 40f3bd722019..cf19422208d6 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -75,7 +75,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
const ScChangeAction* pFound = nullptr;
const ScChangeAction* pFoundContent = nullptr;
const ScChangeAction* pFoundMove = nullptr;
- long nModified = 0;
const ScChangeAction* pAction = pTrack->GetFirst();
while (pAction)
{
@@ -109,7 +108,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
// added to avoid warnings
}
}
- ++nModified;
}
}
if ( eType == SC_CAT_MOVE )
@@ -120,7 +118,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
if ( aRange.In( aCellPos ) )
{
pFound = pAction;
- ++nModified;
}
}
}
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index cd174d88ec3c..1f99c6f5d879 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -218,8 +218,6 @@ namespace dlgprov
Reference< XControlModel > xControlModel = xControl->getModel();
Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
- OUString sName;
- xProps->getPropertyValue("Name") >>= sName;
if ( xEventCont.is() )
{
Sequence< OUString > aNames = xEventCont->getElementNames();
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 54b4b47ceb5f..376074686ac6 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -364,8 +364,6 @@ uno::Sequence<beans::PropertyValue>
else
{
// Such specific path construction is grim.
- OUString aValue;
- aRet[i].Value >>= aValue;
OUStringBuffer aName( getNameOfType( t ) );
OUString aResult;
diff --git a/sdext/source/presenter/PresenterSlidePreview.cxx b/sdext/source/presenter/PresenterSlidePreview.cxx
index d49d5b4b79f0..1c8d813fa9b5 100644
--- a/sdext/source/presenter/PresenterSlidePreview.cxx
+++ b/sdext/source/presenter/PresenterSlidePreview.cxx
@@ -203,21 +203,6 @@ void PresenterSlidePreview::SetSlide (const Reference<drawing::XDrawPage>& rxPag
mxCurrentSlide = rxPage;
mxPreview = nullptr;
- Reference<beans::XPropertySet> xPropertySet (mxCurrentSlide, UNO_QUERY);
- if (xPropertySet.is())
- {
- awt::Size aSlideSize;
- try
- {
- xPropertySet->getPropertyValue("Width") >>= aSlideSize.Width;
- xPropertySet->getPropertyValue("Height") >>= aSlideSize.Height;
- }
- catch (beans::UnknownPropertyException&)
- {
- OSL_ASSERT(false);
- }
- }
-
// The preview is not transparent, therefore only this window, not its
// parent, has to be invalidated.
mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
diff --git a/sdext/source/presenter/PresenterTextView.cxx b/sdext/source/presenter/PresenterTextView.cxx
index b99a482cda82..c95cab1f72f7 100644
--- a/sdext/source/presenter/PresenterTextView.cxx
+++ b/sdext/source/presenter/PresenterTextView.cxx
@@ -460,15 +460,6 @@ PresenterTextParagraph::PresenterTextParagraph (
if (rxTextRange.is())
{
Reference<beans::XPropertySet> xProperties (rxTextRange, UNO_QUERY);
- lang::Locale aLocale;
- try
- {
- xProperties->getPropertyValue("CharLocale") >>= aLocale;
- }
- catch(beans::UnknownPropertyException&)
- {
- // Ignore the exception. Use the default value.
- }
try
{
xProperties->getPropertyValue("WritingMode") >>= mnWritingMode;
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index c20ece60019d..945573bacffd 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -632,9 +632,6 @@ void PresenterToolBar::ProcessEntry (
if ( ! (PresenterConfigurationAccess::GetProperty(rxProperties, "Type") >>= sType))
return;
- OUString sName;
- PresenterConfigurationAccess::GetProperty(rxProperties, "Name") >>= sName;
-
// Read mode specific values.
SharedElementMode pNormalMode (new ElementMode());
SharedElementMode pMouseOverMode (new ElementMode());
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index f3ad18b29c09..e506de0bc734 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -909,7 +909,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
// (attention: some information aren't available on filter directly ... you must search for corresponding type too!)
SfxFilterFlags nFlags = SfxFilterFlags::NONE;
SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE;
- sal_Int32 nDocumentIconId = 0 ;
sal_Int32 nFormatVersion = 0 ;
OUString sMimeType ;
OUString sType ;
@@ -989,10 +988,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
{
lTypeProperties[nTypeProperty].Value >>= sHumanName;
}
- else if ( lTypeProperties[nTypeProperty].Name == "DocumentIconID" )
- {
- lTypeProperties[nTypeProperty].Value >>= nDocumentIconId;
- }
else if ( lTypeProperties[nTypeProperty].Name == "MediaType" )
{
lTypeProperties[nTypeProperty].Value >>= sMimeType;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 434450dbce41..5bd7ad19ded8 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -205,18 +205,6 @@ void BackingWindow::initControls()
// collect the URLs of the entries in the File/New menu
SvtModuleOptions aModuleOptions;
- std::set< OUString > aFileNewAppsAvailable;
- SvtDynamicMenuOptions aOpt;
- Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
- const OUString sURLKey( "URL" );
-
- for ( auto const & newMenuProp : aNewMenu )
- {
- comphelper::SequenceAsHashMap aEntryItems( newMenuProp );
- OUString sURL( aEntryItems.getUnpackedValueOrDefault( sURLKey, OUString() ) );
- if ( !sURL.isEmpty() )
- aFileNewAppsAvailable.insert( sURL );
- }
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER;
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 8066f36fc532..43421fdd9bd7 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -299,7 +299,6 @@ void NotebookbarTabControl::FillShortcutsToolBox(Reference<XComponentContext> co
if ( xIndex->getByIndex( i ) >>= aPropSequence )
{
OUString aCommandURL;
- OUString aLabel;
sal_uInt16 nType = ItemType::DEFAULT;
bool bVisible = true;
@@ -307,8 +306,6 @@ void NotebookbarTabControl::FillShortcutsToolBox(Reference<XComponentContext> co
{
if ( aProp.Name == "CommandURL" )
aProp.Value >>= aCommandURL;
- else if ( aProp.Name == "Label" )
- aProp.Value >>= aLabel;
else if ( aProp.Name == "Type" )
aProp.Value >>= nType;
else if ( aProp.Name == "IsVisible" )
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index a83cf703793f..97c541885c75 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/unusedvariablemore \
compilerplugins/clang/test/useuniqueptr \
compilerplugins/clang/test/vclwidgets \
+ compilerplugins/clang/test/writeonlyvars \
))
$(eval $(call gb_CompilerTest_use_externals,compilerplugins_clang, \
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index ee1cfb8efc7d..844edb390ad2 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -127,8 +127,6 @@ char *includedirs[ MAXDIRS + 1 ];
char *objprefix = "";
char *objsuffix = OBJSUFFIX;
static char *startat = "# DO NOT DELETE";
-static int width = 78;
-static boolean append = FALSE;
boolean printed = FALSE;
boolean verbose = FALSE;
boolean show_where_not = FALSE;
@@ -274,16 +272,13 @@ int main(int argc, char **argv)
/* do not use if endmarker processing */
case 'a':
if (endmarker) break;
- append = TRUE;
break;
case 'w':
if (endmarker) break;
if (argv[0][2] == '\0') {
argv++;
argc--;
- width = atoi(argv[0]);
- } else
- width = atoi(argv[0]+2);
+ }
break;
case 'n':
// Use "-n" switch to generate dependencies with windows-native slash style
diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c
index 731b2f16626e..2b0825221df6 100644
--- a/soltools/mkdepend/pr.c
+++ b/soltools/mkdepend/pr.c
@@ -109,7 +109,6 @@ size_t pr(struct inclist *ip, char *file, char *base)
{
size_t ret;
static char *lastfile;
- static int current_len;
int len, i;
char buf[ BUFSIZ ];
@@ -119,7 +118,7 @@ size_t pr(struct inclist *ip, char *file, char *base)
lastfile = file;
sprintf(buf, "\n%s%s%s: \\\n %s", objprefix, base, objsuffix,
ip->i_file);
- len = current_len = (int)strlen(buf);
+ len = (int)strlen(buf);
}
else {
buf[0] = ' ';
@@ -127,7 +126,6 @@ size_t pr(struct inclist *ip, char *file, char *base)
buf[2] = '\n';
buf[3] = ' ';
strcpy(buf+4, ip->i_file);
- current_len += len;
}
ret = fwrite(buf, len, 1, stdout);
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index faa23511d4d4..8d7c6e1733b7 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -1840,9 +1840,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// 3. Methods
- // Counter for found listeners
- sal_Int32 nListenerCount = 0;
-
// Get and remember all methods
Sequence< Reference<XIdlMethod> > methods = rxIfaceClass->getMethods();
const Reference<XIdlMethod>* pSourceMethods = methods.getConstArray();
@@ -2132,7 +2129,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
pMethodTypes[i] = ADD_LISTENER_METHOD;
pMethodTypes[k] = REMOVE_LISTENER_METHOD;
- nListenerCount++;
}
}
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 55fee9ad9b50..db7dd94fbdfa 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1452,14 +1452,6 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
if ( maContent.empty() )
return;
- // count (estimate) the number of filter tokens
- sal_Int32 nTokens=0;
- const sal_Unicode* pStart = rFilter.getStr();
- const sal_Unicode* pEnd = pStart + rFilter.getLength();
- while ( pStart != pEnd )
- if ( *pStart++ == ';' )
- ++nTokens;
-
// collect the filter tokens
::std::vector< WildCard > aFilters;
FilterMatch::createWildCardFilterList(rFilter,aFilters);
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index d9a6f91693d7..064f923e425a 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -50,8 +50,6 @@ static constexpr auto DRAWTEXT_FLAGS_ICON =
#define EVENTID_SHOW_CURSOR (reinterpret_cast<void*>(1))
#define EVENTID_ADJUST_SCROLLBARS (reinterpret_cast<void*>(2))
-static bool bEndScrollInvalidate = true;
-
SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
SvtIconChoiceCtrl* pCurView,
WinBits nWinStyle
@@ -192,14 +190,12 @@ IMPL_LINK( SvxIconChoiceCtrl_Impl, ScrollUpDownHdl, ScrollBar*, pScrollBar, void
{
// arrow up: delta=-1; arrow down: delta=+1
Scroll( 0, pScrollBar->GetDelta() );
- bEndScrollInvalidate = true;
}
IMPL_LINK( SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl, ScrollBar*, pScrollBar, void )
{
// arrow left: delta=-1; arrow right: delta=+1
Scroll( pScrollBar->GetDelta(), 0 );
- bEndScrollInvalidate = true;
}
void SvxIconChoiceCtrl_Impl::FontModified()
@@ -532,8 +528,6 @@ void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors )
void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
- bEndScrollInvalidate = false;
-
#if defined(OV_DRAWGRID)
Color aOldColor (rRenderContext.GetLineColor());
Color aCOL_BLACK);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 1c6982d4979a..ee5a92fe8226 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2292,7 +2292,6 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly )
else
{
sal_Int32 nLineObjectCount(0);
- sal_Int32 nAreaObjectCount(0);
// correct some values and collect content data
for ( std::pair< SdrPathObj*, double >& rCandidate : vObjectList )
@@ -2305,7 +2304,6 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly )
}
else
{
- nAreaObjectCount++;
AdaptObjColor(
*pObj,
rCandidate.second,
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index b4f42480eb48..7665142d34c9 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -226,7 +226,7 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
}
// extract the descriptor
- OUString sDatasource, sCommand, sFieldName,sDatabaseLocation,sConnnectionResource;
+ OUString sDatasource, sCommand, sFieldName,sDatabaseLocation;
sal_Int32 nCommandType = CommandType::COMMAND;
Reference< XPreparedStatement > xStatement;
Reference< XResultSet > xResultSet;
@@ -236,7 +236,6 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
ODataAccessDescriptor aColumn = OColumnTransferable::extractColumnDescriptor(aDroppedData);
if (aColumn.has(DataAccessDescriptorProperty::DataSource)) aColumn[DataAccessDescriptorProperty::DataSource] >>= sDatasource;
if (aColumn.has(DataAccessDescriptorProperty::DatabaseLocation)) aColumn[DataAccessDescriptorProperty::DatabaseLocation] >>= sDatabaseLocation;
- if (aColumn.has(DataAccessDescriptorProperty::ConnectionResource)) aColumn[DataAccessDescriptorProperty::ConnectionResource] >>= sConnnectionResource;
if (aColumn.has(DataAccessDescriptorProperty::Command)) aColumn[DataAccessDescriptorProperty::Command] >>= sCommand;
if (aColumn.has(DataAccessDescriptorProperty::CommandType)) aColumn[DataAccessDescriptorProperty::CommandType] >>= nCommandType;
if (aColumn.has(DataAccessDescriptorProperty::ColumnName)) aColumn[DataAccessDescriptorProperty::ColumnName] >>= sFieldName;
@@ -675,20 +674,17 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
if (pMenu && xCols.is() && nColId)
{
- Reference< css::beans::XPropertySet > xSet( xCols->getByIndex(nPos), css::uno::UNO_QUERY);
- sal_Int16 nClassId;
- xSet->getPropertyValue(FM_PROP_CLASSID) >>= nClassId;
+ Reference< css::beans::XPropertySet > xPropSet( xCols->getByIndex(nPos), css::uno::UNO_QUERY);
- Reference< css::io::XPersistObject > xServiceQuestion(xSet, UNO_QUERY);
+ Reference< css::io::XPersistObject > xServiceQuestion(xPropSet, UNO_QUERY);
sal_Int32 nColType = xServiceQuestion.is() ? getColumnTypeByModelName(xServiceQuestion->getServiceName()) : 0;
if (nColType == TYPE_TEXTFIELD)
{ // edit fields and formatted fields have the same service name, thus getColumnTypeByModelName returns TYPE_TEXTFIELD
// in both cases. And as columns don't have an css::lang::XServiceInfo interface, we have to distinguish both
// types via the existence of special properties
- Reference< css::beans::XPropertySet > xProps(xSet, UNO_QUERY);
- if (xProps.is())
+ if (xPropSet.is())
{
- Reference< css::beans::XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo();
+ Reference< css::beans::XPropertySetInfo > xPropsInfo = xPropSet->getPropertySetInfo();
if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER))
nColType = TYPE_FORMATTEDFIELD;
}
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 5189920bbff1..6447cf0590f1 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3243,10 +3243,8 @@ void FmXFormShell::CreateExternalView_Lock()
Reference< XPropertySet> xCurrentModelSet;
OUString sColumnType,aGroupName,sControlSource;
Sequence< Property> aProps;
- Reference< XPropertySet> xCurrentBoundField;
while ((xCurrentModelSet = Reference< XPropertySet>(aModelIterator.Next(), UNO_QUERY)).is())
{
- xCurrentModelSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xCurrentBoundField;
OSL_ENSURE(xCurrentModelSet.is(),"xCurrentModelSet is null!");
// create a description of the column to be created
// first : determine it's type
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 95ee01f3d220..22533e21689a 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -734,8 +734,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
// get length of data sequence
sal_Int32 nL = 0;
- sal_Char c;
- while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ while (ii< iiEnd && 'x' == (bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
{
++nL; ++ii;
}
@@ -745,7 +744,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
// to be found because that is not supported
while (ii < iiEnd)
{
- if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ if ('x' == (bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
throw lang::IllegalArgumentException();
++ii;
}
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 09351dd0bd63..dd130751bac4 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -158,7 +158,6 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
{
SwTextFormatColl* pColl = pD->getIDocumentStylePoolAccess().GetTextCollFromPool
(RES_POOLCOLL_STANDARD, false);
- sal_uInt16 nGlosEntry = 0;
SwContentNode* pCNd = nullptr;
bRet = true;
do {
@@ -242,7 +241,6 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
}
aStart = aStart.GetNode().EndOfSectionIndex() + 1;
- ++nGlosEntry;
} while( aStart < aDocEnd && aStart.GetNode().IsStartNode() );
}
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 544f3785ddae..863c8cf6b25b 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1462,14 +1462,11 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
// 2.2.3 adjust LVL of the new NumRule
- sal_uInt16 aFlagsNewCharFormat = 0;
bool bNewCharFormatCreated = false;
for (sal_uInt8 nLevel = 0; nLevel < rLFOInfo.nLfoLvl; ++nLevel)
{
AdjustLVL( nLevel, *rLFOInfo.pNumRule, aItemSet, aCharFormat,
bNewCharFormatCreated, sPrefix );
- if( bNewCharFormatCreated )
- aFlagsNewCharFormat += (1 << nLevel);
}
}
}
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index a46db95870ca..168f9a8b3406 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -159,16 +159,8 @@ static void lcl_addFrameProperties(
if ( !xSet.is() )
return;
- OUString aURL;
- Any aAny = xSet->getPropertyValue("FrameURL");
- aAny >>= aURL;
-
- OUString aName;
- aAny = xSet->getPropertyValue("FrameName");
- aAny >>= aName;
-
bool bIsAutoScroll = false, bIsScrollingMode = false;
- aAny = xSet->getPropertyValue("FrameIsAutoScroll");
+ Any aAny = xSet->getPropertyValue("FrameIsAutoScroll");
aAny >>= bIsAutoScroll;
if ( !bIsAutoScroll )
{
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index ebbbc9ccad7f..a0b5a522de7f 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -103,17 +103,11 @@ static OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet> const & xSou
xSourceProperties->getPropertyValue("Info") >>= aInfo;
if(aFilters.getLength() == 1 && aInfo.getLength() )
{
- OUString sFieldDelim;
- OUString sStringDelim;
OUString sExtension;
OUString sCharSet;
for(sal_Int32 nInfo = 0; nInfo < aInfo.getLength(); ++nInfo)
{
- if(aInfo[nInfo].Name == "FieldDelimiter")
- aInfo[nInfo].Value >>= sFieldDelim;
- else if(aInfo[nInfo].Name == "StringDelimiter")
- aInfo[nInfo].Value >>= sStringDelim;
- else if(aInfo[nInfo].Name == "Extension")
+ if(aInfo[nInfo].Name == "Extension")
aInfo[nInfo].Value >>= sExtension;
else if(aInfo[nInfo].Name == "CharSet")
aInfo[nInfo].Value >>= sCharSet;
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 061a44513e64..0288b37d61b4 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -262,12 +262,9 @@ std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const S
aDescriptor[svx::DataAccessDescriptorProperty::Command] >>= aDBData.sCommand;
aDescriptor[svx::DataAccessDescriptorProperty::CommandType] >>= aDBData.nCommandType;
- uno::Sequence< uno::Any > aSelection;
uno::Reference< sdbc::XConnection> xConnection;
uno::Reference< sdbc::XDataSource> xSource;
uno::Reference< sdbcx::XColumnsSupplier> xColumnsSupplier;
- if (aDescriptor.has(svx::DataAccessDescriptorProperty::Selection))
- aDescriptor[svx::DataAccessDescriptorProperty::Selection] >>= aSelection;
if (aDescriptor.has(svx::DataAccessDescriptorProperty::Connection))
aDescriptor[svx::DataAccessDescriptorProperty::Connection] >>= xConnection;
uno::Reference<container::XChild> xChild(xConnection, uno::UNO_QUERY);
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index b4d9d4494ef6..8daa167434f5 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -98,11 +98,8 @@ void SwDBTreeList_Impl::elementInserted( const ContainerEvent& )
// information not needed
}
-void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent )
+void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& )
{
- SolarMutexGuard aGuard;
- OUString sSource;
- rEvent.Accessor >>= sSource;
}
void SwDBTreeList_Impl::disposing( const EventObject& )
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index f8f825abd129..1564e969b1a2 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -78,7 +78,6 @@ static void lcl_Highlight(const OUString& rSource, TextPortions& aPortionList)
const sal_uInt16 nStrLen = rSource.getLength();
sal_uInt16 nInsert = 0; // number of inserted portions
sal_uInt16 nActPos = 0; // position, where '<' was found
- sal_uInt16 nOffset = 0; // Offset of nActPos to '<'
sal_uInt16 nPortStart = USHRT_MAX; // for the TextPortion
sal_uInt16 nPortEnd = 0;
TextPortion aText;
@@ -119,7 +118,6 @@ static void lcl_Highlight(const OUString& rSource, TextPortions& aPortionList)
// "</" ignore slash
nPortStart = nActPos;
nActPos++;
- nOffset++;
}
if(svtools::HTMLUNKNOWN == eFoundType)
{
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index b0348e02e2f0..f956569d0079 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -1915,12 +1915,6 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
case BASEPROPERTY_BORDERCOLOR:
::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor);
break;
- case BASEPROPERTY_DEFAULTCONTROL:
- {
- OUString aName;
- Value >>= aName;
- break;
- }
}
}
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 4ccd50573a1d..b55b76c1e240 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -2509,15 +2509,13 @@ TaskManager::getv(
{
// Assume failure
aIsRegular = false;
- osl::FileBase::RC result = osl::FileBase::E_INVAL;
osl::DirectoryItem aTargetItem;
osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem );
if ( aTargetItem.is() )
{
osl::FileStatus aTargetStatus( osl_FileStatus_Mask_Type );
- if ( osl::FileBase::E_None ==
- ( result = aTargetItem.getFileStatus( aTargetStatus ) ) )
+ if ( osl::FileBase::E_None == aTargetItem.getFileStatus( aTargetStatus ) )
aIsRegular =
aTargetStatus.getFileType() == osl::FileStatus::Regular;
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 0b0a80dc2ea5..e41f01e00c82 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3096,7 +3096,6 @@ std::vector<ComboBoxTextItem> VclBuilder::handleItems(xmlreader::XmlReader &read
int nLevel = 1;
std::vector<ComboBoxTextItem> aItems;
- sal_Int32 nItemIndex = 0;
while(true)
{
@@ -3153,7 +3152,6 @@ std::vector<ComboBoxTextItem> VclBuilder::handleItems(xmlreader::XmlReader &read
sFinalValue = (*m_pStringReplace)(sFinalValue);
aItems.emplace_back(sFinalValue, sId);
- ++nItemIndex;
}
}
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index e4a285e84575..861a33662d87 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1373,9 +1373,6 @@ void PrintDialog::setupOptionalUI()
Sequence< OUString > aHelpIds;
sal_Int64 nMinValue = 0, nMaxValue = 0;
OUString aGroupingHint;
- OUString aDependsOnName;
- sal_Int32 nDependsOnValue = 0;
- bool bUseDependencyRow = false;
for( int n = 0; n < aOptProp.getLength(); n++ )
{
@@ -1409,8 +1406,6 @@ void PrintDialog::setupOptionalUI()
}
else if ( rEntry.Name == "Enabled" )
{
- bool bValue = true;
- rEntry.Value >>= bValue;
}
else if ( rEntry.Name == "GroupingHint" )
{
@@ -1418,15 +1413,12 @@ void PrintDialog::setupOptionalUI()
}
else if ( rEntry.Name == "DependsOnName" )
{
- rEntry.Value >>= aDependsOnName;
}
else if ( rEntry.Name == "DependsOnEntry" )
{
- rEntry.Value >>= nDependsOnValue;
}
else if ( rEntry.Name == "AttachToDependency" )
{
- rEntry.Value >>= bUseDependencyRow;
}
else if ( rEntry.Name == "MinValue" )
{
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index b0a6b9935fdb..7926df64f12c 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -69,9 +69,6 @@
static FT_Library aLibFT = nullptr;
-// enable linking with old FT versions
-static int nFTVERSION = 0;
-
typedef std::unordered_map<const char*, std::shared_ptr<FreetypeFontFile>, rtl::CStringHash, rtl::CStringEqual> FontFileList;
namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; }
@@ -84,7 +81,6 @@ namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFi
// if (AH<AA) => do not autohint when antialiasing
// if (EB<AH) => do not autohint for monochrome
static int nDefaultPrioEmbedded = 2;
-static int nDefaultPrioAutoHint = 1;
static int nDefaultPrioAntiAlias = 1;
FreetypeFontFile::FreetypeFontFile( const OString& rNativeFileName )
@@ -265,7 +261,6 @@ void GlyphCache::InitFreetype()
FT_Int nMajor = 0, nMinor = 0, nPatch = 0;
FT_Library_Version(aLibFT, &nMajor, &nMinor, &nPatch);
- nFTVERSION = nMajor * 1000 + nMinor * 100 + nPatch;
// TODO: remove when the priorities are selected by UI
char* pEnv;
@@ -275,9 +270,6 @@ void GlyphCache::InitFreetype()
pEnv = ::getenv( "SAL_ANTIALIASED_TEXT_PRIORITY" );
if( pEnv )
nDefaultPrioAntiAlias = pEnv[0] - '0';
- pEnv = ::getenv( "SAL_AUTOHINTING_PRIORITY" );
- if( pEnv )
- nDefaultPrioAutoHint = pEnv[0] - '0';
(void)vclFontFileList::get();
}
diff --git a/vcl/unx/gtk/salprn-gtk.cxx b/vcl/unx/gtk/salprn-gtk.cxx
index eab182ecb4c5..c3be7e405451 100644
--- a/vcl/unx/gtk/salprn-gtk.cxx
+++ b/vcl/unx/gtk/salprn-gtk.cxx
@@ -918,13 +918,10 @@ GtkPrintDialog::impl_readFromSettings()
const OUString aCollate(pItem->getValue(aPrintDialogStr,
"Collate"));
- bool bChanged(false);
-
const gint nOldCopyCount(m_xWrapper->print_settings_get_n_copies(pSettings));
const sal_Int32 nCopyCount(aCopyCount.toInt32());
if (nCopyCount > 0 && nOldCopyCount != nCopyCount)
{
- bChanged = true;
m_xWrapper->print_settings_set_n_copies(pSettings, sal::static_int_cast<gint>(nCopyCount));
}
@@ -932,11 +929,8 @@ GtkPrintDialog::impl_readFromSettings()
const bool bCollate(aCollate.equalsIgnoreAsciiCase("true"));
if (bOldCollate != bCollate)
{
- bChanged = true;
m_xWrapper->print_settings_set_collate(pSettings, bCollate);
}
- // TODO: what was this variable meant for?
- (void) bChanged;
m_xWrapper->print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog), pSettings);
g_object_unref(G_OBJECT(pSettings));
diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx
index 1d3de2c1779e..c3798d9bad58 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -93,13 +93,7 @@ void FontTable::lcl_attribute(Id Name, Value & val)
m_pImpl->pCurrentEntry->nTextEncoding = RTL_TEXTENCODING_SYMBOL;
break;
}
- default:
- {
- //----> debug
- int nVal = val.getInt();
- ++nVal;
- //<---- debug
- }
+ default: ;
}
}
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index effda87f8ade..0e01c2e5872e 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -554,7 +554,6 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream)
static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXml";
bool bFound = false;
- sal_Int32 counter = 0;
uno::Sequence<uno::Sequence< beans::StringPair>> aSeqs = xRelationshipAccess->getAllRelationships();
std::vector<uno::Reference<xml::dom::XDocument>> aCustomXmlDomList;
std::vector<uno::Reference<xml::dom::XDocument>> aCustomXmlDomPropsList;
@@ -586,7 +585,6 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream)
{
aCustomXmlDomList.push_back(customXmlTemp);
aCustomXmlDomPropsList.push_back(mxCustomXmlProsDom);
- counter++;
resolveFastSubStream(rStream, OOXMLStream::CUSTOMXML);
}
@@ -628,7 +626,6 @@ void OOXMLDocumentImpl::resolveGlossaryStream(Stream & /*rStream*/)
uno::Sequence< uno::Sequence< beans::StringPair > >aSeqs = xRelationshipAccess->getAllRelationships();
std::vector< uno::Sequence<uno::Any> > aGlossaryDomList;
- sal_Int32 counter = 0;
for (sal_Int32 j = 0; j < aSeqs.getLength(); j++)
{
OOXMLStream::Pointer_t gStream;
@@ -704,7 +701,6 @@ void OOXMLDocumentImpl::resolveGlossaryStream(Stream & /*rStream*/)
glossaryTuple[3] <<= gTarget;
glossaryTuple[4] <<= contentType;
aGlossaryDomList.push_back(glossaryTuple);
- counter++;
}
}
}
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index eac4adc7a39e..ac464c6d02c3 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -118,7 +118,6 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
IndexFolderIterator aIndexFolderIt( *pDatabases, m_aURLParameter.get_module(), m_aURLParameter.get_language() );
OUString idxDir;
bool bExtension = false;
- int iDir = 0;
vector< vector<HitItem> > aIndexFolderResultVectorVector;
bool bTemporary;
@@ -240,8 +239,6 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
SAL_WARN("xmlhelp", e);
}
- ++iDir;
-
if( bTemporary )
aIndexFolderIt.deleteTempIndexFolder( idxDir );