diff options
author | David Boddie <david.boddie@nokia.com> | 2010-12-07 13:57:38 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-12-07 13:57:38 (GMT) |
commit | d8fb8ca3a378743eebb8464f7910a5e6d1870c01 (patch) | |
tree | 9c31a017163a532946f10107b8d9f4405ed1c9db /src/corelib | |
parent | b5915ef3a6d0417440ad82e9369d6679505b953e (diff) | |
parent | 076bba6c901e292b61fffb7a91020075dcd84919 (diff) | |
download | Qt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.zip Qt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.tar.gz Qt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.tar.bz2 |
Merge branch 'qdoc-simplified' into mimir-simplified
Conflicts:
doc/src/platforms/compiler-notes.qdoc
tools/qdoc3/ditaxmlgenerator.cpp
tools/qdoc3/ditaxmlgenerator.h
tools/qdoc3/htmlgenerator.cpp
tools/qdoc3/htmlgenerator.h
tools/qdoc3/node.cpp
tools/qdoc3/pagegenerator.h
Diffstat (limited to 'src/corelib')
37 files changed, 323 insertions, 241 deletions
diff --git a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp index 39d966a..444d3d3 100644 --- a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp +++ b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** This file implements the generic atomics interface using ARMv6 assembly -** instructions. It is more efficent than the inline versions when Qt is +** instructions. It is more efficient than the inline versions when Qt is ** built for the THUMB instruction set, as the required instructions are ** only available in ARM state. ****************************************************************************/ diff --git a/src/corelib/arch/symbian/heap_hybrid.cpp b/src/corelib/arch/symbian/heap_hybrid.cpp index 91faaed..5d2b2b6 100644 --- a/src/corelib/arch/symbian/heap_hybrid.cpp +++ b/src/corelib/arch/symbian/heap_hybrid.cpp @@ -134,7 +134,7 @@ The constant can be changed at ROM build time using patchdata OBY keyword. @deprecated Patching this constant no longer has any effect. */ -#ifdef __X86GCC__ // For X86GCC we dont use the proper data import attribute +#ifdef __X86GCC__ // For X86GCC we don't use the proper data import attribute #undef IMPORT_D // since the constants are not really imported. GCC doesn't #define IMPORT_D // allow imports from self. #endif @@ -451,7 +451,7 @@ TInt RHybridHeap::ConstructLock(TUint32 aMode) void RHybridHeap::Init(TInt aBitmapSlab, TInt aPagePower) { - /*Moved code which does initilization */ + /*Moved code which does initialization */ iTop = (TUint8*)this + iMinLength; iBase = Ceiling(iBase, ECellAlignment); // Align iBase address @@ -874,7 +874,7 @@ available in the largest free block. Note that this function exists mainly for compatibility reasons. In a modern heap implementation such as that present in Symbian it is not appropriate to concern oneself with details such as the amount of free memory available on a -heap and its largeset free block, because the way that a modern heap implmentation +heap and its largeset free block, because the way that a modern heap implementation works is not simple. The amount of available virtual memory != physical memory and there are multiple allocation strategies used internally, which makes all memory usage figures "fuzzy" at best. @@ -1616,7 +1616,7 @@ void* RHybridHeap::DlMalloc(size_t bytes) void RHybridHeap::DlFree(void* mem) { /* - Consolidate freed chunks with preceeding or succeeding bordering + Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for iTop, iDv, mmapped chunks, and usage errors. */ diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f747bf7..031baa3 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -195,7 +195,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte // utf-8 bom composes into 0xfeff code point bool nonCharacter; if (!headerdone && uc == 0xfeff) { - // dont do anything, just skip the BOM + // don't do anything, just skip the BOM } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && uc > 0xffff && uc < 0x110000) { // surrogate pair Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length()); diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index b7d6034..a001940 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -37,10 +37,3 @@ symbian: { MMP_RULES -= PAGED MMP_RULES *= UNPAGED } - -neon { - DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon -} - - diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 4800716..86800ef 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -27,3 +27,5 @@ linux*:!static:!linux-armcc:!linux-gcce { # Compensate for lack of platform defines in Symbian3 and Symbian4 symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) + +include(../../../tools/shared/symbian/epocroot.pri) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 35607d5..b148a1d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include <stddef.h> -#define QT_VERSION_STR "4.7.1" +#define QT_VERSION_STR "4.7.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040701 +#define QT_VERSION 0x040702 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 957abbf..898b860 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -62,6 +62,10 @@ QT_END_NAMESPACE # include "private/qcore_mac_p.h" #endif +#ifdef QLIBRARYINFO_EPOCROOT +# include "symbian/epocroot_p.h" +#endif + #include "qconfig.cpp" QT_BEGIN_NAMESPACE @@ -433,6 +437,14 @@ QLibraryInfo::location(LibraryLocation loc) QString::fromLocal8Bit(qgetenv(ret.mid(rep + 2, reg_var.matchedLength() - 3).toLatin1().constData()).constData())); } + +#ifdef QLIBRARYINFO_EPOCROOT + // $${EPOCROOT} is a special case, resolve it similarly to qmake. + QRegExp epocrootMatcher(QLatin1String("\\$\\$\\{EPOCROOT\\}")); + if ((rep = epocrootMatcher.indexIn(ret)) != -1) + ret.replace(rep, epocrootMatcher.matchedLength(), qt_epocRoot()); +#endif + config->endGroup(); } } diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index 090998c..028a0a5 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -90,8 +90,6 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align return newptr + 1; } - union { void *ptr; void **pptr; quintptr n; } real, faked; - // qMalloc returns pointers aligned at least at sizeof(size_t) boundaries // but usually more (8- or 16-byte boundaries). // So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a @@ -100,19 +98,21 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align // However, we need to store the actual pointer, so we need to allocate actually size + // alignment anyway. - real.ptr = qRealloc(actualptr, newsize + alignment); - if (!real.ptr) + void *real = qRealloc(actualptr, newsize + alignment); + if (!real) return 0; - faked.n = real.n + alignment; - faked.n &= ~(alignment - 1); + quintptr faked = reinterpret_cast<quintptr>(real) + alignment; + faked &= ~(alignment - 1); + + void **faked_ptr = reinterpret_cast<void **>(faked); // now save the value of the real pointer at faked-sizeof(void*) // by construction, alignment > sizeof(void*) and is a power of 2, so // faked-sizeof(void*) is properly aligned for a pointer - faked.pptr[-1] = real.ptr; + faked_ptr[-1] = real; - return faked.ptr; + return faked_ptr; } void qFreeAligned(void *ptr) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 1c41eca..6b1aa17 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -470,9 +470,9 @@ text; otherwise this width is excluded. \value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces \value TextJustificationForced Ensures that text lines are justified. - \value TextLongestVariant Ensures that the longest variant is always used - when computing the size of a multi-variant string. + \omitvalue TextLongestVariant Ensures that the longest variant is always used + when computing the size of a multi-variant string. (Internal) \omitvalue TextBypassShaping \omitvalue BreakAnywhere \omitvalue DontClip @@ -511,11 +511,11 @@ delivery at a later time. \value AutoConnection - (default) If the object sending the signal is in a different thread - than the receiving object, the signal is queued, behaving as - Qt::QueuedConnection. If both objects are in the same thread, - the slot is invoked directly, behaving as Qt::DirectConnection. The - type of connection is determined when the signal is emitted. + (default) If the signal is emitted from a different thread than the + receiving object, the signal is queued, behaving as + Qt::QueuedConnection. Otherwise, the slot is invoked directly, + behaving as Qt::DirectConnection. The type of connection is + determined when the signal is emitted. \value DirectConnection The slot is invoked immediately, when the signal is diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index fd4b9c1..dbb333f 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -389,9 +389,6 @@ QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags) \note To list symlinks that point to non existing files, QDir::System must be passed to the flags. - \warning This constructor expects \a flags to be left at its default value. Use - the constructors that do not take the \a filters argument instead. - \sa hasNext(), next(), IteratorFlags */ QDirIterator::QDirIterator(const QString &path, QDir::Filters filters, IteratorFlags flags) @@ -429,9 +426,6 @@ QDirIterator::QDirIterator(const QString &path, IteratorFlags flags) \note To list symlinks that point to non existing files, QDir::System must be passed to the flags. - \warning This constructor expects \c flags to be left at its default value. Use the - constructors that do not take the \a filters argument instead. - \sa hasNext(), next(), IteratorFlags */ QDirIterator::QDirIterator(const QString &path, const QStringList &nameFilters, diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 18c3c9f..1e6dcee 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -228,8 +228,14 @@ void QPollingFileSystemWatcherEngine::timeout() dit.remove(); emit directoryChanged(path, true); } else if (x.value() != fi) { - x.value() = fi; - emit directoryChanged(path, false); + fi.refresh(); + if (!fi.exists()) { + dit.remove(); + emit directoryChanged(path, true); + } else { + x.value() = fi; + emit directoryChanged(path, false); + } } } diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 378ad20..3664396 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -117,67 +117,77 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - QStringList p = paths; - QMutableListIterator<QString> it(p); - while (it.hasNext()) { - QString path = it.next(); - int fd; + { + QMutexLocker locker(&mutex); + + QMutableListIterator<QString> it(p); + while (it.hasNext()) { + QString path = it.next(); + int fd; #if defined(O_EVTONLY) - fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); + fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); #else - fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); + fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); #endif - if (fd == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: open"); - continue; - } + if (fd == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: open"); + continue; + } + if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) { + int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE); + if (fddup != -1) { + ::close(fd); + fd = fddup; + } + } + fcntl(fd, F_SETFD, FD_CLOEXEC); - QT_STATBUF st; - if (QT_FSTAT(fd, &st) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); - ::close(fd); - continue; - } - int id = (S_ISDIR(st.st_mode)) ? -fd : fd; - if (id < 0) { - if (directories->contains(path)) { + QT_STATBUF st; + if (QT_FSTAT(fd, &st) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); ::close(fd); continue; } - } else { - if (files->contains(path)) { + int id = (S_ISDIR(st.st_mode)) ? -fd : fd; + if (id < 0) { + if (directories->contains(path)) { + ::close(fd); + continue; + } + } else { + if (files->contains(path)) { + ::close(fd); + continue; + } + } + + struct kevent kev; + EV_SET(&kev, + fd, + EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_CLEAR, + NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, + 0, + 0); + if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); ::close(fd); continue; } - } - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); - ::close(fd); - continue; - } + it.remove(); + if (id < 0) { + DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; + directories->append(path); + } else { + DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; + files->append(path); + } - it.remove(); - if (id < 0) { - DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; - directories->append(path); - } else { - DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; - files->append(path); + pathToID.insert(path, id); + idToPath.insert(id, path); } - - pathToID.insert(path, id); - idToPath.insert(id, path); } if (!isRunning()) @@ -192,43 +202,35 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - + bool isEmpty; QStringList p = paths; - QMutableListIterator<QString> it(p); - while (it.hasNext()) { - QString path = it.next(); - int id = pathToID.take(path); - QString x = idToPath.take(id); - if (x.isEmpty() || x != path) - continue; - - int fd = id < 0 ? -id : id; - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_DELETE, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::removeWatch: kevent"); - } - ::close(fd); + { + QMutexLocker locker(&mutex); + if (pathToID.isEmpty()) + return p; + + QMutableListIterator<QString> it(p); + while (it.hasNext()) { + QString path = it.next(); + int id = pathToID.take(path); + QString x = idToPath.take(id); + if (x.isEmpty() || x != path) + continue; - it.remove(); - if (id < 0) - directories->removeAll(path); - else - files->removeAll(path); + ::close(id < 0 ? -id : id); + + it.remove(); + if (id < 0) + directories->removeAll(path); + else + files->removeAll(path); + } + isEmpty = pathToID.isEmpty(); } - if (pathToID.isEmpty()) { + if (isEmpty) { stop(); - locker.unlock(); wait(); - locker.relock(); } else { write(kqpipe[1], "@", 1); } @@ -243,19 +245,15 @@ void QKqueueFileSystemWatcherEngine::stop() void QKqueueFileSystemWatcherEngine::run() { - static const struct timespec ZeroTimeout = { 0, 0 }; - forever { + int r; struct kevent kev; DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents..."; - int r = kevent(kqfd, 0, 0, &kev, 1, 0); + EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0)); if (r < 0) { perror("QKqueueFileSystemWatcherEngine: error during kevent wait"); return; - } - - QMutexLocker locker(&mutex); - do { + } else { int fd = kev.ident; DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter; @@ -287,6 +285,8 @@ void QKqueueFileSystemWatcherEngine::run() break; } } else { + QMutexLocker locker(&mutex); + int id = fd; QString path = idToPath.value(id); if (path.isEmpty()) { @@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - goto process_next_event; + continue; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - goto process_next_event; + continue; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -315,31 +315,15 @@ void QKqueueFileSystemWatcherEngine::run() else emit fileChanged(path, true); } else { - DEBUG() << path << "changed, re-enabling watch"; + DEBUG() << path << "changed"; if (id < 0) emit directoryChanged(path, false); else emit fileChanged(path, false); - - // renable the watch - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD"); - } } } - - // are there any more? -process_next_event: - r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); - } while (r > 0); + } } } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index d83f7ee..69e9219 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -695,7 +695,7 @@ bool QFSFileEnginePrivate::doStat() const } else if (fd == -1) { // ### actually covers two cases: d->fh and when the file is not open #if defined(Q_OS_SYMBIAN) - // Optimisation for Symbian where fileFlags() calls both doStat() and isSymlink(), but rarely on real links. + // Optimization for Symbian where fileFlags() calls both doStat() and isSymlink(), but rarely on real links. // When the filename is not a link, lstat will return the same info as stat, but this also removes // any need for a further call to lstat to check if the file is a link. need_lstat = false; diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 26e587d..68fb2bf 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -395,7 +395,10 @@ QIODevice::QIODevice(QIODevicePrivate &dd, QObject *parent) /*! - Destructs the QIODevice object. + The destructor is virtual, and QIODevice is an abstract base + class. This destructor does not call close(), but the subclass + destructor might. If you are in doubt, call close() before + destroying the QIODevice. */ QIODevice::~QIODevice() { diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index 1dd51ea..8b77da5 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE #define QIODEVICE_BUFFERSIZE Q_INT64_C(16384) #endif -// This is QIODevice's read buffer, optimised for read(), isEmpty() and getChar() +// This is QIODevice's read buffer, optimized for read(), isEmpty() and getChar() class QIODevicePrivateLinearBuffer { public: diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index 003e781..5b283a5 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -1050,6 +1050,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a newProc->Resume(); newProc->Close(); + delete newProc; return true; } diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index edd6d2b..e6c5fb9 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -88,6 +88,12 @@ #define CSIDL_APPDATA 0x001a // <username>\Application Data #endif +#ifdef Q_AUTOTEST_EXPORT +# define Q_AUTOTEST_EXPORT_HELPER Q_AUTOTEST_EXPORT +#else +# define Q_AUTOTEST_EXPORT_HELPER static +#endif + // ************************************************************************ // QConfFile @@ -134,7 +140,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include <sys/mount.h> QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool qIsLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -160,7 +166,7 @@ QT_END_INCLUDE_NAMESPACE # define AUTOFSNG_SUPER_MAGIC 0x7d92b1a0 # endif -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool qIsLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -177,7 +183,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include <sys/statvfs.h> QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool qIsLikelyToBeNfs(int handle) { struct statvfs buf; if (fstatvfs(handle, &buf) != 0) @@ -189,7 +195,7 @@ static bool isLikelyToBeNfs(int handle) #endif } #else -static inline bool isLikelyToBeNfs(int /* handle */) +Q_AUTOTEST_EXPORT_HELPER inline bool qIsLikelyToBeNfs(int /* handle */) { return true; } @@ -203,7 +209,7 @@ static bool unixLock(int handle, int lockType) now is to disable locking when we detect NFS (or AutoFS or CacheFS, which are probably wrapping NFS). */ - if (isLikelyToBeNfs(handle)) + if (qIsLikelyToBeNfs(handle)) return false; struct flock fl; @@ -1231,16 +1237,21 @@ QConfFileSettingsPrivate::~QConfFileSettingsPrivate() if (confFiles[i] && !confFiles[i]->ref.deref()) { if (confFiles[i]->size == 0) { delete confFiles[i].take(); - } else if (unusedCache) { + } else { if (usedHash) usedHash->remove(confFiles[i]->name); - QT_TRY { - // compute a better size? - unusedCache->insert(confFiles[i]->name, confFiles[i].data(), - 10 + (confFiles[i]->originalKeys.size() / 4)); - confFiles[i].take(); - } QT_CATCH(...) { - // out of memory. Do not cache the file. + if (unusedCache) { + QT_TRY { + // compute a better size? + unusedCache->insert(confFiles[i]->name, confFiles[i].data(), + 10 + (confFiles[i]->originalKeys.size() / 4)); + confFiles[i].take(); + } QT_CATCH(...) { + // out of memory. Do not cache the file. + delete confFiles[i].take(); + } + } else { + // unusedCache is gone - delete the entry to prevent a memory leak delete confFiles[i].take(); } } @@ -3506,7 +3517,7 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) \threadsafe Registers a custom storage format. On success, returns a special - Format value that can then be passed to the QSettings constuctor. + Format value that can then be passed to the QSettings constructor. On failure, returns InvalidFormat. The \a extension is the file diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 6e37aee..589d304 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \l{QAbstractItemModel::}{endInsertRows()} must be called. \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex, - QAbstractItemView, {Using drag & drop with item views}, + QAbstractItemView, {Using drag and drop with item views}, {Simple DOM Model Example}, {Simple Tree Model Example}, {Editable Tree Model Example}, {Fetch More Example} */ @@ -1760,7 +1760,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const where to place the data. This can occur in a tree when data is dropped on a parent. Models will usually append the data to the parent in this case. - \sa supportedDropActions(), {Using drag & drop with item views} + \sa supportedDropActions(), {Using drag and drop with item views} */ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) @@ -1797,7 +1797,7 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti reimplement the dropMimeData() function to handle the additional operations. - \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item + \sa dropMimeData(), Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDropActions() const @@ -1814,7 +1814,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs. - \sa Qt::DropActions, {Using drag & drop with item views} + \sa Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDragActions() const { @@ -1830,7 +1830,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const Sets the supported drag \a actions for the items in the model. - \sa supportedDragActions(), {Using drag & drop with item views} + \sa supportedDragActions(), {Using drag and drop with item views} */ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) { @@ -2636,8 +2636,6 @@ void QAbstractItemModel::endMoveRows() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2648,6 +2646,8 @@ void QAbstractItemModel::endMoveRows() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical); + emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } @@ -2860,8 +2860,6 @@ void QAbstractItemModel::endMoveColumns() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2872,6 +2870,8 @@ void QAbstractItemModel::endMoveColumns() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal); + emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index d3f399b..5598187 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -406,11 +406,10 @@ QString qAppName() operations can call processEvents() to keep the application responsive. - Some Qt classes, such as QString, can be used without a - QCoreApplication object. However, in general, we recommend that - you create a QCoreApplication or a QApplication object in your \c - main() function as early as possible. exit() will not return - until the event loop exits; e.g., when quit() is called. + In general, we recommend that you create a QCoreApplication or + a QApplication object in your \c main() function as early as + possible. exit() will not return until the event loop exits; + e.g., when quit() is called. Several static convenience functions are also provided. The QCoreApplication object is available from instance(). Events can diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 8390275..6fa2707 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -311,6 +311,10 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) } } +#if GLIB_CHECK_VERSION (2, 22, 0) + g_main_context_push_thread_default (mainContext); +#endif + // setup post event source postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); @@ -389,6 +393,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib() d->postEventSource = 0; Q_ASSERT(d->mainContext != 0); +#if GLIB_CHECK_VERSION (2, 22, 0) + g_main_context_pop_thread_default (d->mainContext); +#endif g_main_context_unref(d->mainContext); d->mainContext = 0; } diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index d8cc344..bb9bd01 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -975,9 +975,7 @@ bool QEventDispatcherSymbian::sendPostedEvents() inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object) { - if (m_deferredActiveObjects.isEmpty()) { - m_completeDeferredAOs->complete(); - } + queueDeferredActiveObjectsCompletion(); m_deferredActiveObjects.append(object); } @@ -986,6 +984,11 @@ inline void QEventDispatcherSymbian::removeDeferredActiveObject(QActiveObject *o m_deferredActiveObjects.removeAll(object); } +void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion() +{ + m_completeDeferredAOs->complete(); +} + void QEventDispatcherSymbian::reactivateDeferredActiveObjects() { while (!m_deferredActiveObjects.isEmpty()) { diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 1486db5..3615996 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -247,7 +247,9 @@ public: void addDeferredActiveObject(QActiveObject *object); void removeDeferredActiveObject(QActiveObject *object); - void reactivateDeferredActiveObjects(); + void queueDeferredActiveObjectsCompletion(); + // Can be overridden to activate local active objects too, but do call baseclass! + virtual void reactivateDeferredActiveObjects(); inline int iterationCount() const { return m_iterationCount; } diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 153ccdf..4eb0073 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -84,7 +84,8 @@ extern uint qGlobalPostedEventsCount(); enum { WM_QT_SOCKETNOTIFIER = WM_USER, - WM_QT_SENDPOSTEDEVENTS = WM_USER + 1 + WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, + SendPostedEventsWindowsTimerId = ~1u }; #if defined(Q_OS_WINCE) @@ -353,10 +354,7 @@ public: // for controlling when to send posted events QAtomicInt serialNumber; - int lastSerialNumber; -#ifndef Q_OS_WINCE - int lastMessageTime; -#endif + int lastSerialNumber, sendPostedEventsWindowsTimerId; QAtomicInt wakeUps; // timers @@ -381,11 +379,7 @@ public: QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), - serialNumber(0), lastSerialNumber(0), -#ifndef Q_OS_WINCE - lastMessageTime(0), -#endif - wakeUps(0) + serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) { resolveTimerAPI(); } @@ -492,20 +486,21 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } } return 0; - } else if (message == WM_TIMER) { - Q_ASSERT(d != 0); - d->sendTimerEvent(wp); - return 0; - } else if (message == WM_QT_SENDPOSTEDEVENTS) { + } else if (message == WM_QT_SENDPOSTEDEVENTS + // we also use a Windows timer to send posted events when the message queue is full + || (message == WM_TIMER + && d->sendPostedEventsWindowsTimerId != 0 + && wp == d->sendPostedEventsWindowsTimerId)) { int localSerialNumber = d->serialNumber; if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; -#ifndef Q_OS_WINCE - d->lastMessageTime = GetMessageTime(); -#endif QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); } return 0; + } else if (message == WM_TIMER) { + Q_ASSERT(d != 0); + d->sendTimerEvent(wp); + return 0; } return DefWindowProc(hwnd, message, wp, lp); @@ -517,25 +512,36 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance()); Q_ASSERT(q != 0); if (q) { + MSG *msg = (MSG *) lp; QEventDispatcherWin32Private *d = q->d_func(); int localSerialNumber = d->serialNumber; - MSG unused; - if ((HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT)) == 0 - && PeekMessage(&unused, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0) -#ifndef Q_OS_WINCE - || GetMessageTime() - d->lastMessageTime >= 10 -#endif - ) { - // no more input or timer events in the message queue or more than 10ms has elapsed since - // we send posted events, we can allow posted events to be sent now + if (HIWORD(GetQueueStatus(QS_TIMER | QS_INPUT | QS_RAWINPUT)) == 0) { + // no more input or timer events in the message queue, we can allow posted events to be sent normally now + if (d->sendPostedEventsWindowsTimerId != 0) { + // stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message + KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId); + d->sendPostedEventsWindowsTimerId = 0; + } (void) d->wakeUps.fetchAndStoreRelease(0); - MSG *msg = (MSG *) lp; if (localSerialNumber != d->lastSerialNumber // if this message IS the one that triggers sendPostedEvents(), no need to post it again && (msg->hwnd != d->internalHwnd || msg->message != WM_QT_SENDPOSTEDEVENTS)) { PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); } + } else if (d->sendPostedEventsWindowsTimerId == 0 + && localSerialNumber != d->lastSerialNumber + // if this message IS the one that triggers sendPostedEvents(), no need to post it again + && (msg->hwnd != d->internalHwnd + || msg->message != WM_QT_SENDPOSTEDEVENTS)) { + // start a special timer to continue delivering posted events while + // there are still input and timer messages in the message queue + d->sendPostedEventsWindowsTimerId = SetTimer(d->internalHwnd, + SendPostedEventsWindowsTimerId, + 0, // we specify zero, but Windows uses USER_TIMER_MINIMUM + NULL); + // we don't check the return value of SetTimer()... if creating the timer failed, there's little + // we can do. we just have to accept that posted events will be starved } } } diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index bf4001a..899ca7b 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -249,7 +249,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty \o We can subclass QMimeData and reimplement hasFormat(), formats(), and retrieveData(). - \o If the drag and drop operation occurs withing a single + \o If the drag and drop operation occurs within a single application, we can subclass QMimeData and add extra data in it, and use a qobject_cast() in the receiver's drop event handler. For example: diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index 78556c3..da76b74 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -90,14 +90,14 @@ static const char will_shutdown_now[] = static int qt_eval_is_supported() { - const char *const license_key = qt_eval_key_data + 12; + const volatile char *const license_key = qt_eval_key_data + 12; // fast fail if (!qt_eval_key_data[0] || !*license_key) return -1; // is this an unsupported evaluation? - const char* typecode = license_key; + const volatile char *typecode = license_key; int field = 2; for ( ; field && *typecode; ++typecode) if (*typecode == '-') diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 4b371f7..6324cc9 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE QStateMachinePrivate::QStateMachinePrivate() { - QAbstractStatePrivate::isMachine = true; + isMachine = true; state = NotRunning; _startState = 0; diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 69b70cb..6fb182b 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -482,8 +482,10 @@ int QThread::exec() Q_D(QThread); QMutexLocker locker(&d->mutex); d->data->quitNow = false; - if (d->exited) + if (d->exited) { + d->exited = false; return d->returnCode; + } locker.unlock(); QEventLoop eventLoop; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index a7601b6..e3b587d 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -97,6 +97,11 @@ # define SCHED_IDLE 5 #endif +#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#define QT_HAS_THREAD_PRIORITY_SCHEDULING +#endif + + QT_BEGIN_NAMESPACE #ifndef QT_NO_THREAD @@ -142,6 +147,39 @@ static void destroy_current_thread_data_key() } Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key) + +// Utility functions for getting, setting and clearing thread specific data. +// In Symbian, TLS access is significantly faster than pthread_getspecific. +// However Symbian does not have the thread destruction cleanup functionality +// that pthread has, so pthread_setspecific is also used. +static QThreadData *get_thread_data() +{ +#ifdef Q_OS_SYMBIAN + return reinterpret_cast<QThreadData *>(Dll::Tls()); +#else + pthread_once(¤t_thread_data_once, create_current_thread_data_key); + return reinterpret_cast<QThreadData *>(pthread_getspecific(current_thread_data_key)); +#endif +} + +static void set_thread_data(QThreadData *data) +{ +#ifdef Q_OS_SYMBIAN + qt_symbian_throwIfError(Dll::SetTls(data)); +#endif + pthread_once(¤t_thread_data_once, create_current_thread_data_key); + pthread_setspecific(current_thread_data_key, data); +} + +static void clear_thread_data() +{ +#ifdef Q_OS_SYMBIAN + Dll::FreeTls(); +#endif + pthread_setspecific(current_thread_data_key, 0); +} + + #ifdef Q_OS_SYMBIAN static void init_symbian_thread_handle(RThread &thread) { @@ -158,26 +196,24 @@ static void init_symbian_thread_handle(RThread &thread) QThreadData *QThreadData::current() { - pthread_once(¤t_thread_data_once, create_current_thread_data_key); - - QThreadData *data = reinterpret_cast<QThreadData *>(pthread_getspecific(current_thread_data_key)); + QThreadData *data = get_thread_data(); if (!data) { void *a; if (QInternal::activateCallbacks(QInternal::AdoptCurrentThread, &a)) { QThread *adopted = static_cast<QThread*>(a); Q_ASSERT(adopted); data = QThreadData::get2(adopted); - pthread_setspecific(current_thread_data_key, data); + set_thread_data(data); adopted->d_func()->running = true; adopted->d_func()->finished = false; static_cast<QAdoptedThread *>(adopted)->init(); } else { data = new QThreadData; - pthread_setspecific(current_thread_data_key, data); QT_TRY { + set_thread_data(data); data->thread = new QAdoptedThread(data); } QT_CATCH(...) { - pthread_setspecific(current_thread_data_key, 0); + clear_thread_data(); data->deref(); data = 0; QT_RETHROW; @@ -268,8 +304,7 @@ void *QThreadPrivate::start(void *arg) User::SetCritical(User::EProcessCritical); #endif - pthread_once(¤t_thread_data_once, create_current_thread_data_key); - pthread_setspecific(current_thread_data_key, data); + set_thread_data(data); data->ref(); data->quitNow = false; @@ -473,6 +508,7 @@ void QThread::usleep(unsigned long usecs) thread_sleep(&ti); } +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING // Does some magic and calculate the Unix scheduler priorities // sched_policy is IN/OUT: it must be set to a valid policy before calling this function // sched_priority is OUT only @@ -503,6 +539,7 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr *sched_priority = prio; return true; } +#endif void QThread::start(Priority priority) { @@ -523,7 +560,7 @@ void QThread::start(Priority priority) d->priority = priority; -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING) && !defined(Q_OS_SYMBIAN) // ### Need to implement thread sheduling and priorities for symbian os. Implementation removed for now switch (priority) { case InheritPriority: @@ -564,7 +601,7 @@ void QThread::start(Priority priority) break; } } -#endif // _POSIX_THREAD_PRIORITY_SCHEDULING +#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING #ifdef Q_OS_SYMBIAN if (d->stackSize == 0) @@ -727,7 +764,7 @@ void QThread::setPriority(Priority priority) // copied from start() with a few modifications: -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING int sched_policy; sched_param param; diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index b0c784e..fac0f45 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1812,7 +1812,7 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) return *this; } else { QByteArray copy(after); - // ### optimise me + // ### optimize me remove(pos, len); return insert(pos, copy); } @@ -1853,7 +1853,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen) } } -// ### optimise all other replace method, by offering +// ### optimize all other replace method, by offering // QByteArray::replace(const char *before, int blen, const char *after, int alen) /*! diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 6b1de5e..b817eb2 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -77,7 +77,7 @@ QT_END_NAMESPACE #include <qdebug.h> #include <time.h> -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) # include <fenv.h> #endif @@ -1576,8 +1576,6 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) defaults to the default locale (see setDefault()). \endlist - The "C" locale is identical in behavior to \l{English}/\l{UnitedStates}. - Use language() and country() to determine the actual language and country values used. @@ -6637,7 +6635,7 @@ Q_CORE_EXPORT char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *si _control87(MCW_EM, MCW_EM); #endif -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) fenv_t envp; feholdexcept(&envp); #endif @@ -6653,7 +6651,7 @@ Q_CORE_EXPORT char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *si #endif //_M_X64 #endif //Q_OS_WIN -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) fesetenv(&envp); #endif @@ -7308,6 +7306,7 @@ Q_CORE_EXPORT char *qdtoa( double d, int mode, int ndigits, int *decpt, int *sig Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok) { + errno = 0; double ret = strtod((char*)s00, (char**)se); if (ok) { if((ret == 0.0l && errno == ERANGE) diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 8b424bb..1af2cb4 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -114,7 +114,7 @@ class Q_CORE_EXPORT QLocale friend class QString; friend class QByteArray; friend class QIntValidator; - friend class QDoubleValidator; + friend class QDoubleValidatorPrivate; friend class QTextStream; friend class QTextStreamPrivate; diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index 66f06e9..c297709 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -438,8 +438,12 @@ QDebug operator<<(QDebug d, const QPointF &p) /*! \fn bool QPointF::isNull() const - Returns true if both the x and y coordinates are set to 0.0, + Returns true if both the x and y coordinates are set to +0.0; otherwise returns false. + + \note Since this function treats +0.0 and -0.0 differently, points + with zero-valued coordinates where either or both values have a + negative sign are not defined to be null points. */ diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 4cce339..2895bba 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -378,6 +378,13 @@ namespace QtSharedPointer { inline ExternalRefCount() : d(0) { } inline ExternalRefCount(Qt::Initialization i) : Basic<T>(i) { } + + inline ExternalRefCount(T *ptr) : Basic<T>(Qt::Uninitialized) // throws + { internalConstruct(ptr); } + template <typename Deleter> + inline ExternalRefCount(T *ptr, Deleter deleter) : Basic<T>(Qt::Uninitialized) // throws + { internalConstruct(ptr, deleter); } + inline ExternalRefCount(const ExternalRefCount<T> &other) : Basic<T>(other), d(other.d) { if (d) ref(); } template <class X> @@ -448,11 +455,12 @@ public: inline QSharedPointer() { } // inline ~QSharedPointer() { } - inline explicit QSharedPointer(T *ptr) : BaseClass(Qt::Uninitialized) - { BaseClass::internalConstruct(ptr); } + inline explicit QSharedPointer(T *ptr) : BaseClass(ptr) // throws + { } template <typename Deleter> - inline QSharedPointer(T *ptr, Deleter d) { BaseClass::internalConstruct(ptr, d); } + inline QSharedPointer(T *ptr, Deleter d) : BaseClass(ptr, d) // throws + { } inline QSharedPointer(const QSharedPointer<T> &other) : BaseClass(other) { } inline QSharedPointer<T> &operator=(const QSharedPointer<T> &other) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index b2fe2da..63ebafb 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -135,7 +135,7 @@ static inline uint detectProcessorFeatures() #if defined(QT_HAVE_IWMMXT) // runtime detection only available when running as a previlegied process features = IWMMXT; -#elif defined(QT_HAVE_NEON) +#elif defined(QT_ALWAYS_HAVE_NEON) features = NEON; #endif diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 664543b..2dbed76 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -87,9 +87,13 @@ QT_BEGIN_HEADER #include <tmmintrin.h> #endif -// SSE4.1 and SSE4.2 intrinsics -#if (defined(QT_HAVE_SSE4_1) || defined(QT_HAVE_SSE4_2)) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) +// SSE4.1 intrinsics +#if defined(QT_HAVE_SSE4_1) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) #include <smmintrin.h> +#endif + +// SSE4.2 intrinsics +#if defined(QT_HAVE_SSE4_2) && (defined(__SSE4_2__) || defined(Q_CC_MSVC)) #include <nmmintrin.h> #endif @@ -105,7 +109,8 @@ QT_BEGIN_HEADER #endif // defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) // NEON intrinsics -#if defined(QT_HAVE_NEON) +#if defined __ARM_NEON__ +#define QT_ALWAYS_HAVE_NEON #include <arm_neon.h> #endif diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index 20ac344..12287ab 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -492,9 +492,13 @@ QDebug operator<<(QDebug dbg, const QSize &s) { /*! \fn bool QSizeF::isNull() const - Returns true if both the width and height is 0; otherwise returns + Returns true if both the width and height are +0.0; otherwise returns false. + \note Since this function treats +0.0 and -0.0 differently, sizes with + zero width and height where either or both values have a negative + sign are not defined to be null sizes. + \sa isValid(), isEmpty() */ diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 8083aee..114c4ee 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -567,7 +567,7 @@ const QString::Null QString::null = { }; strings from a string list that contain a particular substring or that match a particular QRegExp using the QStringList::filter() function. -: + \section1 Querying String Data If you want to see if a QString starts or ends with a particular @@ -3573,7 +3573,7 @@ static QByteArray toLatin1_helper(const QChar *data, int length) } length = length % 16; } -#elif QT_HAVE_NEON +#elif defined(QT_ALWAYS_HAVE_NEON) // Refer to the documentation of the SSE2 implementation // this use eactly the same method as for SSE except: // 1) neon has unsigned comparison |