Fixes examples/tests to use qinptr in QTcpServer::incomingConnection.

This is a fix for problems introduced by bf7f170.

Change-Id: If5dd8e031ef2efea578b3efb188c2e950e1ba41a
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
Jonas M. Gastal 2012-01-11 13:06:14 -02:00 committed by Qt by Nokia
parent 14b929e9c4
commit bdce610022
14 changed files with 20 additions and 18 deletions

2
dist/changes-5.0.0 vendored
View File

@ -155,6 +155,8 @@ information about a particular change.
- QAbstractSocket's connectToHost() and disconnectFromHost() are now virtual and - QAbstractSocket's connectToHost() and disconnectFromHost() are now virtual and
connectToHostImplementation() and disconnectFromHostImplementation() don't exist. connectToHostImplementation() and disconnectFromHostImplementation() don't exist.
- QTcpServer::incomingConnection() now takes a qintptr instead of an int.
**************************************************************************** ****************************************************************************
* General * * General *

View File

@ -47,7 +47,7 @@ socket->connectToHostEncrypted("imap.example.com", 993);
//! [1] //! [1]
void SslServer::incomingConnection(int socketDescriptor) void SslServer::incomingConnection(qintptr socketDescriptor)
{ {
QSslSocket *serverSocket = new QSslSocket; QSslSocket *serverSocket = new QSslSocket;
if (serverSocket->setSocketDescriptor(socketDescriptor)) { if (serverSocket->setSocketDescriptor(socketDescriptor)) {

View File

@ -49,7 +49,7 @@ Server::Server(QObject *parent)
listen(QHostAddress::Any); listen(QHostAddress::Any);
} }
void Server::incomingConnection(int socketDescriptor) void Server::incomingConnection(qintptr socketDescriptor)
{ {
Connection *connection = new Connection(this); Connection *connection = new Connection(this);
connection->setSocketDescriptor(socketDescriptor); connection->setSocketDescriptor(socketDescriptor);

View File

@ -56,7 +56,7 @@ signals:
void newConnection(Connection *connection); void newConnection(Connection *connection);
protected: protected:
void incomingConnection(int socketDescriptor); void incomingConnection(qintptr socketDescriptor);
}; };
#endif #endif

View File

@ -58,7 +58,7 @@ FortuneServer::FortuneServer(QObject *parent)
//! [0] //! [0]
//! [1] //! [1]
void FortuneServer::incomingConnection(int socketDescriptor) void FortuneServer::incomingConnection(qintptr socketDescriptor)
{ {
QString fortune = fortunes.at(qrand() % fortunes.size()); QString fortune = fortunes.at(qrand() % fortunes.size());
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this); FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);

View File

@ -53,7 +53,7 @@ public:
FortuneServer(QObject *parent = 0); FortuneServer(QObject *parent = 0);
protected: protected:
void incomingConnection(int socketDescriptor); void incomingConnection(qintptr socketDescriptor);
private: private:
QStringList fortunes; QStringList fortunes;

View File

@ -61,7 +61,7 @@ void TorrentServer::removeClient(TorrentClient *client)
clients.removeAll(client); clients.removeAll(client);
} }
void TorrentServer::incomingConnection(int socketDescriptor) void TorrentServer::incomingConnection(qintptr socketDescriptor)
{ {
PeerWireClient *client = PeerWireClient *client =
new PeerWireClient(ConnectionManager::instance()->clientId(), this); new PeerWireClient(ConnectionManager::instance()->clientId(), this);

View File

@ -58,7 +58,7 @@ public:
void removeClient(TorrentClient *client); void removeClient(TorrentClient *client);
protected: protected:
void incomingConnection(int socketDescriptor); void incomingConnection(qintptr socketDescriptor);
private slots: private slots:
void removeClient(); void removeClient();

View File

@ -485,7 +485,7 @@ public:
} }
protected: protected:
void incomingConnection(int socketDescriptor) void incomingConnection(qintptr socketDescriptor)
{ {
//qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6; //qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6;
if (!doSsl) { if (!doSsl) {
@ -807,7 +807,7 @@ public:
return nextPendingConnection(); return nextPendingConnection();
} }
} }
virtual void incomingConnection(int socketDescriptor) virtual void incomingConnection(qintptr socketDescriptor)
{ {
#ifndef QT_NO_OPENSSL #ifndef QT_NO_OPENSSL
if (doSsl) { if (doSsl) {
@ -4277,7 +4277,7 @@ class SslServer : public QTcpServer {
Q_OBJECT Q_OBJECT
public: public:
SslServer() : socket(0) {}; SslServer() : socket(0) {};
void incomingConnection(int socketDescriptor) { void incomingConnection(qintptr socketDescriptor) {
QSslSocket *serverSocket = new QSslSocket; QSslSocket *serverSocket = new QSslSocket;
serverSocket->setParent(this); serverSocket->setParent(this);

View File

@ -107,7 +107,7 @@ My4Server::My4Server(QObject *parent)
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void My4Server::incomingConnection(int socketId) void My4Server::incomingConnection(qintptr socketId)
{ {
m_socket = new My4Socket(this); m_socket = new My4Socket(this);
m_socket->setSocketDescriptor(socketId); m_socket->setSocketDescriptor(socketId);

View File

@ -69,7 +69,7 @@ public:
My4Server(QObject *parent = 0); My4Server(QObject *parent = 0);
protected: protected:
void incomingConnection(int socket); void incomingConnection(qintptr socket);
private slots: private slots:
void stopServer(); void stopServer();

View File

@ -912,7 +912,7 @@ public:
QString m_certFile; QString m_certFile;
protected: protected:
void incomingConnection(int socketDescriptor) void incomingConnection(qintptr socketDescriptor)
{ {
socket = new QSslSocket(this); socket = new QSslSocket(this);
socket->setProtocol(protocol); socket->setProtocol(protocol);
@ -1332,7 +1332,7 @@ void tst_QSslSocket::wildcard()
class SslServer2 : public QTcpServer class SslServer2 : public QTcpServer
{ {
protected: protected:
void incomingConnection(int socketDescriptor) void incomingConnection(qintptr socketDescriptor)
{ {
QSslSocket *socket = new QSslSocket(this); QSslSocket *socket = new QSslSocket(this);
socket->ignoreSslErrors(); socket->ignoreSslErrors();
@ -1558,7 +1558,7 @@ public:
QSslSocket *socket; QSslSocket *socket;
protected: protected:
void incomingConnection(int socketDescriptor) void incomingConnection(qintptr socketDescriptor)
{ {
socket = new QSslSocket(this); socket = new QSslSocket(this);
connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
@ -1730,7 +1730,7 @@ public:
QSslSocket *socket; QSslSocket *socket;
protected: protected:
void incomingConnection(int socketDescriptor) void incomingConnection(qintptr socketDescriptor)
{ {
socket = new QSslSocket(this); socket = new QSslSocket(this);

View File

@ -101,7 +101,7 @@ QString BaselineServer::settingsFilePath()
return settingsFile; return settingsFile;
} }
void BaselineServer::incomingConnection(int socketDescriptor) void BaselineServer::incomingConnection(qintptr socketDescriptor)
{ {
QString runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss")); QString runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss"));
if (runId == lastRunId) { if (runId == lastRunId) {

View File

@ -69,7 +69,7 @@ public:
static QString settingsFilePath(); static QString settingsFilePath();
protected: protected:
void incomingConnection(int socketDescriptor); void incomingConnection(qintptr socketDescriptor);
private slots: private slots:
void heartbeat(); void heartbeat();