summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-08-03 12:39:54 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-08-03 12:53:19 (GMT)
commit78b769c7d433e38352ac936c4d1f2e35134f5fa0 (patch)
treef7289ef134c6593036931bc0ade775f928392df7 /src/network/socket
parentae597a532683e5d544400b62497c870cf570b069 (diff)
downloadQt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.zip
Qt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.tar.gz
Qt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.tar.bz2
Trailing whitespace and tab/space fixes for QtNetwork
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qlocalserver_unix.cpp10
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp14
-rw-r--r--src/network/socket/qnativesocketengine.cpp8
-rw-r--r--src/network/socket/qnativesocketengine_p.h4
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp102
-rw-r--r--src/network/socket/qudpsocket.cpp16
6 files changed, 77 insertions, 77 deletions
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index e4bc1aa..b05a2cc 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -112,7 +112,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
//
// As an workaround, we set the socket to non blocking so possible
// subsequent call to accept will not block in any case
- //
+ //
// This change can be removed once more generic fix to select thread
// syncronization problem is implemented.
int flags = fcntl(listenSocket, F_GETFL, 0);
@@ -120,10 +120,10 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
|| -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
- return false;
- }
-#endif
-
+ return false;
+ }
+#endif
+
// bind
if(-1 == qBind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
setError(QLatin1String("QLocalServer::listen"));
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index cba5a7f..b2eb15f 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -301,7 +301,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
case ETIMEDOUT:
errorOccurred(QLocalSocket::SocketTimeoutError, function);
break;
- case EINPROGRESS:
+ case EINPROGRESS:
case EAGAIN:
// Try again later, all of the sockets listening are full
if (!delayConnect) {
@@ -534,14 +534,14 @@ bool QLocalSocket::waitForConnected(int msec)
timer.start();
while (state() == ConnectingState
&& (-1 == msec || timer.elapsed() < msec)) {
-#ifdef Q_OS_SYMBIAN
- // On Symbian, ready-to-write is signaled when non-blocking socket
- // connect is finised. Is ready-to-read really used on other
- // UNIX paltforms when using non-blocking AF_UNIX socket?
+#ifdef Q_OS_SYMBIAN
+ // On Symbian, ready-to-write is signaled when non-blocking socket
+ // connect is finised. Is ready-to-read really used on other
+ // UNIX paltforms when using non-blocking AF_UNIX socket?
result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout);
#else
- result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
-#endif
+ result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
+#endif
if (-1 == result && errno != EINTR) {
d->errorOccurred( QLocalSocket::UnknownSocketError,
QLatin1String("QLocalSocket::waitForConnected"));
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 666c86e..f88094a 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -381,13 +381,13 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
return false;
}
-
+
// Make sure we receive out-of-band data
// On Symbian OS this works only with native IP stack, not with WinSock
if (socketType == QAbstractSocket::TcpSocket
&& !setOption(ReceiveOutOfBandData, 1)) {
qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data");
- }
+ }
// Set the send and receive buffer sizes to a magic size, found
// most optimal for our platforms.
@@ -913,7 +913,7 @@ bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWri
d_func()->fetchConnectionParameters();
return true;
}
-#endif
+#endif
if (ret == 0) {
if (timedOut)
*timedOut = true;
@@ -1094,7 +1094,7 @@ bool QExceptionNotifier::event(QEvent *e)
engine->exceptionNotification();
return true;
}
- return QSocketNotifier::event(e);
+ return QSocketNotifier::event(e);
}
void QNativeSocketEngine::setReadNotificationEnabled(bool enable)
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index a8d7fff..c2881b0 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -351,8 +351,8 @@ public:
struct sockaddr_storage aa;
#else
struct sockaddr_in aa;
-#endif
-
+#endif
+
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
#ifdef Q_OS_WIN
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 58adaff..0027c8e 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -281,7 +281,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
}
case QNativeSocketEngine::AddressReusable:
#ifdef Q_OS_SYMBIAN
- n = SO_REUSEADDR;
+ n = SO_REUSEADDR;
#elif SO_REUSEPORT
n = SO_REUSEPORT;
#else
@@ -295,7 +295,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
break;
}
- return qt_socket_setsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, sizeof(v)) == 0;
+ return qt_socket_setsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, sizeof(v)) == 0;
}
@@ -303,8 +303,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
{
#ifdef QNATIVESOCKETENGINE_DEBUG
qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor);
-#endif
-
+#endif
+
struct sockaddr_in sockAddrIPv4;
struct sockaddr *sockAddrPtr = 0;
QT_SOCKLEN_T sockAddrSize = 0;
@@ -571,7 +571,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
#ifdef Q_OS_SYMBIAN
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
{
- size_t nbytes = 0;
+ size_t nbytes = 0;
qt_socket_ioctl(socketDescriptor, E32IONREAD, (char *) &nbytes);
return qint64(nbytes-28);
}
@@ -579,7 +579,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
{
QVarLengthArray<char, 8192> udpMessagePeekBuffer(8192);
- ssize_t recvResult = -1;
+ ssize_t recvResult = -1;
for (;;) {
// the data written to udpMessagePeekBuffer is discarded, so
@@ -595,7 +595,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
udpMessagePeekBuffer.resize(udpMessagePeekBuffer.size() * 2);
}
-
+
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult);
#endif
@@ -644,23 +644,23 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#if !defined(QT_NO_IPV6)
struct sockaddr_in6 sockAddrIPv6;
if (host.protocol() == QAbstractSocket::IPv6Protocol) {
- memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6));
- sockAddrIPv6.sin6_family = AF_INET6;
- sockAddrIPv6.sin6_port = htons(port);
-
- Q_IPV6ADDR tmp = host.toIPv6Address();
- memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp));
- sockAddrSize = sizeof(sockAddrIPv6);
- sockAddrPtr = (struct sockaddr *)&sockAddrIPv6;
+ memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6));
+ sockAddrIPv6.sin6_family = AF_INET6;
+ sockAddrIPv6.sin6_port = htons(port);
+
+ Q_IPV6ADDR tmp = host.toIPv6Address();
+ memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp));
+ sockAddrSize = sizeof(sockAddrIPv6);
+ sockAddrPtr = (struct sockaddr *)&sockAddrIPv6;
} else
#endif
if (host.protocol() == QAbstractSocket::IPv4Protocol) {
- memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4));
- sockAddrIPv4.sin_family = AF_INET;
- sockAddrIPv4.sin_port = htons(port);
- sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address());
- sockAddrSize = sizeof(sockAddrIPv4);
- sockAddrPtr = (struct sockaddr *)&sockAddrIPv4;
+ memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4));
+ sockAddrIPv4.sin_family = AF_INET;
+ sockAddrIPv4.sin_port = htons(port);
+ sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address());
+ sockAddrSize = sizeof(sockAddrIPv4);
+ sockAddrPtr = (struct sockaddr *)&sockAddrIPv4;
}
// ignore the SIGPIPE signal
@@ -870,10 +870,10 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
-#ifdef Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
fd_set fdexec;
FD_ZERO(&fdexec);
- FD_SET(socketDescriptor, &fdexec);
+ FD_SET(socketDescriptor, &fdexec);
#endif
QTime timer;
@@ -884,18 +884,18 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
if (selectForRead)
#ifndef Q_OS_SYMBIAN
retval = qt_socket_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
-#else
- retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv);
-#endif
+#else
+ retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv);
+#endif
else
#ifndef Q_OS_SYMBIAN
retval = qt_socket_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
-#else
- retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv);
-#endif
+#else
+ retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv);
+#endif
+
-
-#ifdef Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
bool selectForExec = false;
if(retval != 0) {
if(retval < 0) {
@@ -904,10 +904,10 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
selectForExec = FD_ISSET(socketDescriptor, &fdexec);
}
if(selectForExec) {
- qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d",
- selectForRead, retval, errno, socketDescriptor);
- }
-#endif
+ qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d",
+ selectForRead, retval, errno, socketDescriptor);
+ }
+#endif
if (retval != -1 || errno != EINTR) {
break;
@@ -931,7 +931,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
}
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
- bool *selectForRead, bool *selectForWrite) const
+ bool *selectForRead, bool *selectForWrite) const
{
fd_set fdread;
FD_ZERO(&fdread);
@@ -942,12 +942,12 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
FD_ZERO(&fdwrite);
if (checkWrite)
FD_SET(socketDescriptor, &fdwrite);
-
-#ifdef Q_OS_SYMBIAN
+
+#ifdef Q_OS_SYMBIAN
fd_set fdexec;
FD_ZERO(&fdexec);
- FD_SET(socketDescriptor, &fdexec);
-#endif
+ FD_SET(socketDescriptor, &fdexec);
+#endif
struct timeval tv;
tv.tv_sec = timeout / 1000;
@@ -960,7 +960,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
do {
#ifndef Q_OS_SYMBIAN
ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
-#else
+#else
ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, &fdexec, timeout < 0 ? 0 : &tv);
bool selectForExec = false;
if(ret != 0) {
@@ -970,18 +970,18 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
selectForExec = FD_ISSET(socketDescriptor, &fdexec);
}
if(selectForExec) {
- qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d",
- checkRead, checkWrite, ret, errno, socketDescriptor);
- if (checkRead)
- FD_SET(socketDescriptor, &fdread);
- if (checkWrite)
- FD_SET(socketDescriptor, &fdwrite);
-
- if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE ))
+ qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d",
+ checkRead, checkWrite, ret, errno, socketDescriptor);
+ if (checkRead)
+ FD_SET(socketDescriptor, &fdread);
+ if (checkWrite)
+ FD_SET(socketDescriptor, &fdwrite);
+
+ if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE ))
ret = 1;
-
+
}
-#endif
+#endif
if (ret != -1 || errno != EINTR) {
break;
}
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index 61b28ba..8e641d9 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -91,12 +91,12 @@
This enum describes the different flags you can pass to modify the
behavior of QUdpSocket::bind().
-
+
\note On Symbian OS bind flags behaviour depends on process capabilties.
- If process has NetworkControl capability, the bind attempt with
+ If process has NetworkControl capability, the bind attempt with
ReuseAddressHint will always succeed even the address and port is already
- bound by another socket with any flags. If process does not have
- NetworkControl capability, the bind attempt to address and port already
+ bound by another socket with any flags. If process does not have
+ NetworkControl capability, the bind attempt to address and port already
bound by another socket will always fail.
\value ShareAddress Allow other services to bind to the same address
@@ -353,7 +353,7 @@ qint64 QUdpSocket::pendingDatagramSize() const
as even if they are sent successfully, they are likely to be
fragmented by the IP layer before arriving at their final
destination.
-
+
\warning In S60 5.0 and earlier versions, the writeDatagram return
value is not reliable for large datagrams.
@@ -383,8 +383,8 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre
// As an workaround, we just set sent = size
if( sent == 0 )
sent = size;
- }
-#endif
+ }
+#endif
d->cachedSocketDescriptor = d->socketEngine->socketDescriptor();
if (sent >= 0) {
@@ -397,7 +397,7 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre
return sent;
}
-/*!
+/*!
\fn qint64 QUdpSocket::writeDatagram(const QByteArray &datagram,
const QHostAddress &host, quint16 port)
\overload