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/qobjectconnect.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/qobjectconnect.cpp')
| -rw-r--r-- | sources/pyside6/libpyside/qobjectconnect.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sources/pyside6/libpyside/qobjectconnect.cpp b/sources/pyside6/libpyside/qobjectconnect.cpp index 3c5b75953..1d9453ab1 100644 --- a/sources/pyside6/libpyside/qobjectconnect.cpp +++ b/sources/pyside6/libpyside/qobjectconnect.cpp @@ -8,7 +8,8 @@ #include "pysideutils.h" #include "signalmanager.h" -#include "shiboken.h" +#include <sbkstring.h> +#include <sbkstaticstrings.h> #include "basewrapper.h" #include "autodecref.h" @@ -29,7 +30,7 @@ static bool isMethodDecorator(PyObject *method, bool is_pymethod, PyObject *self // PYSIDE-1523: Each could be a compiled method or a normal method here, for the // compiled ones we can use the attributes. - PyObject *function1; + PyObject *function1{}; if (PyMethod_Check(otherMethod.object())) { function1 = PyMethod_GET_FUNCTION(otherMethod.object()); } else { @@ -40,7 +41,7 @@ static bool isMethodDecorator(PyObject *method, bool is_pymethod, PyObject *self // Not retaining a reference in line with what PyMethod_GET_FUNCTION does. } - PyObject *function2; + PyObject *function2{}; if (is_pymethod) { function2 = PyMethod_GET_FUNCTION(method); } else { @@ -85,7 +86,7 @@ static const char *getQualifiedName(PyObject *ob) static bool isDeclaredIn(PyObject *method, const char *className) { bool result = false; - if (auto *qualifiedNameC = getQualifiedName(PyMethod_Function(method))) { + if (const auto *qualifiedNameC = getQualifiedName(PyMethod_Function(method))) { std::string_view qualifiedName(qualifiedNameC); if (const auto dot = qualifiedName.rfind('.'); dot != std::string::npos) result = qualifiedName.substr(0, dot) == className; @@ -147,7 +148,7 @@ static GetReceiverResult getReceiver(QObject *source, const char *signal, } } - const auto receiverThread = result.receiver ? result.receiver->thread() : nullptr; + auto *receiverThread = result.receiver ? result.receiver->thread() : nullptr; if (result.usingGlobalReceiver) { PySide::SignalManager &signalManager = PySide::SignalManager::instance(); @@ -281,7 +282,7 @@ QMetaObject::Connection qobjectConnectCallback(QObject *source, const char *sign PySide::SignalManager &signalManager = PySide::SignalManager::instance(); - PySideQSlotObject *slotObject = new PySideQSlotObject(callback); + auto *slotObject = new PySideQSlotObject(callback); QMetaObject::Connection connection{}; Py_BEGIN_ALLOW_THREADS // PYSIDE-2367, prevent threading deadlocks with connectNotify() |
