[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:28 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=6c6f2b1

The following commit has been merged in the master branch:
commit 6c6f2b1a03f01ceb7bb68824c8baf67557f60342
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Sat Apr 4 10:05:55 2015 -0700

    Fixed uninitialized members
---
 core/backends/lan/lanlinkprovider.cpp              | 58 ++++++++++++----------
 core/backends/lan/uploadjob.cpp                    |  6 ++-
 core/backends/lan/uploadjob.h                      |  2 +-
 core/filetransferjob.cpp                           |  2 +-
 plugins/battery/batterydbusinterface.cpp           |  2 +
 plugins/battery/batterydbusinterface.h             |  2 +-
 plugins/mpriscontrol/mpriscontrolplugin.cpp        |  1 +
 .../screensaverinhibitplugin.cpp                   | 39 ++++++++-------
 8 files changed, 63 insertions(+), 49 deletions(-)

diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp
index 1755e81..daba994 100644
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@ -29,38 +29,14 @@
 #include <QHostInfo>
 #include <QTcpServer>
 #include <QUdpSocket>
+#include <QtGlobal>
 
 #include "landevicelink.h"
 #include <kdeconnectconfig.h>
 
-void LanLinkProvider::configureSocket(QTcpSocket* socket)
-{
-    int fd = socket->socketDescriptor();
-
-    socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1));
-
-    #ifdef TCP_KEEPIDLE
-        // time to start sending keepalive packets (seconds)
-        int maxIdle = 10;
-        setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &maxIdle, sizeof(maxIdle));
-    #endif
-
-    #ifdef TCP_KEEPINTVL
-        // interval between keepalive packets after the initial period (seconds)
-        int interval = 5;
-        setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &interval, sizeof(interval));
-    #endif
-
-    #ifdef TCP_KEEPCNT
-        // number of missed keepalive packets before disconnecting
-        int count = 3;
-        setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &count, sizeof(count));
-    #endif
-
-}
-
 LanLinkProvider::LanLinkProvider()
 {
+    mTcpPort = 0;
 
     mUdpServer = new QUdpSocket(this);
     connect(mUdpServer, SIGNAL(readyRead()), this, SLOT(newUdpConnection()));
@@ -70,6 +46,11 @@ LanLinkProvider::LanLinkProvider()
 
 }
 
+LanLinkProvider::~LanLinkProvider()
+{
+
+}
+
 void LanLinkProvider::onStart()
 {
     mUdpServer->bind(QHostAddress::Any, port, QUdpSocket::ShareAddress);
@@ -102,6 +83,8 @@ void LanLinkProvider::onNetworkChange(QNetworkSession::State state)
         return;
     }
 
+    Q_ASSERT(mTcpPort != 0);
+
     NetworkPackage np("");
     NetworkPackage::createIdentityPackage(&np);
     np.set("tcpPort", mTcpPort);
@@ -295,7 +278,28 @@ void LanLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
 
 }
 
-LanLinkProvider::~LanLinkProvider()
+void LanLinkProvider::configureSocket(QTcpSocket* socket)
 {
+    int fd = socket->socketDescriptor();
+
+    socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1));
+
+    #ifdef TCP_KEEPIDLE
+        // time to start sending keepalive packets (seconds)
+        int maxIdle = 10;
+        setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &maxIdle, sizeof(maxIdle));
+    #endif
+
+    #ifdef TCP_KEEPINTVL
+        // interval between keepalive packets after the initial period (seconds)
+        int interval = 5;
+        setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &interval, sizeof(interval));
+    #endif
+
+    #ifdef TCP_KEEPCNT
+        // number of missed keepalive packets before disconnecting
+        int count = 3;
+        setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &count, sizeof(count));
+    #endif
 
 }
diff --git a/core/backends/lan/uploadjob.cpp b/core/backends/lan/uploadjob.cpp
index e46dd4c..b0d35fc 100644
--- a/core/backends/lan/uploadjob.cpp
+++ b/core/backends/lan/uploadjob.cpp
@@ -19,6 +19,7 @@
  */
 
 #include <qalgorithms.h>
+#include <QtGlobal>
 
 #include "uploadjob.h"
 #include "core_debug.h"
@@ -28,6 +29,7 @@ UploadJob::UploadJob(const QSharedPointer<QIODevice>& source): KJob()
     mInput = source;
     mServer = new QTcpServer(this);
     mSocket = 0;
+    mPort = 0;
 
     connect(mInput.data(), SIGNAL(readyRead()), this, SLOT(readyRead()));
     connect(mInput.data(), SIGNAL(aboutToClose()), this, SLOT(aboutToClose()));
@@ -91,10 +93,10 @@ void UploadJob::aboutToClose()
 
 QVariantMap UploadJob::getTransferInfo()
 {
-    QVariantMap ret;
+    Q_ASSERT(mPort != 0);
 
+    QVariantMap ret;
     ret["port"] = mPort;
-
     return ret;
 }
 
