diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qiconvcodec.cpp | 41 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 42 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qprocess_symbian.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 17 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 6 | ||||
-rw-r--r-- | src/corelib/thread/qmutex.h | 15 | ||||
-rw-r--r-- | src/corelib/thread/qreadwritelock.h | 30 | ||||
-rw-r--r-- | src/corelib/tools/qregexp.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 2 |
14 files changed, 110 insertions, 70 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 0f73d9b..0fcdf96 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -299,6 +299,32 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState Q_GLOBAL_STATIC(QThreadStorage<QIconvCodec::IconvState *>, fromUnicodeState) +static bool setByteOrder(iconv_t cd) +{ +#if !defined(NO_BOM) + // give iconv() a BOM + char buf[4]; + ushort bom[] = { QChar::ByteOrderMark }; + + char *outBytes = buf; + char *inBytes = reinterpret_cast<char *>(bom); + size_t outBytesLeft = sizeof buf; + size_t inBytesLeft = sizeof bom; + +#if defined(GNU_LIBICONV) + const char **inBytesPtr = const_cast<const char **>(&inBytes); +#else + char **inBytesPtr = &inBytes; +#endif + + if (iconv(cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { + return false; + } +#endif // NO_BOM + + return true; +} + QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *convState) const { char *inBytes; @@ -325,17 +351,8 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt IconvState *&state = ts->localData(); if (!state) { state = new IconvState(QIconvCodec::createIconv_t(0, UTF16)); - if (state->cd != reinterpret_cast<iconv_t>(-1)) { - size_t outBytesLeft = len + 3; // +3 for the BOM - QByteArray ba(outBytesLeft, Qt::Uninitialized); - outBytes = ba.data(); - -#if !defined(NO_BOM) - // give iconv() a BOM - QChar bom[] = { QChar(QChar::ByteOrderMark) }; - inBytes = reinterpret_cast<char *>(bom); - inBytesLeft = sizeof(bom); - if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { + if (state->cd == reinterpret_cast<iconv_t>(-1)) { + if (!setByteOrder(state->cd)) { perror("QIconvCodec::convertFromUnicode: using ASCII for conversion, iconv failed for BOM"); iconv_close(state->cd); @@ -343,7 +360,6 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt return QString(uc, len).toAscii(); } -#endif // NO_BOM } } if (state->cd == reinterpret_cast<iconv_t>(-1)) { @@ -422,6 +438,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); + setByteOrder(state->cd); ba.resize(ba.size() - outBytesLeft); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index d2546a7..f7aea36 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -299,7 +299,9 @@ public: MacWindowToolBarButtonHint = 0x10000000, BypassGraphicsProxyWidget = 0x20000000, WindowOkButtonHint = 0x00080000, - WindowCancelButtonHint = 0x00100000 + WindowCancelButtonHint = 0x00100000, + WindowSoftkeysVisibleHint = 0x40000000, + WindowSoftkeysRespondHint = 0x80000000 #ifdef QT3_SUPPORT , diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c5b5998..74144b0 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1623,22 +1623,22 @@ \value Key_OpenUrl \value Key_LaunchMail \value Key_LaunchMedia - \value Key_Launch0 - \value Key_Launch1 - \value Key_Launch2 - \value Key_Launch3 - \value Key_Launch4 - \value Key_Launch5 - \value Key_Launch6 - \value Key_Launch7 - \value Key_Launch8 - \value Key_Launch9 - \value Key_LaunchA - \value Key_LaunchB - \value Key_LaunchC - \value Key_LaunchD - \value Key_LaunchE - \value Key_LaunchF + \value Key_Launch0 On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key for legacy reasons. + \value Key_Launch1 On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key for legacy reasons. + \value Key_Launch2 On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons. + \value Key_Launch3 On X11 this key is mapped to XF86XK_Launch1 key for legacy reasons. + \value Key_Launch4 On X11 this key is mapped to XF86XK_Launch2 key for legacy reasons. + \value Key_Launch5 On X11 this key is mapped to XF86XK_Launch3 key for legacy reasons. + \value Key_Launch6 On X11 this key is mapped to XF86XK_Launch4 key for legacy reasons. + \value Key_Launch7 On X11 this key is mapped to XF86XK_Launch5 key for legacy reasons. + \value Key_Launch8 On X11 this key is mapped to XF86XK_Launch6 key for legacy reasons. + \value Key_Launch9 On X11 this key is mapped to XF86XK_Launch7 key for legacy reasons. + \value Key_LaunchA On X11 this key is mapped to XF86XK_Launch8 key for legacy reasons. + \value Key_LaunchB On X11 this key is mapped to XF86XK_Launch9 key for legacy reasons. + \value Key_LaunchC On X11 this key is mapped to XF86XK_LaunchA key for legacy reasons. + \value Key_LaunchD On X11 this key is mapped to XF86XK_LaunchB key for legacy reasons. + \value Key_LaunchE On X11 this key is mapped to XF86XK_LaunchC key for legacy reasons. + \value Key_LaunchF On X11 this key is mapped to XF86XK_LaunchD key for legacy reasons. \value Key_MonBrightnessUp \value Key_MonBrightnessDown \value Key_KeyboardLightOnOff @@ -1664,7 +1664,7 @@ \value Key_ApplicationRight \value Key_Book \value Key_CD - \value Key_Calculator + \value Key_Calculator On X11 this key is not mapped for legacy reasons. Use Qt::Key_Launch1 instead. \value Key_ToDoList \value Key_ClearGrab \value Key_Close @@ -2147,6 +2147,14 @@ \value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog. Only supported for Windows CE. + \value WindowSoftkeysVisibleHint Makes softkeys visible when widget is fullscreen. + Only supported for Symbian. + + \value WindowSoftkeysRespondHint Makes softkeys to receive key events even + when invisible. With this hint the softkey actions are triggered + even the softkeys are invisible i.e. the window is displayed with + \c showFullscreen(). Only supported for Symbian. + \value WindowType_Mask A mask for extracting the window type part of the window flags. diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 1672dfc..070edb4 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -147,6 +147,8 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) return path; #endif #if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN) || defined(Q_OS_MAC) + // ... but Linux with uClibc does not have it +#if !defined(__UCLIBC__) char *ret = 0; #if defined(Q_OS_MAC) // Mac OS X 10.5.x doesn't support the realpath(X,0) extension we use here. @@ -173,6 +175,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) return canonicalPath; } #endif +#endif QFileInfo fi; const QChar slash(QLatin1Char('/')); diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index d2fa744..1331f54 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -668,6 +668,16 @@ bool QFSFileEnginePrivate::doStat() const could_stat = (QT_FSTAT(QT_FILENO(fh), &st) == 0); } 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. + // 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; + could_stat = (QT_LSTAT(nativeFilePath.constData(), &st) == 0); + is_link = could_stat ? S_ISLNK(st.st_mode) : false; + // if it turns out this was a link, we can call stat too. + if (is_link) +#endif could_stat = (QT_STAT(nativeFilePath.constData(), &st) == 0); } else { could_stat = (QT_FSTAT(fd, &st) == 0); diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index 07d10ad..adc87fb 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -371,6 +371,7 @@ QProcessActive::QProcessActive() // Called from ProcessManagerThread QProcessActive::~QProcessActive() { + Cancel(); process = NULL; pproc = NULL; } @@ -477,6 +478,7 @@ QProcessManagerMediator::QProcessManagerMediator() // Called from ProcessManagerThread QProcessManagerMediator::~QProcessManagerMediator() { + Cancel(); processManagerThread.Close(); currentCommand = ENoCommand; currentObserver = NULL; diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 1d7be79..191be6c 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -733,7 +733,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } TInt error; - handledSymbianEvent = CActiveScheduler::RunIfReady(error, CActive::EPriorityIdle); + handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt); if (error) { qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error); CActiveScheduler::Current()->Error(error); diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index ecffe99..312c4b2 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -974,7 +974,7 @@ QByteArray QMetaObject::normalizedType(const char *type) if (!type || !*type) return result; - QVarLengthArray<char> stackbuf(int(strlen(type)) + 1); + QVarLengthArray<char> stackbuf(qstrlen(type) + 1); qRemoveWhitespace(type, stackbuf.data()); int templdepth = 0; qNormalizeType(stackbuf.data(), templdepth, result); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8e4ec7c..389e6e7 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3279,12 +3279,14 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign const int method = c->method; QObjectPrivate::Sender currentSender; - currentSender.sender = sender; - currentSender.signal = signal_absolute_index; - currentSender.ref = 1; + const bool receiverInSameThread = currentThreadData == receiver->d_func()->threadData; QObjectPrivate::Sender *previousSender = 0; - if (currentThreadData == receiver->d_func()->threadData) + if (receiverInSameThread) { + currentSender.sender = sender; + currentSender.signal = signal_absolute_index; + currentSender.ref = 1; previousSender = QObjectPrivate::setCurrentSender(receiver, ¤tSender); + } locker.unlock(); if (qt_signal_spy_callback_set.slot_begin_callback != 0) { @@ -3300,8 +3302,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); } QT_CATCH(...) { locker.relock(); - - QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender); + if (receiverInSameThread) + QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender); --connectionLists->inUse; Q_ASSERT(connectionLists->inUse >= 0); @@ -3316,7 +3318,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign locker.relock(); - QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender); + if (receiverInSameThread) + QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender); if (connectionLists->orphaned) break; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 227a60d..07c9e53 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -484,9 +484,13 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) * QMetaType::VoidStar, QMetaType::QObjectStar and so forth, is that it wouldn't include * user defined pointer types. */ const char *const typeName = QMetaType::typeName(a->type); - if (typeName[qstrlen(typeName) - 1] == '*') + uint typeNameLen = qstrlen(typeName); + if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*') return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr); + if (a->is_null && b->is_null) + return true; + return a_ptr == b_ptr; } diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 80b50fc..677412e 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -95,7 +95,7 @@ class Q_CORE_EXPORT QMutexLocker { public: inline explicit QMutexLocker(QMutex *m) - : mtx(m) + : val(reinterpret_cast<quintptr>(m)) { Q_ASSERT_X((val & quintptr(1u)) == quintptr(0), "QMutexLocker", "QMutex pointer is misaligned"); @@ -105,19 +105,19 @@ public: inline void unlock() { - if (mtx) { + if (val) { if ((val & quintptr(1u)) == quintptr(1u)) { val &= ~quintptr(1u); - mtx->unlock(); + mutex()->unlock(); } } } inline void relock() { - if (mtx) { + if (val) { if ((val & quintptr(1u)) == quintptr(0u)) { - mtx->lock(); + mutex()->lock(); val |= quintptr(1u); } } @@ -140,10 +140,7 @@ public: private: Q_DISABLE_COPY(QMutexLocker) - union { - QMutex *mtx; - quintptr val; - }; + quintptr val; }; #else // QT_NO_THREAD diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h index 278b8d4..9521ac3 100644 --- a/src/corelib/thread/qreadwritelock.h +++ b/src/corelib/thread/qreadwritelock.h @@ -96,19 +96,19 @@ public: inline void unlock() { - if (q_lock) { + if (q_val) { if ((q_val & quintptr(1u)) == quintptr(1u)) { q_val &= ~quintptr(1u); - q_lock->unlock(); + readWriteLock()->unlock(); } } } inline void relock() { - if (q_lock) { + if (q_val) { if ((q_val & quintptr(1u)) == quintptr(0u)) { - q_lock->lockForRead(); + readWriteLock()->lockForRead(); q_val |= quintptr(1u); } } @@ -119,14 +119,11 @@ public: private: Q_DISABLE_COPY(QReadLocker) - union { - QReadWriteLock *q_lock; - quintptr q_val; - }; + quintptr q_val; }; inline QReadLocker::QReadLocker(QReadWriteLock *areadWriteLock) - : q_lock(areadWriteLock) + : q_val(reinterpret_cast<quintptr>(areadWriteLock)) { Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), "QReadLocker", "QReadWriteLock pointer is misaligned"); @@ -143,19 +140,19 @@ public: inline void unlock() { - if (q_lock) { + if (q_val) { if ((q_val & quintptr(1u)) == quintptr(1u)) { q_val &= ~quintptr(1u); - q_lock->unlock(); + readWriteLock()->unlock(); } } } inline void relock() { - if (q_lock) { + if (q_val) { if ((q_val & quintptr(1u)) == quintptr(0u)) { - q_lock->lockForWrite(); + readWriteLock()->lockForWrite(); q_val |= quintptr(1u); } } @@ -167,14 +164,11 @@ public: private: Q_DISABLE_COPY(QWriteLocker) - union{ - QReadWriteLock *q_lock; - quintptr q_val; - }; + quintptr q_val; }; inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock) - : q_lock(areadWriteLock) + : q_val(reinterpret_cast<quintptr>(areadWriteLock)) { Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), "QWriteLocker", "QReadWriteLock pointer is misaligned"); diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 20ad444..eb104a8 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -523,7 +523,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, \endtable In the mode Wildcard, the wildcard characters cannot be - escaped. In the mode WildcardUnix, the character '\' escapes the + escaped. In the mode WildcardUnix, the character '\\' escapes the wildcard. For example if we are in wildcard mode and have strings which @@ -3779,7 +3779,7 @@ static void invalidateEngine(QRegExpPrivate *priv) \value WildcardUnix This is similar to Wildcard but with the behavior of a Unix shell. The wildcard characters can be escaped - with the character "\". + with the character "\\". \value FixedString The pattern is a fixed string. This is equivalent to using the RegExp pattern on a string in diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index e9b7b9a..eff87e8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3227,7 +3227,7 @@ QString QString::section(const QRegExp ®, int start, int end, SectionFlags fl if (!empty || !(flags & SectionSkipEmpty)) x++; } - if((flags & SectionIncludeLeadingSep)) { + if((flags & SectionIncludeLeadingSep) && first_i < sections.size()) { const qt_section_chunk §ion = sections.at(first_i); ret.prepend(section.string.left(section.length)); } |