diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-02-02 19:19:19 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-02-03 02:17:32 +0000 |
commit | bd76d319bbda17f242e64b042027077e84c0f1d9 (patch) | |
tree | 56461ec91801dfd18af86929dca04ea6505ba533 | |
parent | 32096592fcf067d50e22090135b542325f5e3e62 (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>
-rw-r--r-- | dbaccess/source/filter/xml/xmlfilter.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableShapesContext.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcoli.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlconti.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/xml/xmldpimp.cxx | 49 | ||||
-rw-r--r-- | sc/source/filter/xml/xmldrani.cxx | 21 | ||||
-rw-r--r-- | xmloff/source/draw/ximpnote.cxx | 13 |
7 files changed, 30 insertions, 103 deletions
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 702ac846d6f3..5453f39ce916 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -700,15 +700,14 @@ const SvXMLTokenMap& ODBFilter::GetColumnElemTokenMap() const SvXMLImportContext* ODBFilter::CreateStylesContext(sal_uInt16 _nPrefix,const OUString& rLocalName, const uno::Reference< XAttributeList>& xAttrList, bool bIsAutoStyle ) { - SvXMLImportContext *pContext = nullptr; - if (!pContext) - { - pContext = new OTableStylesContext(*this, _nPrefix, rLocalName, xAttrList, bIsAutoStyle); - if (bIsAutoStyle) - SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext)); - else - SetStyles(static_cast<SvXMLStylesContext*>(pContext)); - } + SvXMLImportContext *pContext; + + pContext = new OTableStylesContext(*this, _nPrefix, rLocalName, xAttrList, bIsAutoStyle); + if (bIsAutoStyle) + SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext)); + else + SetStyles(static_cast<SvXMLStylesContext*>(pContext)); + return pContext; } 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() diff --git a/xmloff/source/draw/ximpnote.cxx b/xmloff/source/draw/ximpnote.cxx index 7f82c1f51173..23272f3e6730 100644 --- a/xmloff/source/draw/ximpnote.cxx +++ b/xmloff/source/draw/ximpnote.cxx @@ -96,17 +96,8 @@ SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList ) { - // OK, notes page is set on base class, objects can be imported on notes page - SvXMLImportContext *pContext = nullptr; - - // some special objects inside presentation:notes context - - - // call parent when no own context was created - if(!pContext) - pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); - - return pContext; + // no own context in notes, call parent + return SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); } void SdXMLNotesContext::EndElement() |