diff options
66 files changed, 109 insertions, 67 deletions
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index 3b1800ed99f8..ad24412be5a2 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -69,7 +69,7 @@ namespace accessibility SvTreeListBox* AccessibleListBox::getListBox() const { - return static_cast< SvTreeListBox* >( const_cast<AccessibleListBox*>(this)->GetWindow() ); + return static_cast< SvTreeListBox* >( GetWindow() ); } void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx index ee3d904814a8..fba970761567 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx @@ -90,7 +90,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySe ::cppu::IPropertyArrayHelper& ChartTypeUnoDlg::getInfoHelper() { - return *const_cast<ChartTypeUnoDlg*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* ChartTypeUnoDlg::createArrayHelper( ) const diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 0996f9fec217..aad77d8e2f6c 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -703,7 +703,7 @@ void SAL_CALL Diagram::setFastPropertyValue( sal_Int32 nHandle, const Any& rValu if( rValue >>=nNewAngleDegree ) { sal_Int32 nHorizontal, nVertical; - ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical ); + ThreeDHelper::getRotationFromDiagram( this, nHorizontal, nVertical ); if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle ) nHorizontal = nNewAngleDegree; else diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index ee731e2938fc..3abf66a853b3 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -156,6 +156,48 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) { } } break; + case CK_DerivedToBase: + case CK_UncheckedDerivedToBase: + if (expr->getType()->isPointerType()) { + Expr const * e = expr->getSubExpr()->IgnoreParenImpCasts(); + while (isa<CXXConstCastExpr>(e)) { + auto cc = dyn_cast<CXXConstCastExpr>(e); + if (expr->getType()->getAs<PointerType>()->getPointeeType() + .isAtLeastAsQualifiedAs( + cc->getSubExpr()->getType() + ->getAs<PointerType>()->getPointeeType())) + { + report( + DiagnosticsEngine::Warning, + ("redundant const_cast from %0 to %1, result is" + " ultimately implictly cast to %2"), + cc->getExprLoc()) + << cc->getSubExprAsWritten()->getType() << cc->getType() + << expr->getType() << expr->getSourceRange(); + } + e = cc->getSubExpr()->IgnoreParenImpCasts(); + } + } else if (expr->getType()->isReferenceType()) { + Expr const * e = expr->getSubExpr()->IgnoreParenImpCasts(); + while (isa<CXXConstCastExpr>(e)) { + auto cc = dyn_cast<CXXConstCastExpr>(e); + if (expr->getType()->getAs<ReferenceType>()->getPointeeType() + .isAtLeastAsQualifiedAs( + cc->getSubExpr()->getType() + ->getAs<ReferenceType>()->getPointeeType())) + { + report( + DiagnosticsEngine::Warning, + ("redundant const_cast from %0 to %1, result is" + " ultimately implictly cast to %2"), + cc->getExprLoc()) + << cc->getSubExprAsWritten()->getType() << cc->getType() + << expr->getType() << expr->getSourceRange(); + } + e = cc->getSubExpr()->IgnoreParenImpCasts(); + } + } + break; default: break; } diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 04ddc3508ac0..3f9dfc9c9629 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -511,7 +511,7 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, Run ::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper() { - return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } void ODatabaseMetaDataResultSet::setProceduresMap() diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index 0ea33b25684b..a6ce0a481b4c 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -1135,7 +1135,7 @@ sal_Int32 SAL_CALL OEvoabResultSet::findColumn( const OUString& columnName ) thr ::cppu::IPropertyArrayHelper & OEvoabResultSet::getInfoHelper() { - return *const_cast<OEvoabResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } void SAL_CALL OEvoabResultSet::acquire() throw() diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 032ec33ef058..d952d48c557f 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -528,7 +528,7 @@ void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeExc ::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper() { - return *const_cast< OCommonStatement* >( this )->getArrayHelper(); + return *getArrayHelper(); } diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 1394f9361047..fd11265acc19 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -798,7 +798,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const IPropertyArrayHelper & OResultSet::getInfoHelper() { - return *const_cast<OResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index a1128455527f..86d882b704b7 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -230,7 +230,7 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce ::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() { - return *const_cast<OStatement_Base*>(this)->getArrayHelper(); + return *getArrayHelper(); } OResultSet* OStatement::createResultSet() diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx index dd71674f704c..4b1477440007 100644 --- a/connectivity/source/drivers/firebird/ResultSet.cxx +++ b/connectivity/source/drivers/firebird/ResultSet.cxx @@ -780,7 +780,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper() const IPropertyArrayHelper & OResultSet::getInfoHelper() { - return *const_cast<OResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } void SAL_CALL OResultSet::acquire() throw() diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx index 6f83c850bad2..9c56020ee84e 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx @@ -289,7 +289,7 @@ void SAL_CALL OStatementCommonBase::clearWarnings() throw(SQLException, RuntimeE ::cppu::IPropertyArrayHelper & OStatementCommonBase::getInfoHelper() { - return *const_cast<OStatementCommonBase*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OStatementCommonBase::convertFastPropertyValue( diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index 632a943bc6ea..79b263d0362c 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -106,7 +106,7 @@ void OHSQLTable::construct() ::cppu::IPropertyArrayHelper & OHSQLTable::getInfoHelper() { - return *static_cast<OHSQLTable_PROP*>(const_cast<OHSQLTable*>(this))->getArrayHelper(isNew() ? 1 : 0); + return *static_cast<OHSQLTable_PROP*>(this)->getArrayHelper(isNew() ? 1 : 0); } sdbcx::OCollection* OHSQLTable::createColumns(const TStringVector& _rNames) diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index b0a6b1f04e5d..838eaa88768d 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -622,7 +622,7 @@ void java_sql_Statement_Base::setCursorName(const OUString &_par0) throw(SQLExce ::cppu::IPropertyArrayHelper & java_sql_Statement_Base::getInfoHelper() { - return *const_cast<java_sql_Statement_Base*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool java_sql_Statement_Base::convertFastPropertyValue( diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index af3da44eafba..0ad6bb207f3e 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -891,7 +891,7 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::s ::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper() { - return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool java_sql_ResultSet::convertFastPropertyValue( diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx index 24241fc1e7c3..2ae8c25eb98b 100644 --- a/connectivity/source/drivers/kab/KStatement.cxx +++ b/connectivity/source/drivers/kab/KStatement.cxx @@ -506,7 +506,7 @@ void SAL_CALL KabCommonStatement::clearWarnings( ) throw(SQLException, RuntimeE ::cppu::IPropertyArrayHelper & KabCommonStatement::getInfoHelper() { - return *const_cast<KabCommonStatement*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool KabCommonStatement::convertFastPropertyValue( diff --git a/connectivity/source/drivers/mork/MCatalog.cxx b/connectivity/source/drivers/mork/MCatalog.cxx index a8692ba9ea86..88d4c2065730 100644 --- a/connectivity/source/drivers/mork/MCatalog.cxx +++ b/connectivity/source/drivers/mork/MCatalog.cxx @@ -105,7 +105,7 @@ Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException // allowed } - return const_cast<OCatalog*>(this)->m_pTables; + return m_pTables; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx index 40078e675846..d0c74f604c52 100644 --- a/connectivity/source/drivers/mork/MResultSet.cxx +++ b/connectivity/source/drivers/mork/MResultSet.cxx @@ -614,7 +614,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const IPropertyArrayHelper & OResultSet::getInfoHelper() { - return *const_cast<OResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OResultSet::convertFastPropertyValue( diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx index 12a672588e42..423d6c528a90 100644 --- a/connectivity/source/drivers/mork/MStatement.cxx +++ b/connectivity/source/drivers/mork/MStatement.cxx @@ -363,7 +363,7 @@ void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeExc ::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper() { - return *const_cast<OCommonStatement*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OCommonStatement::convertFastPropertyValue( diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index 8268773903fd..74a8744072d9 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -125,7 +125,7 @@ void OMySQLTable::construct() ::cppu::IPropertyArrayHelper & OMySQLTable::getInfoHelper() { - return *static_cast<OMySQLTable_PROP*>(const_cast<OMySQLTable*>(this))->getArrayHelper(isNew() ? 1 : 0); + return *static_cast<OMySQLTable_PROP*>(this)->getArrayHelper(isNew() ? 1 : 0); } sdbcx::OCollection* OMySQLTable::createColumns(const TStringVector& _rNames) diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 25105b06828e..a4d019dfaf72 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -729,7 +729,7 @@ OUString ODatabaseMetaDataResultSet::getCursorName() const throw(SQLException, R ::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper() { - return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue( diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index c3eadb098cc6..426b869c0224 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -1434,7 +1434,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const IPropertyArrayHelper & OResultSet::getInfoHelper() { - return *const_cast<OResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OResultSet::convertFastPropertyValue( diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index ca6cec3499c6..6ecadf402e87 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -915,7 +915,7 @@ void OStatement_Base::setUsingBookmarks(bool _bUseBookmark) ::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() { - return *const_cast<OStatement_Base*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OStatement_Base::convertFastPropertyValue( diff --git a/connectivity/source/sdbcx/VGroup.cxx b/connectivity/source/sdbcx/VGroup.cxx index c71f22e50fc8..1bf65b9e9804 100644 --- a/connectivity/source/sdbcx/VGroup.cxx +++ b/connectivity/source/sdbcx/VGroup.cxx @@ -86,7 +86,7 @@ void OGroup::disposing(void) ::cppu::IPropertyArrayHelper & OGroup::getInfoHelper() { - return *const_cast<OGroup*>(this)->getArrayHelper(); + return *getArrayHelper(); } Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, std::exception) diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx index ccd9e9b53881..59d820659538 100644 --- a/connectivity/source/sdbcx/VKey.cxx +++ b/connectivity/source/sdbcx/VKey.cxx @@ -148,7 +148,7 @@ void SAL_CALL OKey::disposing() ::cppu::IPropertyArrayHelper & OKey::getInfoHelper() { - return *const_cast<OKey*>(this)->getArrayHelper(isNew() ? 1 : 0); + return *getArrayHelper(isNew() ? 1 : 0); } Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns( ) throw(RuntimeException, std::exception) diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx index dffe47b8b611..7828c7e1fe12 100644 --- a/connectivity/source/sdbcx/VTable.cxx +++ b/connectivity/source/sdbcx/VTable.cxx @@ -220,7 +220,7 @@ cppu::IPropertyArrayHelper* OTable::createArrayHelper( sal_Int32 /*_nId*/ ) cons cppu::IPropertyArrayHelper & OTable::getInfoHelper() { - return *const_cast<OTable*>(this)->getArrayHelper(isNew() ? 1 : 0); + return *getArrayHelper(isNew() ? 1 : 0); } Reference< XPropertySet > SAL_CALL OTable::createDataDescriptor( ) throw(RuntimeException, std::exception) diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx index 393493b67dae..b74842c724eb 100644 --- a/connectivity/source/sdbcx/VUser.cxx +++ b/connectivity/source/sdbcx/VUser.cxx @@ -86,7 +86,7 @@ Sequence< Type > SAL_CALL OUser::getTypes( ) throw(RuntimeException, std::excep ::cppu::IPropertyArrayHelper & OUser::getInfoHelper() { - return *const_cast<OUser*>(this)->getArrayHelper(); + return *getArrayHelper(); } // XUser diff --git a/connectivity/source/sdbcx/VView.cxx b/connectivity/source/sdbcx/VView.cxx index be69eb632cf1..a1c9813b4a33 100644 --- a/connectivity/source/sdbcx/VView.cxx +++ b/connectivity/source/sdbcx/VView.cxx @@ -93,7 +93,7 @@ Any SAL_CALL OView::queryInterface( const Type & rType ) throw(RuntimeException, ::cppu::IPropertyArrayHelper & OView::getInfoHelper() { - return *const_cast<OView*>(this)->getArrayHelper(isNew() ? 1 : 0); + return *getArrayHelper(isNew() ? 1 : 0); } OUString SAL_CALL OView::getName() throw(::com::sun::star::uno::RuntimeException, std::exception) diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 54eecc0230a1..fdca9bcd10f6 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -969,7 +969,7 @@ void SvxBitmapTabPage::PointChanged( vcl::Window* pWindow, RECT_POINT ) vcl::Window* SvxBitmapTabPage::GetParentLabeledBy( const vcl::Window* pLabeled ) const { if (pLabeled == m_pLbBitmaps) - return const_cast<FixedText*>(m_pLbBitmapsHidden); + return m_pLbBitmapsHidden; else return SvxTabPage::GetParentLabeledBy (pLabeled); } diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 43acaa94e842..cad73d99295e 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -182,7 +182,7 @@ void SAL_CALL ORowSetBase::disposing(void) // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetBase::getInfoHelper() { - return *const_cast<ORowSetBase*>(this)->getArrayHelper(); + return *getArrayHelper(); } // XRow diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx index f61045458791..5966a9b27e3c 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx @@ -197,7 +197,7 @@ namespace dbmm ::cppu::IPropertyArrayHelper& SAL_CALL MacroMigrationDialogService::getInfoHelper() { - return *const_cast< MacroMigrationDialogService* >( this )->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* MacroMigrationDialogService::createArrayHelper( ) const diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 74aeeda682ea..c1f5fe73011e 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -413,7 +413,7 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i ::cppu::IPropertyArrayHelper& OQueryController::getInfoHelper() { - return *const_cast< OQueryController* >( this )->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OQueryController::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx index cf90db45463b..ec9594082bcf 100644 --- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx @@ -110,7 +110,7 @@ namespace dbaui ::cppu::IPropertyArrayHelper& OAdvancedSettingsDialog::getInfoHelper() { - return *const_cast<OAdvancedSettingsDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OAdvancedSettingsDialog::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx index bc1873982ea0..6c5d796872d1 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx @@ -82,7 +82,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo() thr ::cppu::IPropertyArrayHelper& ODBTypeWizDialog::getInfoHelper() { - return *const_cast<ODBTypeWizDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* ODBTypeWizDialog::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx index 15dcaa292158..4c46903fd03b 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx @@ -96,7 +96,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo( ::cppu::IPropertyArrayHelper& ODBTypeWizDialogSetup::getInfoHelper() { - return *const_cast<ODBTypeWizDialogSetup*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* ODBTypeWizDialogSetup::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx index 9f284263bb1e..475c66457157 100644 --- a/dbaccess/source/ui/uno/TableFilterDlg.cxx +++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx @@ -82,7 +82,7 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo() t ::cppu::IPropertyArrayHelper& OTableFilterDialog::getInfoHelper() { - return *const_cast<OTableFilterDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OTableFilterDialog::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx index e66d888c25a1..55bab9fcb5a2 100644 --- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx @@ -82,7 +82,7 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo() ::cppu::IPropertyArrayHelper& OUserSettingsDialog::getInfoHelper() { - return *const_cast<OUserSettingsDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OUserSettingsDialog::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx index f2f52d656174..d6f7a98d3188 100644 --- a/dbaccess/source/ui/uno/admindlg.cxx +++ b/dbaccess/source/ui/uno/admindlg.cxx @@ -82,7 +82,7 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI ::cppu::IPropertyArrayHelper& ODataSourcePropertyDialog::getInfoHelper() { - return *const_cast<ODataSourcePropertyDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* ODataSourcePropertyDialog::createArrayHelper( ) const diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx index df635164f7fe..ec22c959d384 100644 --- a/dbaccess/source/ui/uno/unosqlmessage.cxx +++ b/dbaccess/source/ui/uno/unosqlmessage.cxx @@ -131,7 +131,7 @@ Reference<XPropertySetInfo> SAL_CALL OSQLMessageDialog::getPropertySetInfo() th ::cppu::IPropertyArrayHelper& OSQLMessageDialog::getInfoHelper() { - return *const_cast<OSQLMessageDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OSQLMessageDialog::createArrayHelper( ) const diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index dd24e0c5cd54..f8afef08c385 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -128,7 +128,7 @@ namespace abp ::cppu::IPropertyArrayHelper& OABSPilotUno::getInfoHelper() { - return *const_cast<OABSPilotUno*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index 351669a95d57..8f7f24b9d5cd 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -91,7 +91,7 @@ namespace pcr ::cppu::IPropertyArrayHelper& MasterDetailLinkDialog::getInfoHelper() { - return *const_cast<MasterDetailLinkDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 66718f0d081d..371ca6a5d133 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -129,7 +129,7 @@ namespace pcr ::cppu::IPropertyArrayHelper& OControlFontDialog::getInfoHelper() { - return *const_cast<OControlFontDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 105941592695..e45398145741 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -3314,7 +3314,7 @@ namespace pcr ::cppu::IPropertyArrayHelper & FormComponentPropertyHandler::getInfoHelper() { - return *const_cast<FormComponentPropertyHandler*>(this)->getArrayHelper(); + return *getArrayHelper(); } uno::Reference< beans::XPropertySetInfo > SAL_CALL FormComponentPropertyHandler::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception) diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index 9c26eb5465d6..2f2d56086fb6 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -118,7 +118,7 @@ namespace pcr ::cppu::IPropertyArrayHelper& OTabOrderDialog::getInfoHelper() { - return *const_cast< OTabOrderDialog* >( this )->getArrayHelper(); + return *getArrayHelper(); } diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index dd7432a5f554..e338f58f957a 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -292,7 +292,7 @@ namespace pcr switch ( nPropId ) { case PROPERTY_ID_SUBMISSION_ID: - const_cast< SubmissionHelper* >( m_pHelper.get() )->getAllElementUINames( EFormsHelper::Submission, aListEntries, false ); + m_pHelper.get()->getAllElementUINames( EFormsHelper::Submission, aListEntries, false ); break; case PROPERTY_ID_XFORMS_BUTTONTYPE: diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index 981731ae642e..64a182f47db3 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -201,7 +201,7 @@ Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo() ::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper() { - return *const_cast<SWFDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index 9db0eb60f8a7..93de5b4e9bc7 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -141,7 +141,7 @@ Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo() ::cppu::IPropertyArrayHelper& PDFDialog::getInfoHelper() { - return *const_cast<PDFDialog*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx index fe58a3a7652a..ccc9b45ee653 100644 --- a/filter/source/svg/svgdialog.cxx +++ b/filter/source/svg/svgdialog.cxx @@ -171,7 +171,7 @@ Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo() ::cppu::IPropertyArrayHelper& SVGDialog::getInfoHelper() { - return *const_cast< SVGDialog *>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/forms/source/component/Columns.hxx b/forms/source/component/Columns.hxx index d619b6e39c3e..ecfa7899c7fd 100644 --- a/forms/source/component/Columns.hxx +++ b/forms/source/component/Columns.hxx @@ -150,7 +150,7 @@ ClassName::ClassName( const ClassName* _pCloneFrom ) \ } \ ::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \ { \ - return *const_cast<ClassName*>(this)->getArrayHelper(); \ + return *getArrayHelper(); \ } \ void ClassName::fillProperties( \ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 3e22d71ee8cc..86ab00c47e08 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2027,7 +2027,7 @@ bool OBoundControlModel::approveDbColumnType(sal_Int32 _nColumnType) void OBoundControlModel::impl_determineAmbientForm_nothrow() { - Reference< XInterface > xParent( const_cast< OBoundControlModel* >( this )->getParent() ); + Reference< XInterface > xParent( getParent() ); m_xAmbientForm.set( xParent, UNO_QUERY ); if ( !m_xAmbientForm.is() ) { diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index 84488d85a1c8..c6da4db6ac26 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -175,7 +175,7 @@ namespace svt ::cppu::IPropertyArrayHelper& SAL_CALL OCommonPicker::getInfoHelper() { - return *const_cast< OCommonPicker* >( this )->getArrayHelper(); + return *getArrayHelper(); } diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx index ec750010299d..2ef646c906f0 100644 --- a/mysqlc/source/mysqlc_resultset.cxx +++ b/mysqlc/source/mysqlc_resultset.cxx @@ -1120,7 +1120,7 @@ IPropertyArrayHelper * OResultSet::createArrayHelper() const IPropertyArrayHelper & OResultSet::getInfoHelper() { OSL_TRACE("OResultSet::getInfoHelper"); - return *const_cast<OResultSet*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OResultSet::convertFastPropertyValue(Any & /* rConvertedValue */, diff --git a/mysqlc/source/mysqlc_statement.cxx b/mysqlc/source/mysqlc_statement.cxx index 9bd069ca5dcf..209d31a2f17c 100644 --- a/mysqlc/source/mysqlc_statement.cxx +++ b/mysqlc/source/mysqlc_statement.cxx @@ -327,7 +327,7 @@ void SAL_CALL OCommonStatement::clearWarnings() ::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper() { OSL_TRACE("OCommonStatement::getInfoHelper"); - return *const_cast<OCommonStatement*>(this)->getArrayHelper(); + return *getArrayHelper(); } sal_Bool OCommonStatement::convertFastPropertyValue( diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 6dd1419c57e2..2b08c5d7ff16 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -407,7 +407,7 @@ void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rD ::cppu::IPropertyArrayHelper& OStyle::getInfoHelper() { - return *const_cast<OStyle*>(this)->getArrayHelper(); + return *getArrayHelper(); } ::cppu::IPropertyArrayHelper* OStyle::createArrayHelper( ) const diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 0daeb81ba7f7..94c29dcc50dd 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -418,7 +418,7 @@ void SAL_CALL ScCellFieldsObj::refresh( ) if (pInterfaces) { lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(const_cast<ScCellFieldsObj*>(this))); + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); sal_uInt32 i(0); while (i < nLength) { @@ -598,7 +598,7 @@ void SAL_CALL ScHeaderFieldsObj::refresh( ) if (pInterfaces) { lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(const_cast<ScHeaderFieldsObj*>(this))); + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); sal_uInt32 i(0); while (i < nLength) { diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 207e01bd398d..eac84daaf878 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2500,7 +2500,7 @@ void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide ) for( SdCustomShow::PageVec::iterator it = pCustomShow->PagesVector().begin(); it != pCustomShow->PagesVector().end(); ++it, nSlideIndex++ ) { - const sal_uInt16 nSdSlide = ( const_cast<SdPage*>(*it)->GetPageNum() - 1 ) / 2; + const sal_uInt16 nSdSlide = ( (*it)->GetPageNum() - 1 ) / 2; if( !( mpDoc->GetSdPage( nSdSlide, PK_STANDARD ) )->IsExcluded()) mpSlideController->insertSlideNumber( nSdSlide ); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 6252dcd1e839..c1fdc10ee72c 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -142,7 +142,7 @@ void SmDocShell::LoadSymbols() const OUString SmDocShell::GetComment() const { uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - const_cast<SmDocShell*>(this)->GetModel(), uno::UNO_QUERY_THROW); + GetModel(), uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); return xDocProps->getDescription(); diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 5b21c44bb48d..a22fd414fb9c 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -708,7 +708,7 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_C ::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper() { - return *const_cast<ToolboxController*>(this)->getArrayHelper(); + return *getArrayHelper(); } diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index c9d4a8f7d8e3..b0998a583420 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -308,7 +308,7 @@ namespace { ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper() { - return *const_cast< Wizard* >( this )->getArrayHelper(); + return *getArrayHelper(); } diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 12d983ad93b9..ecb05b5fedcc 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -116,7 +116,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext( maTreeInfo.SetSdrView( mpView ); maTreeInfo.SetWindow( mpControl ); - maTreeInfo.SetViewForwarder( const_cast<SvxGraphCtrlAccessibleContext*>(this) ); + maTreeInfo.SetViewForwarder( this ); } diff --git a/svx/source/form/xfm_addcondition.cxx b/svx/source/form/xfm_addcondition.cxx index 8a0c27557564..58e3fe5849c4 100644 --- a/svx/source/form/xfm_addcondition.cxx +++ b/svx/source/form/xfm_addcondition.cxx @@ -133,7 +133,7 @@ namespace svxform ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper() { - return *const_cast< OAddConditionDialog* >( this )->getArrayHelper(); + return *getArrayHelper(); } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 4a59df7c5ae0..9095f525699e 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -578,7 +578,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() ); if (xGCIterator.is()) { - uno::Reference< lang::XComponent > xDoc( const_cast<SwDocShell*>(GetDocShell())->GetBaseModel(), uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY ); // Expand the string: const ModelToViewHelper aConversionMap(*pNd->GetTxtNode()); OUString aExpandText = aConversionMap.getViewText(); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 148ea268606c..08fb7de31e44 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -321,7 +321,7 @@ void SwEditShell::SetGraphicPolygon( const tools::PolyPolygon *pPoly ) pNd->SetContour( pPoly ); SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper()); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); - pFly->GetFmt()->NotifyClients( const_cast<SwFmtSurround*>(&rSur), const_cast<SwFmtSurround*>(&rSur) ); + pFly->GetFmt()->NotifyClients( &rSur, &rSur ); GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -336,7 +336,7 @@ void SwEditShell::ClearAutomaticContour() pNd->SetContour( NULL, false ); SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper()); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); - pFly->GetFmt()->NotifyClients( const_cast<SwFmtSurround*>(&rSur), const_cast<SwFmtSurround*>(&rSur) ); + pFly->GetFmt()->NotifyClients( &rSur, &rSur ); GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 9e951b698e07..d808f5cbad39 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1549,7 +1549,7 @@ void SwCntntFrm::MakeAll() // Finally, we are able to split table rows. Therefore, bDontMoveMe // can be set to false: if( bDontMoveMe && IsInTab() && - 0 != const_cast<SwCntntFrm*>(this)->GetNextCellLeaf( MAKEPAGE_NONE ) ) + 0 != GetNextCellLeaf( MAKEPAGE_NONE ) ) bDontMoveMe = false; if ( bDontMoveMe && (Frm().*fnRect->fnGetHeight)() > diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index e4a55acb02d5..619404477943 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1479,7 +1479,7 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage ) nCnt != pPage->GetSortedObjs()->size(), "Object couldn't be reattached!" ); #else - rFmt.NotifyClients( 0, const_cast<SwFmtAnchor*>(&rAnch) ); + rFmt.NotifyClients( 0, &rAnch ); #endif // Do not increment index, in this case continue; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a35327a306d2..6c737423d6a8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1304,7 +1304,7 @@ void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >& rxC OUString aText; aData >>= aText; if( ImplTruncateToMaxLen( aText, maSelection.Len() ) ) - ShowTruncationWarning( const_cast<Edit*>(this) ); + ShowTruncationWarning( this ); ReplaceSelected( aText ); } catch( const ::com::sun::star::uno::Exception& ) diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx index 7b7b78a9f039..cbe27e70b06d 100644 --- a/xmlsecurity/source/framework/buffernode.cxx +++ b/xmlsecurity/source/framework/buffernode.cxx @@ -269,7 +269,7 @@ OUString BufferNode::printChildren() const rc += OUString( "(" ); rc += OUString( "SecID=" ); - rc += OUString::number(const_cast<ElementCollector*>(*ii)->getSecurityId()); + rc += OUString::number((*ii)->getSecurityId()); rc += OUString( ")" ); rc += OUString( " " ); } |