summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-10-22 20:04:21 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2015-11-14 09:42:49 +0000
commitbe2e993a9ac03a6fc43b2fa15f3df068984acd70 (patch)
tree266cb5d27542923915622cda0b600beb3c95829d /src/network/socket/qnativesocketengine.cpp
parent9daef8a54c32162a50b0f558dac829333165618f (diff)
Fix build with 'udpsocket' feature disabled
Wrap related code in QNativeSocketEngine and the tuiotouch plugin in conditionals. Change-Id: Ic6861b1c6a9e041fa8a50f96149f7280473a9fba Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/socket/qnativesocketengine.cpp')
-rw-r--r--src/network/socket/qnativesocketengine.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 52e6922b5f..386e0e2cc7 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -651,6 +651,24 @@ int QNativeSocketEngine::accept()
return d->nativeAccept();
}
+/*!
+ Returns the number of bytes that are currently available for
+ reading. On error, -1 is returned.
+
+ For UDP sockets, this function returns the accumulated size of all
+ pending datagrams, and it is therefore more useful for UDP sockets
+ to call hasPendingDatagrams() and pendingDatagramSize().
+*/
+qint64 QNativeSocketEngine::bytesAvailable() const
+{
+ Q_D(const QNativeSocketEngine);
+ Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
+ Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
+
+ return d->nativeBytesAvailable();
+}
+
+#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
/*!
@@ -713,23 +731,6 @@ bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface)
#endif // QT_NO_NETWORKINTERFACE
/*!
- Returns the number of bytes that are currently available for
- reading. On error, -1 is returned.
-
- For UDP sockets, this function returns the accumulated size of all
- pending datagrams, and it is therefore more useful for UDP sockets
- to call hasPendingDatagrams() and pendingDatagramSize().
-*/
-qint64 QNativeSocketEngine::bytesAvailable() const
-{
- Q_D(const QNativeSocketEngine);
- Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
- Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
-
- return d->nativeBytesAvailable();
-}
-
-/*!
Returns \c true if there is at least one datagram pending. This
function is only called by UDP sockets, where a datagram can have
a size of 0. TCP sockets call bytesAvailable().
@@ -810,6 +811,7 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size,
Q_CHECK_TYPE(QNativeSocketEngine::writeDatagram(), QAbstractSocket::UdpSocket, -1);
return d->nativeSendDatagram(data, size, d->adjustAddressProtocol(host), port);
}
+#endif // QT_NO_UDPSOCKET
/*!
Writes a block of \a size bytes from \a data to the socket.