summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:20:48 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:31:33 +0100
commit87686af6b85f3bb06c0d75dd870455236506cb7b (patch)
treeb29e54ce4b62042a0d559be9186b9f802b077384 /pyuno
parent1fc2fe74f2db49b17abc3c4df7feec4f215052ca (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: I7a5fda2606f42e2736ad0618f2d8bcc5ba4028fb
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/inc/pyuno/pyuno.hxx6
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx4
-rw-r--r--pyuno/source/module/pyuno.cxx98
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx2
-rw-r--r--pyuno/source/module/pyuno_callable.cxx40
-rw-r--r--pyuno/source/module/pyuno_dlopenwrapper.c2
-rw-r--r--pyuno/source/module/pyuno_iterator.cxx16
-rw-r--r--pyuno/source/module/pyuno_module.cxx84
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx48
-rw-r--r--pyuno/source/module/pyuno_struct.cxx18
-rw-r--r--pyuno/source/module/pyuno_type.cxx6
-rw-r--r--pyuno/source/module/pyuno_util.cxx2
12 files changed, 163 insertions, 163 deletions
diff --git a/pyuno/inc/pyuno/pyuno.hxx b/pyuno/inc/pyuno/pyuno.hxx
index b79d01dd10f3..30a1bdba05a8 100644
--- a/pyuno/inc/pyuno/pyuno.hxx
+++ b/pyuno/inc/pyuno/pyuno.hxx
@@ -90,7 +90,7 @@ class PyRef
{
PyObject *m;
public:
- PyRef () : m(0) {}
+ PyRef () : m(nullptr) {}
PyRef( PyObject * p ) : m( p ) { Py_XINCREF( m ); }
PyRef( PyObject * p, __sal_NoAcquire ) : m( p ) {}
@@ -130,7 +130,7 @@ public:
only seldom needed ! */
void scratch()
{
- m = 0;
+ m = nullptr;
}
/** returns 1 when the reference points to a python object python object,
@@ -138,7 +138,7 @@ public:
*/
bool is() const
{
- return m != 0;
+ return m != nullptr;
}
struct Hash
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index f56cf044f324..2f166bcd9b08 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -264,9 +264,9 @@ static const struct cppu::ImplementationEntry g_entries[] =
{
pyuno_loader::CreateInstance, pyuno_loader::getImplementationName,
pyuno_loader::getSupportedServiceNames, cppu::createSingleComponentFactory,
- 0 , 0
+ nullptr , 0
},
- { 0, 0, 0, 0, 0, 0 }
+ { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
};
extern "C"
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index e35bec04cc3f..75f3507d31b1 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -149,7 +149,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
case typelib_TypeClass_EXCEPTION:
{
buf.append( "{ " );
- typelib_TypeDescription * pTypeDescr = 0;
+ typelib_TypeDescription * pTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
assert( pTypeDescr );
@@ -171,7 +171,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
{
buf.append( ppMemberNames[nPos] );
buf.append( " = " );
- typelib_TypeDescription * pMemberType = 0;
+ typelib_TypeDescription * pMemberType = nullptr;
TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[nPos] );
buf.append( val2str( static_cast<char const *>(pVal) + pMemberOffsets[nPos], pMemberType->pWeakRef, mode ) );
TYPELIB_DANGER_RELEASE( pMemberType );
@@ -186,11 +186,11 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
}
case typelib_TypeClass_SEQUENCE:
{
- typelib_TypeDescription * pTypeDescr = 0;
+ typelib_TypeDescription * pTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
uno_Sequence * pSequence = *static_cast<uno_Sequence * const *>(pVal);
- typelib_TypeDescription * pElementTypeDescr = 0;
+ typelib_TypeDescription * pElementTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pElementTypeDescr, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType );
sal_Int32 nElementSize = pElementTypeDescr->nSize;
@@ -233,7 +233,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
break;
case typelib_TypeClass_ENUM:
{
- typelib_TypeDescription * pTypeDescr = 0;
+ typelib_TypeDescription * pTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
sal_Int32 * pValues = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->pEnumValues;
@@ -440,7 +440,7 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args )
}
callable = PyRef( PyObject_GetAttrString( object , name ), SAL_NO_ACQUIRE );
if( !callable.is() )
- return 0;
+ return nullptr;
}
ret = PyRef( PyObject_CallObject( callable.get(), paras.get() ), SAL_NO_ACQUIRE );
}
@@ -486,7 +486,7 @@ PyObject* PyUNO_dir (PyObject* self)
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
- PyObject* member_list = NULL;
+ PyObject* member_list = nullptr;
Sequence<OUString> oo_member_list;
try
@@ -593,7 +593,7 @@ PyRef lcl_indexToSlice( PyRef rIndex )
{
Py_ssize_t nIndex = PyNumber_AsSsize_t( rIndex.get(), PyExc_IndexError );
if (nIndex == -1 && PyErr_Occurred())
- return NULL;
+ return nullptr;
PyRef rStart( PyLong_FromSsize_t( nIndex ), SAL_NO_ACQUIRE );
PyRef rStop( PyLong_FromSsize_t( nIndex+1 ), SAL_NO_ACQUIRE );
PyRef rStep( PyLong_FromLong( 1 ), SAL_NO_ACQUIRE );
@@ -631,7 +631,7 @@ PyObject* lcl_getitem_XCellRange( PyUNO* me, PyObject* pKey )
{
// [0] is equivalent to [0,:]
rKey0 = pKey;
- rKey1 = PySlice_New( NULL, NULL, NULL );
+ rKey1 = PySlice_New( nullptr, nullptr, nullptr );
}
else if ( PyTuple_Check( pKey ) && (PyTuple_Size( pKey ) == 2) )
{
@@ -641,7 +641,7 @@ PyObject* lcl_getitem_XCellRange( PyUNO* me, PyObject* pKey )
else
{
PyErr_SetString( PyExc_KeyError, "invalid subscript" );
- return NULL;
+ return nullptr;
}
// If both keys are indices, return the corresponding cell
@@ -651,7 +651,7 @@ PyObject* lcl_getitem_XCellRange( PyUNO* me, PyObject* pKey )
sal_Int32 nKey1_s = lcl_PyNumber_AsSal_Int32( rKey1.get() );
if ( ((nKey0_s == -1) || (nKey1_s == -1)) && PyErr_Occurred() )
- return NULL;
+ return nullptr;
aParams.realloc( 2 );
aParams[0] <<= nKey1_s;
@@ -691,12 +691,12 @@ PyObject* lcl_getitem_XCellRange( PyUNO* me, PyObject* pKey )
int nSuccess1 = lcl_PySlice_GetIndicesEx( rKey0.get(), nLen0, &nStart0, &nStop0, &nStep0, &nSliceLength0 );
int nSuccess2 = lcl_PySlice_GetIndicesEx( rKey1.get(), nLen1, &nStart1, &nStop1, &nStep1, &nSliceLength1 );
if ( ((nSuccess1 == -1) || (nSuccess2 == -1)) && PyErr_Occurred() )
- return NULL;
+ return nullptr;
if ( nSliceLength0 <= 0 || nSliceLength1 <= 0 )
{
PyErr_SetString( PyExc_KeyError, "invalid number of rows or columns" );
- return NULL;
+ return nullptr;
}
if ( nStep0 == 1 && nStep1 == 1 )
@@ -716,11 +716,11 @@ PyObject* lcl_getitem_XCellRange( PyUNO* me, PyObject* pKey )
}
PyErr_SetString( PyExc_KeyError, "step != 1 not supported" );
- return NULL;
+ return nullptr;
}
PyErr_SetString( PyExc_KeyError, "invalid subscript" );
- return NULL;
+ return nullptr;
}
PyObject* lcl_getitem_index( PyUNO *me, PyObject *pKey, Runtime& runtime )
@@ -730,7 +730,7 @@ PyObject* lcl_getitem_index( PyUNO *me, PyObject *pKey, Runtime& runtime )
nIndex = lcl_PyNumber_AsSal_Int32( pKey );
if (nIndex == -1 && PyErr_Occurred())
- return NULL;
+ return nullptr;
{
PyThreadDetach antiguard;
@@ -749,7 +749,7 @@ PyObject* lcl_getitem_index( PyUNO *me, PyObject *pKey, Runtime& runtime )
return rRet.getAcquired();
}
- return NULL;
+ return nullptr;
}
PyObject* lcl_getitem_slice( PyUNO *me, PyObject *pKey )
@@ -772,7 +772,7 @@ PyObject* lcl_getitem_slice( PyUNO *me, PyObject *pKey )
sal_Int32 nStart = 0, nStop = 0, nStep = 0, nSliceLength = 0;
int nSuccess = lcl_PySlice_GetIndicesEx(pKey, nLen, &nStart, &nStop, &nStep, &nSliceLength);
if ( nSuccess == -1 && PyErr_Occurred() )
- return NULL;
+ return nullptr;
PyRef rTuple( PyTuple_New( nSliceLength ), SAL_NO_ACQUIRE, NOT_NULL );
sal_Int32 nCur, i;
@@ -792,7 +792,7 @@ PyObject* lcl_getitem_slice( PyUNO *me, PyObject *pKey )
return rTuple.getAcquired();
}
- return NULL;
+ return nullptr;
}
PyObject* lcl_getitem_string( PyUNO *me, PyObject *pKey, Runtime& runtime )
@@ -815,7 +815,7 @@ PyObject* lcl_getitem_string( PyUNO *me, PyObject *pKey, Runtime& runtime )
return rRet.getAcquired();
}
- return NULL;
+ return nullptr;
}
PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
@@ -829,7 +829,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
if ( PyIndex_Check( pKey ) )
{
PyObject* pRet = lcl_getitem_index( me, pKey, runtime );
- if ( pRet != NULL || PyErr_Occurred() )
+ if ( pRet != nullptr || PyErr_Occurred() )
return pRet;
}
@@ -837,7 +837,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
if ( PySlice_Check( pKey ) )
{
PyObject* pRet = lcl_getitem_slice( me, pKey );
- if ( pRet != NULL || PyErr_Occurred() )
+ if ( pRet != nullptr || PyErr_Occurred() )
return pRet;
}
@@ -845,7 +845,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
if ( PyStr_Check( pKey ) )
{
PyObject* pRet = lcl_getitem_string( me, pKey, runtime );
- if ( pRet != NULL )
+ if ( pRet != nullptr )
return pRet;
}
@@ -872,7 +872,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
if ( xIndexAccess.is() || xNameAccess.is() )
{
PyErr_SetString( PyExc_TypeError, "subscription with invalid type" );
- return NULL;
+ return nullptr;
}
PyErr_SetString( PyExc_TypeError, "object is not subscriptable" );
@@ -902,7 +902,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
raisePyExceptionWithAny( css::uno::makeAny( e ) );
}
- return NULL;
+ return nullptr;
}
int lcl_setitem_index( PyUNO *me, PyObject *pKey, PyObject *pValue )
@@ -918,7 +918,7 @@ int lcl_setitem_index( PyUNO *me, PyObject *pKey, PyObject *pValue )
bool isTuple = false;
Any aValue;
- if ( pValue != NULL )
+ if ( pValue != nullptr )
{
isTuple = PyTuple_Check( pValue );
@@ -948,7 +948,7 @@ int lcl_setitem_index( PyUNO *me, PyObject *pKey, PyObject *pValue )
nIndex += xIndexReplace->getCount();
// XIndexReplace replace by index
- if ( (pValue != NULL) && xIndexReplace.is() )
+ if ( (pValue != nullptr) && xIndexReplace.is() )
{
if ( isTuple )
{
@@ -962,7 +962,7 @@ int lcl_setitem_index( PyUNO *me, PyObject *pKey, PyObject *pValue )
}
// XIndexContainer remove by index
- if ( (pValue == NULL) && xIndexContainer.is() )
+ if ( (pValue == nullptr) && xIndexContainer.is() )
{
xIndexContainer->removeByIndex( nIndex );
return 0;
@@ -1002,7 +1002,7 @@ int lcl_setitem_slice( PyUNO *me, PyObject *pKey, PyObject *pValue )
if ( (nSuccess == -1) && PyErr_Occurred() )
return 0;
- if ( pValue == NULL )
+ if ( pValue == nullptr )
{
pValue = PyTuple_New( 0 );
}
@@ -1099,7 +1099,7 @@ int lcl_setitem_string( PyUNO *me, PyObject *pKey, PyObject *pValue )
bool isTuple = false;
Any aValue;
- if ( pValue != NULL)
+ if ( pValue != nullptr)
{
isTuple = PyTuple_Check( pValue );
try
@@ -1289,7 +1289,7 @@ PyObject* PyUNO_iter( PyObject *self )
raisePyExceptionWithAny( css::uno::makeAny( e ) );
}
- return NULL;
+ return nullptr;
}
int PyUNO_contains( PyObject *self, PyObject *pKey )
@@ -1459,7 +1459,7 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
raisePyExceptionWithAny( makeAny(e) );
}
- return NULL;
+ return nullptr;
}
int PyUNO_setattr (PyObject* self, char* name, PyObject* value)
@@ -1513,7 +1513,7 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op )
if(op != Py_EQ && op != Py_NE)
{
PyErr_SetString(PyExc_TypeError, "only '==' and '!=' comparisons are defined");
- return 0;
+ return nullptr;
}
if( self == that )
{
@@ -1555,8 +1555,8 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op )
static PyMethodDef PyUNOMethods[] =
{
- {"__dir__", reinterpret_cast<PyCFunction>(PyUNO_dir), METH_NOARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {"__dir__", reinterpret_cast<PyCFunction>(PyUNO_dir), METH_NOARGS, nullptr},
+ {nullptr, nullptr, 0, nullptr}
};
static PyNumberMethods PyUNONumberMethods[] =
@@ -1647,7 +1647,7 @@ static PyTypeObject PyUNOType =
nullptr,
PyUNO_getattr,
PyUNO_setattr,
- /* this type does not exist in Python 3: (cmpfunc) */ 0,
+ /* this type does not exist in Python 3: (cmpfunc) */ nullptr,
PyUNO_repr,
PyUNONumberMethods,
PyUNOSequenceMethods,
@@ -1657,9 +1657,9 @@ static PyTypeObject PyUNOType =
PyUNO_str,
nullptr,
nullptr,
- NULL,
+ nullptr,
Py_TPFLAGS_HAVE_ITER | Py_TPFLAGS_HAVE_RICHCOMPARE | Py_TPFLAGS_HAVE_SEQUENCE_IN,
- NULL,
+ nullptr,
nullptr,
nullptr,
PyUNO_cmp,
@@ -1667,10 +1667,10 @@ static PyTypeObject PyUNOType =
PyUNO_iter,
nullptr,
PyUNOMethods,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr,
nullptr,
0,
@@ -1679,17 +1679,17 @@ static PyTypeObject PyUNOType =
nullptr,
nullptr,
nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr
#if PY_VERSION_HEX >= 0x02060000
, 0
#endif
#if PY_VERSION_HEX >= 0x03040000
- , 0
+ , nullptr
#endif
};
@@ -1729,7 +1729,7 @@ PyRef PyUNO_new (
throw RuntimeException();
PyUNO* self = PyObject_New (PyUNO, &PyUNOType);
- if (self == NULL)
+ if (self == nullptr)
return PyRef(); // == error
self->members = new PyUNOInternals();
self->members->xInvocation = xInvocation;
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index cd5e5e4b8e31..dc1a25af4946 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -193,7 +193,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
- RuntimeCargo *cargo = 0;
+ RuntimeCargo *cargo = nullptr;
try
{
PyThreadAttach guard( mInterpreter );
diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx
index ef6a707bf4aa..d52d6577da2b 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -70,7 +70,7 @@ PyObject* PyUNO_callable_call(
Sequence<Any> aParams;
Any any_params;
Any ret_value;
- RuntimeCargo *cargo = 0;
+ RuntimeCargo *cargo = nullptr;
me = reinterpret_cast<PyUNO_callable*>(self);
PyRef ret;
@@ -191,30 +191,30 @@ static PyTypeObject PyUNO_callable_Type =
nullptr,
nullptr,
nullptr,
- 0,
nullptr,
- 0,
- 0,
- 0,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr,
::pyuno::PyUNO_callable_call,
nullptr,
nullptr,
nullptr,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
nullptr,
nullptr,
nullptr,
0,
nullptr,
nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr,
nullptr,
0,
@@ -223,17 +223,17 @@ static PyTypeObject PyUNO_callable_Type =
nullptr,
nullptr,
nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr
#if PY_VERSION_HEX >= 0x02060000
, 0
#endif
#if PY_VERSION_HEX >= 0x03040000
- , 0
+ , nullptr
#endif
};
@@ -247,8 +247,8 @@ PyRef PyUNO_callable_new (
OSL_ENSURE (my_inv.is(), "XInvocation must be valid");
self = PyObject_New (PyUNO_callable, &PyUNO_callable_Type);
- if (self == NULL)
- return NULL; //NULL == Error!
+ if (self == nullptr)
+ return nullptr; //NULL == Error!
self->members = new PyUNO_callable_Internals;
self->members->xInvocation = my_inv;
diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c b/pyuno/source/module/pyuno_dlopenwrapper.c
index 8f3f53bb6546..98593ebcf372 100644
--- a/pyuno/source/module/pyuno_dlopenwrapper.c
+++ b/pyuno/source/module/pyuno_dlopenwrapper.c
@@ -56,7 +56,7 @@ static void * load(void * address, char const * symbol) {
libname = malloc(
len + RTL_CONSTASCII_LENGTH(SAL_DLLPREFIX "pyuno" SAL_DLLEXTENSION)
+ 1);
- if (libname == 0) {
+ if (libname == NULL) {
abort();
}
strncpy(libname, dl_info.dli_fname, len);
diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx
index 0b245d33e661..6b8173e1adba 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -86,7 +86,7 @@ PyObject* PyUNO_iterator_next( PyObject *self )
}
PyErr_SetString( PyExc_StopIteration, "" );
- return NULL;
+ return nullptr;
}
catch( css::container::NoSuchElementException &e )
{
@@ -109,7 +109,7 @@ PyObject* PyUNO_iterator_next( PyObject *self )
raisePyExceptionWithAny( css::uno::makeAny( e ) );
}
- return NULL;
+ return nullptr;
}
@@ -170,8 +170,8 @@ static PyTypeObject PyUNO_iterator_Type =
PyObject* PyUNO_iterator_new( const Reference< XEnumeration > xEnumeration )
{
PyUNO_iterator* self = PyObject_New( PyUNO_iterator, &PyUNO_iterator_Type );
- if ( self == NULL )
- return NULL; // == error
+ if ( self == nullptr )
+ return nullptr; // == error
self->members = new PyUNO_iterator_Internals();
self->members->xEnumeration = xEnumeration;
return reinterpret_cast<PyObject*>(self);
@@ -215,7 +215,7 @@ PyObject* PyUNO_list_iterator_next( PyObject *self )
if ( noMoreElements )
{
PyErr_SetString( PyExc_StopIteration, "" );
- return NULL;
+ return nullptr;
}
PyRef rRet = runtime.any2PyObject( aRet );
@@ -239,7 +239,7 @@ PyObject* PyUNO_list_iterator_next( PyObject *self )
raisePyExceptionWithAny( css::uno::makeAny( e ) );
}
- return NULL;
+ return nullptr;
}
@@ -300,8 +300,8 @@ static PyTypeObject PyUNO_list_iterator_Type =
PyObject* PyUNO_list_iterator_new( const Reference<XIndexAccess> &xIndexAccess )
{
PyUNO_list_iterator* self = PyObject_New( PyUNO_list_iterator, &PyUNO_list_iterator_Type );
- if ( self == NULL )
- return NULL; // == error
+ if ( self == nullptr )
+ return nullptr; // == error
self->members = new PyUNO_list_iterator_Internals();
self->members->xIndexAccess = xIndexAccess;
self->members->index = 0;
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index 687e7fc8c148..ed6f304e6b58 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -259,7 +259,7 @@ static PyObject* getComponentContext(
PyErr_SetString(
PyExc_RuntimeError, "osl_getUrlFromAddress fails, that's why I cannot find ini "
"file for bootstrapping python uno bridge\n" );
- return NULL;
+ return nullptr;
}
OUStringBuffer iniFileName;
@@ -327,7 +327,7 @@ static PyObject* initTestEnvironment(
// so load "test" library and invoke a function there to do the work
try
{
- PyObject *const ctx(getComponentContext(0, 0));
+ PyObject *const ctx(getComponentContext(nullptr, nullptr));
if (!ctx) { abort(); }
Runtime const runtime;
Any const a(runtime.pyObject2Any(ctx));
@@ -370,7 +370,7 @@ PyObject * extractOneStringArg( PyObject *args, char const *funcName )
OStringBuffer buf;
buf.append( funcName ).append( ": expecting one string argument" );
PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
- return NULL;
+ return nullptr;
}
PyObject *obj = PyTuple_GetItem( args, 0 );
if (!PyStr_Check(obj) && !PyUnicode_Check(obj))
@@ -378,7 +378,7 @@ PyObject * extractOneStringArg( PyObject *args, char const *funcName )
OStringBuffer buf;
buf.append( funcName ).append( ": expecting one string argument" );
PyErr_SetString( PyExc_TypeError, buf.getStr());
- return NULL;
+ return nullptr;
}
return obj;
}
@@ -472,7 +472,7 @@ static PyObject *createUnoStructHelper(
static PyObject *getTypeByName(
SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
{
- PyObject * ret = NULL;
+ PyObject * ret = nullptr;
try
{
@@ -506,7 +506,7 @@ static PyObject *getTypeByName(
static PyObject *getConstantByName(
SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
{
- PyObject *ret = 0;
+ PyObject *ret = nullptr;
try
{
char *name;
@@ -558,7 +558,7 @@ static PyObject *checkType( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
OStringBuffer buf;
buf.append( "pyuno.checkType : expecting one uno.Type argument" );
PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
- return NULL;
+ return nullptr;
}
PyObject *obj = PyTuple_GetItem( args, 0 );
@@ -569,7 +569,7 @@ static PyObject *checkType( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
catch(const RuntimeException & e)
{
raisePyExceptionWithAny( makeAny( e ) );
- return NULL;
+ return nullptr;
}
Py_INCREF( Py_None );
return Py_None;
@@ -582,7 +582,7 @@ static PyObject *checkEnum( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
OStringBuffer buf;
buf.append( "pyuno.checkType : expecting one uno.Type argument" );
PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
- return NULL;
+ return nullptr;
}
PyObject *obj = PyTuple_GetItem( args, 0 );
@@ -593,7 +593,7 @@ static PyObject *checkEnum( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
catch(const RuntimeException & e)
{
raisePyExceptionWithAny( makeAny( e) );
- return NULL;
+ return nullptr;
}
Py_INCREF( Py_None );
return Py_None;
@@ -603,7 +603,7 @@ static PyObject *getClass( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
{
PyObject *obj = extractOneStringArg( args, "pyuno.getClass");
if( ! obj )
- return NULL;
+ return nullptr;
try
{
@@ -616,7 +616,7 @@ static PyObject *getClass( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
{
raisePyExceptionWithAny( makeAny(e) );
}
- return NULL;
+ return nullptr;
}
static PyObject *isInterface( SAL_UNUSED_PARAMETER PyObject *, PyObject *args )
@@ -635,7 +635,7 @@ static PyObject * generateUuid(
SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * )
{
Sequence< sal_Int8 > seq( 16 );
- rtl_createUuid( reinterpret_cast<sal_uInt8*>(seq.getArray()) , 0 , sal_False );
+ rtl_createUuid( reinterpret_cast<sal_uInt8*>(seq.getArray()) , nullptr , sal_False );
PyRef ret;
try
{
@@ -654,7 +654,7 @@ static PyObject *systemPathToFileUrl(
{
PyObject *obj = extractOneStringArg( args, "pyuno.systemPathToFileUrl" );
if( ! obj )
- return NULL;
+ return nullptr;
OUString sysPath = pyString2ustring( obj );
OUString url;
@@ -670,7 +670,7 @@ static PyObject *systemPathToFileUrl(
buf.append( ")" );
raisePyExceptionWithAny(
makeAny( RuntimeException( buf.makeStringAndClear() )));
- return NULL;
+ return nullptr;
}
return ustring2PyUnicode( url ).getAcquired();
}
@@ -680,7 +680,7 @@ static PyObject * fileUrlToSystemPath(
{
PyObject *obj = extractOneStringArg( args, "pyuno.fileUrlToSystemPath" );
if( ! obj )
- return NULL;
+ return nullptr;
OUString url = pyString2ustring( obj );
OUString sysPath;
@@ -696,7 +696,7 @@ static PyObject * fileUrlToSystemPath(
buf.append( ")" );
raisePyExceptionWithAny(
makeAny( RuntimeException( buf.makeStringAndClear() )));
- return NULL;
+ return nullptr;
}
return ustring2PyUnicode( sysPath ).getAcquired();
}
@@ -723,16 +723,16 @@ static PyObject * absolutize( SAL_UNUSED_PARAMETER PyObject *, PyObject * args )
PyErr_SetString(
PyExc_OSError,
OUStringToOString(buf.makeStringAndClear(),osl_getThreadTextEncoding()).getStr());
- return 0;
+ return nullptr;
}
return ustring2PyUnicode( ret ).getAcquired();
}
- return 0;
+ return nullptr;
}
static PyObject * invoke(SAL_UNUSED_PARAMETER PyObject *, PyObject *args)
{
- PyObject *ret = 0;
+ PyObject *ret = nullptr;
if(PyTuple_Check(args) && PyTuple_Size(args) == 3)
{
PyObject *object = PyTuple_GetItem(args, 0);
@@ -836,23 +836,23 @@ static PyObject *setCurrentContext(
struct PyMethodDef PyUNOModule_methods [] =
{
- {"private_initTestEnvironment", initTestEnvironment, METH_VARARGS, NULL},
- {"getComponentContext", getComponentContext, METH_VARARGS, NULL},
- {"_createUnoStructHelper", reinterpret_cast<PyCFunction>(createUnoStructHelper), METH_VARARGS | METH_KEYWORDS, NULL},
- {"getTypeByName", getTypeByName, METH_VARARGS, NULL},
- {"getConstantByName", getConstantByName, METH_VARARGS, NULL},
- {"getClass", getClass, METH_VARARGS, NULL},
- {"checkEnum", checkEnum, METH_VARARGS, NULL},
- {"checkType", checkType, METH_VARARGS, NULL},
- {"generateUuid", generateUuid, METH_VARARGS, NULL},
- {"systemPathToFileUrl", systemPathToFileUrl, METH_VARARGS, NULL},
- {"fileUrlToSystemPath", fileUrlToSystemPath, METH_VARARGS, NULL},
- {"absolutize", absolutize, METH_VARARGS | METH_KEYWORDS, NULL},
- {"isInterface", isInterface, METH_VARARGS, NULL},
- {"invoke", invoke, METH_VARARGS | METH_KEYWORDS, NULL},
- {"setCurrentContext", setCurrentContext, METH_VARARGS, NULL},
- {"getCurrentContext", getCurrentContext, METH_VARARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {"private_initTestEnvironment", initTestEnvironment, METH_VARARGS, nullptr},
+ {"getComponentContext", getComponentContext, METH_VARARGS, nullptr},
+ {"_createUnoStructHelper", reinterpret_cast<PyCFunction>(createUnoStructHelper), METH_VARARGS | METH_KEYWORDS, nullptr},
+ {"getTypeByName", getTypeByName, METH_VARARGS, nullptr},
+ {"getConstantByName", getConstantByName, METH_VARARGS, nullptr},
+ {"getClass", getClass, METH_VARARGS, nullptr},
+ {"checkEnum", checkEnum, METH_VARARGS, nullptr},
+ {"checkType", checkType, METH_VARARGS, nullptr},
+ {"generateUuid", generateUuid, METH_VARARGS, nullptr},
+ {"systemPathToFileUrl", systemPathToFileUrl, METH_VARARGS, nullptr},
+ {"fileUrlToSystemPath", fileUrlToSystemPath, METH_VARARGS, nullptr},
+ {"absolutize", absolutize, METH_VARARGS | METH_KEYWORDS, nullptr},
+ {"isInterface", isInterface, METH_VARARGS, nullptr},
+ {"invoke", invoke, METH_VARARGS | METH_KEYWORDS, nullptr},
+ {"setCurrentContext", setCurrentContext, METH_VARARGS, nullptr},
+ {"getCurrentContext", getCurrentContext, METH_VARARGS, nullptr},
+ {nullptr, nullptr, 0, nullptr}
};
}
@@ -869,13 +869,13 @@ PyObject* PyInit_pyuno()
{
PyModuleDef_HEAD_INIT,
"pyuno", // module name
- 0, // module documentation
+ nullptr, // module documentation
-1, // module keeps state in global variables,
PyUNOModule_methods, // modules methods
- 0, // m_reload (must be 0)
- 0, // m_traverse
- 0, // m_clear
- 0, // m_free
+ nullptr, // m_reload (must be 0)
+ nullptr, // m_traverse
+ nullptr, // m_clear
+ nullptr, // m_free
};
return PyModule_Create(&moduledef);
}
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 476691592728..283ffc53edd8 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -80,30 +80,30 @@ static PyTypeObject RuntimeImpl_Type =
nullptr,
nullptr,
nullptr,
- 0,
nullptr,
- 0,
- 0,
- 0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
0,
- NULL,
+ nullptr,
nullptr,
nullptr,
nullptr,
0,
nullptr,
nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr,
nullptr,
0,
@@ -112,17 +112,17 @@ static PyTypeObject RuntimeImpl_Type =
nullptr,
nullptr,
nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
nullptr
#if PY_VERSION_HEX >= 0x02060000
, 0
#endif
#if PY_VERSION_HEX >= 0x03040000
- , 0
+ , nullptr
#endif
};
@@ -182,7 +182,7 @@ static PyRef importUnoModule( ) throw ( RuntimeException )
static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
{
*pLevel = LogLevel::NONE;
- *ppFile = 0;
+ *ppFile = nullptr;
OUString fileName;
osl_getModuleURLFromFunctionAddress(
reinterpret_cast< oslGenericFunction >(readLoggingConfig),
@@ -223,7 +223,7 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
oslProcessInfo data;
data.Size = sizeof( data );
osl_getProcessInfo(
- 0 , osl_Process_IDENTIFIER , &data );
+ nullptr , osl_Process_IDENTIFIER , &data );
osl_getSystemPathFromFileURL( str.pData, &str.pData);
OString o = OUStringToOString( str, osl_getThreadTextEncoding() );
o += ".";
@@ -233,7 +233,7 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
if ( *ppFile )
{
// do not buffer (useful if e.g. analyzing a crash)
- setvbuf( *ppFile, 0, _IONBF, 0 );
+ setvbuf( *ppFile, nullptr, _IONBF, 0 );
}
else
{
@@ -255,7 +255,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
RuntimeImpl *me = PyObject_New (RuntimeImpl, &RuntimeImpl_Type);
if( ! me )
throw RuntimeException( "cannot instantiate pyuno::RuntimeImpl" );
- me->cargo = 0;
+ me->cargo = nullptr;
// must use a different struct here, as the PyObject_New
// makes C++ unusable
RuntimeCargo *c = new RuntimeCargo();
@@ -327,7 +327,7 @@ bool Runtime::isInitialized() throw ( RuntimeException )
}
Runtime::Runtime() throw( RuntimeException )
- : impl( 0 )
+ : impl( nullptr )
{
PyRef globalDict, runtime;
getRuntimeImpl( globalDict , runtime );
@@ -576,7 +576,7 @@ static Sequence< Type > invokeGetTypes( const Runtime & r , PyObject * o )
raiseInvocationTargetExceptionWhenNeeded( r );
if( method.is() && PyCallable_Check( method.get() ) )
{
- PyRef types( PyObject_CallObject( method.get(), 0 ) , SAL_NO_ACQUIRE );
+ PyRef types( PyObject_CallObject( method.get(), nullptr ) , SAL_NO_ACQUIRE );
raiseInvocationTargetExceptionWhenNeeded( r );
if( types.is() && PyTuple_Check( types.get() ) )
{
@@ -899,7 +899,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
}
else
{
- OUString const msg(lcl_ExceptionMessage(o, 0));
+ OUString const msg(lcl_ExceptionMessage(o, nullptr));
throw RuntimeException(msg);
}
}
diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx
index 684ebed44ff0..66d5d5630b26 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -80,7 +80,7 @@ PyObject *PyUNOStruct_str( PyObject *self )
PyObject *PyUNOStruct_repr( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
- PyObject *ret = 0;
+ PyObject *ret = nullptr;
if( me->members->wrappedObject.getValueType().getTypeClass()
== css::uno::TypeClass_EXCEPTION )
@@ -106,7 +106,7 @@ PyObject* PyUNOStruct_dir( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
- PyObject* member_list = NULL;
+ PyObject* member_list = nullptr;
try
{
@@ -188,7 +188,7 @@ PyObject* PyUNOStruct_getattr( PyObject* self, char* name )
raisePyExceptionWithAny( makeAny(e) );
}
- return NULL;
+ return nullptr;
}
int PyUNOStruct_setattr (PyObject* self, char* name, PyObject* value)
@@ -243,7 +243,7 @@ static PyObject* PyUNOStruct_cmp( PyObject *self, PyObject *that, int op )
if(op != Py_EQ && op != Py_NE)
{
PyErr_SetString( PyExc_TypeError, "only '==' and '!=' comparisons are defined" );
- return 0;
+ return nullptr;
}
if( self == that )
{
@@ -291,8 +291,8 @@ static PyObject* PyUNOStruct_cmp( PyObject *self, PyObject *that, int op )
static PyMethodDef PyUNOStructMethods[] =
{
- {"__dir__", reinterpret_cast<PyCFunction>(PyUNOStruct_dir), METH_NOARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {"__dir__", reinterpret_cast<PyCFunction>(PyUNOStruct_dir), METH_NOARGS, nullptr},
+ {nullptr, nullptr, 0, nullptr}
};
static PyTypeObject PyUNOStructType =
@@ -305,7 +305,7 @@ static PyTypeObject PyUNOStructType =
nullptr,
PyUNOStruct_getattr,
PyUNOStruct_setattr,
- /* this type does not exist in Python 3: (cmpfunc) */ 0,
+ /* this type does not exist in Python 3: (cmpfunc) */ nullptr,
PyUNOStruct_repr,
nullptr,
nullptr,
@@ -347,7 +347,7 @@ static PyTypeObject PyUNOStructType =
, 0
#endif
#if PY_VERSION_HEX >= 0x03040000
- , 0
+ , nullptr
#endif
};
@@ -379,7 +379,7 @@ PyRef PyUNOStruct_new (
throw RuntimeException();
PyUNO* self = PyObject_New (PyUNO, &PyUNOStructType);
- if (self == NULL)
+ if (self == nullptr)
return PyRef(); // == error
self->members = new PyUNOInternals();
self->members->xInvocation = xInvocation;
diff --git a/pyuno/source/module/pyuno_type.cxx b/pyuno/source/module/pyuno_type.cxx
index dfaf0d3951b0..f5efbfe20592 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -36,7 +36,7 @@ namespace pyuno
{
const char *typeClassToString( TypeClass t )
{
- const char * ret = 0;
+ const char * ret = nullptr;
switch (t)
{
case css::uno::TypeClass_VOID:
@@ -243,7 +243,7 @@ static PyObject* callCtor( const Runtime &r , const char * clazz, const PyRef &
buf.append( "couldn't access uno." );
buf.append( clazz );
PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
- return NULL;
+ return nullptr;
}
PyRef instance( PyObject_CallObject( code.get(), args.get() ), SAL_NO_ACQUIRE);
Py_XINCREF( instance.get() );
@@ -270,7 +270,7 @@ PyObject* PyUNO_Type_new (const char *typeName , TypeClass t , const Runtime &r
PyTuple_SetItem( args.get() , 0 , PyStr_FromString( typeName ) );
PyObject *typeClass = PyUNO_Enum_new( "com.sun.star.uno.TypeClass" , typeClassToString(t), r );
if( ! typeClass )
- return NULL;
+ return nullptr;
PyTuple_SetItem( args.get() , 1 , typeClass);
return callCtor( r, "Type" , args );
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index 77fe4557a5d0..86528f1817f7 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -57,7 +57,7 @@ PyRef ustring2PyUnicode( const OUString & str )
ret = PyRef( PyUnicode_FromUnicode( (const Py_UNICODE*)str.getStr(), str.getLength() ), SAL_NO_ACQUIRE );
#else
OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8));
- ret = PyRef( PyUnicode_DecodeUTF8( sUtf8.getStr(), sUtf8.getLength(), NULL) , SAL_NO_ACQUIRE );
+ ret = PyRef( PyUnicode_DecodeUTF8( sUtf8.getStr(), sUtf8.getLength(), nullptr) , SAL_NO_ACQUIRE );
#endif
return ret;
}