aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/voidptr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken/voidptr.cpp')
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index 4d09adb0c..0dceefc29 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -63,8 +63,8 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwd
PyObject *ob = type->tp_alloc(type, 0);
SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
- if (self != 0) {
- self->cptr = 0;
+ if (self != nullptr) {
+ self->cptr = nullptr;
self->size = -1;
self->isWritable = false;
}
@@ -82,7 +82,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
int isWritable = 0;
SbkVoidPtrObject *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
- static const char *kwlist[] = {"address", "size", "writeable", 0};
+ static const char *kwlist[] = {"address", "size", "writeable", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ni", const_cast<char **>(kwlist),
&addressObject, &size, &isWritable))
@@ -147,8 +147,8 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
{
PyObject *result = Py_False;
- void *cptr1 = 0;
- void *cptr2 = 0;
+ void *cptr1 = nullptr;
+ void *cptr2 = nullptr;
bool validObjects = true;
if (SbkVoidPtr_Check(obj1))
@@ -197,7 +197,7 @@ PyObject *toBytes(PyObject *self, PyObject *args)
static struct PyMethodDef SbkVoidPtrObject_methods[] = {
{"toBytes", toBytes, METH_NOARGS},
- {0}
+ {nullptr}
};
static Py_ssize_t SbkVoidPtrObject_length(PyObject *v)
@@ -251,7 +251,7 @@ PyObject *SbkVoidPtrObject_str(PyObject *v)
static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
{
- if (view == NULL)
+ if (view == nullptr)
return -1;
SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
@@ -273,18 +273,18 @@ static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
view->len = sbkObject->size;
view->readonly = readonly;
view->itemsize = 1;
- view->format = NULL;
+ view->format = nullptr;
if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT)
view->format = "B";
view->ndim = 1;
- view->shape = NULL;
+ view->shape = nullptr;
if ((flags & PyBUF_ND) == PyBUF_ND)
view->shape = &(view->len);
- view->strides = NULL;
+ view->strides = nullptr;
if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES)
view->strides = &(view->itemsize);
- view->suboffsets = NULL;
- view->internal = NULL;
+ view->suboffsets = nullptr;
+ view->internal = nullptr;
return 0;
}
@@ -321,7 +321,7 @@ PyBufferProcs SbkVoidPtrObjectBufferProc = {
static PyBufferProcs SbkVoidPtrObjectBufferProc = {
(getbufferproc)SbkVoidPtrObject_getbuffer, // bf_getbuffer
- (releasebufferproc)0 // bf_releasebuffer
+ (releasebufferproc)nullptr // bf_releasebuffer
};
#endif
@@ -337,7 +337,7 @@ static PyType_Slot SbkVoidPtrType_slots[] = {
{Py_tp_new, (void *)SbkVoidPtrObject_new},
{Py_tp_dealloc, (void *)object_dealloc},
{Py_tp_methods, (void *)SbkVoidPtrObject_methods},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkVoidPtrType_spec = {
"shiboken2.libshiboken.VoidPtr",
@@ -416,7 +416,7 @@ static void VoidPtrToCpp(PyObject *pyIn, void *cppOut)
static PythonToCppFunc VoidPtrToCppIsConvertible(PyObject *pyIn)
{
- return SbkVoidPtr_Check(pyIn) ? VoidPtrToCpp : 0;
+ return SbkVoidPtr_Check(pyIn) ? VoidPtrToCpp : nullptr;
}
static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
@@ -427,7 +427,7 @@ static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
static PythonToCppFunc SbkObjectToCppIsConvertible(PyObject *pyIn)
{
- return Shiboken::Object::checkType(pyIn) ? SbkObjectToCpp : 0;
+ return Shiboken::Object::checkType(pyIn) ? SbkObjectToCpp : nullptr;
}
static void PythonBufferToCpp(PyObject *pyIn, void *cppOut)
@@ -453,14 +453,14 @@ static PythonToCppFunc PythonBufferToCppIsConvertible(PyObject *pyIn)
// Bail out if the object can't provide a simple contiguous buffer.
if (PyObject_GetBuffer(pyIn, &bufferView, PyBUF_SIMPLE) < 0)
- return 0;
+ return nullptr;
// Release the buffer.
PyBuffer_Release(&bufferView);
return PythonBufferToCpp;
}
- return 0;
+ return nullptr;
}
SbkConverter *createConverter()