diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-30 13:23:31 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-30 16:36:39 +0000 |
commit | 83f09c51f76f17255b34e72a5a3c9b7b325e7aae (patch) | |
tree | 0f8f26e3361f3759bde46f7f5faa8a5d7ab2cf88 /sources/pyside2/libpyside/globalreceiverv2.cpp | |
parent | 08af692e40cb178ad59af2ed7b7b8928c0ac2ff6 (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/globalreceiverv2.cpp')
-rw-r--r-- | sources/pyside2/libpyside/globalreceiverv2.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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<QObject**>(args[1]); incRef(); //keep the object live (safe ref) m_refs.removeAll(obj); // remove all refs to this object decRef(); //remove the safe ref |