summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-02-02 19:19:19 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-02-03 02:17:32 +0000
commitbd76d319bbda17f242e64b042027077e84c0f1d9 (patch)
tree56461ec91801dfd18af86929dca04ea6505ba533 /sc
parent32096592fcf067d50e22090135b542325f5e3e62 (diff)
remove bogus nullprt checks for pContext
reported by Cppcheck Change-Id: I737c2bd7be197ef9d0b29b922acd8021fefb7af6 Signed-off-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-on: https://gerrit.libreoffice.org/22059 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/XMLTableShapesContext.cxx19
-rw-r--r--sc/source/filter/xml/xmlcoli.cxx7
-rw-r--r--sc/source/filter/xml/xmlconti.cxx7
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx49
-rw-r--r--sc/source/filter/xml/xmldrani.cxx21
5 files changed, 20 insertions, 83 deletions
diff --git a/sc/source/filter/xml/XMLTableShapesContext.cxx b/sc/source/filter/xml/XMLTableShapesContext.cxx
index 05530fcf2b29..53389bb41991 100644
--- a/sc/source/filter/xml/XMLTableShapesContext.cxx
+++ b/sc/source/filter/xml/XMLTableShapesContext.cxx
@@ -42,19 +42,16 @@ SvXMLImportContext *ScXMLTableShapesContext::CreateChildContext( sal_uInt16 nPre
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{
- SvXMLImportContext *pContext(nullptr);
+ SvXMLImportContext *pContext = nullptr;
- if (!pContext)
+ ScXMLImport& rXMLImport(GetScImport());
+ uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
+ if (xShapes.is())
{
- ScXMLImport& rXMLImport(GetScImport());
- uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
- if (xShapes.is())
- {
- XMLTableShapeImportHelper* pTableShapeImport(static_cast<XMLTableShapeImportHelper*>(rXMLImport.GetShapeImport().get()));
- pTableShapeImport->SetOnTable(true);
- pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
- rXMLImport, nPrefix, rLName, xAttrList, xShapes);
- }
+ XMLTableShapeImportHelper* pTableShapeImport(static_cast<XMLTableShapeImportHelper*>(rXMLImport.GetShapeImport().get()));
+ pTableShapeImport->SetOnTable(true);
+ pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
+ rXMLImport, nPrefix, rLName, xAttrList, xShapes);
}
if( !pContext )
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 2f88e644083d..bd1de55afdcb 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -94,12 +94,7 @@ SvXMLImportContext *ScXMLTableColContext::CreateChildContext( sal_uInt16 nPrefix
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLTableColContext::EndElement()
diff --git a/sc/source/filter/xml/xmlconti.cxx b/sc/source/filter/xml/xmlconti.cxx
index de74e8148c06..800cfd41cc7a 100644
--- a/sc/source/filter/xml/xmlconti.cxx
+++ b/sc/source/filter/xml/xmlconti.cxx
@@ -48,8 +48,6 @@ SvXMLImportContext *ScXMLContentContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{
- SvXMLImportContext *pContext = nullptr;
-
if ((nPrefix == XML_NAMESPACE_TEXT) && IsXMLToken(rLName, XML_S))
{
sal_Int32 nRepeat(0);
@@ -71,10 +69,7 @@ SvXMLImportContext *ScXMLContentContext::CreateChildContext( sal_uInt16 nPrefix,
sOUText.append(' ');
}
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );;
}
void ScXMLContentContext::Characters( const OUString& rChars )
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 61e3db86d9da..891db2223f1a 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -634,12 +634,7 @@ SvXMLImportContext *ScXMLDPSourceSQLContext::CreateChildContext( sal_uInt16 nPre
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDPSourceSQLContext::EndElement()
@@ -688,12 +683,7 @@ SvXMLImportContext *ScXMLDPSourceTableContext::CreateChildContext( sal_uInt16 nP
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDPSourceTableContext::EndElement()
@@ -742,12 +732,7 @@ SvXMLImportContext *ScXMLDPSourceQueryContext::CreateChildContext( sal_uInt16 nP
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDPSourceQueryContext::EndElement()
@@ -811,12 +796,7 @@ SvXMLImportContext *ScXMLSourceServiceContext::CreateChildContext( sal_uInt16 nP
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLSourceServiceContext::EndElement()
@@ -1567,12 +1547,7 @@ SvXMLImportContext *ScXMLDataPilotSubTotalContext::CreateChildContext( sal_uInt1
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDataPilotSubTotalContext::EndElement()
@@ -1676,12 +1651,7 @@ SvXMLImportContext *ScXMLDataPilotMemberContext::CreateChildContext( sal_uInt16
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDataPilotMemberContext::EndElement()
@@ -1905,12 +1875,7 @@ SvXMLImportContext *ScXMLDataPilotGroupMemberContext::CreateChildContext( sal_uI
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDataPilotGroupMemberContext::EndElement()
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 22a4f7622afd..476ec86409c4 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -723,12 +723,7 @@ SvXMLImportContext *ScXMLConResContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLConResContext::EndElement()
@@ -881,12 +876,7 @@ SvXMLImportContext *ScXMLSortGroupsContext::CreateChildContext( sal_uInt16 nPref
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLSortGroupsContext::EndElement()
@@ -997,12 +987,7 @@ SvXMLImportContext *ScXMLSubTotalFieldContext::CreateChildContext( sal_uInt16 nP
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
-
- return pContext;
+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLSubTotalFieldContext::EndElement()