瀏覽代碼

COMP: PluginFramework: Fixed compiler warnings

Sascha Zelzer 15 年之前
父節點
當前提交
fca0f9887e

+ 1 - 1
Applications/ctkPluginBrowser/ctkPluginBrowser.cpp

@@ -130,7 +130,7 @@ void ctkPluginBrowser::pluginDoubleClicked(const QModelIndex& index)
 
 void ctkPluginBrowser::qtResourceDoubleClicked(const QModelIndex& index)
 {
-
+  Q_UNUSED(index)
 }
 
 void ctkPluginBrowser::dbResourceDoubleClicked(const QModelIndex& index)

+ 2 - 0
Applications/ctkPluginBrowser/ctkPluginBrowserEditors.cpp

@@ -38,6 +38,8 @@ ctkPluginBrowserEditors::ctkPluginBrowserEditors(QWidget* editorArea)
 void ctkPluginBrowserEditors::openEditor(const QString &location, const QByteArray& content,
                                  const QString& title, const QString& tooltip)
 {
+  Q_UNUSED(tooltip)
+
   if (editorLocations.contains(location))
   {
     int index = editorLocations.indexOf(location);

+ 9 - 1
Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp

@@ -84,6 +84,8 @@ ctkPluginResourceTreeItem::~ctkPluginResourceTreeItem()
 
 ctkPluginResourceTreeItem* ctkPluginResourceTreeItem::child(int row)
 {
+  Q_UNUSED(row)
+
   return 0;
 }
 
@@ -190,7 +192,7 @@ QVariant ctkPluginResourcesTreeModel::data(const QModelIndex &index, int role) c
   if (!index.isValid())
     return QVariant();
 
-  if (role == Qt::DisplayRole | role == Qt::UserRole)
+  if ((role == Qt::DisplayRole) | (role == Qt::UserRole))
   {
     ctkPluginResourceTreeItem* item = static_cast<ctkPluginResourceTreeItem*>(index.internalPointer());
     return item->data(role);
@@ -210,6 +212,10 @@ Qt::ItemFlags ctkPluginResourcesTreeModel::flags(const QModelIndex &index) const
 QVariant ctkPluginResourcesTreeModel::headerData(int section, Qt::Orientation orientation,
                    int role) const
 {
+  Q_UNUSED(section)
+  Q_UNUSED(orientation)
+  Q_UNUSED(role)
+
   return QVariant();
 }
 
@@ -267,5 +273,7 @@ int ctkPluginResourcesTreeModel::rowCount(const QModelIndex &parent) const
 
 int ctkPluginResourcesTreeModel::columnCount(const QModelIndex &parent) const
 {
+  Q_UNUSED(parent)
+
   return 1;
 }

+ 4 - 0
Applications/ctkPluginBrowser/ctkPluginTableModel.cpp

@@ -82,11 +82,15 @@ QVariant ctkPluginTableModel::headerData(int section, Qt::Orientation orientatio
 
 int ctkPluginTableModel::columnCount(const QModelIndex& parent) const
 {
+  Q_UNUSED(parent)
+
   return 3;
 }
 
 int ctkPluginTableModel::rowCount(const QModelIndex& parent) const
 {
+  Q_UNUSED(parent)
+
   return plugins.size();
 }
 

+ 8 - 0
Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp

@@ -81,6 +81,8 @@ ctkQtResourceTreeItem::~ctkQtResourceTreeItem()
 
 ctkQtResourceTreeItem* ctkQtResourceTreeItem::child(int row)
 {
+  Q_UNUSED(row)
+
   return 0;
 }
 
@@ -198,6 +200,10 @@ Qt::ItemFlags ctkQtResourcesTreeModel::flags(const QModelIndex &index) const
 QVariant ctkQtResourcesTreeModel::headerData(int section, Qt::Orientation orientation,
                    int role) const
 {
+  Q_UNUSED(section)
+  Q_UNUSED(orientation)
+  Q_UNUSED(role)
+
   return QVariant();
 }
 
@@ -250,5 +256,7 @@ int ctkQtResourcesTreeModel::rowCount(const QModelIndex &parent) const
 
 int ctkQtResourcesTreeModel::columnCount(const QModelIndex &parent) const
 {
+  Q_UNUSED(parent)
+
   return 1;
 }

+ 2 - 1
Libs/PluginFramework/EventBus/ctkEvent.cpp

@@ -52,7 +52,7 @@ bool ctkEvent::operator==(const ctkEvent& other) const
   return false;
 }
 
-const QVariant& ctkEvent::property(const QString& name) const
+QVariant ctkEvent::property(const QString& name) const
 {
   return d->properties[name];
 }
@@ -69,6 +69,7 @@ const QString& ctkEvent::topic() const
 
 bool ctkEvent::matches(const ctkLDAPSearchFilter& filter) const
 {
+  Q_UNUSED(filter)
   // TODO
   return true;
 }

+ 1 - 1
Libs/PluginFramework/EventBus/ctkEvent.h

@@ -25,7 +25,7 @@
 
     bool operator==(const ctkEvent& other) const;
 
-    const QVariant& property(const QString& name) const;
+    QVariant property(const QString& name) const;
     QStringList propertyNames() const;
 
     const QString& topic() const;

+ 47 - 46
Libs/PluginFramework/ctkLDAPSearchFilter.cpp

@@ -22,63 +22,64 @@
 #include "ctkLDAPSearchFilter.h"
 
 
-  class ctkLDAPSearchFilterPrivate {
-  public:
+class ctkLDAPSearchFilterPrivate {
+public:
 
-    ctkLDAPSearchFilterPrivate()
-      : ref(1)
-    {}
+  ctkLDAPSearchFilterPrivate()
+    : ref(1)
+  {}
 
-    QAtomicInt ref;
+  QAtomicInt ref;
 
-  };
+};
 
-  ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
-    : d(new ctkLDAPSearchFilterPrivate())
-  {
-
-  }
+ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
+  : d(new ctkLDAPSearchFilterPrivate())
+{
+  Q_UNUSED(filter)
+}
 
-  ctkLDAPSearchFilter::ctkLDAPSearchFilter(const ctkLDAPSearchFilter& filter)
-    : d(filter.d)
-  {
-    d->ref.ref();
-  }
+ctkLDAPSearchFilter::ctkLDAPSearchFilter(const ctkLDAPSearchFilter& filter)
+  : d(filter.d)
+{
+  d->ref.ref();
+}
 
-  ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
-  {
-    if (!d->ref.deref())
-      delete d;
-  }
+ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
+{
+  if (!d->ref.deref())
+    delete d;
+}
 
-  bool ctkLDAPSearchFilter::match(const Dictionary& dictionary) const
-  {
-    return true;
-  }
+bool ctkLDAPSearchFilter::match(const Dictionary& dictionary) const
+{
+  Q_UNUSED(dictionary)
+  return true;
+}
 
-  bool ctkLDAPSearchFilter::matchCase(const Dictionary& dictionary) const
-  {
-    return true;
-  }
+bool ctkLDAPSearchFilter::matchCase(const Dictionary& dictionary) const
+{
+  Q_UNUSED(dictionary)
+  return true;
+}
 
-  bool ctkLDAPSearchFilter::operator==(const ctkLDAPSearchFilter& other) const
-  {
-    // TODO
-    return true;
-  }
+bool ctkLDAPSearchFilter::operator==(const ctkLDAPSearchFilter& other) const
+{
+  // TODO
+  Q_UNUSED(other)
+  return true;
+}
 
-  ctkLDAPSearchFilter& ctkLDAPSearchFilter::operator=(const ctkLDAPSearchFilter& filter)
+ctkLDAPSearchFilter& ctkLDAPSearchFilter::operator=(const ctkLDAPSearchFilter& filter)
+{
+  if (d != filter.d)
   {
-    if (d != filter.d)
-    {
-      if (!d->ref.deref())
-        delete d;
-
-      d = filter.d;
-      d->ref.ref();
-    }
-
-    return *this;
+    if (!d->ref.deref())
+      delete d;
 
+    d = filter.d;
+    d->ref.ref();
+  }
 
+  return *this;
 }

+ 1 - 1
Libs/PluginFramework/ctkPlugin.cpp

@@ -111,7 +111,7 @@
 
   void ctkPlugin::stop(const StopOptions& options)
   {
-
+    Q_UNUSED(options)
   }
 
   ctkPluginContext* ctkPlugin::getPluginContext() const

+ 1 - 0
Libs/PluginFramework/ctkPluginArchive.cpp

@@ -90,6 +90,7 @@
 
   void ctkPluginArchive::setStartLevel(int level)
   {
+    Q_UNUSED(level)
     //TODO
 //    if (startLevel != level)
 //    {

+ 1 - 1
Libs/PluginFramework/ctkPluginDatabase.cpp

@@ -242,7 +242,7 @@ void ctkPluginDatabase::updateDB()
             error == QtMobility::QServiceManager::ComponentNotFound))
       {
         throw ctkServiceException(QString("Removing service named ") + serviceName +
-                               " failed: " + QString::number(serviceManager.error()));
+                               " failed: " + QString::number(static_cast<unsigned int>(error)));
       }
     }
   }

