diff options
Diffstat (limited to 'tdecore/network')
39 files changed, 218 insertions, 254 deletions
diff --git a/tdecore/network/kbufferedsocket.cpp b/tdecore/network/kbufferedsocket.cpp index 3e9462922..08f899c8a 100644 --- a/tdecore/network/kbufferedsocket.cpp +++ b/tdecore/network/kbufferedsocket.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003-2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -93,12 +93,7 @@ void TDEBufferedSocket::close() } } -#ifdef USE_QT3 TQ_LONG TDEBufferedSocket::bytesAvailable() const -#endif -#ifdef USE_QT4 -qint64 TDEBufferedSocket::bytesAvailable() const -#endif { if (!d->input) return KStreamSocket::bytesAvailable(); @@ -118,7 +113,7 @@ TQ_LONG TDEBufferedSocket::waitForMore(int msecs, bool *timeout) return retval; } -TQT_TQIO_LONG TDEBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) +TQ_LONG TDEBufferedSocket::readBlock(char *data, TQ_ULONG maxlen) { if (d->input) { @@ -131,13 +126,13 @@ TQT_TQIO_LONG TDEBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) resetError(); return d->input->consumeBuffer(data, maxlen); } - return KStreamSocket::tqreadBlock(data, maxlen); + return KStreamSocket::readBlock(data, maxlen); } -TQT_TQIO_LONG TDEBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) +TQ_LONG TDEBufferedSocket::readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { from = peerAddress(); - return tqreadBlock(data, maxlen); + return readBlock(data, maxlen); } TQ_LONG TDEBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen) @@ -162,7 +157,7 @@ TQ_LONG TDEBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddre return peekBlock(data, maxlen); } -TQT_TQIO_LONG TDEBufferedSocket::tqwriteBlock(const char *data, TQT_TQIO_ULONG len) +TQ_LONG TDEBufferedSocket::writeBlock(const char *data, TQ_ULONG len) { if (state() != Connected) { @@ -189,14 +184,14 @@ TQT_TQIO_LONG TDEBufferedSocket::tqwriteBlock(const char *data, TQT_TQIO_ULONG l return d->output->feedBuffer(data, len); } - return KStreamSocket::tqwriteBlock(data, len); + return KStreamSocket::writeBlock(data, len); } -TQT_TQIO_LONG TDEBufferedSocket::tqwriteBlock(const char *data, TQT_TQIO_ULONG maxlen, +TQ_LONG TDEBufferedSocket::writeBlock(const char *data, TQ_ULONG maxlen, const TDESocketAddress&) { // ignore the third parameter - return tqwriteBlock(data, maxlen); + return writeBlock(data, maxlen); } void TDEBufferedSocket::enableRead(bool enable) @@ -213,7 +208,7 @@ void TDEBufferedSocket::enableRead(bool enable) if (enable && state() != Connected && d->input && !d->input->isEmpty()) // this means the buffer is still dirty // allow the signal to be emitted - TQTimer::singleShot(0, this, TQT_SLOT(slotReadActivity())); + TQTimer::singleShot(0, this, TQ_SLOT(slotReadActivity())); } void TDEBufferedSocket::enableWrite(bool enable) @@ -284,12 +279,7 @@ TDEIOBufferBase* TDEBufferedSocket::outputBuffer() return d->output; } -#ifdef USE_QT3 TQ_ULONG TDEBufferedSocket::bytesToWrite() const -#endif -#ifdef USE_QT4 -qint64 TDEBufferedSocket::bytesToWrite() const -#endif { if (!d->output) return 0; @@ -368,7 +358,7 @@ void TDEBufferedSocket::slotReadActivity() { // buffer isn't empty // keep emitting signals till it is - TQTimer::singleShot(0, this, TQT_SLOT(slotReadActivity())); + TQTimer::singleShot(0, this, TQ_SLOT(slotReadActivity())); emit readyRead(); } } diff --git a/tdecore/network/kbufferedsocket.h b/tdecore/network/kbufferedsocket.h index 60ad3e81d..641d35cd1 100644 --- a/tdecore/network/kbufferedsocket.h +++ b/tdecore/network/kbufferedsocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago@kde.org> * * @@ -57,7 +57,7 @@ class TDEBufferedSocketPrivate; */ class TDECORE_EXPORT TDEBufferedSocket: public KStreamSocket { - Q_OBJECT + TQ_OBJECT public: /** @@ -99,12 +99,7 @@ public: /** * Make use of the buffers. */ -#ifdef USE_QT3 virtual TQ_LONG bytesAvailable() const; -#endif -#ifdef USE_QT4 - virtual qint64 bytesAvailable() const; -#endif /** * Make use of buffers. @@ -114,7 +109,7 @@ public: /** * Reads data from the socket. Make use of buffers. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * @overload @@ -122,7 +117,7 @@ public: * * The @p from parameter is always set to @ref peerAddress() */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Peeks data from the socket. @@ -140,7 +135,7 @@ public: /** * Writes data to the socket. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * @overload @@ -148,7 +143,7 @@ public: * * The @p to parameter is discarded. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Catch changes. @@ -183,12 +178,7 @@ public: /** * Returns the length of the output buffer. */ -#ifdef USE_QT3 virtual TQ_ULONG bytesToWrite() const; -#endif -#ifdef USE_QT4 - virtual qint64 bytesToWrite() const; -#endif /** * Closes the socket and discards any output data that had been buffered @@ -208,8 +198,6 @@ public: */ TQCString readLine(); - // KDE4: make virtual, add timeout to match the Qt4 signature - // and move to another class up the hierarchy /** * Blocks until the connection is either established, or completely * failed. @@ -255,12 +243,7 @@ public: * which required a call to reset() in order to be able to connect again * using the same device. This is not necessary in TDEBufferedSocket any more. */ -#ifdef USE_QT3 inline void reset() -#endif -#ifdef USE_QT4 - inline bool reset() -#endif { closeNow(); } }; diff --git a/tdecore/network/kclientsocketbase.cpp b/tdecore/network/kclientsocketbase.cpp index eb8e4883b..25eb34d8e 100644 --- a/tdecore/network/kclientsocketbase.cpp +++ b/tdecore/network/kclientsocketbase.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -48,16 +48,8 @@ public: }; KClientSocketBase::KClientSocketBase(TQObject *parent, const char *name) : -#ifdef USE_QT4 -#else // USE_QT4 - TQObject(parent, name), -#endif // USE_QT4 - d(new KClientSocketBasePrivate) -{ -#ifdef USE_QT4 - setParent(parent); - setObjectName(name); -#endif // USE_QT4 + TQObject(parent, name), d(new KClientSocketBasePrivate) +{ d->state = Idle; d->enableRead = true; d->enableWrite = false; @@ -152,10 +144,10 @@ bool KClientSocketBase::lookup() // don't restart the lookups if they had succeeded and // the input values weren't changed - TQObject::connect(&d->peerResolver, TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedSlot())); - TQObject::connect(&d->localResolver, TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedSlot())); + TQObject::connect(&d->peerResolver, TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedSlot())); + TQObject::connect(&d->localResolver, TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedSlot())); if (d->localResolver.status() <= 0) d->localResolver.start(); @@ -172,7 +164,7 @@ bool KClientSocketBase::lookup() if (blocking()) lookupFinishedSlot(); else - TQTimer::singleShot(0, this, TQT_SLOT(lookupFinishedSlot())); + TQTimer::singleShot(0, this, TQ_SLOT(lookupFinishedSlot())); } else { @@ -286,12 +278,7 @@ void KClientSocketBase::close() } // This function is unlike all the others because it is const -#ifdef USE_QT3 TQ_LONG KClientSocketBase::bytesAvailable() const -#endif -#ifdef USE_QT4 -qint64 KClientSocketBase::bytesAvailable() const -#endif { return socketDevice()->bytesAvailable(); } @@ -311,10 +298,10 @@ TQ_LONG KClientSocketBase::waitForMore(int msecs, bool *timeout) return retval; } -TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) +TQ_LONG KClientSocketBase::readBlock(char *data, TQ_ULONG maxlen) { resetError(); - TQ_LONG retval = socketDevice()->tqreadBlock(data, maxlen); + TQ_LONG retval = socketDevice()->readBlock(data, maxlen); if (retval == -1) { copyError(); @@ -323,10 +310,10 @@ TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) return retval; } -TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) +TQ_LONG KClientSocketBase::readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { resetError(); - TQ_LONG retval = socketDevice()->tqreadBlock(data, maxlen, from); + TQ_LONG retval = socketDevice()->readBlock(data, maxlen, from); if (retval == -1) { copyError(); @@ -359,10 +346,10 @@ TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddre return retval; } -TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG len) +TQ_LONG KClientSocketBase::writeBlock(const char *data, TQ_ULONG len) { resetError(); - TQ_LONG retval = socketDevice()->tqwriteBlock(data, len); + TQ_LONG retval = socketDevice()->writeBlock(data, len); if (retval == -1) { copyError(); @@ -371,10 +358,10 @@ TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG l return retval; } -TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) +TQ_LONG KClientSocketBase::writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { resetError(); - TQ_LONG retval = socketDevice()->tqwriteBlock(data, len, to); + TQ_LONG retval = socketDevice()->writeBlock(data, len, to); if (retval == -1) { copyError(); @@ -440,8 +427,8 @@ void KClientSocketBase::lookupFinishedSlot() if (d->peerResolver.isRunning() || d->localResolver.isRunning() || state() != HostLookup) return; - TQObject::disconnect(&d->peerResolver, 0L, this, TQT_SLOT(lookupFinishedSlot())); - TQObject::disconnect(&d->localResolver, 0L, this, TQT_SLOT(lookupFinishedSlot())); + TQObject::disconnect(&d->peerResolver, 0L, this, TQ_SLOT(lookupFinishedSlot())); + TQObject::disconnect(&d->localResolver, 0L, this, TQ_SLOT(lookupFinishedSlot())); if (d->peerResolver.status() < 0 || d->localResolver.status() < 0) { setState(Idle); // backtrack @@ -466,7 +453,7 @@ void KClientSocketBase::stateChanging(SocketState newState) if (n) { n->setEnabled(d->enableRead); - TQObject::connect(n, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotReadActivity())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotReadActivity())); } else return; @@ -475,7 +462,7 @@ void KClientSocketBase::stateChanging(SocketState newState) if (n) { n->setEnabled(d->enableWrite); - TQObject::connect(n, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotWriteActivity())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotWriteActivity())); } else return; diff --git a/tdecore/network/kclientsocketbase.h b/tdecore/network/kclientsocketbase.h index 27da219a9..a6f9eaf92 100644 --- a/tdecore/network/kclientsocketbase.h +++ b/tdecore/network/kclientsocketbase.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -32,10 +32,6 @@ #include "kresolver.h" #include <tdelibs_export.h> -#ifdef Q_MOC_RUN -#define USE_QT4 -#endif // Q_MOC_RUN - namespace KNetwork { class KClientSocketBasePrivate; @@ -50,14 +46,9 @@ class KClientSocketBasePrivate; * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KClientSocketBase : -#ifdef USE_QT4 -#else // USE_QT4 -public TQObject, -#endif // USE_QT4 -public KActiveSocketBase +class TDECORE_EXPORT KClientSocketBase : public TQObject, public KActiveSocketBase { - Q_OBJECT + TQ_OBJECT public: @@ -281,7 +272,7 @@ public: * * You should not call this function; instead, use @ref connect */ - virtual inline bool open(TQ_OpenMode) + virtual inline bool open(int) { return connect(); } /** @@ -302,12 +293,7 @@ public: * Returns the number of bytes available on this socket. * Reimplemented from TDESocketBase. */ -#ifdef USE_QT3 virtual TQ_LONG bytesAvailable() const; -#endif -#ifdef USE_QT4 - virtual qint64 bytesAvailable() const; -#endif /** * Waits for more data. Reimplemented from TDESocketBase. @@ -317,13 +303,13 @@ public: /** * Reads data from a socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * @overload * Reads data from a socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Peeks data from the socket. Reimplemented from TDESocketBase. @@ -339,13 +325,13 @@ public: /** * Writes data to the socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * @overload * Writes data to the socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Returns the local socket address. Reimplemented from TDESocketBase. diff --git a/tdecore/network/kdatagramsocket.cpp b/tdecore/network/kdatagramsocket.cpp index ac8e526ee..5fa631560 100644 --- a/tdecore/network/kdatagramsocket.cpp +++ b/tdecore/network/kdatagramsocket.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2004 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -52,11 +52,11 @@ KDatagramSocket::KDatagramSocket(TQObject* parent, const char *name) localResolver().setFlags(KResolver::Passive); - // TQObject::connect(localResolver(), TQT_SIGNAL(finished(KResolverResults)), - // this, TQT_SLOT(lookupFinishedLocal())); - TQObject::connect(&peerResolver(), TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedPeer())); - TQObject::connect(this, TQT_SIGNAL(hostFound()), this, TQT_SLOT(lookupFinishedLocal())); + // TQObject::connect(localResolver(), TQ_SIGNAL(finished(KResolverResults)), + // this, TQ_SLOT(lookupFinishedLocal())); + TQObject::connect(&peerResolver(), TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedPeer())); + TQObject::connect(this, TQ_SIGNAL(hostFound()), this, TQ_SLOT(lookupFinishedLocal())); } KDatagramSocket::~KDatagramSocket() @@ -156,7 +156,7 @@ KDatagramPacket KDatagramSocket::receive() TDESocketAddress address; // now do the reading - size = tqreadBlock(data.data(), size, address); + size = readBlock(data.data(), size, address); if (size < 0) // error has been set return KDatagramPacket(); @@ -167,10 +167,10 @@ KDatagramPacket KDatagramSocket::receive() TQ_LONG KDatagramSocket::send(const KDatagramPacket& packet) { - return tqwriteBlock(packet.data(), packet.size(), packet.address()); + return writeBlock(packet.data(), packet.size(), packet.address()); } -TQ_LONG KDatagramSocket::tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) +TQ_LONG KDatagramSocket::writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { if (to.family() != AF_UNSPEC) { @@ -179,7 +179,7 @@ TQ_LONG KDatagramSocket::tqwriteBlock(const char *data, TQ_ULONG len, const TDES // error handling will happen below socketDevice()->create(to.family(), SOCK_DGRAM, 0); } - return KClientSocketBase::tqwriteBlock(data, len, to); + return KClientSocketBase::writeBlock(data, len, to); } void KDatagramSocket::lookupFinishedLocal() @@ -265,7 +265,7 @@ void KDatagramSocket::setupSignals() if (n) { n->setEnabled(emitsReadyRead()); - TQObject::connect(n, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotReadActivity())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotReadActivity())); } else return; @@ -274,7 +274,7 @@ void KDatagramSocket::setupSignals() if (n) { n->setEnabled(emitsReadyWrite()); - TQObject::connect(n, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotWriteActivity())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotWriteActivity())); } else return; diff --git a/tdecore/network/kdatagramsocket.h b/tdecore/network/kdatagramsocket.h index fd12a0d97..b99938e8b 100644 --- a/tdecore/network/kdatagramsocket.h +++ b/tdecore/network/kdatagramsocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -179,7 +179,7 @@ class KDatagramSocketPrivate; */ class TDECORE_EXPORT KDatagramSocket: public KClientSocketBase { - Q_OBJECT + TQ_OBJECT public: @@ -223,7 +223,7 @@ public: * * Connecting means only to designate the given address as the default * destination address for datagrams sent without destination addresses - * ( tqwriteBlock(const char *, TQ_ULONG) ). + * ( writeBlock(const char *, TQ_ULONG) ). * * @note Calling connect will not cause the socket to be bound. You have * to call @ref bind explicitly. @@ -241,7 +241,7 @@ public: /** * Writes data to the socket. Reimplemented from KClientSocketBase. */ - virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Receives one datagram from the stream. The reading process is guaranteed diff --git a/tdecore/network/khttpproxysocketdevice.cpp b/tdecore/network/khttpproxysocketdevice.cpp index 0c4947554..980fa39d5 100644 --- a/tdecore/network/khttpproxysocketdevice.cpp +++ b/tdecore/network/khttpproxysocketdevice.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -182,7 +182,7 @@ bool KHttpProxySocketDevice::parseServerReply() if (!d->request.isEmpty()) { // send request - TQ_LONG written = tqwriteBlock(d->request, d->request.length()); + TQ_LONG written = writeBlock(d->request, d->request.length()); if (written < 0) { tqDebug("KHttpProxySocketDevice: would block writing request!"); @@ -230,7 +230,7 @@ bool KHttpProxySocketDevice::parseServerReply() { // no, headers not yet finished... // consume data from socket - tqreadBlock(buf.data(), avail); + readBlock(buf.data(), avail); d->reply += buf.data(); setError(IO_ConnectError, InProgress); return true; @@ -241,7 +241,7 @@ bool KHttpProxySocketDevice::parseServerReply() d->reply += fullHeaders.mid(d->reply.length(), index + 4); // consume from socket - tqreadBlock(buf.data(), index + 4); + readBlock(buf.data(), index + 4); } else { diff --git a/tdecore/network/khttpproxysocketdevice.h b/tdecore/network/khttpproxysocketdevice.h index dc5faef93..f6b05ef9e 100644 --- a/tdecore/network/khttpproxysocketdevice.h +++ b/tdecore/network/khttpproxysocketdevice.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/knetworkinterface.h b/tdecore/network/knetworkinterface.h index d4eb43f08..8b63dc784 100644 --- a/tdecore/network/knetworkinterface.h +++ b/tdecore/network/knetworkinterface.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/kresolver.cpp b/tdecore/network/kresolver.cpp index 6ec0c5aba..f80b9209e 100644 --- a/tdecore/network/kresolver.cpp +++ b/tdecore/network/kresolver.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003-2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -550,7 +550,7 @@ void KResolver::emitFinished() emit finished(d->results); if (p && d->deleteWhenDone) - deleteLater(); // in QObject + deleteLater(); // in TQObject } TQString KResolver::errorString(int errorcode, int syserror) @@ -591,7 +591,7 @@ KResolverResults KResolver::resolve(const TQString& host, const TQString& service, int flags, int families) { - KResolver qres(host, service, TQT_TQOBJECT(tqApp), "synchronous KResolver"); + KResolver qres(host, service, tqApp, "synchronous KResolver"); qres.setFlags(flags); qres.setFamily(families); qres.start(); @@ -603,8 +603,8 @@ bool KResolver::resolveAsync(TQObject* userObj, const char *userSlot, const TQString& host, const TQString& service, int flags, int families) { - KResolver* qres = new KResolver(host, service, TQT_TQOBJECT(tqApp), "asynchronous KResolver"); - TQObject::connect(qres, TQT_SIGNAL(finished(KResolverResults)), userObj, userSlot); + KResolver* qres = new KResolver(host, service, tqApp, "asynchronous KResolver"); + TQObject::connect(qres, TQ_SIGNAL(finished(KResolverResults)), userObj, userSlot); qres->setFlags(flags); qres->setFamily(families); qres->d->deleteWhenDone = true; // this is the only difference from the example code diff --git a/tdecore/network/kresolver.h b/tdecore/network/kresolver.h index 3de19acd3..51e605704 100644 --- a/tdecore/network/kresolver.h +++ b/tdecore/network/kresolver.h @@ -1,4 +1,4 @@ -/* -*- mode: C++; coding: utf-8; -*- +/* * Copyright (C) 2003,2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -294,7 +294,7 @@ class KResolverPrivate; */ class TDECORE_EXPORT KResolver: public TQObject { - Q_OBJECT + TQ_OBJECT public: @@ -759,7 +759,7 @@ public: * * \code * KResolver* qres = new KResolver(host, service); - * TQObject::connect(qres, TQT_SIGNAL(finished(KResolverResults)), + * TQObject::connect(qres, TQ_SIGNAL(finished(KResolverResults)), * userObj, userSlot); * qres->setFlags(flags); * qres->setFamily(families); @@ -768,7 +768,7 @@ public: * * You should use it like this in your code: * \code - * KResolver::resolveAsync(myObj, TQT_SLOT(mySlot(KResolverResults)), host, service); + * KResolver::resolveAsync(myObj, TQ_SLOT(mySlot(KResolverResults)), host, service); * \endcode * * @param userObj the object whose slot @p userSlot we will connect diff --git a/tdecore/network/kresolver_p.h b/tdecore/network/kresolver_p.h index 9cc139458..896fe536f 100644 --- a/tdecore/network/kresolver_p.h +++ b/tdecore/network/kresolver_p.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003-2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -48,7 +48,6 @@ extern TQMutex getXXbyYYmutex; #endif /* some systems have the functions, but don't declare them */ -#ifndef __OpenBSD__ #if defined(HAVE_GETSERVBYNAME_R) && !HAVE_DECL_GETSERVBYNAME_R extern "C" { struct servent; @@ -70,7 +69,6 @@ extern "C" { struct protoent** result); } #endif -#endif /* decide whether res_init is thread-safe or not */ #if defined(__GLIBC__) @@ -208,7 +206,7 @@ namespace KNetwork KResolverManager(); public: - static KResolverManager* manager() KDE_NO_EXPORT; // creates and returns the global manager + static KResolverManager* manager() TDE_NO_EXPORT; // creates and returns the global manager // destructor ~KResolverManager(); diff --git a/tdecore/network/kresolvermanager.cpp b/tdecore/network/kresolvermanager.cpp index 7801a4295..61f8290e5 100644 --- a/tdecore/network/kresolvermanager.cpp +++ b/tdecore/network/kresolvermanager.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003-2005 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/kresolverstandardworkers.cpp b/tdecore/network/kresolverstandardworkers.cpp index 96519d1aa..ed083f541 100644 --- a/tdecore/network/kresolverstandardworkers.cpp +++ b/tdecore/network/kresolverstandardworkers.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2004 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -45,7 +45,7 @@ #include "kdebug.h" #include "tdeglobal.h" -#include "kstandarddirs.h" +#include "tdestandarddirs.h" #include "tdeapplication.h" #include "kresolver.h" @@ -199,7 +199,7 @@ namespace # elif defined(HAVE_GETHOSTBYNAME_R) && (!defined(AF_INET6) || !defined(HAVE_GETHOSTBYNAME2)) # define USE_GETHOSTBYNAME_R # elif defined(HAVE_GETHOSTBYNAME2) -# define USE_GETHOSTBYNAME2) +# define USE_GETHOSTBYNAME2 # else # define USE_GETHOSTBYNAME # endif diff --git a/tdecore/network/kresolverstandardworkers_p.h b/tdecore/network/kresolverstandardworkers_p.h index 95d21bbc0..92d15892a 100644 --- a/tdecore/network/kresolverstandardworkers_p.h +++ b/tdecore/network/kresolverstandardworkers_p.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -39,7 +39,7 @@ namespace KNetwork { namespace Internal { - extern void initStandardWorkers() KDE_NO_EXPORT; + extern void initStandardWorkers() TDE_NO_EXPORT; /** * @internal diff --git a/tdecore/network/kresolverworkerbase.cpp b/tdecore/network/kresolverworkerbase.cpp index f149e2dda..5f39e4975 100644 --- a/tdecore/network/kresolverworkerbase.cpp +++ b/tdecore/network/kresolverworkerbase.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2004 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/kresolverworkerbase.h b/tdecore/network/kresolverworkerbase.h index e0a676ced..94cb04a84 100644 --- a/tdecore/network/kresolverworkerbase.h +++ b/tdecore/network/kresolverworkerbase.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2004 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/kreverseresolver.cpp b/tdecore/network/kreverseresolver.cpp index fc172c2ff..6dffb1840 100644 --- a/tdecore/network/kreverseresolver.cpp +++ b/tdecore/network/kreverseresolver.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/kreverseresolver.h b/tdecore/network/kreverseresolver.h index 4a3fa4bdd..41dc38e90 100644 --- a/tdecore/network/kreverseresolver.h +++ b/tdecore/network/kreverseresolver.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -49,7 +49,7 @@ class KReverseResolverPrivate; */ class TDECORE_EXPORT KReverseResolver: public TQObject { - Q_OBJECT + TQ_OBJECT public: diff --git a/tdecore/network/kserversocket.cpp b/tdecore/network/kserversocket.cpp index e04d74b08..0cfba8fa5 100644 --- a/tdecore/network/kserversocket.cpp +++ b/tdecore/network/kserversocket.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -61,15 +61,15 @@ public: TDEServerSocket::TDEServerSocket(TQObject* parent, const char *name) : TQObject(parent, name), d(new TDEServerSocketPrivate) { - TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedSlot())); + TQObject::connect(&d->resolver, TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedSlot())); } TDEServerSocket::TDEServerSocket(const TQString& service, TQObject* parent, const char *name) : TQObject(parent, name), d(new TDEServerSocketPrivate) { - TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedSlot())); + TQObject::connect(&d->resolver, TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedSlot())); d->resolver.setServiceName(service); } @@ -77,8 +77,8 @@ TDEServerSocket::TDEServerSocket(const TQString& node, const TQString& service, TQObject* parent, const char* name) : TQObject(parent, name), d(new TDEServerSocketPrivate) { - TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), - this, TQT_SLOT(lookupFinishedSlot())); + TQObject::connect(&d->resolver, TQ_SIGNAL(finished(KResolverResults)), + this, TQ_SLOT(lookupFinishedSlot())); setAddress(node, service); } @@ -403,8 +403,8 @@ bool TDEServerSocket::doListen() } // set up ready accept signal - TQObject::connect(socketDevice()->readNotifier(), TQT_SIGNAL(activated(int)), - this, TQT_SIGNAL(readyAccept())); + TQObject::connect(socketDevice()->readNotifier(), TQ_SIGNAL(activated(int)), + this, TQ_SIGNAL(readyAccept())); d->state = TDEServerSocketPrivate::Listening; return true; } diff --git a/tdecore/network/kserversocket.h b/tdecore/network/kserversocket.h index edb86d0b2..637dc92d0 100644 --- a/tdecore/network/kserversocket.h +++ b/tdecore/network/kserversocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago@kde.org> * * @@ -50,8 +50,8 @@ class TDEServerSocketPrivate; * \code * TQString service = "http"; * TDEServerSocket *ss = new TDEServerSocket(service); - * connect(ss, TQT_SIGNAL(readyAccept()), this, TQT_SLOT(slotReadyAccept())); - * connect(ss, TQT_SIGNAL(gotError(int)), this, TQT_SLOT(slotSocketError(int))); + * connect(ss, TQ_SIGNAL(readyAccept()), this, TQ_SLOT(slotReadyAccept())); + * connect(ss, TQ_SIGNAL(gotError(int)), this, TQ_SLOT(slotSocketError(int))); * ss->listen(); * \endcode * @@ -84,8 +84,8 @@ class TDEServerSocketPrivate; * if( !found ) { * // Couldn't connect to any port. * } else { - * connect(ss, TQT_SIGNAL(readyAccept()), this, TQT_SLOT(slotReadyAccept())); - * connect(ss, TQT_SIGNAL(gotError(int)), this, TQT_SLOT(slotSocketError(int))); + * connect(ss, TQ_SIGNAL(readyAccept()), this, TQ_SLOT(slotReadyAccept())); + * connect(ss, TQ_SIGNAL(gotError(int)), this, TQ_SLOT(slotSocketError(int))); * ss->listen(); * } * \endcode @@ -106,7 +106,7 @@ class TDEServerSocketPrivate; */ class TDECORE_EXPORT TDEServerSocket: public TQObject, public KPassiveSocketBase { - Q_OBJECT + TQ_OBJECT public: /** diff --git a/tdecore/network/ksockssocketdevice.cpp b/tdecore/network/ksockssocketdevice.cpp index 69c674438..f4388251f 100644 --- a/tdecore/network/ksockssocketdevice.cpp +++ b/tdecore/network/ksockssocketdevice.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2004 Thiago Macieira <thiago.macieira@kdemail.net> * * This library is free software; you can redistribute it and/or @@ -214,7 +214,7 @@ static int socks_read_common(int sockfd, char *data, TQ_ULONG maxlen, TDESocketA return 0; } -TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen) +TQ_LONG KSocksSocketDevice::readBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -235,7 +235,7 @@ TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen) return retval; } -TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from) +TQ_LONG KSocksSocketDevice::readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -298,12 +298,12 @@ TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddr return retval; } -TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len) +TQ_LONG KSocksSocketDevice::writeBlock(const char *data, TQ_ULONG len) { - return tqwriteBlock(data, len, TDESocketAddress()); + return writeBlock(data, len, TDESocketAddress()); } -TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) +TQ_LONG KSocksSocketDevice::writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { resetError(); if (m_sockfd == -1) @@ -467,7 +467,7 @@ void KSocksSocketDevice::initSocks() if (init) return; - if (kapp == 0L) + if (tdeApp == 0L) return; // no TDEApplication, so don't initialise // this should, however, test for TDEInstance diff --git a/tdecore/network/ksockssocketdevice.h b/tdecore/network/ksockssocketdevice.h index 2a83c0adc..760038143 100644 --- a/tdecore/network/ksockssocketdevice.h +++ b/tdecore/network/ksockssocketdevice.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2004 Thiago Macieira <thiago.macieira@kdemail.net> * * This library is free software; you can redistribute it and/or @@ -83,8 +83,8 @@ public: /** * Overrides reading. */ - virtual TQ_LONG tqreadBlock(char *data, TQ_ULONG maxlen); - virtual TQ_LONG tqreadBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Overrides peeking. @@ -95,8 +95,8 @@ public: /** * Overrides writing. */ - virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len); - virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Overrides getting socket address. diff --git a/tdecore/network/ksrvresolverworker.cpp b/tdecore/network/ksrvresolverworker.cpp index 419873d4f..732de02a4 100644 --- a/tdecore/network/ksrvresolverworker.cpp +++ b/tdecore/network/ksrvresolverworker.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2005 Thiago Macieira <thiago@kde.org> * * This library is free software; you can redistribute it and/or @@ -226,7 +226,7 @@ bool KSrvResolverWorker::postprocess() void KSrvResolverWorker::customEvent(TQCustomEvent*) { dns = new TQDns(TQString::fromLatin1(encodedName), TQDns::Srv); - TQObject::connect(dns, TQT_SIGNAL(resultsReady()), this, TQT_SLOT(dnsResultsReady())); + TQObject::connect(dns, TQ_SIGNAL(resultsReady()), this, TQ_SLOT(dnsResultsReady())); } void KSrvResolverWorker::dnsResultsReady() @@ -242,7 +242,7 @@ namespace KNetwork namespace Internal { - void initSrvWorker() KDE_NO_EXPORT; + void initSrvWorker() TDE_NO_EXPORT; void initSrvWorker() { if (getenv("TDE_NO_SRV") != NULL) diff --git a/tdecore/network/ksrvresolverworker_p.h b/tdecore/network/ksrvresolverworker_p.h index a9aba3d35..efb4c45f9 100644 --- a/tdecore/network/ksrvresolverworker_p.h +++ b/tdecore/network/ksrvresolverworker_p.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2005 Thiago Macieira <thiago@kde.org> * * This library is free software; you can redistribute it and/or @@ -41,7 +41,7 @@ namespace KNetwork class KSrvResolverWorker: public TQObject, public KNetwork::KResolverWorkerBase { - Q_OBJECT + TQ_OBJECT public: diff --git a/tdecore/network/kstreamsocket.cpp b/tdecore/network/kstreamsocket.cpp index 700f9f53f..a36f8cc78 100644 --- a/tdecore/network/kstreamsocket.cpp +++ b/tdecore/network/kstreamsocket.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -61,7 +61,7 @@ KStreamSocket::KStreamSocket(const TQString& node, const TQString& service, setSocketOptions(socketOptions() & ~Blocking); - TQObject::connect(&d->timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeoutSlot())); + TQObject::connect(&d->timer, TQ_SIGNAL(timeout()), this, TQ_SLOT(timeoutSlot())); } KStreamSocket::~KStreamSocket() @@ -130,7 +130,7 @@ bool KStreamSocket::connect(const TQString& node, const TQString& service) // connection hasn't started yet if (!blocking()) { - QObject::connect(this, TQT_SIGNAL(hostFound()), TQT_SLOT(hostFoundSlot())); + TQObject::connect(this, TQ_SIGNAL(hostFound()), TQ_SLOT(hostFoundSlot())); return lookup(); } @@ -196,10 +196,10 @@ bool KStreamSocket::connect(const KResolverEntry& entry) void KStreamSocket::hostFoundSlot() { - QObject::disconnect(this, TQT_SLOT(hostFoundSlot())); + TQObject::disconnect(this, TQ_SLOT(hostFoundSlot())); if (timeout() > 0) d->timer.start(timeout(), true); - TQTimer::singleShot(0, this, TQT_SLOT(connectionEvent())); + TQTimer::singleShot(0, this, TQ_SLOT(connectionEvent())); } void KStreamSocket::connectionEvent() @@ -267,13 +267,13 @@ void KStreamSocket::connectionEvent() if (socketDevice()->error() == InProgress) { TQSocketNotifier *n = socketDevice()->readNotifier(); - TQObject::connect(n, TQT_SIGNAL(activated(int)), - this, TQT_SLOT(connectionEvent())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), + this, TQ_SLOT(connectionEvent())); n->setEnabled(true); n = socketDevice()->writeNotifier(); - TQObject::connect(n, TQT_SIGNAL(activated(int)), - this, TQT_SLOT(connectionEvent())); + TQObject::connect(n, TQ_SIGNAL(activated(int)), + this, TQ_SLOT(connectionEvent())); n->setEnabled(true); return; // wait for activity @@ -350,8 +350,8 @@ bool KStreamSocket::bindLocallyFor(const KResolverEntry& peer) void KStreamSocket::connectionSucceeded(const KResolverEntry& peer) { - TQObject::disconnect(socketDevice()->readNotifier(), 0, this, TQT_SLOT(connectionEvent())); - TQObject::disconnect(socketDevice()->writeNotifier(), 0, this, TQT_SLOT(connectionEvent())); + TQObject::disconnect(socketDevice()->readNotifier(), 0, this, TQ_SLOT(connectionEvent())); + TQObject::disconnect(socketDevice()->writeNotifier(), 0, this, TQ_SLOT(connectionEvent())); resetError(); setFlags(IO_Sequential | IO_Raw | IO_ReadWrite | IO_Open | IO_Async); diff --git a/tdecore/network/kstreamsocket.h b/tdecore/network/kstreamsocket.h index c1f9e5848..a7557d585 100644 --- a/tdecore/network/kstreamsocket.h +++ b/tdecore/network/kstreamsocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago@kde.org> * * @@ -70,14 +70,14 @@ class KStreamSocketPrivate; * : socket(hostname, port) * { * // connect signals to our slots - * TQObject::connect(&socket, TQT_SIGNAL(connected(const KResolverEntry&)), - * this, TQT_SLOT(slotSocketConnected())); - * TQObject::connect(&socket, TQT_SIGNAL(gotError(int)), - * this, TQT_SLOT(slotSocketError(int))); - * TQObject::connect(&socket, TQT_SIGNAL(readyRead()), - * this, TQT_SLOT(slotSocketReadyToRead())); - * TQObject::connect(&socket, TQT_SIGNAL(readyWrite()), - * this, TQT_SLOT(slotSocketReadyToWrite())); + * TQObject::connect(&socket, TQ_SIGNAL(connected(const KResolverEntry&)), + * this, TQ_SLOT(slotSocketConnected())); + * TQObject::connect(&socket, TQ_SIGNAL(gotError(int)), + * this, TQ_SLOT(slotSocketError(int))); + * TQObject::connect(&socket, TQ_SIGNAL(readyRead()), + * this, TQ_SLOT(slotSocketReadyToRead())); + * TQObject::connect(&socket, TQ_SIGNAL(readyWrite()), + * this, TQ_SLOT(slotSocketReadyToWrite())); * * // set non-blocking mode in order to work asynchronously * socket.setBlocking(false); @@ -96,7 +96,7 @@ class KStreamSocketPrivate; */ class TDECORE_EXPORT KStreamSocket: public KClientSocketBase { - Q_OBJECT + TQ_OBJECT public: diff --git a/tdecore/network/syssocket.h b/tdecore/network/syssocket.h index 03e069940..d26cb085b 100644 --- a/tdecore/network/syssocket.h +++ b/tdecore/network/syssocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdeiobuffer.h b/tdecore/network/tdeiobuffer.h index 394af5b7b..cd8c75b86 100644 --- a/tdecore/network/tdeiobuffer.h +++ b/tdecore/network/tdeiobuffer.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdemulticastsocket.h b/tdecore/network/tdemulticastsocket.h index 09eeb01cd..a5345315a 100644 --- a/tdecore/network/tdemulticastsocket.h +++ b/tdecore/network/tdemulticastsocket.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdemulticastsocketdevice.h b/tdecore/network/tdemulticastsocketdevice.h index 99511b356..a87c7fc98 100644 --- a/tdecore/network/tdemulticastsocketdevice.h +++ b/tdecore/network/tdemulticastsocketdevice.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdesocketaddress.cpp b/tdecore/network/tdesocketaddress.cpp index a6da5f7c0..36adaa631 100644 --- a/tdecore/network/tdesocketaddress.cpp +++ b/tdecore/network/tdesocketaddress.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -191,17 +191,19 @@ TQString KIpAddress::toString() const char buf[sizeof "1111:2222:3333:4444:5555:6666:255.255.255.255" + 2]; buf[0] = '\0'; switch (m_version) - { + { case 4: inet_ntop(AF_INET, m_data, buf, sizeof(buf) - 1); return TQString::fromLatin1(buf); case 6: + { #ifdef AF_INET6 inet_ntop(AF_INET6, m_data, buf, sizeof(buf) - 1); #endif return TQString::fromLatin1(buf); } + } return TQString::null; } @@ -294,11 +296,15 @@ public: switch (addr.generic->sa_family) { case AF_INET: + { return; // nothing to do here + } #ifdef AF_INET6 case AF_INET6: + { oldport = addr.in6->sin6_port; break; + } #endif } @@ -319,12 +325,16 @@ public: switch (addr.generic->sa_family) { case AF_INET: + { oldport = addr.in->sin_port; break; + } #ifdef AF_INET6 case AF_INET6: + { return; // nothing to do here + } #endif } @@ -517,12 +527,15 @@ bool TDESocketAddress::operator ==(const TDESocketAddress& other) const switch (d->addr.generic->sa_family) { case AF_INET: + { Q_ASSERT(d->reallen == SOCKADDR_IN_LEN); Q_ASSERT(other.d->reallen == SOCKADDR_IN_LEN); return memcmp(d->addr.in, other.d->addr.in, SOCKADDR_IN_LEN) == 0; + } #ifdef AF_INET6 case AF_INET6: + { Q_ASSERT(d->reallen >= MIN_SOCKADDR_IN6_LEN); Q_ASSERT(other.d->reallen >= MIN_SOCKADDR_IN6_LEN); @@ -540,6 +553,7 @@ bool TDESocketAddress::operator ==(const TDESocketAddress& other) const # endif return memcmp(d->addr.in6, other.d->addr.in6, d->reallen) == 0; + } #endif case AF_UNIX: @@ -566,10 +580,11 @@ TQString TDESocketAddress::nodeName() const switch (d->addr.generic->sa_family) { - case AF_INET: #ifdef AF_INET6 case AF_INET6: - +#endif + case AF_INET: +#ifdef AF_INET6 TQString scopeid("%"); if (d->addr.generic->sa_family == AF_INET6 && d->addr.in6->sin6_scope_id) scopeid += TQString::number(d->addr.in6->sin6_scope_id); @@ -592,10 +607,10 @@ TQString TDESocketAddress::serviceName() const switch (d->addr.generic->sa_family) { - case AF_INET: #ifdef AF_INET6 case AF_INET6: #endif + case AF_INET: return TQString::number(d->ref.port()); case AF_UNIX: @@ -652,11 +667,15 @@ int TDESocketAddress::ianaFamily(int af) switch (af) { case AF_INET: + { return 1; + } #ifdef AF_INET6 case AF_INET6: + { return 2; + } #endif default: @@ -669,11 +688,15 @@ int TDESocketAddress::fromIanaFamily(int iana) switch (iana) { case 1: + { return AF_INET; + } #ifdef AF_INET6 case 2: + { return AF_INET6; + } #endif default: @@ -743,11 +766,15 @@ int KInetSocketAddress::ipVersion() const switch (d->addr.generic->sa_family) { case AF_INET: + { return 4; + } #ifdef AF_INET6 case AF_INET6: + { return 6; + } #endif } @@ -762,10 +789,14 @@ KIpAddress KInetSocketAddress::ipAddress() const switch (d->addr.generic->sa_family) { case AF_INET: + { return KIpAddress(&d->addr.in->sin_addr, 4); + } #ifdef AF_INET6 case AF_INET6: + { return KIpAddress(&d->addr.in6->sin6_addr, 6); + } #endif } @@ -803,11 +834,15 @@ TQ_UINT16 KInetSocketAddress::port() const switch (d->addr.generic->sa_family) { case AF_INET: + { return ntohs(d->addr.in->sin_port); + } #ifdef AF_INET6 case AF_INET6: + { return ntohs(d->addr.in6->sin6_port); + } #endif } @@ -822,13 +857,17 @@ KInetSocketAddress& KInetSocketAddress::setPort(TQ_UINT16 port) switch (d->addr.generic->sa_family) { case AF_INET: + { d->addr.in->sin_port = htons(port); break; + } #ifdef AF_INET6 case AF_INET6: + { d->addr.in6->sin6_port = htons(port); break; + } #endif default: diff --git a/tdecore/network/tdesocketaddress.h b/tdecore/network/tdesocketaddress.h index 100e05fb2..7aa9a6d20 100644 --- a/tdecore/network/tdesocketaddress.h +++ b/tdecore/network/tdesocketaddress.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdesocketbase.cpp b/tdecore/network/tdesocketbase.cpp index 66decb15d..0b2ef90d7 100644 --- a/tdecore/network/tdesocketbase.cpp +++ b/tdecore/network/tdesocketbase.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003-2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -291,7 +291,7 @@ KActiveSocketBase::~KActiveSocketBase() int KActiveSocketBase::getch() { unsigned char c; - if (tqreadBlock((char*)&c, 1) != 1) + if (readBlock((char*)&c, 1) != 1) return -1; return c; @@ -300,7 +300,7 @@ int KActiveSocketBase::getch() int KActiveSocketBase::putch(int ch) { unsigned char c = (unsigned char)ch; - if (tqwriteBlock((char*)&c, 1) != 1) + if (writeBlock((char*)&c, 1) != 1) return -1; return c; diff --git a/tdecore/network/tdesocketbase.h b/tdecore/network/tdesocketbase.h index bd0828408..d2a213300 100644 --- a/tdecore/network/tdesocketbase.h +++ b/tdecore/network/tdesocketbase.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -63,10 +63,10 @@ #include <tdelibs_export.h> /* - * This is extending QIODevice's error codes + * This is extending TQIODevice's error codes * * According to tqiodevice.h, the last error is IO_UnspecifiedError - * These errors will never occur in functions declared in QIODevice + * These errors will never occur in functions declared in TQIODevice * (except open, but you shouldn't call open) */ #define IO_ListenError (IO_UnspecifiedError+1) @@ -504,11 +504,7 @@ public: * This call is not supported on sockets. Reimplemented from TQIODevice. * This will always return 0. */ -#ifdef USE_QT4 - virtual qint64 size() const -#else // USE_QT4 virtual Offset size() const -#endif // USE_QT4 { return 0; } /** @@ -536,12 +532,7 @@ public: * Returns the number of bytes available for reading without * blocking. */ -#ifdef USE_QT3 virtual TQ_LONG bytesAvailable() const = 0; -#endif -#ifdef USE_QT4 - virtual qint64 bytesAvailable() const = 0; -#endif /** * Waits up to @p msecs for more data to be available on this socket. @@ -562,7 +553,7 @@ public: * Reimplemented from TQIODevice. See TQIODevice::readBlock for * more information. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG len) = 0; + virtual TQ_LONG readBlock(char *data, TQ_ULONG len) = 0; /** @overload * Receives data and the source address. @@ -575,7 +566,7 @@ public: * @param from the address of the sender will be stored here * @returns the actual number of bytes read */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) = 0; + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) = 0; /** * Peeks the data in the socket. @@ -610,7 +601,7 @@ public: * Reimplemented from TQIODevice. See TQIODevice::writeBlock for * more information. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len) = 0; + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len) = 0; /** @overload * Writes the given data to the destination address. @@ -623,7 +614,7 @@ public: * @param to the address to send to * @returns the number of bytes actually sent */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) = 0; + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) = 0; /** * Reads one character from the socket. diff --git a/tdecore/network/tdesocketbuffer.cpp b/tdecore/network/tdesocketbuffer.cpp index 13c7c0447..36e64e0f0 100644 --- a/tdecore/network/tdesocketbuffer.cpp +++ b/tdecore/network/tdesocketbuffer.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -274,7 +274,7 @@ TQ_LONG TDESocketBuffer::sendTo(KActiveSocketBase* dev, TQ_LONG len) } // now try to write those bytes - TQ_LONG wrote = dev->tqwriteBlock(buf, count); + TQ_LONG wrote = dev->writeBlock(buf, count); if (wrote == -1) // error? @@ -315,7 +315,7 @@ TQ_LONG TDESocketBuffer::receiveFrom(KActiveSocketBase* dev, TQ_LONG len) // now do the reading TQByteArray a(len); - len = dev->tqreadBlock(a.data(), len); + len = dev->readBlock(a.data(), len); if (len == -1) // error? diff --git a/tdecore/network/tdesocketbuffer_p.h b/tdecore/network/tdesocketbuffer_p.h index 2f8e4fa75..561629935 100644 --- a/tdecore/network/tdesocketbuffer_p.h +++ b/tdecore/network/tdesocketbuffer_p.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * diff --git a/tdecore/network/tdesocketdevice.cpp b/tdecore/network/tdesocketdevice.cpp index b97ad0ba0..b5aef0943 100644 --- a/tdecore/network/tdesocketdevice.cpp +++ b/tdecore/network/tdesocketdevice.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003,2005 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -171,7 +171,7 @@ bool TDESocketDevice::setSocketOptions(int opts) return true; // all went well } -bool TDESocketDevice::open(TQ_OpenMode) +bool TDESocketDevice::open(int) { resetError(); return false; @@ -364,12 +364,7 @@ bool TDESocketDevice::disconnect() return true; // all is well } -#ifdef USE_QT3 TQ_LONG TDESocketDevice::bytesAvailable() const -#endif -#ifdef USE_QT4 -qint64 TDESocketDevice::bytesAvailable() const -#endif { if (m_sockfd == -1) return -1; // there's nothing to read in a closed socket @@ -419,7 +414,7 @@ static int do_read_common(int sockfd, char *data, TQ_ULONG maxlen, TDESocketAddr return 0; } -TQT_TQIO_LONG TDESocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) +TQ_LONG TDESocketDevice::readBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -440,7 +435,7 @@ TQT_TQIO_LONG TDESocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) return retval; } -TQT_TQIO_LONG TDESocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress &from) +TQ_LONG TDESocketDevice::readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -503,12 +498,12 @@ TQ_LONG TDESocketDevice::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress return retval; } -TQT_TQIO_LONG TDESocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len) +TQ_LONG TDESocketDevice::writeBlock(const char *data, TQ_ULONG len) { - return tqwriteBlock(data, len, TDESocketAddress()); + return writeBlock(data, len, TDESocketAddress()); } -TQT_TQIO_LONG TDESocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) +TQ_LONG TDESocketDevice::writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { resetError(); if (m_sockfd == -1) diff --git a/tdecore/network/tdesocketdevice.h b/tdecore/network/tdesocketdevice.h index 52fe18709..2196e9d3f 100644 --- a/tdecore/network/tdesocketdevice.h +++ b/tdecore/network/tdesocketdevice.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- +/* * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net> * * @@ -142,7 +142,7 @@ public: /** * Reimplementation from TQIODevice. You should not call this function in sockets. */ - virtual bool open(TQ_OpenMode mode); + virtual bool open(int mode); /** * Closes the socket. Reimplemented from TQIODevice. @@ -198,12 +198,7 @@ public: /** * Returns the number of bytes available for reading without blocking. */ -#ifdef USE_QT3 virtual TQ_LONG bytesAvailable() const; -#endif -#ifdef USE_QT4 - virtual qint64 bytesAvailable() const; -#endif /** * Waits up to @p msecs for more data to be available on this socket. @@ -216,12 +211,12 @@ public: /** * Reads data from this socket. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen); /** * Reads data and the source address from this socket. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); + virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Peeks data in the socket. @@ -236,12 +231,12 @@ public: /** * Writes data to the socket. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len); /** * Writes the given data to the given destination address. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); + virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Returns this socket's local address. |
