summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:03:58 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-06-08 01:29:32 +0200
commit5708534b942c1d0ce384f6a8473da6bb569410e7 (patch)
tree2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /reportdesign
parent1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff)
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned to the value. Idea from tml. Used the following script to find places: git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()' Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969 Reviewed-on: https://gerrit.libreoffice.org/55417 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/core/api/FormattedField.cxx15
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx3
-rw-r--r--reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx2
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx13
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx1
5 files changed, 10 insertions, 24 deletions
diff --git a/reportdesign/source/core/api/FormattedField.cxx b/reportdesign/source/core/api/FormattedField.cxx
index 72a300e8876d..80068d54bd8b 100644
--- a/reportdesign/source/core/api/FormattedField.cxx
+++ b/reportdesign/source/core/api/FormattedField.cxx
@@ -216,16 +216,13 @@ uno::Reference< util::XCloneable > SAL_CALL OFormattedField::createClone( )
uno::Reference< report::XReportComponent> xSource = this;
uno::Reference< report::XFormattedField> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FORMATTEDFIELD),uno::UNO_QUERY_THROW);
- if ( xSet.is() )
+ ::std::vector< uno::Reference< report::XFormatCondition> >::const_iterator aIter = m_aProps.m_aFormatConditions.begin();
+ ::std::vector< uno::Reference< report::XFormatCondition> >::const_iterator aEnd = m_aProps.m_aFormatConditions.end();
+ for (sal_Int32 i = 0; aIter != aEnd; ++aIter,++i)
{
- ::std::vector< uno::Reference< report::XFormatCondition> >::const_iterator aIter = m_aProps.m_aFormatConditions.begin();
- ::std::vector< uno::Reference< report::XFormatCondition> >::const_iterator aEnd = m_aProps.m_aFormatConditions.end();
- for (sal_Int32 i = 0; aIter != aEnd; ++aIter,++i)
- {
- uno::Reference< report::XFormatCondition > xCond = xSet->createFormatCondition();
- ::comphelper::copyProperties(aIter->get(),xCond.get());
- xSet->insertByIndex(i,uno::makeAny(xCond));
- }
+ uno::Reference< report::XFormatCondition > xCond = xSet->createFormatCondition();
+ ::comphelper::copyProperties(aIter->get(),xCond.get());
+ xSet->insertByIndex(i,uno::makeAny(xCond));
}
return xSet.get();
}
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 29028f1459af..80f25884cf28 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -328,7 +328,6 @@ void ORptExport::exportFunctions(const Reference<XIndexAccess>& _xFunctions)
for (sal_Int32 i = 0; i< nCount; ++i)
{
uno::Reference< report::XFunction> xFunction(_xFunctions->getByIndex(i),uno::UNO_QUERY_THROW);
- OSL_ENSURE(xFunction.is(),"Function object is NULL!");
exportFunction(xFunction);
}
}
@@ -1346,8 +1345,6 @@ SvXMLAutoStylePoolP* ORptExport::CreateAutoStylePool()
void SAL_CALL ORptExport::setSourceDocument( const Reference< XComponent >& xDoc )
{
m_xReportDefinition.set(xDoc,UNO_QUERY_THROW);
- OSL_ENSURE(m_xReportDefinition.is(),"DataSource is NULL!");
-
SvXMLExport::setSourceDocument(xDoc);
}
diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
index af3b1787360f..63b8b2f94133 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
@@ -108,7 +108,7 @@ void SAL_CALL ImportDocumentHandler::endDocument()
{
m_xDelegatee->endDocument();
uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW);
- if ( xReceiver.is() && m_bImportedChart )
+ if ( m_bImportedChart )
{
// this fills the chart again
::comphelper::NamedValueCollection aArgs;
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 2e2bc8f07ed2..e49748177b70 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -443,9 +443,6 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
if ( bRet )
{
m_xReportDefinition.set(GetModel(),UNO_QUERY_THROW);
- OSL_ENSURE(m_xReportDefinition.is(),"ReportDefinition is NULL!");
- if ( !m_xReportDefinition.is() )
- return false;
#if OSL_DEBUG_LEVEL > 1
uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY );
@@ -1077,14 +1074,10 @@ const OUString& ORptFilter::convertFormula(const OUString& _sFormula)
void SAL_CALL ORptFilter::startDocument()
{
m_xReportDefinition.set(GetModel(),UNO_QUERY_THROW);
- OSL_ENSURE(m_xReportDefinition.is(),"ReportDefinition is NULL!");
- if ( m_xReportDefinition.is() )
- {
- m_pReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition);
- OSL_ENSURE(m_pReportModel,"Report model is NULL!");
+ m_pReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition);
+ OSL_ENSURE(m_pReportModel,"Report model is NULL!");
- SvXMLImport::startDocument();
- }
+ SvXMLImport::startDocument();
}
void ORptFilter::endDocument()
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 66bf2ec329a5..79ceeb9da8c3 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -537,7 +537,6 @@ void NavigatorTree::traverseSection(const uno::Reference< report::XSection>& _xS
for (sal_Int32 i = 0; i < nCount; ++i)
{
uno::Reference< report::XReportComponent> xElement(_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
- OSL_ENSURE(xElement.is(),"Found report element which is NULL!");
insertEntry(lcl_getName(xElement.get()),pSection,lcl_getImageId(xElement),TREELIST_APPEND,new UserData(this,xElement));
uno::Reference< report::XReportDefinition> xSubReport(xElement,uno::UNO_QUERY);
if ( xSubReport.is() )