Applied undo_some_whitespace_changes.patch

This commit is contained in:
Matthias Kollmann
2017-10-23 20:12:00 +02:00
parent 2d21502972
commit 323d9494f5
8 changed files with 96 additions and 110 deletions

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf
File name : avahiclient.cpp
Created : 20 July 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf
File name : avahiclient.cpp
Created : 20 July 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Avahi-client wrapper for use in Desktop Linux systems
Avahi-client wrapper for use in Desktop Linux systems
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
//#include <avahi-qt4/qt-watch.h> //
@ -136,19 +136,19 @@ public:
}
static void resolveCallback(
AVAHI_GCC_UNUSED AvahiServiceResolver *r,
AVAHI_GCC_UNUSED AvahiIfIndex interface,
AVAHI_GCC_UNUSED AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name,
const char *type,
const char *domain,
const char *host_name,
const AvahiAddress *address,
uint16_t port,
AvahiStringList *txt,
AvahiLookupResultFlags,
AVAHI_GCC_UNUSED void* userdata)
AVAHI_GCC_UNUSED AvahiServiceResolver *r,
AVAHI_GCC_UNUSED AvahiIfIndex interface,
AVAHI_GCC_UNUSED AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name,
const char *type,
const char *domain,
const char *host_name,
const AvahiAddress *address,
uint16_t port,
AvahiStringList *txt,
AvahiLookupResultFlags,
AVAHI_GCC_UNUSED void* userdata)
{
bool newRecord = 0;
QZeroConfService zcs;
@ -162,8 +162,8 @@ public:
newRecord = 1;
zcs.setName(name);
zcs.setType(type);
zcs.setDomain( domain);
zcs.setHost( host_name);
zcs.setDomain(domain);
zcs.setHost(host_name);
zcs.setInterfaceIndex(interface);
zcs.setPort(port);
while (txt) // get txt records
@ -209,15 +209,13 @@ public:
QMap<QString, QZeroConfService>::iterator i;
for (i = pub->services.begin(); i != pub->services.end(); i++) {
emit pub->serviceRemoved(i.value());
emit pub->serviceRemoved(i.value());
}
pub->services.clear();
QMap<QString, AvahiServiceResolver *>::iterator r;
for (r = resolvers.begin(); r != resolvers.end(); r++)
avahi_service_resolver_free(*r);
avahi_service_resolver_free(*r);
resolvers.clear();
}
@ -233,8 +231,7 @@ public:
};
QZeroConf::QZeroConf(QObject *parent) : QObject(parent)
QZeroConf::QZeroConf(QObject *parent) : QObject (parent)
{
pri = new QZeroConfPrivate(this);
}
@ -303,7 +300,7 @@ void QZeroConf::clearServiceTxtRecords()
void QZeroConf::startBrowser(QString type, QAbstractSocket::NetworkLayerProtocol protocol)
{
AvahiProtocol avahiProtocol;
AvahiProtocol avahiProtocol;
if (pri->browser)
emit error(QZeroConf::browserFailed);

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf
File name : avahicore.cpp
Created : 9 September 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf
File name : avahicore.cpp
Created : 9 September 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Avahi-core wrapper for use in embedded Linux systems (Android)
Avahi-core wrapper for use in embedded Linux systems (Android)
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
//#include <avahi-qt4/qt-watch.h> //
@ -67,9 +67,9 @@ public:
switch (state) {
case AVAHI_SERVER_RUNNING:
ref->ready = 1;
if (ref->registerWaiting) {
ref->registerWaiting = 0;
ref->registerService(ref->name.toUtf8(), ref->type.toUtf8(), ref->domain.toUtf8(), ref->port);
if (ref->registerWaiting) {
ref->registerWaiting = 0;
ref->registerService(ref->name.toUtf8(), ref->type.toUtf8(), ref->domain.toUtf8(), ref->port);
}
break;
case AVAHI_SERVER_COLLISION:
@ -147,19 +147,19 @@ public:
}
static void resolveCallback(
AVAHI_GCC_UNUSED AvahiSServiceResolver *r,
AVAHI_GCC_UNUSED AvahiIfIndex interface,
AVAHI_GCC_UNUSED AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name,
const char *type,
const char *domain,
const char *host_name,
const AvahiAddress *address,
uint16_t port,
AvahiStringList *txt,
AvahiLookupResultFlags,
AVAHI_GCC_UNUSED void* userdata)
AVAHI_GCC_UNUSED AvahiSServiceResolver *r,
AVAHI_GCC_UNUSED AvahiIfIndex interface,
AVAHI_GCC_UNUSED AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name,
const char *type,
const char *domain,
const char *host_name,
const AvahiAddress *address,
uint16_t port,
AvahiStringList *txt,
AvahiLookupResultFlags,
AVAHI_GCC_UNUSED void* userdata)
{
bool newRecord = 0;
QZeroConfService *zcs;

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf
File name : bonjour.cpp
Created : 20 July 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf
File name : bonjour.cpp
Created : 20 July 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Wrapper for Apple's Bonjour library for use on Windows, MACs and iOS
Wrapper for Apple's Bonjour library for use on Windows, MACs and iOS
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#include "qzeroconf.h"
@ -37,7 +37,6 @@ QZeroConfPrivate::QZeroConfPrivate(QZeroConf *parent)
browserSocket = NULL;
resolverSocket = NULL;
addressSocket = NULL;
}
void QZeroConfPrivate::bsRead()
@ -69,7 +68,7 @@ void QZeroConfPrivate::resolve(void)
{
DNSServiceErrorType err;
err = DNSServiceResolve(&resolver, kDNSServiceFlagsTimeout, newService.interfaceIndex(), newService.name().toUtf8(), newService.type().toUtf8(), newService.domain().toUtf8(), (DNSServiceResolveReply) resolverCallback, this);
err = DNSServiceResolve(&resolver, kDNSServiceFlagsTimeout, newService.interfaceIndex(), newService.name().toUtf8(), newService.type().toUtf8(), newService.domain().toUtf8(), (DNSServiceResolveReply) resolverCallback, this);
if (err == kDNSServiceErr_NoError) {
int sockfd = DNSServiceRefSockFD(resolver);
if (sockfd == -1) {
@ -103,7 +102,7 @@ void DNSSD_API QZeroConfPrivate::browseCallback(DNSServiceRef, DNSServiceFlags f
const char *type, const char *domain, void *userdata)
{
QString key;
QZeroConfService zcs;
QZeroConfService zcs;
QZeroConfPrivate *ref = static_cast<QZeroConfPrivate *>(userdata);
//qDebug() << name;
@ -111,12 +110,11 @@ void DNSSD_API QZeroConfPrivate::browseCallback(DNSServiceRef, DNSServiceFlags f
key = name + QString::number(interfaceIndex);
if (flags & kDNSServiceFlagsAdd) {
if (!ref->pub->services.contains(key)) {
//zcs = new QZeroConfService;
zcs.setName(name);
zcs.setType( type);
zcs.setDomain(domain);
zcs.setInterfaceIndex(interfaceIndex);
if (!ref->newService.isValid()) {
zcs.setName(name);
zcs.setType(type);
zcs.setDomain(domain);
zcs.setInterfaceIndex(interfaceIndex);
if (!ref->newService.isValid()) {
ref->newService = zcs;
ref->resolve();
}
@ -128,7 +126,6 @@ void DNSSD_API QZeroConfPrivate::browseCallback(DNSServiceRef, DNSServiceFlags f
zcs = ref->pub->services[key];
ref->pub->services.remove(key);
emit ref->pub->serviceRemoved(zcs);
}
}
else {
@ -157,15 +154,15 @@ void DNSSD_API QZeroConfPrivate::resolverCallback(DNSServiceRef, DNSServiceFlags
QByteArray avahiText((const char *)txtRecord, recLen);
QList<QByteArray> pair = avahiText.split('=');
if (pair.size() == 2)
ref->newService.appendTxt(pair.at(0), pair.at(1));
ref->newService.appendTxt(pair.at(0), pair.at(1));
else
ref->newService.appendTxt(pair.at(0));
ref->newService.appendTxt(pair.at(0));
txtLen-= recLen + 1;
txtRecord+= recLen;
}
ref->newService.setHost(hostName);
ref->newService.setPort(qFromBigEndian<quint16>(port));
ref->newService.setHost(hostName);
ref->newService.setPort(qFromBigEndian<quint16>(port));
err = DNSServiceGetAddrInfo(&ref->resolver, kDNSServiceFlagsForceMulticast, interfaceIndex, ref->protocol, hostName, (DNSServiceGetAddrInfoReply) addressReply, ref);
if (err == kDNSServiceErr_NoError) {
int sockfd = DNSServiceRefSockFD(ref->resolver);
@ -198,11 +195,11 @@ void DNSSD_API QZeroConfPrivate::addressReply(DNSServiceRef sdRef,
if ((flags & kDNSServiceFlagsAdd) != 0) {
QHostAddress hAddress(address);
if (hAddress.protocol() == QAbstractSocket::IPv6Protocol)
ref->newService.setIpv6(hAddress);
ref->newService.setIpv6(hAddress);
else
ref->newService.setIp(hAddress);
ref->newService.setIp(hAddress);
QString key = ref->newService.name() + QString::number(interfaceIndex);
QString key = ref->newService.name() + QString::number(interfaceIndex);
if (!ref->pub->services.contains(key)) {
ref->pub->services.insert(key, ref->newService);
emit ref->pub->serviceAdded(ref->newService);
@ -245,12 +242,10 @@ void QZeroConfPrivate::cleanUp(DNSServiceRef toClean)
delete browserSocket;
browserSocket = NULL;
}
QMap<QString, QZeroConfService >::iterator i;
for (i = pub->services.begin(); i != pub->services.end(); i++) {
emit pub->serviceRemoved(*i);
}
pub->services.clear();
}
else if (toClean == dnssRef) {

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf
File name : bonjour_p.h
Created : 22 July 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf
File name : bonjour_p.h
Created : 22 July 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Part of wrapper for Apple's Bonjour library for use on Windows, MACs and iOS. Needed for slots.
Part of wrapper for Apple's Bonjour library for use on Windows, MACs and iOS. Needed for slots.
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#ifndef QZEROCONFPRIVATE_H_

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf Example
File name : main.cpp
Created : 3 November 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf Example
File name : main.cpp
Created : 3 November 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Example app to demonstrate service publishing and service discovery
Example app to demonstrate service publishing and service discovery
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#include <QApplication>

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf Example
File name : window.cpp
Created : 3 November 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf Example
File name : window.cpp
Created : 3 November 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Example app to demonstrate service publishing and service discovery
Example app to demonstrate service publishing and service discovery
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#include <QGuiApplication>
@ -53,13 +53,11 @@ mainWindow::mainWindow()
publishEnabled = 0;
buildGUI();
connect(&zeroConf, &QZeroConf::serviceAdded, this, &mainWindow::addService);
connect(&zeroConf, &QZeroConf::serviceRemoved, this, &mainWindow::removeService);
connect(qGuiApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(appStateChanged(Qt::ApplicationState)));
publishEnabled = 1;
}
void mainWindow::buildGUI()
@ -93,7 +91,7 @@ void mainWindow::buildGUI()
QString mainWindow::buildName(void)
{
QString name;
QString name;
QList<QNetworkInterface> list = QNetworkInterface::allInterfaces(); // now you have interfaces list
@ -102,7 +100,7 @@ QString mainWindow::buildName(void)
name.remove(0, 6);
name+= ')';
name.prepend("Qt ZeroConf Test - " OS_NAME " (");
return name;
return name;
}
void mainWindow::appStateChanged(Qt::ApplicationState state)
@ -154,9 +152,9 @@ void mainWindow::addService(QZeroConfService zcs)
row = table.rowCount();
table.insertRow(row);
cell = new QTableWidgetItem(zcs.name());
cell = new QTableWidgetItem(zcs.name());
table.setItem(row, 0, cell);
cell = new QTableWidgetItem(zcs.ip().toString());
cell = new QTableWidgetItem(zcs.ip().toString());
table.setItem(row, 1, cell);
table.resizeColumnsToContents();
#if !(defined(Q_OS_IOS) || defined(Q_OS_ANDROID))
@ -169,12 +167,12 @@ void mainWindow::removeService(QZeroConfService zcs)
qint32 i, row;
QTableWidgetItem *nameItem, *ipItem;
QList <QTableWidgetItem*> search = table.findItems(zcs.name(), Qt::MatchExactly);
QList <QTableWidgetItem*> search = table.findItems(zcs.name(), Qt::MatchExactly);
for (i=0; i<search.size(); i++) {
nameItem = search.at(i);
row = nameItem->row();
ipItem = table.item(row, 1);
if (table.item(row, 1)->text() == zcs.ip().toString()) { // match ip address in case of dual homed systems
if (table.item(row, 1)->text() == zcs.ip().toString()) { // match ip address in case of dual homed systems
delete nameItem;
delete ipItem;
table.removeRow(row);

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf Example
File name : window.h
Created : 3 November 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf Example
File name : window.h
Created : 3 November 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
Example app to demonstrate service publishing and service discovery
Example app to demonstrate service publishing and service discovery
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#ifndef WINDOW_H_
@ -47,13 +47,11 @@ private:
bool publishEnabled;
private slots:
void appStateChanged(Qt::ApplicationState state);
void startPublishClicked();
void stopPublishClicked();
void addService(QZeroConfService item);
void removeService(QZeroConfService item);
};
#endif /* WINDOW_H_ */

View File

@ -16,12 +16,12 @@
You should have received a copy of the GNU Lesser General Public License
along with QtZeroConf. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------
Project name : QtZeroConf
File name : qzeroconf.h
Created : 20 July 2015
Author(s) : Jonathan Bagg
Project name : QtZeroConf
File name : qzeroconf.h
Created : 20 July 2015
Author(s) : Jonathan Bagg
---------------------------------------------------------------------------------------------------
QtZeroConf class definition
QtZeroConf class definition
---------------------------------------------------------------------------------------------------
**************************************************************************************************/
#ifndef QZEROCONF_H_
@ -43,8 +43,6 @@
# define Q_ZEROCONF_EXPORT
#endif
class QZeroConfPrivate;
class Q_ZEROCONF_EXPORT QZeroConf : public QObject
@ -60,7 +58,7 @@ public:
serviceNameCollision = -2,
browserFailed = -3,
};
QZeroConf(QObject *parent = Q_NULLPTR);
QZeroConf(QObject *parent = Q_NULLPTR);
~QZeroConf();
void startServicePublish(const char *name, const char *type, const char *domain, quint16 port);
void stopServicePublish(void);