Kaydet (Commit) fa394eef authored tarafından Noel Grandin's avatar Noel Grandin

clang-tidy misc-throw-by-value-catch-by-reference

Change-Id: I04750771b63551fd3df522753a4ed21b8d5c42f3
Reviewed-on: https://gerrit.libreoffice.org/61680
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a267efe3
...@@ -871,11 +871,11 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey ) ...@@ -871,11 +871,11 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
PyErr_SetString( PyExc_TypeError, "object is not subscriptable" ); 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" ); 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" ); PyErr_SetString( PyExc_KeyError, "key not found" );
} }
...@@ -920,7 +920,7 @@ static int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue ...@@ -920,7 +920,7 @@ static int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue
{ {
aValue = runtime.pyObject2Any( 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 // TODO pyObject2Any can't convert e.g. dicts but only throws
// RuntimeException on failure. Fixing this will require an audit of // 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 ...@@ -1041,7 +1041,7 @@ static int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue
{ {
aItem = runtime.pyObject2Any( rItem.get() ); 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 // TODO pyObject2Any can't convert e.g. dicts but only throws
// RuntimeException on failure. Fixing this will require an audit of // 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 ...@@ -1100,7 +1100,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue
{ {
aValue = runtime.pyObject2Any( 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 // TODO pyObject2Any can't convert e.g. dicts but only throws
// RuntimeException on failure. Fixing this will require an audit of // 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 ...@@ -1136,7 +1136,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue
xNameContainer->insertByName( sKey, aValue ); xNameContainer->insertByName( sKey, aValue );
return 0; return 0;
} }
catch( css::container::ElementExistException ) catch( const css::container::ElementExistException & )
{ {
// Fall through, try replace instead // Fall through, try replace instead
} }
...@@ -1178,19 +1178,19 @@ static int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue ) ...@@ -1178,19 +1178,19 @@ static int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue )
PyErr_SetString( PyExc_TypeError, "list index has invalid type" ); 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" ); 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" ); 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" ); 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" ); PyErr_SetString( PyExc_TypeError, "value has invalid type" );
} }
...@@ -1299,7 +1299,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey ) ...@@ -1299,7 +1299,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey )
{ {
aValue = runtime.pyObject2Any( 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 // TODO pyObject2Any can't convert e.g. dicts but only throws
// RuntimeException on failure. Fixing this will require an audit of // RuntimeException on failure. Fixing this will require an audit of
...@@ -1347,7 +1347,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey ) ...@@ -1347,7 +1347,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey )
PyErr_SetString( PyExc_TypeError, "argument is not iterable" ); 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'" ); PyErr_SetString( PyExc_TypeError, "invalid type passed as left argument to 'in'" );
} }
......
...@@ -205,7 +205,7 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self ) ...@@ -205,7 +205,7 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self )
try { try {
aRet = me->members->xIndexAccess->getByIndex( me->members->index ); aRet = me->members->xIndexAccess->getByIndex( me->members->index );
} }
catch( css::lang::IndexOutOfBoundsException ) catch( const css::lang::IndexOutOfBoundsException & )
{ {
noMoreElements = true; noMoreElements = true;
} }
......
...@@ -250,7 +250,7 @@ void OXMLTable::EndElement() ...@@ -250,7 +250,7 @@ void OXMLTable::EndElement()
(*aCellIter)->setSize(awt::Size(nWidth,nHeight)); (*aCellIter)->setSize(awt::Size(nWidth,nHeight));
(*aCellIter)->setPosition(awt::Point(nPosX,nPosY)); (*aCellIter)->setPosition(awt::Point(nPosX,nPosY));
} }
catch(beans::PropertyVetoException) catch(const beans::PropertyVetoException &)
{ {
OSL_FAIL("Could not set the correct position or size!"); OSL_FAIL("Could not set the correct position or size!");
} }
......
...@@ -430,7 +430,7 @@ void XMLImportTest::testMissingNamespaceDeclaration() ...@@ -430,7 +430,7 @@ void XMLImportTest::testMissingNamespaceDeclaration()
CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr ); CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr );
} }
catch( SAXException ) catch( const SAXException & )
{ {
} }
} }
......
...@@ -356,7 +356,7 @@ namespace { ...@@ -356,7 +356,7 @@ namespace {
css::system::SystemShellExecute::create(comphelper::getProcessComponentContext())); css::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
try { try {
exec->execute(uri, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY); exec->execute(uri, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
} catch (css::uno::Exception) { } catch (const css::uno::Exception &) {
} }
m_xDialog->response(RET_OK); m_xDialog->response(RET_OK);
} }
...@@ -373,7 +373,7 @@ IMPL_LINK(SafeModeDialog, CreateZipBtnHdl, Button*, /*pBtn*/, void) ...@@ -373,7 +373,7 @@ IMPL_LINK(SafeModeDialog, CreateZipBtnHdl, Button*, /*pBtn*/, void)
aZipHelper.addFolderWithContent(aZipHelper.getRootFolder(), comphelper::BackupFileHelper::getUserProfileWorkURL()); aZipHelper.addFolderWithContent(aZipHelper.getRootFolder(), comphelper::BackupFileHelper::getUserProfileWorkURL());
aZipHelper.savePackage(); aZipHelper.savePackage();
} }
catch (uno::Exception) catch (const uno::Exception &)
{ {
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok, VclMessageType::Warning, VclButtonsType::Ok,
......
...@@ -43,7 +43,7 @@ void testBooleanOptionalProperty(uno::Reference<beans::XPropertySet> const& xPro ...@@ -43,7 +43,7 @@ void testBooleanOptionalProperty(uno::Reference<beans::XPropertySet> const& xPro
{ {
testBooleanProperty(xPropertySet, rName); testBooleanProperty(xPropertySet, rName);
} }
catch (css::beans::UnknownPropertyException /*ex*/) catch (const css::beans::UnknownPropertyException& /*ex*/)
{ {
// ignore if the property is unknown as it is optional // ignore if the property is unknown as it is optional
} }
...@@ -192,7 +192,7 @@ void testStringOptionalProperty(uno::Reference<beans::XPropertySet> const& xProp ...@@ -192,7 +192,7 @@ void testStringOptionalProperty(uno::Reference<beans::XPropertySet> const& xProp
{ {
testStringProperty(xPropertySet, rName, rValue); 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 // ignore if the property is unknown as it is optional
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment