summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-04 14:34:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-11 09:48:10 +0200
commit49eb02f07a5af44da59008a238e828b4a9532bef (patch)
tree43c4b4eaacd79fe0bff784a4ef71f4c1080c3912 /sw
parent5823ecd54b16974ffe8821a5ae061cd0ecc4cf84 (diff)
new loplugin:unusedvariablemore
collection of heuristics to look for local variables that are never read from i.e. do not contribute to the surrounding logic This is an expensive plugin, since it walks up the parent tree, so it is off by default. Change-Id: Ib8ba292241bd16adf299e8bba4502cb473513a06 Reviewed-on: https://gerrit.libreoffice.org/52450 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/docbasic.cxx5
-rw-r--r--sw/source/core/undo/unins.cxx3
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx5
-rw-r--r--sw/source/core/unocore/unofield.cxx4
-rw-r--r--sw/source/filter/html/htmlftn.cxx4
-rw-r--r--sw/source/filter/html/htmlplug.cxx3
-rw-r--r--sw/source/filter/html/swhtml.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx4
-rw-r--r--sw/source/filter/xml/xmltbli.cxx6
-rw-r--r--sw/source/uibase/shells/tabsh.cxx4
10 files changed, 6 insertions, 36 deletions
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index dba0e27a94d7..09fc7b9b2117 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -74,7 +74,6 @@ static Sequence<Any> *lcl_docbasic_convertArgs( SbxArray& rArgs )
void SwDoc::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs )
{
- ErrCode eErr = ERRCODE_NONE;
switch( rMacro.GetScriptType() )
{
case STARBASIC:
@@ -82,7 +81,7 @@ void SwDoc::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs )
SbxBaseRef aRef;
SbxValue* pRetValue = new SbxValue;
aRef = pRetValue;
- eErr = mpDocShell->CallBasic( rMacro.GetMacName(),
+ mpDocShell->CallBasic( rMacro.GetMacName(),
rMacro.GetLibName(),
pArgs, pRet ? pRetValue : nullptr );
@@ -119,7 +118,7 @@ void SwDoc::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs )
SAL_INFO("sw", "SwDoc::ExecMacro URL is " << rMacro.GetMacName() );
- eErr = mpDocShell->CallXScript(
+ mpDocShell->CallXScript(
rMacro.GetMacName(), *pUnoArgs, aRet, aOutArgsIndex, aOutArgs);
break;
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index c721330682d2..59c28db7188b 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -68,9 +68,6 @@ boost::optional<OUString> SwUndoInsert::GetTextFromDoc() const
SwNodeIndex aNd( pDoc->GetNodes(), nNode);
SwContentNode* pCNd = aNd.GetNode().GetContentNode();
- SwPaM aPaM( *pCNd, nContent );
-
- aPaM.SetMark();
if( pCNd->IsTextNode() )
{
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 4dc670aab746..ad54ef7383e1 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1214,7 +1214,6 @@ void makeRedline( SwPaM const & rPaM,
if (aRevertProperties.getLength())
{
SwDoc *const pDoc = rPaM.GetDoc();
- OUString aUnknownExMsg, aPropertyVetoExMsg;
// Build set of attributes we want to fetch
std::vector<sal_uInt16> aWhichPairs;
@@ -1225,15 +1224,13 @@ void makeRedline( SwPaM const & rPaM,
const OUString &rPropertyName = aRevertProperties[i].Name;
SfxItemPropertySimpleEntry const* pEntry = rPropSet.getPropertyMap().getByName(rPropertyName);
- // Queue up any exceptions until the end ...
if (!pEntry)
{
- aUnknownExMsg += "Unknown property: '" + rPropertyName + "' ";
+ // unknown property
break;
}
else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
- aPropertyVetoExMsg += "Property is read-only: '" + rPropertyName + "' ";
break;
}
else
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 436f437b7c8c..030125a8f44b 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2341,10 +2341,6 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
{
sal_Int32 nHiddenStart;
sal_Int32 nHiddenEnd;
-
- SwPosition aPosition( pTextField->GetTextNode() );
- aPosition.nContent = pTextField->GetStart();
-
bHidden = SwScriptInfo::GetBoundsOfHiddenRange( pTextField->GetTextNode(),
pTextField->GetStart(),
nHiddenStart, nHiddenEnd );
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 56ba83a50100..d52b69493844 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -320,16 +320,14 @@ void SwHTMLWriter::OutFootEndNotes()
{
m_pFormatFootnote = &pTextFootnote->GetFootnote();
- OUString sFootnoteName, sClass;
+ OUString sFootnoteName;
if( m_pFormatFootnote->IsEndNote() )
{
- sClass = OOO_STRING_SVTOOLS_HTML_sdendnote;
sFootnoteName = OOO_STRING_SVTOOLS_HTML_sdendnote;
sFootnoteName += OUString::number(static_cast<sal_Int32>(++m_nEndNote));
}
else
{
- sClass = OOO_STRING_SVTOOLS_HTML_sdfootnote;
sFootnoteName = OOO_STRING_SVTOOLS_HTML_sdfootnote;
sFootnoteName += OUString::number(static_cast<sal_Int32>(++m_nFootNote));
}
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 296b68a3b901..aa9ef4557bf0 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -604,7 +604,7 @@ bool SwHTMLParser::InsertEmbed()
void SwHTMLParser::NewObject()
{
OUString aClassID;
- OUString aName, aStandBy, aId, aStyle, aClass;
+ OUString aStandBy, aId, aStyle, aClass;
Size aSize( USHRT_MAX, USHRT_MAX );
Size aSpace( 0, 0 );
sal_Int16 eVertOri = text::VertOrientation::TOP;
@@ -666,7 +666,6 @@ void SwHTMLParser::NewObject()
case HtmlOptionId::USEMAP:
break;
case HtmlOptionId::NAME:
- aName = rOption.GetString();
break;
case HtmlOptionId::HSPACE:
aSpace.setWidth( static_cast<long>(rOption.GetNumber()) );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 63c6c8c53ea5..87874f9a345d 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -4852,7 +4852,6 @@ void SwHTMLParser::NewCharFormat( HtmlTokenId nToken )
void SwHTMLParser::InsertSpacer()
{
// and if applicable change it via the options
- OUString aId;
sal_Int16 eVertOri = text::VertOrientation::TOP;
sal_Int16 eHoriOri = text::HoriOrientation::NONE;
Size aSize( 0, 0);
@@ -4867,9 +4866,6 @@ void SwHTMLParser::InsertSpacer()
const HTMLOption& rOption = rHTMLOptions[--i];
switch( rOption.GetToken() )
{
- case HtmlOptionId::ID:
- aId = rOption.GetString();
- break;
case HtmlOptionId::TYPE:
rOption.GetEnum( nType, aHTMLSpacerTypeTable );
break;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index f47be7dcfcda..5c27518b87b6 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1937,8 +1937,6 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr )
// "EMBED"
eF_ResT SwWW8ImplReader::Read_F_Embedd( WW8FieldDesc*, OUString& rStr )
{
- OUString sHost;
-
WW8ReadFieldParams aReadParam( rStr );
for (;;)
{
@@ -1948,7 +1946,7 @@ eF_ResT SwWW8ImplReader::Read_F_Embedd( WW8FieldDesc*, OUString& rStr )
switch( nRet )
{
case -2:
- sHost = aReadParam.GetResult();
+ // sHost
break;
case 's':
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index b6ca8c3848a7..989fe07af328 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -610,7 +610,6 @@ SvXMLImportContextRef SwXMLTableCellContext_Impl::CreateChildContext(
{
SvXMLImportContext *pContext = nullptr;
- OUString sXmlId;
bool bSubTable = false;
if( XML_NAMESPACE_TABLE == nPrefix &&
IsXMLToken( rLocalName, XML_TABLE ) )
@@ -630,11 +629,6 @@ SvXMLImportContextRef SwXMLTableCellContext_Impl::CreateChildContext(
{
bSubTable = true;
}
- else if ( (XML_NAMESPACE_XML == nPrefix2) &&
- IsXMLToken( aLocalName, XML_ID ) )
- {
- sXmlId = xAttrList->getValueByIndex( i );
- }
//FIXME: RDFa
}
}
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index e8d6de529462..ba3291f465c5 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1133,7 +1133,6 @@ void SwTableShell::Execute(SfxRequest &rReq)
}
// Now the slots which are working directly on the TableFormat.
- SwFrameFormat *pFormat = rSh.GetTableFormat();
switch ( nSlot )
{
case SID_ATTR_ULSPACE:
@@ -1153,9 +1152,6 @@ void SwTableShell::Execute(SfxRequest &rReq)
SvxLRSpaceItem aLRSpace( *static_cast<const SvxLRSpaceItem*>(pItem) );
aLRSpace.SetWhich( RES_LR_SPACE );
aSet.Put( aLRSpace );
- SwFormatHoriOrient aHori( pFormat->GetHoriOrient() );
- aHori.SetHoriOrient( text::HoriOrientation::NONE );
- aSet.Put( aLRSpace );
rSh.SetTableAttr( aSet );
}
break;