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"
......
This diff is collapsed.
...@@ -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