summaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside/pysideproperty.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-30 13:23:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-30 16:36:39 +0000
commit83f09c51f76f17255b34e72a5a3c9b7b325e7aae (patch)
tree0f8f26e3361f3759bde46f7f5faa8a5d7ab2cf88 /sources/pyside2/libpyside/pysideproperty.cpp
parent08af692e40cb178ad59af2ed7b7b8928c0ac2ff6 (diff)
libpyside: Fix remaining clang-tidy warnings
- Remove else after return/continue/break; unindent code or simplify return conditions - Use isEmpty() to check for empty containers - Fix C-style casts - Pass std::size_t by value instead of const ref Change-Id: Ic997d7c39720c1cd3698c4d750e9cfc1f1654788 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/libpyside/pysideproperty.cpp')
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index 279e09ec..1929f999 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -173,7 +173,8 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
"designable", "scriptable", "stored", "user",
"constant", "final", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds,
- "O|OOOOsObbbbbb:QtCore.QProperty", (char**) kwlist,
+ "O|OOOOsObbbbbb:QtCore.QProperty",
+ const_cast<char**>(kwlist),
/*OO*/ &type, &(pData->fget),
/*OOO*/ &(pData->fset), &(pData->freset), &(pData->fdel),
/*s*/ &(pData->doc),
@@ -197,14 +198,13 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
Py_XINCREF(pData->fdel);
Py_XINCREF(pData->notify);
return 1;
- } else {
- pData->fget = 0;
- pData->fset = 0;
- pData->freset = 0;
- pData->fdel = 0;
- pData->notify = 0;
- return -1;
}
+ pData->fget = nullptr;
+ pData->fset = nullptr;
+ pData->freset = nullptr;
+ pData->fdel = nullptr;
+ pData->notify = nullptr;
+ return -1;
}
void qpropertyDeAlloc(PyObject* self)
@@ -225,10 +225,9 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
Py_INCREF(self);
return self;
- } else {
- PyErr_SetString(PyExc_TypeError, "Invalid property usage.");
- return 0;
}
+ PyErr_SetString(PyExc_TypeError, "Invalid property usage.");
+ return nullptr;
}
PyObject* qPropertySetter(PyObject* self, PyObject* callback)
@@ -242,10 +241,9 @@ PyObject* qPropertySetter(PyObject* self, PyObject* callback)
Py_INCREF(callback);
return callback;
- } else {
- PyErr_SetString(PyExc_TypeError, "Invalid property setter agument.");
- return 0;
}
+ PyErr_SetString(PyExc_TypeError, "Invalid property setter agument.");
+ return nullptr;
}
PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
@@ -259,10 +257,9 @@ PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
Py_INCREF(callback);
return callback;
- } else {
- PyErr_SetString(PyExc_TypeError, "Invalid property getter agument.");
- return 0;
}
+ PyErr_SetString(PyExc_TypeError, "Invalid property getter agument.");
+ return nullptr;
}
static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)