From be4db0569c947179b0facf367862213748982361 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 21 Dec 2011 23:27:48 +0000 Subject: catch by const ref --- sfx2/source/appl/app.cxx | 2 +- sfx2/source/appl/childwin.cxx | 2 +- sfx2/source/appl/imagemgr.cxx | 4 ++-- sfx2/source/appl/sfxhelp.cxx | 12 ++++++------ sfx2/source/appl/xpackcreator.cxx | 6 +++--- sfx2/source/control/dispatch.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 2 +- sfx2/source/doc/iframe.cxx | 5 +++-- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/objxtor.cxx | 11 ++++++----- sfx2/source/doc/printhelper.cxx | 20 ++++++++++++++++---- sfx2/source/view/sfxbasecontroller.cxx | 6 +++--- 12 files changed, 45 insertions(+), 31 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 81bf1f649d9a..8795e805a19f 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -542,7 +542,7 @@ sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL ) result = sal_True; } } - catch ( ::com::sun::star::uno::RuntimeException& ) + catch (const ::com::sun::star::uno::RuntimeException&) { // ignore, will just return FALSE } diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 4fdf4268565e..99c5e3a44f59 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -184,7 +184,7 @@ void SfxChildWindow::Destroy() else GetFrame()->dispose(); } - catch ( com::sun::star::uno::Exception& ) + catch (const com::sun::star::uno::Exception&) { } } diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index f6faced79646..2b9109932b4f 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -146,7 +146,7 @@ Image SAL_CALL GetImage( if ( !!aImage ) return aImage; } - catch ( Exception& ) + catch (const Exception&) { } } @@ -214,7 +214,7 @@ Image SAL_CALL GetImage( return SvFileInformationManager::GetImageNoDefault( aObj, bBig ); } } - catch ( Exception& ) + catch (const Exception&) { } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 47f470e98175..6093d8025379 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -208,7 +208,7 @@ sal_Bool GetHelpAnchor_Impl( const String& _rURL, String& _rAnchor ) DBG_ERRORFILE( "Property 'AnchorName' is missing" ); } } - catch( ::com::sun::star::uno::Exception& ) + catch (const ::com::sun::star::uno::Exception&) { } @@ -445,11 +445,11 @@ SfxHelp::~SfxHelp() { sIdentifier = xModuleManager->identify( xCurrentFrame ); } - catch ( ::com::sun::star::frame::UnknownModuleException& ) + catch (const ::com::sun::star::frame::UnknownModuleException&) { DBG_WARNING( "SfxHelp::getCurrentModuleIdentifier_Impl(): unknown module (help in help?)" ); } - catch ( Exception& ) + catch (const Exception&) { DBG_ERRORFILE( "SfxHelp::getCurrentModuleIdentifier_Impl(): exception of XModuleManager::identify()" ); } @@ -484,7 +484,7 @@ String SfxHelp::GetHelpModuleName_Impl() } } } - catch ( Exception& ) + catch (const Exception&) { DBG_ERRORFILE( "SfxHelp::GetHelpModuleName_Impl(): exception of XNameAccess::getByName()" ); } @@ -697,7 +697,7 @@ static bool impl_showOnlineHelp( const String& rURL ) return true; } } - catch( const Exception& ) + catch (const Exception&) { } return false; @@ -866,7 +866,7 @@ void SfxHelp::OpenHelpAgent( const rtl::OString& sHelpId ) if ( xHelpDispatch.is() ) xHelpDispatch->dispatch( aURL, Sequence< PropertyValue >() ); } - catch( const Exception& ) + catch (const Exception&) { DBG_ERRORFILE( "OpenHelpAgent: caught an exception while executing the dispatch!" ); } diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index b82226f39038..3f404fdc725e 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -137,7 +137,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const ::rtl::OUString& } } } - catch ( uno::RuntimeException& ) + catch (const uno::RuntimeException&) { if ( pTempStream ) delete pTempStream; @@ -147,7 +147,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const ::rtl::OUString& throw; } - catch ( io::IOException& ) + catch (const io::IOException&) { if ( pTempStream ) delete pTempStream; @@ -157,7 +157,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const ::rtl::OUString& throw; } - catch ( uno::Exception& ) + catch (const uno::Exception&) { } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index a72035421a9a..4f2331eb46c3 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1368,7 +1368,7 @@ void SfxDispatcher::Update_Impl( sal_Bool bForce ) com::sun::star::uno::Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) ); aValue >>= xLayoutManager; } - catch ( com::sun::star::uno::Exception& ) + catch (const com::sun::star::uno::Exception&) { } } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index b6c745bd74f5..014fd38e980d 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -939,7 +939,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt { ((::com::sun::star::frame::XStatusListener *)aIt.next())->statusChanged( aEvent ); } - catch( ::com::sun::star::uno::RuntimeException& ) + catch (const ::com::sun::star::uno::RuntimeException&) { aIt.remove(); } diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index f9817478da1e..d9c169e49a54 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -182,8 +182,9 @@ void SAL_CALL IFrameObject::cancel() throw( com::sun::star::uno::RuntimeExceptio xClose->close( sal_True ); mxFrame = 0; } - catch ( uno::Exception& ) - {} + catch (const uno::Exception&) + { + } } void SAL_CALL IFrameObject::close( sal_Bool /*bDeliverOwnership*/ ) throw( com::sun::star::util::CloseVetoException, com::sun::star::uno::RuntimeException ) diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 570a13a1e435..d1b967706d91 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -285,7 +285,7 @@ void SfxObjectShell::UpdateTime_Impl( i_xDocProps->setEditingDuration(newSecs); i_xDocProps->setEditingCycles(i_xDocProps->getEditingCycles() + 1); } - catch (lang::IllegalArgumentException &) + catch (const lang::IllegalArgumentException &) { // ignore overflow } @@ -920,7 +920,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) bOK = sal_True; } } - catch ( Exception& ) + catch (const Exception&) { } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index d4e8b5643304..d6662045124c 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -146,7 +146,7 @@ static VBAConstantNameMap s_aRegisteredVBAConstants; xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobalConstantName" ) ) ) >>= aConstName; return ::rtl::OUStringToOString( aConstName, RTL_TEXTENCODING_ASCII_US ); } - catch( uno::Exception& ) // not supported + catch (const uno::Exception&) // not supported { } return ::rtl::OString(); @@ -466,7 +466,7 @@ sal_Bool SfxObjectShell::Close() { xCloseable->close( sal_True ); } - catch( Exception& ) + catch (const Exception&) { pImp->bClosing = sal_False; } @@ -762,7 +762,7 @@ namespace xContext, xStorageDoc ) , UNO_QUERY_THROW ); } - catch( const Exception& ) + catch (const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -1092,8 +1092,9 @@ Reference SfxObjectShell::CreateAndLoadComponent( const SfxIte { xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, aProps); } - catch( uno::Exception& ) - {} + catch (const uno::Exception&) + { + } return xComp; } diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 24dcd6669834..9206d3a1bfee 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -556,10 +556,22 @@ class ImplUCBPrintWatcher : public ::osl::Thread ::com::sun::star::ucb::NameClash::OVERWRITE); } } - catch( ::com::sun::star::ucb::ContentCreationException& ) { OSL_FAIL("content create exception"); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) { OSL_FAIL("command abort exception"); } - catch( ::com::sun::star::uno::RuntimeException& ) { OSL_FAIL("runtime exception"); } - catch( ::com::sun::star::uno::Exception& ) { OSL_FAIL("unknown exception"); } + catch (const ::com::sun::star::ucb::ContentCreationException&) + { + OSL_FAIL("content create exception"); + } + catch (const ::com::sun::star::ucb::CommandAbortedException&) + { + OSL_FAIL("command abort exception"); + } + catch (const ::com::sun::star::uno::RuntimeException&) + { + OSL_FAIL("runtime exception"); + } + catch (const ::com::sun::star::uno::Exception&) + { + OSL_FAIL("unknown exception"); + } // kill the temp file! delete *ppTempFile; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index e90f7ef575e0..7dcaeec000cf 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -998,7 +998,7 @@ void SfxBaseController::BorderWidthsChanged_Impl() { ((frame::XBorderResizeListener*)pIterator.next())->borderWidthsChanged( xThis, aBWidths ); } - catch( uno::RuntimeException& ) + catch (const uno::RuntimeException&) { pIterator.remove(); } @@ -1302,7 +1302,7 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); } - catch( const uno::Exception& ) + catch (const uno::Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -1446,7 +1446,7 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) m_pData->m_pViewShell->ReadUserDataSequence( aViewData, sal_True ); } } - catch( const Exception& ) + catch (const Exception&) { DBG_UNHANDLED_EXCEPTION(); } -- cgit