diff --git a/core/backends/lan/uploadjob.h b/core/backends/lan/uploadjob.h
index 4b3dd4d..12b6f7e 100644
--- a/core/backends/lan/uploadjob.h
+++ b/core/backends/lan/uploadjob.h
@@ -42,7 +42,7 @@ private:
     QSharedPointer<QIODevice> mInput;
     QTcpServer* mServer;
     QTcpSocket* mSocket;
-    qint16 mPort;
+    quint16 mPort;
 
 private Q_SLOTS:
     void readyRead();
diff --git a/core/filetransferjob.cpp b/core/filetransferjob.cpp
index 73bad79..b7438d6 100644
--- a/core/filetransferjob.cpp
+++ b/core/filetransferjob.cpp
@@ -128,7 +128,7 @@ void FileTransferJob::readyRead()
         //If a least 1 second has passed since last update
         int secondsSinceLastTime = mTime.secsTo(QTime::currentTime());
         if (secondsSinceLastTime > 0 && mSpeedBytes > 0) {
-            float speed = (mWritten - mSpeedBytes) / secondsSinceLastTime;
+            float speed = (mWritten - mSpeedBytes) / float(secondsSinceLastTime);
             emitSpeed(speed);
 
             mTime = QTime::currentTime();
diff --git a/plugins/battery/batterydbusinterface.cpp b/plugins/battery/batterydbusinterface.cpp
index 7602585..1567dd0 100644
--- a/plugins/battery/batterydbusinterface.cpp
+++ b/plugins/battery/batterydbusinterface.cpp
@@ -26,6 +26,8 @@
 
 BatteryDbusInterface::BatteryDbusInterface(const Device *device)
     : QDBusAbstractAdaptor(const_cast<Device*>(device))
+	, mCharge(-1)
+	, mIsCharging(false)
 {
 }
 
diff --git a/plugins/battery/batterydbusinterface.h b/plugins/battery/batterydbusinterface.h
index b444ae2..fb5d768 100644
--- a/plugins/battery/batterydbusinterface.h
+++ b/plugins/battery/batterydbusinterface.h
@@ -46,7 +46,7 @@ Q_SIGNALS:
 
 private:
     int mCharge;
-    bool mIsCharging : 1;
+    bool mIsCharging;
 
 };
 
diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp
index 949c6b1..65146f1 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.cpp
+++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp
@@ -40,6 +40,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MPRIS, "kdeconnect.plugin.mpris")
 MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args)
     : KdeConnectPlugin(parent, args)
 {
+    prevVolume = -1;
 
     //Detect new interfaces
     connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
index a863090..49faebe 100644
--- a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
+++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
@@ -42,34 +42,39 @@ const QString SIMULATE_ACTIVITY_METHOD = "SimulateUserActivity";
 ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject* parent, const QVariantList& args)
     : KdeConnectPlugin(parent, args)
 {
-     QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
+    QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
 
-     QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, "kdeconnect", "Phone is connected");
+    QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, "kdeconnect", "Phone is connected");
 
-     if (reply.errorMessage() != NULL) {
+    if (reply.errorMessage() != NULL) {
         qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage();
-     } else {
+        inhibitCookie = 0;
+    } else {
         // Store the cookie we receive, this will be sent back when sending the uninhibit call.
-        this->inhibitCookie = reply.arguments().first().toUInt();
-     }
+        inhibitCookie = reply.arguments().first().toUInt();
+    }
 }
 
 ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin()
 {
-      QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
-      inhibitInterface.call(UNINHIBIT_METHOD, this->inhibitCookie);
-
-      /*
-       * Simulate user activity because what ever manages the screensaver does not seem to start the timer
-       * automatically when all inhibitions are lifted and the user does nothing which results in an
-       * unlocked desktop which would be dangerous. Ideally we should not be doing this and the screen should
-       * be locked anyway.
-       */
-      inhibitInterface.call(SIMULATE_ACTIVITY_METHOD);
+    if (inhibitCookie == 0) return;
+
+    QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
+    inhibitInterface.call(UNINHIBIT_METHOD, this->inhibitCookie);
+
+    /*
+     * Simulate user activity because what ever manages the screensaver does not seem to start the timer
+     * automatically when all inhibitions are lifted and the user does nothing which results in an
+     * unlocked desktop which would be dangerous. Ideally we should not be doing this and the screen should
+     * be locked anyway.
+     */
+    inhibitInterface.call(SIMULATE_ACTIVITY_METHOD);
 }
 
 void ScreensaverInhibitPlugin::connected()
-{}
+{
+
+}
 
 bool ScreensaverInhibitPlugin::receivePackage(const NetworkPackage& np)
 {

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list