diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/arch/qatomic_s390.h | 16 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_symbian.h | 2 | ||||
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 52 | ||||
-rw-r--r-- | src/corelib/concurrent/qfuture.h | 2 | ||||
-rw-r--r-- | src/corelib/corelib.pro | 16 | ||||
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_kqueue.cpp | 18 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 37 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qset.h | 7 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 6 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream_p.h | 2 |
18 files changed, 145 insertions, 65 deletions
diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h index 21f5037..273c17b 100644 --- a/src/corelib/arch/qatomic_s390.h +++ b/src/corelib/arch/qatomic_s390.h @@ -366,11 +366,9 @@ template <typename T> Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { #ifndef __s390x__ - return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", - "", "bcr 15,0\n"); + return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", ""); #else - return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", - "", "bcr 15,0\n"); + return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", ""); #endif } @@ -378,9 +376,9 @@ template <typename T> Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { #ifndef __s390x__ - return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", "", ""); + return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "bcr 15,0 \n"); #else - return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", "", ""); + return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "bcr 15,0 \n"); #endif } @@ -388,11 +386,9 @@ template <typename T> Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { #ifndef __s390x__ - return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", - "bcr 15,0 \n", ""); + return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "bcr 15,0 \n", ""); #else - return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", - "bcr 15,0\n", ""); + return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "bcr 15,0\n", ""); #endif } diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index f1d332f..fa4e4a9 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -42,7 +42,7 @@ #ifndef QATOMIC_SYMBIAN_H #define QATOMIC_SYMBIAN_H -#include <qglobal.h> +#include <QtCore/qglobal.h> #include <e32std.h> QT_BEGIN_HEADER diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 1c607a6..ca5e658 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -80,6 +80,7 @@ #endif // QT_NO_CODECS #include "qlocale.h" #include "qmutex.h" +#include "qhash.h" #include <stdlib.h> #include <ctype.h> @@ -172,6 +173,7 @@ static QTextCodec *createForMib(int mib) } static QList<QTextCodec*> *all = 0; +static int clearCaches = 0; // flags specifying if caches should be invalided: 0x1 codecForName, 0x2 codecForMib #ifdef Q_DEBUG_TEXTCODEC static bool destroying_is_ok = false; #endif @@ -935,6 +937,7 @@ QTextCodec::~QTextCodec() QMutexLocker locker(textCodecsMutex()); #endif all->removeAll(this); + clearCaches = 0x1 | 0x2; } } @@ -961,17 +964,33 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) #endif setup(); + static QHash <QByteArray, QTextCodec *> cache; + if (clearCaches & 0x1) { + cache.clear(); + clearCaches &= ~0x1; + } + QTextCodec *codec = cache.value(name); + if (codec) + return codec; + for (int i = 0; i < all->size(); ++i) { QTextCodec *cursor = all->at(i); - if (nameMatch(cursor->name(), name)) + if (nameMatch(cursor->name(), name)) { + cache.insert(name, cursor); return cursor; + } QList<QByteArray> aliases = cursor->aliases(); for (int y = 0; y < aliases.size(); ++y) - if (nameMatch(aliases.at(y), name)) + if (nameMatch(aliases.at(y), name)) { + cache.insert(name, cursor); return cursor; + } } - return createForName(name); + codec = createForName(name); + if (codec) + cache.insert(name, codec); + return codec; } @@ -986,19 +1005,34 @@ QTextCodec* QTextCodec::codecForMib(int mib) #endif setup(); - // Qt 3 used 1000 (mib for UCS2) as its identifier for the utf16 codec. Map - // this correctly for compatibility. - if (mib == 1000) - mib = 1015; + static QHash <int, QTextCodec *> cache; + if (clearCaches & 0x2) { + cache.clear(); + clearCaches &= ~0x2; + } + QTextCodec *codec = cache.value(mib); + if (codec) + return codec; QList<QTextCodec*>::ConstIterator i; for (int i = 0; i < all->size(); ++i) { QTextCodec *cursor = all->at(i); - if (cursor->mibEnum() == mib) + if (cursor->mibEnum() == mib) { + cache.insert(mib, cursor); return cursor; + } } - return createForMib(mib); + codec = createForMib(mib); + + // Qt 3 used 1000 (mib for UCS2) as its identifier for the utf16 codec. Map + // this correctly for compatibility. + if (!codec && mib == 1000) + return codecForMib(1015); + + if (codec) + cache.insert(mib, codec); + return codec; } /*! diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h index e402335..02ae40a 100644 --- a/src/corelib/concurrent/qfuture.h +++ b/src/corelib/concurrent/qfuture.h @@ -111,7 +111,7 @@ public: { public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 9a15bf1..efee610 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -35,4 +35,20 @@ symbian: { # Workaroud for problems with paging this dll MMP_RULES -= PAGED MMP_RULES *= UNPAGED + + # Partial upgrade SIS file + vendorinfo = \ + "&EN" \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt\"" \ + " " + pu_header = "; Partial upgrade package for testing QtCore changes without reinstalling everything" \ + "$${LITERAL_HASH}{\"Qt corelib\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" + partial_upgrade.pkg_prerules = pu_header vendorinfo + partial_upgrade.sources = qtcore.dll + partial_upgrade.path = c:/sys/bin + DEPLOYMENT = partial_upgrade $$DEPLOYMENT } diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 7c1887e..fc35bfa 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -157,6 +157,13 @@ QT_BEGIN_NAMESPACE data, followed by the data. Note that any encoding/decoding of the data (apart from the length quint32) must be done by you. + \section1 Reading and writing Qt collection classes + + The Qt collection classes can also be serialized to a QDataStream. + These include QList, QLinkedList, QVector, QSet, QHash, and QMap. + These classes have have stream operators declared as non-member of + the class. + \target Serializing Qt Classes \section1 Reading and writing other Qt classes. diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 8396481..99c165e 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -260,12 +260,22 @@ void QKqueueFileSystemWatcherEngine::run() DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter; if (fd == kqpipe[0]) { - char c; - if (read(kqpipe[0], &c, 1) != 1) { + // read all pending data from the pipe + QByteArray ba; + ba.resize(kev.data); + if (read(kqpipe[0], ba.data(), ba.size()) != ba.size()) { perror("QKqueueFileSystemWatcherEngine: error reading from pipe"); return; } - switch (c) { + // read the command from the buffer (but break and return on 'q') + char cmd = 0; + for (int i = 0; i < ba.size(); ++i) { + cmd = ba.constData()[i]; + if (cmd == 'q') + break; + } + // handle the command + switch (cmd) { case 'q': DEBUG() << "QKqueueFileSystemWatcherEngine: thread received 'q', exiting..."; return; @@ -273,7 +283,7 @@ void QKqueueFileSystemWatcherEngine::run() DEBUG() << "QKqueueFileSystemWatcherEngine: thread received '@', continuing..."; break; default: - DEBUG() << "QKqueueFileSystemWatcherEngine: thread received unknow message" << c; + DEBUG() << "QKqueueFileSystemWatcherEngine: thread received unknow message" << cmd; break; } } else { diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index eb99f27..d8b1c03 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1479,7 +1479,7 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const { //### what to do with permissions if we don't use NTFS // for now just add all permissions and what about exe missions ?? - // also qt_ntfs_permission_lookup is now not set by defualt ... should it ? + // also qt_ntfs_permission_lookup is now not set by default ... should it ? ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 7c8fb3d..4755540 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -68,6 +68,14 @@ extern uint qGlobalPostedEventsCount(); # define QS_RAWINPUT 0x0400 #endif +#ifndef WM_TOUCH +# define WM_TOUCH 0x0240 +#endif +#ifndef WM_GESTURE +# define WM_GESTURE 0x0119 +# define WM_GESTURENOTIFY 0x011A +#endif + enum { WM_QT_SOCKETNOTIFIER = WM_USER, WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, @@ -517,8 +525,8 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) 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) { + && (msg->hwnd != d->internalHwnd + || msg->message != WM_QT_SENDPOSTEDEVENTS)) { PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); } } @@ -729,6 +737,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) && msg.message <= WM_MOUSELAST) || msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL + || msg.message == WM_TOUCH + || msg.message == WM_GESTURE + || msg.message == WM_GESTURENOTIFY || msg.message == WM_CLOSE)) { // queue user input events for later processing haveMessage = false; diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 1f7fdb2..f767962 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -97,7 +97,7 @@ public: typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef int size_type; explicit QContiguousCache(int capacity = 0); @@ -221,22 +221,29 @@ void QContiguousCache<T>::setCapacity(int asize) x.d->alloc = asize; x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; - x.d->start = x.d->offset % x.d->alloc; - T *dest = x.p->array + (x.d->start + x.d->count-1) % x.d->alloc; - T *src = p->array + (d->start + d->count-1) % d->alloc; + if(asize) + x.d->start = x.d->offset % x.d->alloc; + else + x.d->start = 0; + int oldcount = x.d->count; - while (oldcount--) { - if (QTypeInfo<T>::isComplex) { - new (dest) T(*src); - } else { - *dest = *src; + if(oldcount) + { + T *dest = x.p->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = p->array + (d->start + d->count-1) % d->alloc; + while (oldcount--) { + if (QTypeInfo<T>::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + if (dest == x.p->array) + dest = x.p->array + x.d->alloc; + dest--; + if (src == p->array) + src = p->array + d->alloc; + src--; } - if (dest == x.p->array) - dest = x.p->array + x.d->alloc; - dest--; - if (src == p->array) - src = p->array + d->alloc; - src--; } /* free old */ free(p); diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 2832ca2..f1030ae 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -330,7 +330,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; @@ -395,7 +395,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -479,7 +479,7 @@ public: // STL compatibility typedef T mapped_type; typedef Key key_type; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef int size_type; inline bool empty() const { return isEmpty(); } diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index fe586a4..d145fe3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -114,7 +114,7 @@ public: { public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; @@ -147,7 +147,7 @@ public: { public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -213,7 +213,7 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; #ifndef QT_NO_STL static inline QLinkedList<T> fromStdList(const std::list<T> &list) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 8c75c98..5364e8e 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -166,7 +166,7 @@ public: public: Node *i; typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; @@ -213,7 +213,7 @@ public: public: Node *i; typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -292,7 +292,7 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; #ifdef QT3_SUPPORT inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 9ba9ca5..2e21547 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -214,7 +214,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; @@ -282,7 +282,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -385,7 +385,7 @@ public: // STL compatibility typedef Key key_type; typedef T mapped_type; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef int size_type; inline bool empty() const { return isEmpty(); } diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 9acbed4..fe50d4d 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -97,7 +97,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -132,7 +132,7 @@ public: public: typedef std::bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -188,11 +188,10 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef int size_type; inline bool empty() const { return isEmpty(); } - // comfort inline QSet<T> &operator<<(const T &value) { insert(value); return *this; } inline QSet<T> &operator|=(const QSet<T> &other) { unite(other); return *this; } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 0dcea5f..d85c248 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -132,7 +132,7 @@ namespace QtSharedPointer { typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; inline T *data() const { return value; } inline bool isNull() const { return !data(); } @@ -541,7 +541,7 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; inline bool isNull() const { return d == 0 || d->strongref == 0 || value == 0; } #ifndef Q_CC_NOKIAX86 diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 2fc4d6c..c2e2485 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -164,7 +164,7 @@ public: public: T *i; typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; @@ -197,7 +197,7 @@ public: public: T *i; typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; @@ -261,7 +261,7 @@ public: typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; - typedef ptrdiff_t difference_type; + typedef qptrdiff difference_type; typedef iterator Iterator; typedef const_iterator ConstIterator; typedef int size_type; diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 6b911d2..ac421cf 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -54,7 +54,7 @@ #ifndef QXMLSTREAM_P_H #define QXMLSTREAM_P_H -#if defined(Q_OS_VXWORKS) && defined(ERROR) +#if defined(ERROR) # undef ERROR #endif |