You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qaccessibilityclient/0011-Fix-missing-return-val...

99 lines
3.8 KiB

From 3469e6e0859c47b1ae6ad4ec33b68d1141c67746 Mon Sep 17 00:00:00 2001
From: Luigi Toscano <luigi.toscano@tiscali.it>
Date: Tue, 18 Apr 2017 22:29:33 +0200
Subject: [PATCH 11/12] Fix missing return values of methods
Summary:
Errors spotted by the recent compilers (or their settings, namely
-Werror=return-type).
Either add the return statement where it makes sense, or remove
the return value in a leaf application when it's not used.
Test Plan:
Now the module compiles (tested with Qt5) and the sample application
starts.
Reviewers: gladhorn, whiting
Reviewed By: gladhorn
Differential Revision: https://phabricator.kde.org/D5498
---
examples/accessibleapps/accessibletree.cpp | 6 +++++-
examples/accessibleapps/accessibletree.h | 2 +-
src/qaccessibilityclient/cachestrategy_p.h | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/examples/accessibleapps/accessibletree.cpp b/examples/accessibleapps/accessibletree.cpp
index b236025..4847144 100644
--- a/examples/accessibleapps/accessibletree.cpp
+++ b/examples/accessibleapps/accessibletree.cpp
@@ -315,11 +315,13 @@ bool AccessibleTree::removeAccessible(const QModelIndex &index)
Q_ASSERT(index.model() == this);
QModelIndex parent = index.parent();
int row = index.row();
+ bool removed = false;
beginRemoveRows(parent, row, row);
if (parent.isValid()) {
AccessibleWrapper *wraper = static_cast<AccessibleWrapper*>(parent.internalPointer());
Q_ASSERT(wraper);
delete wraper->m_children.takeAt(row);
+ removed = true;
} else {
AccessibleWrapper *wraper = static_cast<AccessibleWrapper*>(index.internalPointer());
Q_ASSERT(wraper);
@@ -327,12 +329,14 @@ bool AccessibleTree::removeAccessible(const QModelIndex &index)
if (m_apps[row] == wraper) {
qDebug() << Q_FUNC_INFO << "Delete application accessible object! indexRow=" << row;
delete m_apps.takeAt(row);
+ removed = true;
}
}
endRemoveRows();
+ return removed;
}
-bool AccessibleTree::updateAccessible(const QAccessibleClient::AccessibleObject &object)
+void AccessibleTree::updateAccessible(const QAccessibleClient::AccessibleObject &object)
{
QModelIndex index = indexForAccessible(object);
emit dataChanged(index, index);
diff --git a/examples/accessibleapps/accessibletree.h b/examples/accessibleapps/accessibletree.h
index 66f3684..559fce2 100644
--- a/examples/accessibleapps/accessibletree.h
+++ b/examples/accessibleapps/accessibletree.h
@@ -64,7 +64,7 @@ public:
bool addAccessible(const QAccessibleClient::AccessibleObject &object);
bool removeAccessible(const QAccessibleClient::AccessibleObject &object);
bool removeAccessible(const QModelIndex &index);
- bool updateAccessible(const QAccessibleClient::AccessibleObject &object);
+ void updateAccessible(const QAccessibleClient::AccessibleObject &object);
QList<AccessibleWrapper*> apps() const { return m_apps; }
diff --git a/src/qaccessibilityclient/cachestrategy_p.h b/src/qaccessibilityclient/cachestrategy_p.h
index 33ba9ab..ed01298 100644
--- a/src/qaccessibilityclient/cachestrategy_p.h
+++ b/src/qaccessibilityclient/cachestrategy_p.h
@@ -55,7 +55,7 @@ public:
virtual bool remove(const QString &id)
{
QSharedPointer<AccessibleObjectPrivate> obj = accessibleObjectsHash.take(id);
- interfaceHash.remove(obj.data());
+ return (interfaceHash.remove(obj.data()) >= 1);
}
virtual void clear()
{
@@ -96,7 +96,7 @@ public:
virtual bool remove(const QString &id)
{
QSharedPointer<AccessibleObjectPrivate> obj = accessibleObjectsHash.take(id);
- interfaceHash.remove(obj.data());
+ return (interfaceHash.remove(obj.data()) >= 1);
}
virtual void clear()
{
--
2.9.4