diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-06-18 11:27:06 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-06-24 10:36:11 +0200 |
| commit | 1a4593f940b0eca4d0756092ed34c2b6a6962bd6 (patch) | |
| tree | 2869c01e31258c12347601980715888e8b352a15 /sources/pyside6/libpyside/class_property.cpp | |
| parent | 8f85650fe8066c5903e865aedb3d92d863243996 (diff) | |
libpyside: Fix static analysis warnings
- Initialize variables
- Use auto *
- Remove repeated return types
- Fix else after return
- Fix some invocations of static methods
- Make functions const/static where appropriate
- Fix some int types to avoid lossy conversions
- Use Py_RETURN_NONE where appropriate
- Minor cleanups
- Remove some macros
Change-Id: I7fa7a29e7b3dc47037027978001824e0709d001f
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/class_property.cpp')
| -rw-r--r-- | sources/pyside6/libpyside/class_property.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sources/pyside6/libpyside/class_property.cpp b/sources/pyside6/libpyside/class_property.cpp index 2bed97ef5..9be7dccb0 100644 --- a/sources/pyside6/libpyside/class_property.cpp +++ b/sources/pyside6/libpyside/class_property.cpp @@ -79,7 +79,7 @@ PyTypeObject *PyClassPropertyType_TypeF() // We call `__init__` while pretending to be a PyProperty_Type instance. static int PyClassProperty_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) { - auto hold = Py_TYPE(self); + auto *hold = Py_TYPE(self); self->ob_type = &PyProperty_Type; auto ret = PepExt_Type_GetInitSlot(&PyProperty_Type)(self, args, kwargs); self->ob_type = hold; @@ -126,7 +126,7 @@ static int SbkObjectType_meta_setattro(PyObject *obj, PyObject *name, PyObject * { // Use `_PepType_Lookup()` instead of `PyObject_GetAttr()` in order to get the raw // descriptor (`property`) instead of calling `tp_descr_get` (`property.__get__()`). - auto type = reinterpret_cast<PyTypeObject *>(obj); + auto *type = reinterpret_cast<PyTypeObject *>(obj); PySide::Feature::Select(type); PyObject *descr = _PepType_Lookup(type, name); @@ -134,7 +134,7 @@ static int SbkObjectType_meta_setattro(PyObject *obj, PyObject *name, PyObject * // 1. `Type.class_prop = value` --> descr_set: `Type.class_prop.__set__(value)` // 2. `Type.class_prop = other_class_prop` --> setattro: replace existing `class_prop` // 3. `Type.regular_attribute = value` --> setattro: regular attribute assignment - const auto class_prop = reinterpret_cast<PyObject *>(PyClassProperty_TypeF()); + auto *class_prop = reinterpret_cast<PyObject *>(PyClassProperty_TypeF()); const auto call_descr_set = descr && PyObject_IsInstance(descr, class_prop) && !PyObject_IsInstance(value, class_prop); if (call_descr_set) { @@ -171,7 +171,7 @@ void init(PyObject *module) return; Py_INCREF(PyClassProperty_TypeF()); - auto classproptype = reinterpret_cast<PyObject *>(PyClassProperty_TypeF()); + auto *classproptype = reinterpret_cast<PyObject *>(PyClassProperty_TypeF()); PyModule_AddObject(module, "PyClassProperty", classproptype); } |
