From 51c986230316643e42a3deff7e802a8455fd0459 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 4 May 2022 07:02:00 +0200 Subject: Just use Any ctor instead of makeAny in pyuno Change-Id: I53eb836c64e8e4a354c5c895bc7f16b168bd4cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133793 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- pyuno/source/loader/pyuno_loader.cxx | 2 +- pyuno/source/module/pyuno.cxx | 61 +++++++++++++++++----------------- pyuno/source/module/pyuno_adapter.cxx | 5 ++- pyuno/source/module/pyuno_callable.cxx | 6 ++-- pyuno/source/module/pyuno_iterator.cxx | 18 +++++----- pyuno/source/module/pyuno_module.cxx | 39 +++++++++++----------- pyuno/source/module/pyuno_struct.cxx | 19 +++++------ 7 files changed, 73 insertions(+), 77 deletions(-) (limited to 'pyuno') diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index f01d8a0529a3..c9b8248c1b25 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -259,7 +259,7 @@ pyuno_Loader_get_implementation( Runtime runtime; PyRef pyCtx = runtime.any2PyObject( - css::uno::makeAny( css::uno::Reference(ctx) ) ); + css::uno::Any( css::uno::Reference(ctx) ) ); PyRef clazz = getObjectFromLoaderModule( "Loader" ); PyRef args ( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL ); diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 0db385793d86..cc4858279949 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -48,7 +48,6 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::Reference; using com::sun::star::uno::XInterface; using com::sun::star::uno::Any; -using com::sun::star::uno::makeAny; using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::Type; using com::sun::star::uno::TypeClass; @@ -428,19 +427,19 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args ) } catch (const css::lang::IllegalArgumentException &e) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch (const css::script::CannotConvertException &e) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch (const css::uno::RuntimeException &e) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch (const css::uno::Exception &e) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return ret.getAcquired(); @@ -482,7 +481,7 @@ static PyObject* PyUNO_dir (PyObject* self) } catch( const RuntimeException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return member_list; @@ -529,7 +528,7 @@ static int PyUNO_bool( PyObject* self ) } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return -1; @@ -549,7 +548,7 @@ static Py_ssize_t PyUNO_len( PyObject* self ) } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return -1; @@ -857,19 +856,19 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey ) } catch( const css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::WrappedTargetException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return nullptr; @@ -1172,15 +1171,15 @@ static int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue ) } catch( const css::container::ElementExistException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::WrappedTargetException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return 1; @@ -1248,15 +1247,15 @@ static PyObject* PyUNO_iter( PyObject *self ) } catch( css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return nullptr; @@ -1329,23 +1328,23 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey ) } catch( const css::container::NoSuchElementException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::IndexOutOfBoundsException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::WrappedTargetException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return -1; @@ -1421,19 +1420,19 @@ static PyObject* PyUNO_getattr (PyObject* self, char* name) } catch( const css::beans::UnknownPropertyException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const RuntimeException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return nullptr; @@ -1466,17 +1465,17 @@ static int PyUNO_setattr (PyObject* self, char* name, PyObject* value) } catch( const css::beans::UnknownPropertyException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); return 1; } catch( const css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); return 1; } catch( const RuntimeException & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); return 1; } PyErr_SetString (PyExc_AttributeError, name); @@ -1522,7 +1521,7 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) } catch( const css::uno::RuntimeException & e) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } result = (op == Py_EQ ? Py_False : Py_True); diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index 4d31da9dadb2..b15387a2074e 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -33,7 +33,6 @@ using com::sun::star::beans::XIntrospectionAccess; using com::sun::star::uno::Any; -using com::sun::star::uno::makeAny; using com::sun::star::uno::Reference; using com::sun::star::uno::Sequence; using com::sun::star::uno::RuntimeException; @@ -119,7 +118,7 @@ Sequence< sal_Int16 > Adapter::getOutIndexes( const OUString & functionName ) // an instance of the introspection at (this), but this results in a cyclic // reference, which is never broken (as it is up to OOo1.1.0). Reference< XIntrospectionAccess > introspection = - runtime.getImpl()->cargo->xIntrospection->inspect( makeAny( unoAdapterObject ) ); + runtime.getImpl()->cargo->xIntrospection->inspect( Any( unoAdapterObject ) ); if( !introspection.is() ) { @@ -171,7 +170,7 @@ Any Adapter::invoke( const OUString &aFunctionName, { Sequence< sal_Int8 > id; if( aParams[0] >>= id ) - return css::uno::makeAny( getSomething( id ) ); + return css::uno::Any( getSomething( id ) ); } diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index 7816bbf7de3b..f22de316b7de 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -152,7 +152,7 @@ static PyObject* PyUNO_callable_call( logException( cargo, "error py->uno[0x", me->members->xInvocation.get() , me->members->methodName, &e, cppu::UnoType::get().getTypeLibType()); } - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::IllegalArgumentException &e ) { @@ -161,7 +161,7 @@ static PyObject* PyUNO_callable_call( logException( cargo, "error py->uno[0x", me->members->xInvocation.get() , me->members->methodName, &e, cppu::UnoType::get().getTypeLibType()); } - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch (const css::uno::RuntimeException &e) { @@ -170,7 +170,7 @@ static PyObject* PyUNO_callable_call( logException( cargo, "error py->uno[0x", me->members->xInvocation.get() , me->members->methodName, &e, cppu::UnoType::get().getTypeLibType()); } - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return ret.getAcquired(); diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx index b5dcf78695a8..134f318a1017 100644 --- a/pyuno/source/module/pyuno_iterator.cxx +++ b/pyuno/source/module/pyuno_iterator.cxx @@ -88,23 +88,23 @@ static PyObject* PyUNO_iterator_next( PyObject *self ) } catch( css::container::NoSuchElementException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::WrappedTargetException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return nullptr; @@ -238,19 +238,19 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self ) } catch( css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::lang::WrappedTargetException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } catch( const css::uno::RuntimeException &e ) { - raisePyExceptionWithAny( css::uno::makeAny( e ) ); + raisePyExceptionWithAny( css::uno::Any( e ) ); } return nullptr; diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index 81a8b7919db9..81c8ef7aa5cf 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -57,7 +57,6 @@ using osl::Module; using com::sun::star::uno::Sequence; using com::sun::star::uno::Reference; using com::sun::star::uno::Any; -using com::sun::star::uno::makeAny; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::TypeDescription; using com::sun::star::uno::XComponentContext; @@ -278,7 +277,7 @@ static PyObject* getComponentContext( Runtime::initialize( ctx ); } Runtime runtime; - ret = runtime.any2PyObject( makeAny( ctx ) ); + ret = runtime.any2PyObject( Any( ctx ) ); } catch (const css::registry::InvalidRegistryException &e) { @@ -469,15 +468,15 @@ static PyObject *createUnoStructHelper( } catch( const css::uno::RuntimeException & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } catch( const css::script::CannotConvertException & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } catch( const css::uno::Exception & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } return ret.getAcquired(); } @@ -510,7 +509,7 @@ static PyObject *getTypeByName( } catch ( const RuntimeException & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } return ret; } @@ -543,19 +542,19 @@ static PyObject *getConstantByName( // to the python programmer, this is a runtime exception, // do not support tweakings with the type system RuntimeException runExc( e.Message ); - raisePyExceptionWithAny( makeAny( runExc ) ); + raisePyExceptionWithAny( Any( runExc ) ); } catch(const css::script::CannotConvertException & e) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } catch(const css::lang::IllegalArgumentException & e) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } catch( const RuntimeException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return ret; } @@ -576,7 +575,7 @@ static PyObject *checkType( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) } catch(const RuntimeException & e) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); return nullptr; } Py_INCREF( Py_None ); @@ -599,7 +598,7 @@ static PyObject *checkEnum( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) } catch(const RuntimeException & e) { - raisePyExceptionWithAny( makeAny( e) ); + raisePyExceptionWithAny( Any( e) ); return nullptr; } Py_INCREF( Py_None ); @@ -621,7 +620,7 @@ static PyObject *getClass( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) } catch(const RuntimeException & e) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return nullptr; } @@ -647,11 +646,11 @@ static PyObject * generateUuid( try { Runtime runtime; - ret = runtime.any2PyObject( makeAny( seq ) ); + ret = runtime.any2PyObject( Any( seq ) ); } catch( const RuntimeException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return ret.getAcquired(); } @@ -675,7 +674,7 @@ static PyObject *systemPathToFileUrl( OUString::number( static_cast(e) ) + ")"; raisePyExceptionWithAny( - makeAny( RuntimeException( buf ))); + Any( RuntimeException( buf ))); return nullptr; } return ustring2PyUnicode( url ).getAcquired(); @@ -700,7 +699,7 @@ static PyObject * fileUrlToSystemPath( OUString::number( static_cast(e) ) + ")"; raisePyExceptionWithAny( - makeAny( RuntimeException( buf ))); + Any( RuntimeException( buf ))); return nullptr; } return ustring2PyUnicode( sysPath ).getAcquired(); @@ -783,11 +782,11 @@ static PyObject *getCurrentContext( { Runtime runtime; ret = runtime.any2PyObject( - makeAny( css::uno::getCurrentContext() ) ); + Any( css::uno::getCurrentContext() ) ); } catch( const css::uno::Exception & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } return ret.getAcquired(); } @@ -829,7 +828,7 @@ static PyObject *setCurrentContext( } catch( const css::uno::Exception & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } return ret.getAcquired(); } diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx index 747e759f6b61..c8fd7e987905 100644 --- a/pyuno/source/module/pyuno_struct.cxx +++ b/pyuno/source/module/pyuno_struct.cxx @@ -30,7 +30,6 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::Reference; using com::sun::star::uno::Any; -using com::sun::star::uno::makeAny; using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::TypeClass; using com::sun::star::uno::RuntimeException; @@ -112,7 +111,7 @@ static PyObject* PyUNOStruct_dir( PyObject *self ) } catch( const RuntimeException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return member_list; @@ -166,19 +165,19 @@ static PyObject* PyUNOStruct_getattr( PyObject* self, char* name ) } catch( const css::beans::UnknownPropertyException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const css::lang::IllegalArgumentException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } catch( const RuntimeException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); } return nullptr; @@ -211,17 +210,17 @@ static int PyUNOStruct_setattr (PyObject* self, char* name, PyObject* value) } catch( const css::beans::UnknownPropertyException & e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); return 1; } catch( const css::script::CannotConvertException &e ) { - raisePyExceptionWithAny( makeAny(e) ); + raisePyExceptionWithAny( Any(e) ); return 1; } catch( const RuntimeException & e ) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); return 1; } PyErr_SetString (PyExc_AttributeError, name); @@ -274,7 +273,7 @@ static PyObject* PyUNOStruct_cmp( PyObject *self, PyObject *that, int op ) } catch( const css::uno::RuntimeException & e) { - raisePyExceptionWithAny( makeAny( e ) ); + raisePyExceptionWithAny( Any( e ) ); } result = (op == Py_EQ ? Py_False : Py_True); -- cgit