Make socket descriptors qintptr.
Windows x64 uses 64 bits integer for sockets, to ensure compatibility we should use ptr sized integers for our socket descriptors. Task-number: QTBUG-19004 Change-Id: I4b56023874a4f1bad107c66c054fecfedde33d88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
eb0ce0d5c1
commit
bf7f170607
@ -900,6 +900,7 @@ template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qin
|
||||
template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { };
|
||||
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
|
||||
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
|
||||
typedef qptrdiff qintptr;
|
||||
|
||||
/*
|
||||
Useful type definitions for Qt
|
||||
|
@ -168,7 +168,7 @@ QT_BEGIN_NAMESPACE
|
||||
\sa setEnabled(), isEnabled()
|
||||
*/
|
||||
|
||||
QSocketNotifier::QSocketNotifier(int socket, Type type, QObject *parent)
|
||||
QSocketNotifier::QSocketNotifier(qintptr socket, Type type, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
if (socket < 0)
|
||||
|
@ -58,7 +58,7 @@ class Q_CORE_EXPORT QSocketNotifier : public QObject
|
||||
public:
|
||||
enum Type { Read, Write, Exception };
|
||||
|
||||
QSocketNotifier(int socket, Type, QObject *parent = 0);
|
||||
QSocketNotifier(qintptr socket, Type, QObject *parent = 0);
|
||||
~QSocketNotifier();
|
||||
|
||||
inline int socket() const { return sockfd; }
|
||||
@ -78,7 +78,7 @@ protected:
|
||||
private:
|
||||
Q_DISABLE_COPY(QSocketNotifier)
|
||||
|
||||
int sockfd;
|
||||
qintptr sockfd;
|
||||
Type sntype;
|
||||
bool snenabled;
|
||||
};
|
||||
|
@ -1723,7 +1723,7 @@ bool QAbstractSocket::canReadLine() const
|
||||
|
||||
\sa setSocketDescriptor()
|
||||
*/
|
||||
int QAbstractSocket::socketDescriptor() const
|
||||
qintptr QAbstractSocket::socketDescriptor() const
|
||||
{
|
||||
Q_D(const QAbstractSocket);
|
||||
return d->cachedSocketDescriptor;
|
||||
@ -1741,7 +1741,7 @@ int QAbstractSocket::socketDescriptor() const
|
||||
|
||||
\sa socketDescriptor()
|
||||
*/
|
||||
bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState socketState,
|
||||
bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState socketState,
|
||||
OpenMode openMode)
|
||||
{
|
||||
Q_D(QAbstractSocket);
|
||||
|
@ -156,8 +156,8 @@ public:
|
||||
void abort();
|
||||
|
||||
// ### Qt 5: Make socketDescriptor() and setSocketDescriptor() virtual.
|
||||
int socketDescriptor() const;
|
||||
bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
|
||||
qintptr socketDescriptor() const;
|
||||
bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState,
|
||||
OpenMode openMode = ReadWrite);
|
||||
|
||||
// ### Qt 5: Make virtual?
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
QString peerName;
|
||||
|
||||
QAbstractSocketEngine *socketEngine;
|
||||
int cachedSocketDescriptor;
|
||||
qintptr cachedSocketDescriptor;
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
QNetworkProxy proxy;
|
||||
|
@ -118,7 +118,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket
|
||||
return new QNativeSocketEngine(parent);
|
||||
}
|
||||
|
||||
QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(int socketDescripter, QObject *parent)
|
||||
QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(qintptr socketDescripter, QObject *parent)
|
||||
{
|
||||
QMutexLocker locker(&socketHandlers()->mutex);
|
||||
for (int i = 0; i < socketHandlers()->size(); i++) {
|
||||
|
@ -84,7 +84,7 @@ class Q_AUTOTEST_EXPORT QAbstractSocketEngine : public QObject
|
||||
public:
|
||||
|
||||
static QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType, const QNetworkProxy &, QObject *parent);
|
||||
static QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
|
||||
static QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent);
|
||||
|
||||
QAbstractSocketEngine(QObject *parent = 0);
|
||||
|
||||
@ -105,9 +105,9 @@ public:
|
||||
|
||||
virtual bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) = 0;
|
||||
|
||||
virtual bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) = 0;
|
||||
virtual bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) = 0;
|
||||
|
||||
virtual int socketDescriptor() const = 0;
|
||||
virtual qintptr socketDescriptor() const = 0;
|
||||
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
@ -225,7 +225,7 @@ protected:
|
||||
virtual ~QSocketEngineHandler();
|
||||
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
|
||||
const QNetworkProxy &, QObject *parent) = 0;
|
||||
virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent) = 0;
|
||||
virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) = 0;
|
||||
|
||||
private:
|
||||
friend class QAbstractSocketEngine;
|
||||
|
@ -103,7 +103,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QHttpSocketEngine::initialize(int, QAbstractSocket::SocketState)
|
||||
bool QHttpSocketEngine::initialize(qintptr, QAbstractSocket::SocketState)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -120,7 +120,7 @@ void QHttpSocketEngine::setProxy(const QNetworkProxy &proxy)
|
||||
d->authenticator.setPassword(password);
|
||||
}
|
||||
|
||||
int QHttpSocketEngine::socketDescriptor() const
|
||||
qintptr QHttpSocketEngine::socketDescriptor() const
|
||||
{
|
||||
Q_D(const QHttpSocketEngine);
|
||||
return d->socket ? d->socket->socketDescriptor() : 0;
|
||||
@ -838,7 +838,7 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(QAbstractSoc
|
||||
return engine;
|
||||
}
|
||||
|
||||
QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(int, QObject *)
|
||||
QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QObject *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -80,11 +80,11 @@ public:
|
||||
~QHttpSocketEngine();
|
||||
|
||||
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
|
||||
bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
|
||||
void setProxy(const QNetworkProxy &networkProxy);
|
||||
|
||||
int socketDescriptor() const;
|
||||
qintptr socketDescriptor() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
@ -191,7 +191,7 @@ class Q_AUTOTEST_EXPORT QHttpSocketEngineHandler : public QSocketEngineHandler
|
||||
public:
|
||||
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
|
||||
const QNetworkProxy &, QObject *parent);
|
||||
virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
|
||||
virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescripter, QObject *parent);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -414,7 +414,7 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
|
||||
If the socket type is either TCP or UDP, it is made non-blocking.
|
||||
UDP sockets are also broadcast enabled.
|
||||
*/
|
||||
bool QNativeSocketEngine::initialize(int socketDescriptor, QAbstractSocket::SocketState socketState)
|
||||
bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)
|
||||
{
|
||||
Q_D(QNativeSocketEngine);
|
||||
|
||||
@ -471,7 +471,7 @@ bool QNativeSocketEngine::isValid() const
|
||||
Returns the native socket descriptor. Any use of this descriptor
|
||||
stands the risk of being non-portable.
|
||||
*/
|
||||
int QNativeSocketEngine::socketDescriptor() const
|
||||
qintptr QNativeSocketEngine::socketDescriptor() const
|
||||
{
|
||||
Q_D(const QNativeSocketEngine);
|
||||
return d->socketDescriptor;
|
||||
@ -1114,7 +1114,7 @@ bool QNativeSocketEngine::isReadNotificationEnabled() const
|
||||
class QReadNotifier : public QSocketNotifier
|
||||
{
|
||||
public:
|
||||
QReadNotifier(int fd, QNativeSocketEngine *parent)
|
||||
QReadNotifier(qintptr fd, QNativeSocketEngine *parent)
|
||||
: QSocketNotifier(fd, QSocketNotifier::Read, parent)
|
||||
{ engine = parent; }
|
||||
|
||||
|
@ -113,9 +113,9 @@ public:
|
||||
~QNativeSocketEngine();
|
||||
|
||||
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
|
||||
bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
|
||||
int socketDescriptor() const;
|
||||
qintptr socketDescriptor() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
@ -199,7 +199,7 @@ public:
|
||||
QNativeSocketEnginePrivate();
|
||||
~QNativeSocketEnginePrivate();
|
||||
|
||||
int socketDescriptor;
|
||||
qintptr socketDescriptor;
|
||||
|
||||
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
|
||||
|
||||
|
@ -229,7 +229,7 @@ void QNativeSocketEnginePrivate::setPortAndAddress(sockaddr_in * sockAddrIPv4, q
|
||||
/*! \internal
|
||||
|
||||
*/
|
||||
static inline QAbstractSocket::SocketType qt_socket_getType(int socketDescriptor)
|
||||
static inline QAbstractSocket::SocketType qt_socket_getType(qintptr socketDescriptor)
|
||||
{
|
||||
int value = 0;
|
||||
QT_SOCKLEN_T valueSize = sizeof(value);
|
||||
@ -247,7 +247,7 @@ static inline QAbstractSocket::SocketType qt_socket_getType(int socketDescriptor
|
||||
/*! \internal
|
||||
|
||||
*/
|
||||
static inline int qt_socket_getMaxMsgSize(int socketDescriptor)
|
||||
static inline int qt_socket_getMaxMsgSize(qintptr socketDescriptor)
|
||||
{
|
||||
int value = 0;
|
||||
QT_SOCKLEN_T valueSize = sizeof(value);
|
||||
|
@ -332,9 +332,9 @@ public:
|
||||
QSocks5BindStore();
|
||||
~QSocks5BindStore();
|
||||
|
||||
void add(int socketDescriptor, QSocks5BindData *bindData);
|
||||
bool contains(int socketDescriptor);
|
||||
QSocks5BindData *retrieve(int socketDescriptor);
|
||||
void add(qintptr socketDescriptor, QSocks5BindData *bindData);
|
||||
bool contains(qintptr socketDescriptor);
|
||||
QSocks5BindData *retrieve(qintptr socketDescriptor);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent * event);
|
||||
@ -360,7 +360,7 @@ QSocks5BindStore::~QSocks5BindStore()
|
||||
{
|
||||
}
|
||||
|
||||
void QSocks5BindStore::add(int socketDescriptor, QSocks5BindData *bindData)
|
||||
void QSocks5BindStore::add(qintptr socketDescriptor, QSocks5BindData *bindData)
|
||||
{
|
||||
QMutexLocker lock(&mutex);
|
||||
if (store.contains(socketDescriptor)) {
|
||||
@ -373,13 +373,13 @@ void QSocks5BindStore::add(int socketDescriptor, QSocks5BindData *bindData)
|
||||
sweepTimerId = startTimer(60000);
|
||||
}
|
||||
|
||||
bool QSocks5BindStore::contains(int socketDescriptor)
|
||||
bool QSocks5BindStore::contains(qintptr socketDescriptor)
|
||||
{
|
||||
QMutexLocker lock(&mutex);
|
||||
return store.contains(socketDescriptor);
|
||||
}
|
||||
|
||||
QSocks5BindData *QSocks5BindStore::retrieve(int socketDescriptor)
|
||||
QSocks5BindData *QSocks5BindStore::retrieve(qintptr socketDescriptor)
|
||||
{
|
||||
QMutexLocker lock(&mutex);
|
||||
if (!store.contains(socketDescriptor))
|
||||
@ -1018,7 +1018,7 @@ bool QSocks5SocketEngine::initialize(QAbstractSocket::SocketType type, QAbstract
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QSocks5SocketEngine::initialize(int socketDescriptor, QAbstractSocket::SocketState socketState)
|
||||
bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)
|
||||
{
|
||||
Q_D(QSocks5SocketEngine);
|
||||
|
||||
@ -1080,7 +1080,7 @@ void QSocks5SocketEngine::setProxy(const QNetworkProxy &networkProxy)
|
||||
d->proxyInfo = networkProxy;
|
||||
}
|
||||
|
||||
int QSocks5SocketEngine::socketDescriptor() const
|
||||
qintptr QSocks5SocketEngine::socketDescriptor() const
|
||||
{
|
||||
Q_D(const QSocks5SocketEngine);
|
||||
return d->socketDescriptor;
|
||||
@ -1448,7 +1448,7 @@ int QSocks5SocketEngine::accept()
|
||||
d->data->controlSocket->setParent(0);
|
||||
d->bindData->localAddress = d->localAddress;
|
||||
d->bindData->localPort = d->localPort;
|
||||
int sd = d->socketDescriptor;
|
||||
qintptr sd = d->socketDescriptor;
|
||||
socks5BindStore()->add(sd, d->bindData);
|
||||
d->data = 0;
|
||||
d->bindData = 0;
|
||||
@ -1917,7 +1917,7 @@ QSocks5SocketEngineHandler::createSocketEngine(QAbstractSocket::SocketType socke
|
||||
return engine.take();
|
||||
}
|
||||
|
||||
QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(int socketDescriptor, QObject *parent)
|
||||
QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr socketDescriptor, QObject *parent)
|
||||
{
|
||||
QSOCKS5_DEBUG << "createSocketEngine" << socketDescriptor;
|
||||
if (socks5BindStore()->contains(socketDescriptor)) {
|
||||
|
@ -70,11 +70,11 @@ public:
|
||||
~QSocks5SocketEngine();
|
||||
|
||||
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
|
||||
bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
|
||||
void setProxy(const QNetworkProxy &networkProxy);
|
||||
|
||||
int socketDescriptor() const;
|
||||
qintptr socketDescriptor() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
@ -261,7 +261,7 @@ public:
|
||||
|
||||
bool readNotificationEnabled, writeNotificationEnabled, exceptNotificationEnabled;
|
||||
|
||||
int socketDescriptor;
|
||||
qintptr socketDescriptor;
|
||||
|
||||
QSocks5Data *data;
|
||||
QSocks5ConnectData *connectData;
|
||||
@ -290,7 +290,7 @@ class Q_AUTOTEST_EXPORT QSocks5SocketEngineHandler : public QSocketEngineHandler
|
||||
public:
|
||||
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
|
||||
const QNetworkProxy &, QObject *parent);
|
||||
virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
|
||||
virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent);
|
||||
};
|
||||
|
||||
|
||||
|
@ -378,7 +378,7 @@ void QTcpServer::close()
|
||||
|
||||
\sa setSocketDescriptor(), isListening()
|
||||
*/
|
||||
int QTcpServer::socketDescriptor() const
|
||||
qintptr QTcpServer::socketDescriptor() const
|
||||
{
|
||||
Q_D(const QTcpServer);
|
||||
Q_CHECK_SOCKETENGINE(-1);
|
||||
@ -394,7 +394,7 @@ int QTcpServer::socketDescriptor() const
|
||||
|
||||
\sa socketDescriptor(), isListening()
|
||||
*/
|
||||
bool QTcpServer::setSocketDescriptor(int socketDescriptor)
|
||||
bool QTcpServer::setSocketDescriptor(qintptr socketDescriptor)
|
||||
{
|
||||
Q_D(QTcpServer);
|
||||
if (isListening()) {
|
||||
@ -566,7 +566,7 @@ QTcpSocket *QTcpServer::nextPendingConnection()
|
||||
|
||||
\sa newConnection(), nextPendingConnection(), addPendingConnection()
|
||||
*/
|
||||
void QTcpServer::incomingConnection(int socketDescriptor)
|
||||
void QTcpServer::incomingConnection(qintptr socketDescriptor)
|
||||
{
|
||||
#if defined (QTCPSERVER_DEBUG)
|
||||
qDebug("QTcpServer::incomingConnection(%i)", socketDescriptor);
|
||||
|
@ -76,8 +76,8 @@ public:
|
||||
quint16 serverPort() const;
|
||||
QHostAddress serverAddress() const;
|
||||
|
||||
int socketDescriptor() const;
|
||||
bool setSocketDescriptor(int socketDescriptor);
|
||||
qintptr socketDescriptor() const;
|
||||
bool setSocketDescriptor(qintptr socketDescriptor);
|
||||
|
||||
bool waitForNewConnection(int msec = 0, bool *timedOut = 0);
|
||||
virtual bool hasPendingConnections() const;
|
||||
@ -92,7 +92,7 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void incomingConnection(int handle);
|
||||
virtual void incomingConnection(qintptr handle);
|
||||
void addPendingConnection(QTcpSocket* socket);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -455,7 +455,7 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port,
|
||||
|
||||
\sa socketDescriptor()
|
||||
*/
|
||||
bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, OpenMode openMode)
|
||||
bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state, OpenMode openMode)
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
// Autostarting the SSL client handshake.
|
||||
void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
|
||||
void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
|
||||
bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
|
||||
bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState,
|
||||
OpenMode openMode = ReadWrite);
|
||||
|
||||
// ### Qt 5: Make virtual
|
||||
|
@ -264,7 +264,7 @@ void tst_QLocalSocket::socket_basic()
|
||||
QCOMPARE(socket.isValid(), false);
|
||||
QVERIFY(socket.readBufferSize() == 0);
|
||||
socket.setReadBufferSize(0);
|
||||
//QCOMPARE(socket.socketDescriptor(), -1);
|
||||
//QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.state(), QLocalSocket::UnconnectedState);
|
||||
QCOMPARE(socket.waitForConnected(0), false);
|
||||
QCOMPARE(socket.waitForDisconnected(0), false);
|
||||
@ -632,7 +632,7 @@ void tst_QLocalSocket::hitMaximumConnections()
|
||||
void tst_QLocalSocket::setSocketDescriptor()
|
||||
{
|
||||
LocalSocket socket;
|
||||
quintptr minusOne = -1;
|
||||
qintptr minusOne = -1;
|
||||
socket.setSocketDescriptor(minusOne, QLocalSocket::ConnectingState, QIODevice::Append);
|
||||
QCOMPARE(socket.socketDescriptor(), minusOne);
|
||||
QCOMPARE(socket.state(), QLocalSocket::ConnectingState);
|
||||
|
@ -191,7 +191,7 @@ void tst_QTcpServer::constructing()
|
||||
QCOMPARE(socket.serverAddress(), QHostAddress());
|
||||
QCOMPARE(socket.maxPendingConnections(), 30);
|
||||
QCOMPARE(socket.hasPendingConnections(), false);
|
||||
QCOMPARE(socket.socketDescriptor(), -1);
|
||||
QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.serverError(), QAbstractSocket::UnknownSocketError);
|
||||
|
||||
// Check the state of the socket layer?
|
||||
@ -510,7 +510,7 @@ public:
|
||||
bool ok;
|
||||
|
||||
protected:
|
||||
void incomingConnection(int socketDescriptor)
|
||||
void incomingConnection(qintptr socketDescriptor)
|
||||
{
|
||||
// how a user woulddo it (qabstractsocketengine is not public)
|
||||
unsigned long arg = 0;
|
||||
|
@ -458,7 +458,7 @@ void tst_QTcpSocket::constructing()
|
||||
QCOMPARE((int) socket->bytesAvailable(), 0);
|
||||
QCOMPARE(socket->canReadLine(), false);
|
||||
QCOMPARE(socket->readLine(), QByteArray());
|
||||
QCOMPARE(socket->socketDescriptor(), -1);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE((int) socket->localPort(), 0);
|
||||
QVERIFY(socket->localAddress() == QHostAddress());
|
||||
QCOMPARE((int) socket->peerPort(), 0);
|
||||
@ -538,9 +538,9 @@ void tst_QTcpSocket::bind()
|
||||
void tst_QTcpSocket::setInvalidSocketDescriptor()
|
||||
{
|
||||
QTcpSocket *socket = newSocket();
|
||||
QCOMPARE(socket->socketDescriptor(), -1);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
QVERIFY(!socket->setSocketDescriptor(-5, QTcpSocket::UnconnectedState));
|
||||
QCOMPARE(socket->socketDescriptor(), -1);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
|
||||
QCOMPARE(socket->error(), QTcpSocket::UnsupportedSocketOperationError);
|
||||
|
||||
@ -577,17 +577,17 @@ void tst_QTcpSocket::setSocketDescriptor()
|
||||
QVERIFY(sock != INVALID_SOCKET);
|
||||
QTcpSocket *socket = newSocket();
|
||||
QVERIFY(socket->setSocketDescriptor(sock, QTcpSocket::UnconnectedState));
|
||||
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
|
||||
|
||||
qt_qhostinfo_clear_cache(); //avoid the HostLookupState being skipped due to address being in cache from previous test.
|
||||
socket->connectToHost(QtNetworkSettings::serverName(), 143);
|
||||
QCOMPARE(socket->state(), QTcpSocket::HostLookupState);
|
||||
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
|
||||
QVERIFY(socket->waitForConnected(10000));
|
||||
// skip this, it has been broken for years, see task 260735
|
||||
// if somebody complains, consider fixing it, but it might break existing applications.
|
||||
QEXPECT_FAIL("", "bug has been around for years, will not fix without need", Continue);
|
||||
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
|
||||
delete socket;
|
||||
#ifdef Q_OS_WIN
|
||||
delete dummy;
|
||||
@ -600,7 +600,7 @@ void tst_QTcpSocket::socketDescriptor()
|
||||
{
|
||||
QTcpSocket *socket = newSocket();
|
||||
|
||||
QCOMPARE(socket->socketDescriptor(), -1);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
socket->connectToHost(QtNetworkSettings::serverName(), 143);
|
||||
QVERIFY((socket->state() == QAbstractSocket::HostLookupState && socket->socketDescriptor() == -1) ||
|
||||
(socket->state() == QAbstractSocket::ConnectingState && socket->socketDescriptor() != -1));
|
||||
@ -1025,7 +1025,7 @@ void tst_QTcpSocket::openCloseOpenClose()
|
||||
QCOMPARE((int) socket->bytesAvailable(), 0);
|
||||
QCOMPARE(socket->canReadLine(), false);
|
||||
QCOMPARE(socket->readLine(), QByteArray());
|
||||
QCOMPARE(socket->socketDescriptor(), -1);
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE((int) socket->localPort(), 0);
|
||||
QVERIFY(socket->localAddress() == QHostAddress());
|
||||
QCOMPARE((int) socket->peerPort(), 0);
|
||||
|
@ -195,7 +195,7 @@ void tst_QUdpSocket::constructing()
|
||||
QCOMPARE((int) socket.bytesAvailable(), 0);
|
||||
QCOMPARE(socket.canReadLine(), false);
|
||||
QCOMPARE(socket.readLine(), QByteArray());
|
||||
QCOMPARE(socket.socketDescriptor(), -1);
|
||||
QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.error(), QUdpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.errorString(), QString("Unknown error"));
|
||||
|
||||
|
@ -396,7 +396,7 @@ void tst_QSslSocket::constructing()
|
||||
QCOMPARE(socket.peerPort(), quint16(0));
|
||||
QCOMPARE(socket.proxy().type(), QNetworkProxy::DefaultProxy);
|
||||
QCOMPARE(socket.readBufferSize(), qint64(0));
|
||||
QCOMPARE(socket.socketDescriptor(), -1);
|
||||
QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.socketType(), QAbstractSocket::TcpSocket);
|
||||
QVERIFY(!socket.waitForConnected(10));
|
||||
QTest::ignoreMessage(QtWarningMsg, "QSslSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
|
Loading…
Reference in New Issue
Block a user