diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-11 16:36:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-12 08:54:15 +0200 |
commit | fa394eef4017d62549599ded3a62d790bc508582 (patch) | |
tree | dc23efda2c3e260af82487c1e3046451277efa6c | |
parent | a267efe358cb788e0256feada268987ddbf9604f (diff) |
clang-tidy misc-throw-by-value-catch-by-reference
Change-Id: I04750771b63551fd3df522753a4ed21b8d5c42f3
Reviewed-on: https://gerrit.libreoffice.org/61680
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | pyuno/source/module/pyuno.cxx | 24 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_iterator.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlTable.cxx | 2 | ||||
-rw-r--r-- | sax/qa/cppunit/xmlimport.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.cxx | 4 | ||||
-rw-r--r-- | test/source/unoapi_property_testers.cxx | 4 |
6 files changed, 19 insertions, 19 deletions
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 434888f59e6e..a581d8335d76 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -871,11 +871,11 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey ) PyErr_SetString( PyExc_TypeError, "object is not subscriptable" ); } - catch( const css::lang::IndexOutOfBoundsException ) + catch( const css::lang::IndexOutOfBoundsException & ) { PyErr_SetString( PyExc_IndexError, "index out of range" ); } - catch( const css::container::NoSuchElementException ) + catch( const css::container::NoSuchElementException & ) { PyErr_SetString( PyExc_KeyError, "key not found" ); } @@ -920,7 +920,7 @@ static int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue { aValue = runtime.pyObject2Any( pValue ); } - catch ( const css::uno::RuntimeException ) + catch ( const css::uno::RuntimeException & ) { // TODO pyObject2Any can't convert e.g. dicts but only throws // RuntimeException on failure. Fixing this will require an audit of @@ -1041,7 +1041,7 @@ static int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue { aItem = runtime.pyObject2Any( rItem.get() ); } - catch ( const css::uno::RuntimeException ) + catch ( const css::uno::RuntimeException & ) { // TODO pyObject2Any can't convert e.g. dicts but only throws // RuntimeException on failure. Fixing this will require an audit of @@ -1100,7 +1100,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue { aValue = runtime.pyObject2Any( pValue ); } - catch( const css::uno::RuntimeException ) + catch( const css::uno::RuntimeException & ) { // TODO pyObject2Any can't convert e.g. dicts but only throws // RuntimeException on failure. Fixing this will require an audit of @@ -1136,7 +1136,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue xNameContainer->insertByName( sKey, aValue ); return 0; } - catch( css::container::ElementExistException ) + catch( const css::container::ElementExistException & ) { // Fall through, try replace instead } @@ -1178,19 +1178,19 @@ static int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue ) PyErr_SetString( PyExc_TypeError, "list index has invalid type" ); } - catch( const css::lang::IndexOutOfBoundsException ) + catch( const css::lang::IndexOutOfBoundsException & ) { PyErr_SetString( PyExc_IndexError, "list index out of range" ); } - catch( const css::container::NoSuchElementException ) + catch( const css::container::NoSuchElementException & ) { PyErr_SetString( PyExc_KeyError, "key not found" ); } - catch( const css::lang::IllegalArgumentException ) + catch( const css::lang::IllegalArgumentException & ) { PyErr_SetString( PyExc_TypeError, "value has invalid type" ); } - catch( css::script::CannotConvertException ) + catch( const css::script::CannotConvertException & ) { PyErr_SetString( PyExc_TypeError, "value has invalid type" ); } @@ -1299,7 +1299,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey ) { aValue = runtime.pyObject2Any( pKey ); } - catch( const css::uno::RuntimeException ) + catch( const css::uno::RuntimeException & ) { // TODO pyObject2Any can't convert e.g. dicts but only throws // RuntimeException on failure. Fixing this will require an audit of @@ -1347,7 +1347,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey ) PyErr_SetString( PyExc_TypeError, "argument is not iterable" ); } - catch( const css::script::CannotConvertException ) + catch( const css::script::CannotConvertException& ) { PyErr_SetString( PyExc_TypeError, "invalid type passed as left argument to 'in'" ); } diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx index 5847d881a90e..4868a12ee24f 100644 --- a/pyuno/source/module/pyuno_iterator.cxx +++ b/pyuno/source/module/pyuno_iterator.cxx @@ -205,7 +205,7 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self ) try { aRet = me->members->xIndexAccess->getByIndex( me->members->index ); } - catch( css::lang::IndexOutOfBoundsException ) + catch( const css::lang::IndexOutOfBoundsException & ) { noMoreElements = true; } diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx index dcc0f7078e8d..574e9fd8e06a 100644 --- a/reportdesign/source/filter/xml/xmlTable.cxx +++ b/reportdesign/source/filter/xml/xmlTable.cxx @@ -250,7 +250,7 @@ void OXMLTable::EndElement() (*aCellIter)->setSize(awt::Size(nWidth,nHeight)); (*aCellIter)->setPosition(awt::Point(nPosX,nPosY)); } - catch(beans::PropertyVetoException) + catch(const beans::PropertyVetoException &) { OSL_FAIL("Could not set the correct position or size!"); } diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx index b22f9d268e8a..38944154deba 100644 --- a/sax/qa/cppunit/xmlimport.cxx +++ b/sax/qa/cppunit/xmlimport.cxx @@ -430,7 +430,7 @@ void XMLImportTest::testMissingNamespaceDeclaration() CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr ); } - catch( SAXException ) + catch( const SAXException & ) { } } diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index d802258d3788..e32128570db4 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -356,7 +356,7 @@ namespace { css::system::SystemShellExecute::create(comphelper::getProcessComponentContext())); try { exec->execute(uri, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY); - } catch (css::uno::Exception) { + } catch (const css::uno::Exception &) { } m_xDialog->response(RET_OK); } @@ -373,7 +373,7 @@ IMPL_LINK(SafeModeDialog, CreateZipBtnHdl, Button*, /*pBtn*/, void) aZipHelper.addFolderWithContent(aZipHelper.getRootFolder(), comphelper::BackupFileHelper::getUserProfileWorkURL()); aZipHelper.savePackage(); } - catch (uno::Exception) + catch (const uno::Exception &) { std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, diff --git a/test/source/unoapi_property_testers.cxx b/test/source/unoapi_property_testers.cxx index 5a74443a2550..75eed2c9a70b 100644 --- a/test/source/unoapi_property_testers.cxx +++ b/test/source/unoapi_property_testers.cxx @@ -43,7 +43,7 @@ void testBooleanOptionalProperty(uno::Reference<beans::XPropertySet> const& xPro { testBooleanProperty(xPropertySet, rName); } - catch (css::beans::UnknownPropertyException /*ex*/) + catch (const css::beans::UnknownPropertyException& /*ex*/) { // ignore if the property is unknown as it is optional } @@ -192,7 +192,7 @@ void testStringOptionalProperty(uno::Reference<beans::XPropertySet> const& xProp { testStringProperty(xPropertySet, rName, rValue); } - catch (css::beans::UnknownPropertyException /*ex*/) + catch (const css::beans::UnknownPropertyException& /*ex*/) { // ignore if the property is unknown as it is optional } |