+ 1 - 1
Libs/PluginFramework/ctkPluginEvent.cpp

@@ -30,7 +30,7 @@
   }
 
   ctkPluginEvent::ctkPluginEvent(const ctkPluginEvent& other)
-    : d(other.d)
+    : QObject(), d(other.d)
   {
 
   }

+ 1 - 1
Libs/PluginFramework/ctkPluginFrameworkEvent.cpp

@@ -41,7 +41,7 @@
   }
 
   ctkPluginFrameworkEvent::ctkPluginFrameworkEvent(const ctkPluginFrameworkEvent& other)
-    : d(other.d)
+    : QObject(), d(other.d)
   {
 
   }

+ 4 - 0
Libs/PluginFramework/ctkPluginStorage.cpp

@@ -54,12 +54,16 @@
 
   ctkPluginArchive* ctkPluginStorage::updatePluginArchive(ctkPluginArchive* old, const QString& localPath)
   {
+    Q_UNUSED(old)
+    Q_UNUSED(localPath)
     //return new BundleArchiveImpl((BundleArchiveImpl)old, is);
     return 0;
   }
 
   void ctkPluginStorage::replacePluginArchive(ctkPluginArchive* oldPA, ctkPluginArchive* newPA)
   {
+    Q_UNUSED(oldPA)
+    Q_UNUSED(newPA)
 //    int pos;
 //    long id = oldBA.getBundleId();
 //    synchronized (archives) {

+ 1 - 0
Libs/PluginFramework/ctkServiceRegistration.cpp

@@ -54,6 +54,7 @@
 
   void ctkServiceRegistration::setProperties(const ServiceProperties& properties)
   {
+    Q_UNUSED(properties)
 //    QMutexLocker lock(eventLock);
 //          Set before;
 //          // TBD, optimize the locking of services

+ 1 - 1
Libs/PluginFramework/ctkServiceRegistrationPrivate.cpp

@@ -25,7 +25,7 @@
   ctkServiceRegistrationPrivate::ctkServiceRegistrationPrivate(ctkServiceRegistration* sr,
                                                          ctkPluginPrivate* plugin, QObject* service,
                                                          const ServiceProperties& props)
-                               : q_ptr(sr), plugin(plugin), service(service), reference(new ctkServiceReference(this)),
+                               : q_ptr(sr), service(service), plugin(plugin), reference(new ctkServiceReference(this)),
                                properties(props), available(true), unregistering(false)
   {
 

+ 2 - 2
Libs/PluginFramework/ctkServices.cpp

@@ -146,7 +146,7 @@ ctkServiceRegistration* ctkServices::registerService(ctkPluginPrivate* plugin,
     }
   }
 
-  ctkServiceReference* r = res->getReference();
+  //ctkServiceReference* r = res->getReference();
   // TODO
   //Listeners l = bundle.fwCtx.listeners;
   //l.serviceChanged(l.getMatchingServiceListeners(r),
@@ -421,7 +421,7 @@ QList<ctkServiceRegistration*> ctkServices::getRegisteredByPlugin(ctkPluginPriva
   for (QHashIterator<ctkServiceRegistration*, QStringList> i(services); i.hasNext(); )
   {
     ctkServiceRegistration* sr = i.next().key();
-    if (sr->d_func()->plugin = p)
+    if ((sr->d_func()->plugin = p))
     {
       res.push_back(sr);
     }

+ 6 - 1
Plugins/org.commontk.eventbus/ctkEventBusImpl.cpp

@@ -28,7 +28,8 @@ void ctkEventBusImpl::sendEvent(const ctkEvent& event)
 
 void ctkEventBusImpl::publishSignal(const QObject* publisher, const char* signal)
 {
-
+  Q_UNUSED(publisher)
+  Q_UNUSED(signal)
 }
 
 void ctkEventBusImpl::subscribeSlot(const QObject* subscriber, const char* member, const Properties& properties)
@@ -45,6 +46,8 @@ void ctkEventBusImpl::subscribeSlot(const QObject* subscriber, const char* membe
 
 void ctkEventBusImpl::dispatchEvent(const ctkEvent& event, bool isAsync)
 {
+  Q_UNUSED(isAsync)
+
   QString topic = event.topic();
 
   QSet<ctkEventHandlerWrapper*> eventHandlers = this->handlers(topic);
@@ -65,6 +68,8 @@ void ctkEventBusImpl::bucket(ctkEventHandlerWrapper* wrapper)
 
 QSet<ctkEventHandlerWrapper*> ctkEventBusImpl::handlers(const QString& topic)
 {
+  Q_UNUSED(topic)
+
   // TODO
   return globalWildcard.toSet();
 }

+ 7 - 0
Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp

@@ -18,11 +18,13 @@ using namespace QtMobility;
 
 void ctkEventBusPlugin::start(ctkPluginContext* context)
 {
+  Q_UNUSED(context)
   std::cout << "ctkCore Plugin started\n";
 }
 
 void ctkEventBusPlugin::stop(ctkPluginContext* context)
 {
+  Q_UNUSED(context)
   std::cout << "ctkCore Plugin stopped\n";
 }
 
@@ -30,11 +32,16 @@ QObject* ctkEventBusPlugin::createInstance(const QServiceInterfaceDescriptor& de
                             QServiceContext* context,
                             QAbstractSecuritySession* session)
 {
+  Q_UNUSED(context)
+  Q_UNUSED(session)
+
   std::cout << "Creating service instance for " << descriptor.interfaceName().toStdString() << std::endl;
   if (descriptor.interfaceName() == "org.commontk.core.EventBus")
   {
     return ctkEventBusImpl::instance();
   }
+
+  return 0;
 }
 
 Q_EXPORT_PLUGIN2(org_commontk_eventbus, ctkEventBusPlugin)

+ 1 - 0
Plugins/org.commontk.eventbus/ctkEventHandlerWrapper_p.h

@@ -47,6 +47,7 @@ public:
 
     v = properties[EventConstants::EVENT_FILTER];
     filter = ctkLDAPSearchFilter(v.toString());
+    return true;
   }
 
   void handleEvent(const ctkEvent& event /*, const Permission& perm */)