diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qftp.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessbackend.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qnetworkdiskcache.cpp | 6 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_win.cpp | 33 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinterface_win.cpp | 21 |
5 files changed, 28 insertions, 40 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 50a3b1e..eccfea6 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1851,11 +1851,11 @@ int QFtp::cd(const QString &dir) int QFtp::get(const QString &file, QIODevice *dev, TransferType type) { QStringList cmds; - cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n"); if (type == Binary) cmds << QLatin1String("TYPE I\r\n"); else cmds << QLatin1String("TYPE A\r\n"); + cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n"); cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n"); cmds << QLatin1String("RETR ") + file + QLatin1String("\r\n"); return d_func()->addCommand(new QFtpCommand(Get, cmds, dev)); @@ -2336,7 +2336,7 @@ void QFtpPrivate::_q_piError(int errorCode, const QString &text) // non-fatal errors if (c->command == QFtp::Get && pi.currentCommand().startsWith(QLatin1String("SIZE "))) { - pi.dtp.setBytesTotal(-1); + pi.dtp.setBytesTotal(0); return; } else if (c->command==QFtp::Put && pi.currentCommand().startsWith(QLatin1String("ALLO "))) { return; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 88c45d1..1dc1268 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -72,10 +72,10 @@ public: QMutex mutex; //this is used to avoid (re)constructing factory data from destructors of other global classes - static QAtomicInt valid; + static QBasicAtomicInt valid; }; Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData) -QAtomicInt QNetworkAccessBackendFactoryData::valid; +QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0); QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() { diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 1c515c2..a567c2d 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -429,7 +429,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) // ### verify that QFile uses the fd size and not the file name qint64 size = file->size() - file->pos(); const uchar *p = 0; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_SYMBIAN) p = file->map(file->pos(), size); #endif if (p) { @@ -478,7 +478,7 @@ void QNetworkDiskCache::updateMetaData(const QNetworkCacheMetaData &metaData) } /*! - Returns the current maximum size for the disk cache. + Returns the current maximum size in bytes for the disk cache. \sa setMaximumCacheSize() */ @@ -489,7 +489,7 @@ qint64 QNetworkDiskCache::maximumCacheSize() const } /*! - Sets the maximum size of the disk cache to be \a size. + Sets the maximum size of the disk cache to be \a size in bytes. If the new size is smaller then the current cache size then the cache will call expire(). diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 1052863..58a5bee 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -45,9 +45,7 @@ #include "private/qnativesocketengine_p.h" #include <ws2tcpip.h> #include <private/qsystemlibrary_p.h> -#include <qmutex.h> #include <qurl.h> -#include <private/qmutexpool_p.h> QT_BEGIN_NAMESPACE @@ -84,15 +82,22 @@ static void resolveLibrary() { // Attempt to resolve getaddrinfo(); without it we'll have to fall // back to gethostbyname(), which has no IPv6 support. + static bool triedResolve = false; + if (triedResolve) + return; + #if !defined(Q_OS_WINCE) - local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo"); + QSystemLibrary ws2lib(QLatin1String("ws2_32")); #else - local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo"); + QSystemLibrary ws2lib(QLatin1String("ws2")); #endif + if (ws2lib.load()) { + local_getaddrinfo = (getaddrinfoProto)ws2lib.resolve("getaddrinfo"); + local_freeaddrinfo = (freeaddrinfoProto)ws2lib.resolve("freeaddrinfo"); + local_getnameinfo = (getnameinfoProto)ws2lib.resolve("getnameinfo"); + } + + triedResolve = true; } #if defined(Q_OS_WINCE) @@ -102,22 +107,14 @@ Q_GLOBAL_STATIC(QMutex, qPrivCEMutex) QHostInfo QHostInfoAgent::fromName(const QString &hostName) { + resolveLibrary(); + #if defined(Q_OS_WINCE) QMutexLocker locker(qPrivCEMutex()); #endif QWindowsSockInit winSock; - // Load res_init on demand. - static volatile bool triedResolve = false; - if (!triedResolve) { - QMutexLocker locker(QMutexPool::globalInstanceGet(&local_getaddrinfo)); - if (!triedResolve) { - resolveLibrary(); - triedResolve = true; - } - } - QHostInfo results; #if defined(QHOSTINFO_DEBUG) diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index e8b96f6..a624468 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -63,23 +63,14 @@ static void resolveLibs() { // try to find the functions we need from Iphlpapi.dll static bool done = false; - if (!done) { + QSystemLibrary iphlpapi(QLatin1String("iphlpapi")); + if (iphlpapi.load()) { + ptrGetAdaptersInfo = (PtrGetAdaptersInfo)iphlpapi.resolve("GetAdaptersInfo"); + ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)iphlpapi.resolve("GetAdaptersAddresses"); + ptrGetNetworkParams = (PtrGetNetworkParams)iphlpapi.resolve("GetNetworkParams"); + } done = true; - - HINSTANCE iphlpapiHnd = QSystemLibrary::load(L"iphlpapi"); - if (iphlpapiHnd == NULL) - return; - -#if defined(Q_OS_WINCE) - ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, L"GetAdaptersInfo"); - ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, L"GetAdaptersAddresses"); - ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, L"GetNetworkParams"); -#else - ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, "GetAdaptersInfo"); - ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, "GetAdaptersAddresses"); - ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, "GetNetworkParams"); -#endif } } |