Kaydet (Commit) 87686af6 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

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