summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-03-06 14:40:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-09 11:33:43 +0100
commitabe39f7781f59b96c5a8d3dd5b41c60fdf04ad84 (patch)
tree0f72d1968e5f25e3f280688a414398e3f4a7cce8 /dbaccess
parentbdb1c72198f60fdd91460e26282134d43bc0e2df (diff)
improve loplugin:unusedfields
noticed something that wasn't being picked up, wrote some tests, and found an unhandled case in Plugin::getParentFunctionDecl Change-Id: I52b4ea273be6614e197392dfc4d6053bbc1704de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.cxx22
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.hxx4
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.cxx11
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.hxx1
4 files changed, 18 insertions, 20 deletions
diff --git a/dbaccess/source/filter/xml/xmlComponent.cxx b/dbaccess/source/filter/xml/xmlComponent.cxx
index 33bc12f00731..6bab5aa8f9cf 100644
--- a/dbaccess/source/filter/xml/xmlComponent.cxx
+++ b/dbaccess/source/filter/xml/xmlComponent.cxx
@@ -43,8 +43,10 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
,const OUString& _sComponentServiceName
) :
SvXMLImportContext( rImport )
- ,m_bAsTemplate(false)
{
+ OUString sName;
+ OUString sHREF;
+ bool bAsTemplate(false);
static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
sax_fastparser::FastAttributeList *pAttribList =
sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
@@ -55,38 +57,38 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
switch( aIter.getToken() )
{
case XML_ELEMENT(XLINK, XML_HREF):
- m_sHREF = sValue;
+ sHREF = sValue;
break;
case XML_ELEMENT(DB, XML_NAME):
case XML_ELEMENT(DB_OASIS, XML_NAME):
- m_sName = sValue;
+ sName = sValue;
// sanitize the name. Previously, we allowed to create forms/reports/queries which contain
// a / in their name, which nowadays is forbidden. To not lose such objects if they're contained
// in older files, we replace the slash with something less offending.
- m_sName = m_sName.replace( '/', '_' );
+ sName = sName.replace( '/', '_' );
break;
case XML_ELEMENT(DB, XML_AS_TEMPLATE):
case XML_ELEMENT(DB_OASIS, XML_AS_TEMPLATE):
- m_bAsTemplate = sValue == s_sTRUE;
+ bAsTemplate = sValue == s_sTRUE;
break;
default:
SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
}
- if ( !m_sHREF.isEmpty() && !m_sName.isEmpty() && _xParentContainer.is() )
+ if ( !sHREF.isEmpty() && !sName.isEmpty() && _xParentContainer.is() )
{
Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- {PROPERTY_NAME, Any(m_sName)}, // set as folder
- {PROPERTY_PERSISTENT_NAME, Any(m_sHREF.copy(m_sHREF.lastIndexOf('/')+1))},
- {PROPERTY_AS_TEMPLATE, Any(m_bAsTemplate)},
+ {PROPERTY_NAME, Any(sName)}, // set as folder
+ {PROPERTY_PERSISTENT_NAME, Any(sHREF.copy(sHREF.lastIndexOf('/')+1))},
+ {PROPERTY_AS_TEMPLATE, Any(bAsTemplate)},
}));
try
{
Reference< XMultiServiceFactory > xORB( _xParentContainer, UNO_QUERY_THROW );
Reference< XInterface > xComponent( xORB->createInstanceWithArguments( _sComponentServiceName, aArguments ) );
Reference< XNameContainer > xNameContainer( _xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( m_sName, makeAny( xComponent ) );
+ xNameContainer->insertByName( sName, makeAny( xComponent ) );
}
catch(Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlComponent.hxx b/dbaccess/source/filter/xml/xmlComponent.hxx
index 5cee3a2c381c..43eae3261f03 100644
--- a/dbaccess/source/filter/xml/xmlComponent.hxx
+++ b/dbaccess/source/filter/xml/xmlComponent.hxx
@@ -27,10 +27,6 @@ namespace dbaxml
class ODBFilter;
class OXMLComponent : public SvXMLImportContext
{
- OUString m_sName;
- OUString m_sHREF;
- bool m_bAsTemplate;
-
public:
OXMLComponent( ODBFilter& rImport
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
index 1accf38d9528..20d30d70df15 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
@@ -50,6 +50,7 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
,m_sCollectionServiceName(_sCollectionServiceName)
,m_sComponentServiceName(_sComponentServiceName)
{
+ OUString sName;
sax_fastparser::FastAttributeList *pAttribList =
sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
for (auto &aIter : *pAttribList)
@@ -59,13 +60,13 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_NAME:
- m_sName = sValue;
+ sName = sValue;
break;
default:
SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getNameFromToken(aIter.getToken()) << " value=" << aIter.toString());
}
}
- if ( !m_sName.isEmpty() && _xParentContainer.is() )
+ if ( !sName.isEmpty() && _xParentContainer.is() )
{
try
{
@@ -74,13 +75,13 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
{
Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- {"Name", Any(m_sName)}, // set as folder
+ {"Name", Any(sName)}, // set as folder
{"Parent", Any(_xParentContainer)},
}));
m_xContainer.set(xORB->createInstanceWithArguments(_sCollectionServiceName,aArguments),UNO_QUERY);
Reference<XNameContainer> xNameContainer(_xParentContainer,UNO_QUERY);
- if ( xNameContainer.is() && !xNameContainer->hasByName(m_sName) )
- xNameContainer->insertByName(m_sName,makeAny(m_xContainer));
+ if ( xNameContainer.is() && !xNameContainer->hasByName(sName) )
+ xNameContainer->insertByName(sName,makeAny(m_xContainer));
}
}
catch(Exception&)
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
index d1dbe0d3730f..ad7e7d39e848 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
@@ -30,7 +30,6 @@ namespace dbaxml
{
css::uno::Reference< css::container::XNameAccess > m_xContainer;
css::uno::Reference< css::beans::XPropertySet > m_xTable;
- OUString m_sName;
OUString m_sCollectionServiceName;
OUString m_sComponentServiceName;