From 83f09c51f76f17255b34e72a5a3c9b7b325e7aae Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Aug 2018 13:23:31 +0200 Subject: 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 --- sources/pyside2/libpyside/globalreceiverv2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sources/pyside2/libpyside/globalreceiverv2.cpp') diff --git a/sources/pyside2/libpyside/globalreceiverv2.cpp b/sources/pyside2/libpyside/globalreceiverv2.cpp index 05565e516..428c12294 100644 --- a/sources/pyside2/libpyside/globalreceiverv2.cpp +++ b/sources/pyside2/libpyside/globalreceiverv2.cpp @@ -128,11 +128,11 @@ QByteArray DynamicSlotDataV2::hash() const QByteArray DynamicSlotDataV2::hash(PyObject* callback) { Shiboken::GilState gil; - if (PyMethod_Check(callback)) + if (PyMethod_Check(callback)) { return QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_FUNCTION(callback))) + QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_SELF(callback))); - else - return QByteArray::number((qlonglong)PyObject_Hash(callback)); + } + return QByteArray::number(qlonglong(PyObject_Hash(callback))); } PyObject* DynamicSlotDataV2::callback() @@ -251,7 +251,7 @@ void GlobalReceiverV2::incRef(const QObject* link) void GlobalReceiverV2::decRef(const QObject* link) { - if (m_refs.size() <= 0) + if (m_refs.empty()) return; @@ -268,7 +268,7 @@ void GlobalReceiverV2::decRef(const QObject* link) } } - if (m_refs.size() == 0) + if (m_refs.empty()) Py_BEGIN_ALLOW_THREADS delete this; Py_END_ALLOW_THREADS @@ -328,9 +328,9 @@ int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void** args) } if (id == DESTROY_SLOT_ID) { - if (m_refs.size() == 0) + if (m_refs.empty()) return -1; - QObject *obj = *(QObject**)args[1]; + QObject *obj = *reinterpret_cast(args[1]); incRef(); //keep the object live (safe ref) m_refs.removeAll(obj); // remove all refs to this object decRef(); //remove the safe ref -- cgit v1.2.3