diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 15:23:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-17 08:25:47 +0200 |
commit | ccb2a1f650bc505f8a4f1abebf8ce4f9396562a8 (patch) | |
tree | 2ee2fd4f300ae95cf23bade1f242e02f9b276c07 /forms | |
parent | da5c3a1ee43dd1a07cbd1b8005488bf05432593d (diff) |
clang-tidy readability-redundant-smartptr-get
redundant get() call on smart pointer
Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd
Reviewed-on: https://gerrit.libreoffice.org/61837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/ComboBox.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/Edit.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/ImageControl.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/Pattern.cxx | 10 | ||||
-rw-r--r-- | forms/source/misc/InterfaceContainer.cxx | 25 | ||||
-rw-r--r-- | forms/source/richtext/richtextcontrol.cxx | 4 | ||||
-rw-r--r-- | forms/source/richtext/richtextmodel.cxx | 10 | ||||
-rw-r--r-- | forms/source/xforms/datatypes.cxx | 2 | ||||
-rw-r--r-- | forms/source/xforms/propertysetbase.cxx | 3 |
9 files changed, 44 insertions, 32 deletions
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index c0561c5a62d4..ce94ba6d846d 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -736,8 +736,9 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) { try { - OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::commitControlValueToDbColumn: no value formatter!" ); - if ( m_pValueFormatter.get() ) + OSL_PRECOND(m_pValueFormatter, + "OComboBoxModel::commitControlValueToDbColumn: no value formatter!"); + if (m_pValueFormatter) { if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) return false; @@ -790,8 +791,9 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) Any OComboBoxModel::translateDbColumnToControlValue() { - OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::translateDbColumnToControlValue: no value formatter!" ); - if ( m_pValueFormatter.get() ) + OSL_PRECOND(m_pValueFormatter, + "OComboBoxModel::translateDbColumnToControlValue: no value formatter!"); + if (m_pValueFormatter) { OUString sValue( m_pValueFormatter->getFormattedValue() ); if ( sValue.isEmpty() diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index 600010321d7b..589b0e7ffd3b 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -634,10 +634,11 @@ bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) } else { - OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); + OSL_PRECOND(m_pValueFormatter, + "OEditModel::commitControlValueToDbColumn: no value formatter!"); try { - if ( m_pValueFormatter.get() ) + if (m_pValueFormatter) { if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) return false; @@ -657,9 +658,10 @@ bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) Any OEditModel::translateDbColumnToControlValue() { - OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" ); + OSL_PRECOND(m_pValueFormatter, + "OEditModel::translateDbColumnToControlValue: no value formatter!"); Any aRet; - if ( m_pValueFormatter.get() ) + if (m_pValueFormatter) { OUString sValue( m_pValueFormatter->getFormattedValue() ); if ( sValue.isEmpty() diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 2f8feff4a38a..97b4c60a2ede 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -402,7 +402,7 @@ bool OImageControlModel::impl_updateStreamForURL_lck( const OUString& _rURL, Val else { pImageStream = ::utl::UcbStreamHelper::CreateStream( _rURL, StreamMode::READ ); - bool bSetNull = ( pImageStream.get() == nullptr ) || ( ERRCODE_NONE != pImageStream->GetErrorCode() ); + bool bSetNull = (pImageStream == nullptr) || (ERRCODE_NONE != pImageStream->GetErrorCode()); if ( !bSetNull ) { diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx index 07d1c9467936..eddcfbf19ba7 100644 --- a/forms/source/component/Pattern.cxx +++ b/forms/source/component/Pattern.cxx @@ -130,8 +130,9 @@ bool OPatternModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) } else { - OSL_ENSURE( m_pFormattedValue.get(), "OPatternModel::commitControlValueToDbColumn: no value helper!" ); - if ( !m_pFormattedValue.get() ) + OSL_ENSURE(m_pFormattedValue, + "OPatternModel::commitControlValueToDbColumn: no value helper!"); + if (!m_pFormattedValue) return false; if ( !m_pFormattedValue->setFormattedValue( sNewValue ) ) @@ -167,9 +168,10 @@ void OPatternModel::onDisconnectedDbColumn() Any OPatternModel::translateDbColumnToControlValue() { - OSL_PRECOND( m_pFormattedValue.get(), "OPatternModel::translateDbColumnToControlValue: no value helper!" ); + OSL_PRECOND(m_pFormattedValue, + "OPatternModel::translateDbColumnToControlValue: no value helper!"); - if ( m_pFormattedValue.get() ) + if (m_pFormattedValue) { OUString sValue( m_pFormattedValue->getFormattedValue() ); if ( sValue.isEmpty() diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index ac7049c08d62..2f2a9bf13636 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -916,7 +916,8 @@ void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any // approve the new object std::unique_ptr< ElementDescription > aElementMetaData( createElementMetaData() ); - DBG_ASSERT( aElementMetaData.get(), "OInterfaceContainer::implReplaceByIndex: createElementMetaData returned nonsense!" ); + DBG_ASSERT(aElementMetaData, + "OInterfaceContainer::implReplaceByIndex: createElementMetaData returned nonsense!"); { Reference< XPropertySet > xElementProps; _rNewElement >>= xElementProps; @@ -956,27 +957,30 @@ void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any // examine the new element OUString sName; - DBG_ASSERT( aElementMetaData.get()->xPropertySet.is(), "OInterfaceContainer::implReplaceByIndex: what did approveNewElement do?" ); + DBG_ASSERT(aElementMetaData->xPropertySet.is(), + "OInterfaceContainer::implReplaceByIndex: what did approveNewElement do?"); - aElementMetaData.get()->xPropertySet->getPropertyValue(PROPERTY_NAME) >>= sName; - aElementMetaData.get()->xPropertySet->addPropertyChangeListener(PROPERTY_NAME, this); + aElementMetaData->xPropertySet->getPropertyValue(PROPERTY_NAME) >>= sName; + aElementMetaData->xPropertySet->addPropertyChangeListener(PROPERTY_NAME, this); // insert the new one - m_aMap.insert( ::std::pair<const OUString, css::uno::Reference<css::uno::XInterface> >( sName, aElementMetaData.get()->xInterface ) ); - m_aItems[ _nIndex ] = aElementMetaData.get()->xInterface; + m_aMap.insert(::std::pair<const OUString, css::uno::Reference<css::uno::XInterface>>( + sName, aElementMetaData->xInterface)); + m_aItems[_nIndex] = aElementMetaData->xInterface; - aElementMetaData.get()->xChild->setParent(static_cast<XContainer*>(this)); + aElementMetaData->xChild->setParent(static_cast<XContainer*>(this)); if ( m_xEventAttacher.is() ) { m_xEventAttacher->insertEntry( _nIndex ); - m_xEventAttacher->attach( _nIndex, aElementMetaData.get()->xInterface, makeAny( aElementMetaData.get()->xPropertySet ) ); + m_xEventAttacher->attach(_nIndex, aElementMetaData->xInterface, + makeAny(aElementMetaData->xPropertySet)); } ContainerEvent aReplaceEvent; aReplaceEvent.Source = static_cast< XContainer* >( this ); aReplaceEvent.Accessor <<= _nIndex; - aReplaceEvent.Element = aElementMetaData.get()->xInterface->queryInterface( m_aElementType ); + aReplaceEvent.Element = aElementMetaData->xInterface->queryInterface(m_aElementType); aReplaceEvent.ReplacedElement = xOldElement->queryInterface( m_aElementType ); impl_replacedElement( aReplaceEvent, _rClearBeforeNotify ); @@ -1064,7 +1068,8 @@ void SAL_CALL OInterfaceContainer::insertByName(const OUString& _rName, const An Reference< XPropertySet > xElementProps; std::unique_ptr< ElementDescription > aElementMetaData( createElementMetaData() ); - DBG_ASSERT( aElementMetaData.get(), "OInterfaceContainer::insertByName: createElementMetaData returned nonsense!" ); + DBG_ASSERT(aElementMetaData, + "OInterfaceContainer::insertByName: createElementMetaData returned nonsense!"); // ensure the correct name of the element try diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 7962c7b9bf5d..0d90d3541e60 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -638,11 +638,11 @@ namespace frm { AttributeDispatchers::iterator aDispatcherPos = m_aDispatchers.find( SID_COPY ); if ( aDispatcherPos != m_aDispatchers.end() ) - aDispatcherPos->second.get()->invalidate(); + aDispatcherPos->second->invalidate(); aDispatcherPos = m_aDispatchers.find( SID_CUT ); if ( aDispatcherPos != m_aDispatchers.end() ) - aDispatcherPos->second.get()->invalidate(); + aDispatcherPos->second->invalidate(); } diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index cca527d17578..ba25affe199f 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -122,8 +122,8 @@ namespace frm void ORichTextModel::implInit() { - OSL_ENSURE( m_pEngine.get(), "ORichTextModel::implInit: where's the engine?" ); - if ( m_pEngine.get() ) + OSL_ENSURE(m_pEngine, "ORichTextModel::implInit: where's the engine?"); + if (m_pEngine) { m_pEngine->SetModifyHdl( LINK( this, ORichTextModel, OnEngineContentModified ) ); @@ -201,7 +201,7 @@ namespace frm acquire(); dispose(); } - if ( m_pEngine.get() ) + if (m_pEngine) { SolarMutexGuard g; SfxItemPool* pPool = m_pEngine->getPool(); @@ -485,7 +485,7 @@ namespace frm void ORichTextModel::impl_smlock_setEngineText( const OUString& _rText ) { - if ( m_pEngine.get() ) + if (m_pEngine) { SolarMutexGuard aSolarGuard; m_bSettingEngineText = true; @@ -584,7 +584,7 @@ namespace frm void ORichTextModel::potentialTextChange( ) { OUString sCurrentEngineText; - if ( m_pEngine.get() ) + if (m_pEngine) sCurrentEngineText = m_pEngine->GetText(); if ( sCurrentEngineText != m_sLastKnownEngineText ) diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 55ceeac78f14..acae26c8e69f 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -228,7 +228,7 @@ namespace xforms } // let it match the string - if ( !lcl_matchString( *m_pPatternMatcher.get(), _rValue ) ) + if (!lcl_matchString(*m_pPatternMatcher, _rValue)) return RID_STR_XFORMS_PATTERN_DOESNT_MATCH; } diff --git a/forms/source/xforms/propertysetbase.cxx b/forms/source/xforms/propertysetbase.cxx index 393182c2f8f1..d9609640c7f6 100644 --- a/forms/source/xforms/propertysetbase.cxx +++ b/forms/source/xforms/propertysetbase.cxx @@ -69,7 +69,8 @@ Reference< XPropertySetInfo > SAL_CALL PropertySetBase::getPropertySetInfo( ) void PropertySetBase::registerProperty( const Property& rProperty, const ::rtl::Reference< PropertyAccessorBase >& rAccessor ) { - OSL_ENSURE( rAccessor.get(), "PropertySetBase::registerProperty: invalid property accessor, this will crash!" ); + OSL_ENSURE(rAccessor, + "PropertySetBase::registerProperty: invalid property accessor, this will crash!"); m_aAccessors.emplace( rProperty.Handle, rAccessor ); OSL_ENSURE( rAccessor->isWriteable() |