From 4f29687c1391208184ebfdb9d2d5536723bafe0c Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Tue, 18 Aug 2015 15:37:38 -0400
Subject: [PATCH] build: fix most of warnings

- unnused vars: add Q_UNUSED when necessary
- API disruption: return something in ConfigurationManagerInterface::setCodecDetails()
- remove unused code

Issue: #75334
Change-Id: Ib43098e01bd276b6d5a2e1538ae6e7720500aed1
Signed-off-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
---
 src/accountmodel.cpp                      | 2 ++
 src/categorizedbookmarkmodel.cpp          | 1 -
 src/collectioninterface.hpp               | 1 +
 src/daemoncertificatecollection.cpp       | 6 +++++-
 src/localtextrecordingcollection.cpp      | 1 +
 src/media/recordingmodel.cpp              | 1 +
 src/pendingtrustrequestmodel.cpp          | 1 +
 src/qtwrapper/configurationmanager_wrap.h | 2 +-
 8 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/accountmodel.cpp b/src/accountmodel.cpp
index 8726cac1..32201554 100644
--- a/src/accountmodel.cpp
+++ b/src/accountmodel.cpp
@@ -270,6 +270,7 @@ Account::RegistrationState AccountModelPrivate::fromDaemonName(const QString& st
 ///Account status changed
 void AccountModelPrivate::slotDaemonAccountChanged(const QString& account, const QString& registration_state, unsigned code, const QString& status)
 {
+   Q_UNUSED(registration_state);
    Account* a = q_ptr->getById(account.toLatin1());
 
    //TODO move this to AccountStatusModel
@@ -397,6 +398,7 @@ void AccountModelPrivate::slotVolatileAccountDetailsChange(const QString& accoun
 ///When a Ring-DHT trust request arrive
 void AccountModelPrivate::slotIncomingTrustRequest(const QString& accountId, const QString& hash, const QByteArray& payload, time_t time)
 {
+   Q_UNUSED(payload);
    qDebug() << "INCOMING REQUEST" << accountId << hash << time;
    Account* a = q_ptr->getById(accountId.toLatin1());
 
diff --git a/src/categorizedbookmarkmodel.cpp b/src/categorizedbookmarkmodel.cpp
index c5803f6a..f007481c 100644
--- a/src/categorizedbookmarkmodel.cpp
+++ b/src/categorizedbookmarkmodel.cpp
@@ -189,7 +189,6 @@ void CategorizedBookmarkModel::reloadCategories()
       endInsertRows();
 
       //This a proxy, so the items already exist elsewhere
-      const int currentSize = PhoneDirectoryModel::instance()->d_ptr->m_lPopularityIndex.size();
       beginInsertRows(index(item->m_Index,0), item->m_lChildren.size(), item->m_lChildren.size());
       endInsertRows();
 
diff --git a/src/collectioninterface.hpp b/src/collectioninterface.hpp
index c4f38c5f..bbfd1569 100644
--- a/src/collectioninterface.hpp
+++ b/src/collectioninterface.hpp
@@ -91,6 +91,7 @@ CollectionEditor<T>* CollectionInterface::editor() const
 template<class T>
 bool CollectionInterface::attachExtension(bool enable)
 {
+    Q_UNUSED(enable);
    //FIXME for now all extensions are considered active
    return true;
 }
diff --git a/src/daemoncertificatecollection.cpp b/src/daemoncertificatecollection.cpp
index 45642a05..d7674734 100644
--- a/src/daemoncertificatecollection.cpp
+++ b/src/daemoncertificatecollection.cpp
@@ -101,11 +101,14 @@ void DaemonCertificateCollectionPrivate::slotCertificatePinned(const QString& id
 
 void DaemonCertificateCollectionPrivate::slotCertificateExpired(const QString& id)
 {
+   Q_UNUSED(id);
    //qDebug() << "\n\nCERTIFICATE EXPIRED" << id;
 }
 
 void DaemonCertificateCollectionPrivate::slotCertificatePathPinned(const QString& path, const QStringList& certIds)
 {
+   Q_UNUSED(path);
+   Q_UNUSED(certIds);
    //Create a new collection if it is a directory or size > 1
    //qDebug() << "\n\nSIGNAL CERTIFICATE PATH PINNING" << path << certIds;
 }
@@ -126,7 +129,7 @@ bool DaemonCertificateCollection::load()
    //qDebug() << "\n\nLOADING CERTS" << d_ptr->m_pAccount << certs;
 
    for (const QString& id : certs)
-      Certificate* cert = CertificateModel::instance()->getCertificateFromId(id,d_ptr->m_pAccount,d_ptr->m_pAccount->id()+"_"+mode);
+      CertificateModel::instance()->getCertificateFromId(id,d_ptr->m_pAccount,d_ptr->m_pAccount->id()+"_"+mode);
 
    return true;
 }
@@ -201,6 +204,7 @@ bool DaemonCertificateEditor::save( const Certificate* item)
 bool DaemonCertificateEditor::remove( const Certificate* item)
 {
    //TODO
+   Q_UNUSED(item);
    return false;
 }
 
diff --git a/src/localtextrecordingcollection.cpp b/src/localtextrecordingcollection.cpp
index 88b82a1d..76ed2de0 100644
--- a/src/localtextrecordingcollection.cpp
+++ b/src/localtextrecordingcollection.cpp
@@ -224,6 +224,7 @@ bool LocalTextRecordingCollection::listId(std::function<void(const QList<Element
 
 bool LocalTextRecordingCollection::fetch(const Element& e)
 {
+   Q_UNUSED(e);
    return false;
 }
 
diff --git a/src/media/recordingmodel.cpp b/src/media/recordingmodel.cpp
index 77496406..a2b7a2d7 100644
--- a/src/media/recordingmodel.cpp
+++ b/src/media/recordingmodel.cpp
@@ -95,6 +95,7 @@ d_ptr(new RecordingModelPrivate(this))
 
    d_ptr->m_pTextRecordingCollection->listId([](const QList<CollectionInterface::Element>& e) {
       //TODO
+      Q_UNUSED(e);
    });
 }
 
diff --git a/src/pendingtrustrequestmodel.cpp b/src/pendingtrustrequestmodel.cpp
index 0a58caa1..5833a540 100644
--- a/src/pendingtrustrequestmodel.cpp
+++ b/src/pendingtrustrequestmodel.cpp
@@ -80,6 +80,7 @@ int PendingTrustRequestModel::columnCount( const QModelIndex& parent ) const
 
 Qt::ItemFlags PendingTrustRequestModel::flags( const QModelIndex& index ) const
 {
+   Q_UNUSED(index);
    return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
 }
 
diff --git a/src/qtwrapper/configurationmanager_wrap.h b/src/qtwrapper/configurationmanager_wrap.h
index cf412526..fbacabc5 100644
--- a/src/qtwrapper/configurationmanager_wrap.h
+++ b/src/qtwrapper/configurationmanager_wrap.h
@@ -608,7 +608,7 @@ public Q_SLOTS: // METHODS
 
    bool setCodecDetails(const QString& accountId, unsigned int codecId, const MapStringString& details)
    {
-      DRing::setCodecDetails(accountId.toStdString(), codecId, convertMap(details));
+      return DRing::setCodecDetails(accountId.toStdString(), codecId, convertMap(details));
    }
 
 Q_SIGNALS: // SIGNALS
-- 
GitLab