From d782060b396cf2aee3d8929c2bcbf0a81963eeb6 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Mon, 18 Nov 2013 02:34:34 +0100 Subject: [PATCH] Code chages for compatibility with MSVC compiler Thanks to Xiluembo --- kded/backends/lan/lanlinkprovider.cpp | 8 +++++++- kded/device.cpp | 7 +++++-- kded/plugins/mpriscontrol/mpriscontrolplugin.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/kded/backends/lan/lanlinkprovider.cpp b/kded/backends/lan/lanlinkprovider.cpp index 2d0658b5d..a205e1fdd 100644 --- a/kded/backends/lan/lanlinkprovider.cpp +++ b/kded/backends/lan/lanlinkprovider.cpp @@ -35,17 +35,23 @@ void LanLinkProvider::configureSocket(QTcpSocket* socket) { int fd = socket->socketDescriptor(); - int enableKeepAlive = 1; + char enableKeepAlive = 1; setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &enableKeepAlive, sizeof(enableKeepAlive)); +#ifdef TCP_KEEPIDLE int maxIdle = 60; /* seconds */ setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &maxIdle, sizeof(maxIdle)); +#endif +#ifdef TCP_KEEPCNT int count = 3; // send up to 3 keepalive packets out, then disconnect if no response setsockopt(fd, getprotobyname("TCP")->p_proto, TCP_KEEPCNT, &count, sizeof(count)); +#endif +#ifdef TCP_KEEPINTVL int interval = 5; // send a keepalive packet out every 2 seconds (after the 5 second idle period) setsockopt(fd, getprotobyname("TCP")->p_proto, TCP_KEEPINTVL, &interval, sizeof(interval)); +#endif } diff --git a/kded/device.cpp b/kded/device.cpp index ded0b8f2a..3550888c4 100644 --- a/kded/device.cpp +++ b/kded/device.cpp @@ -1,7 +1,5 @@ #include "device.h" -#include - #include #include #include @@ -17,6 +15,11 @@ #include "backends/linkprovider.h" #include "networkpackage.h" +#ifdef interface // MSVC language extension, QDBusConnection uses this as a variable name +#undef interface +#endif +#include + Device::Device(const QString& id) : m_deviceId(id) , m_pairStatus(Device::Paired) diff --git a/kded/plugins/mpriscontrol/mpriscontrolplugin.h b/kded/plugins/mpriscontrol/mpriscontrolplugin.h index abb4587ec..44e9d62d4 100644 --- a/kded/plugins/mpriscontrol/mpriscontrolplugin.h +++ b/kded/plugins/mpriscontrol/mpriscontrolplugin.h @@ -42,7 +42,7 @@ public Q_SLOTS: private Q_SLOTS: void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); - void propertiesChanged(const QString& interface, const QVariantMap& properties); + void propertiesChanged(const QString& propertyInterface, const QVariantMap& properties); private: void addPlayer(const QString& ifaceName);