diff options
author | Liang Qi <liang.qi@qt.io> | 2016-04-26 11:08:23 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-04-26 11:08:23 +0000 |
commit | 75d4742e0481d236aba9913768f24b377603f6c6 (patch) | |
tree | f799474f9dc86fdc12ff5aea28f545e4c58d28fa /src/corelib | |
parent | 84330007e12122bf1b690a4e68b5ef8e973c7882 (diff) | |
parent | bb4b86618dc930e0035c5829e336f2606d140ada (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qwindowscodec.cpp | 8 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 6 | ||||
-rw-r--r-- | src/corelib/global/qversiontagging.h | 4 | ||||
-rw-r--r-- | src/corelib/io/qprocess.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qcore_mac_objc.mm | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 25 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_winrt.cpp | 31 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs_impl.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qwineventnotifier.h | 4 | ||||
-rw-r--r-- | src/corelib/thread/qatomic.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 4 |
14 files changed, 84 insertions, 24 deletions
diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp index 74c2f75d2b..b802ab7249 100644 --- a/src/corelib/codecs/qwindowscodec.cpp +++ b/src/corelib/codecs/qwindowscodec.cpp @@ -214,10 +214,12 @@ QByteArray QWindowsLocalCodec::convertFromUnicode(const QChar *ch, int uclen, Co 0, 0, 0, &used_def)); // and try again... } else { + // Fail. Probably can't happen in fact (dwFlags is 0). #ifndef QT_NO_DEBUG - // Fail. - qWarning("WideCharToMultiByte: Cannot convert multibyte text (error %d): %s (UTF-8)", - r, QString(ch, uclen).toLocal8Bit().data()); + // Can't use qWarning(), as it'll recurse to handle %ls + fprintf(stderr, + "WideCharToMultiByte: Cannot convert multibyte text (error %d): %ls\n", + r, reinterpret_cast<const wchar_t*>(QString(ch, uclen).utf16())); #endif break; } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5e2d7b7c1a..6ca2ecff91 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1998,6 +1998,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() #define pGetModuleHandle GetModuleHandleW #endif +#ifndef Q_OS_WINCE HMODULE ntdll = pGetModuleHandle(L"ntdll.dll"); if (Q_UNLIKELY(!ntdll)) return result; @@ -2017,6 +2018,9 @@ static inline OSVERSIONINFOEX determineWinOsVersion() // GetVersionEx() has been deprecated in Windows 8.1 and will return // only Windows 8 from that version on, so use the kernel API function. pRtlGetVersion((LPOSVERSIONINFO) &result); // always returns STATUS_SUCCESS +#else // !Q_OS_WINCE + GetVersionEx(&result); +#endif return result; } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 235bae89af..a72bdb4d59 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -585,10 +585,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max # define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \ QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA) -QT_END_NAMESPACE -Q_FORWARD_DECLARE_OBJC_CLASS(NSAutoreleasePool); -QT_BEGIN_NAMESPACE - // Implemented in qcore_mac_objc.mm class Q_CORE_EXPORT QMacAutoReleasePool { @@ -597,7 +593,7 @@ public: ~QMacAutoReleasePool(); private: Q_DISABLE_COPY(QMacAutoReleasePool) - NSAutoreleasePool *pool; + void *pool; }; #endif // Q_OS_MAC diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h index ef3da7c658..1e276dc3e0 100644 --- a/src/corelib/global/qversiontagging.h +++ b/src/corelib/global/qversiontagging.h @@ -64,9 +64,9 @@ QT_BEGIN_NAMESPACE // don't make tags in QtCore, bootstrapped systems or if the user asked not to #elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID) # if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL)) -# if defined(Q_PROCESSOR_X86_64) // x86-64 or x32 +# if defined(Q_PROCESSOR_X86_64) && QT_POINTER_SIZE == 8 // x86-64 64-bit # define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n" -# else // x86 +# else // x86 or x86-64 32-bit (x32) # define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n" # endif # define QT_VERSION_TAG(sym) \ diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 0a0fef4cd8..854db31a79 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -112,11 +112,13 @@ QT_BEGIN_NAMESPACE \macro QT_NO_PROCESS_COMBINED_ARGUMENT_START \relates QProcess - Disables the QProcess::start() overload taking a single string. + Disables the + \l {QProcess::start(const QString &, OpenMode)}{QProcess::start()} + overload taking a single string. In most cases where it is used, the user intends for the first argument to be treated atomically as per the other overload. - \sa QProcess::start() + \sa QProcess::start(const QString &command, OpenMode mode) */ /*! @@ -2543,7 +2545,7 @@ bool QProcess::startDetached(const QString &program, After the \a command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list. - \sa start() + \sa start(const QString &command, OpenMode mode) */ bool QProcess::startDetached(const QString &command) { diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 18eaea7e21..fda7d59619 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1052,7 +1052,7 @@ inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QU if (colonIndex == end - 1) { // found a colon but no digits after it - setError(PortEmptyError, auth, colonIndex + 1); + port = -1; } else if (uint(colonIndex) < uint(end)) { unsigned long x = 0; for (int i = colonIndex + 1; i < end; ++i) { @@ -1182,7 +1182,7 @@ inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions o } else { // this is either an IPv4Address or a reg-name // if it is a reg-name, it is already stored in Unicode form - if (options == QUrl::EncodeUnicode) + if (options & QUrl::EncodeUnicode && !(options & 0x4000000)) appendTo += qt_ACE_do(host, ToAceOnly, AllowLeadingDot); else appendTo += host; diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index a923d83bcf..de491dd43d 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -156,7 +156,7 @@ QMacAutoReleasePool::~QMacAutoReleasePool() // Drain behaves the same as release, with the advantage that // if we're ever used in a garbage-collected environment, the // drain acts as a hint to the garbage collector to collect. - [pool drain]; + [static_cast<NSAutoreleasePool*>(pool) drain]; } // ------------------------------------------------------------------------- diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 4d7aa83c43..166e509635 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -316,7 +316,10 @@ static void resolveTimerAPI() QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), - wakeUps(0), activateNotifiersPosted(false) + wakeUps(0) +#ifndef Q_OS_WINCE + , activateNotifiersPosted(false) +#endif { resolveTimerAPI(); } @@ -398,9 +401,11 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSockNot *sn = dict ? dict->value(wp) : 0; if (sn) { +#ifndef Q_OS_WINCE d->doWsaAsyncSelect(sn->fd, 0); d->active_fd[sn->fd].selected = false; d->postActivateSocketNotifiers(); +#endif if (type < 3) { QEvent event(QEvent::SockAct); QCoreApplication::sendEvent(sn->obj, &event); @@ -411,6 +416,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } } return 0; +#ifndef Q_OS_WINCE } else if (message == WM_QT_ACTIVATENOTIFIERS) { Q_ASSERT(d != 0); @@ -425,6 +431,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } d->activateNotifiersPosted = false; return 0; +#endif // !Q_OS_WINCE } 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 @@ -665,11 +672,13 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event) WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event); } +#ifndef Q_OS_WINCE void QEventDispatcherWin32Private::postActivateSocketNotifiers() { if (!activateNotifiersPosted) activateNotifiersPosted = PostMessage(internalHwnd, WM_QT_ACTIVATENOTIFIERS, 0, 0); } +#endif // !Q_OS_WINCE void QEventDispatcherWin32::createInternalHwnd() { @@ -927,16 +936,22 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); +#ifndef Q_OS_WINCE if (sd.selected) { d->doWsaAsyncSelect(sockfd, 0); sd.selected = false; } +#endif // !Q_OS_WINCE sd.event |= event; } else { d->active_fd.insert(sockfd, QSockFd(event)); } +#ifndef Q_OS_WINCE d->postActivateSocketNotifiers(); +#else + d->doWsaAsyncSelect(sockfd, event); +#endif } void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) @@ -965,6 +980,7 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); +#ifndef Q_OS_WINCE if (sd.selected) d->doWsaAsyncSelect(sockfd, 0); const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; @@ -975,6 +991,13 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier sd.selected = false; d->postActivateSocketNotifiers(); } +#else + const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; + sd.event ^= event[type]; + d->doWsaAsyncSelect(sockfd, sd.event); + if (sd.event == 0) + d->active_fd.erase(it); +#endif // !Q_OS_WINCE } QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except }; diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index d745f16975..a87b56cd38 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -185,9 +185,11 @@ public: QSNDict sn_write; QSNDict sn_except; QSFDict active_fd; +#ifndef Q_OS_WINCE bool activateNotifiersPosted; - void doWsaAsyncSelect(int socket, long event); void postActivateSocketNotifiers(); +#endif + void doWsaAsyncSelect(int socket, long event); QList<QWinEventNotifier *> winEventNotifierList; void activateEventNotifier(QWinEventNotifier * wen); diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp index a6f61afc90..2ffcf03eb2 100644 --- a/src/corelib/kernel/qeventdispatcher_winrt.cpp +++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp @@ -56,6 +56,7 @@ using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; using namespace ABI::Windows::System::Threading; using namespace ABI::Windows::Foundation; +using namespace ABI::Windows::Foundation::Collections; using namespace ABI::Windows::UI::Core; using namespace ABI::Windows::ApplicationModel::Core; @@ -185,8 +186,34 @@ HRESULT QEventDispatcherWinRT::runOnXamlThread(const std::function<HRESULT ()> & ComPtr<ICoreWindow> window; hr = view->get_CoreWindow(&window); Q_ASSERT_SUCCEEDED(hr); - hr = window->get_Dispatcher(&dispatcher); - Q_ASSERT_SUCCEEDED(hr); + if (!window) { + // In case the application is launched via activation + // there might not be a main view (eg ShareTarget). + // Hence iterate through the available views and try to find + // a dispatcher in there + ComPtr<IVectorView<CoreApplicationView*>> appViews; + hr = application->get_Views(&appViews); + Q_ASSERT_SUCCEEDED(hr); + quint32 count; + hr = appViews->get_Size(&count); + Q_ASSERT_SUCCEEDED(hr); + for (quint32 i = 0; i < count; ++i) { + hr = appViews->GetAt(i, &view); + Q_ASSERT_SUCCEEDED(hr); + hr = view->get_CoreWindow(&window); + Q_ASSERT_SUCCEEDED(hr); + if (window) { + hr = window->get_Dispatcher(&dispatcher); + Q_ASSERT_SUCCEEDED(hr); + if (dispatcher) + break; + } + } + Q_ASSERT(dispatcher); + } else { + hr = window->get_Dispatcher(&dispatcher); + Q_ASSERT_SUCCEEDED(hr); + } } HRESULT hr; diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 2da76e1a4e..6ef83a6eb5 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -497,7 +497,7 @@ namespace QtPrivate { template <typename, typename, typename, typename> struct FunctorCall; template <int... II, typename... SignalArgs, typename R, typename Function> struct FunctorCall<IndexesList<II...>, List<SignalArgs...>, R, Function> { - static void call(Function f, void **arg) { + static void call(Function &f, void **arg) { f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]); } }; diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h index ad712b20a4..f17fa059a1 100644 --- a/src/corelib/kernel/qwineventnotifier.h +++ b/src/corelib/kernel/qwineventnotifier.h @@ -54,8 +54,8 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject typedef Qt::HANDLE HANDLE; public: - explicit QWinEventNotifier(QObject *parent = 0); - explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = 0); + explicit QWinEventNotifier(QObject *parent = Q_NULLPTR); + explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = Q_NULLPTR); ~QWinEventNotifier(); void setHandle(HANDLE hEvent); diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 23e816af64..ccb0ee6923 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -1289,7 +1289,7 @@ /*! \fn T *QAtomicPointer::loadAcquire() const - Atomically loads the value of this QAtomicPointerusing the "Acquire" memory + Atomically loads the value of this QAtomicPointer using the "Acquire" memory ordering. The value is not modified in any way, but note that there's no guarantee that it remains so. diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 9801878bdc..f84d733db0 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -640,6 +640,8 @@ Q_INLINE_TEMPLATE void QMap<Key, T>::clear() *this = QMap<Key, T>(); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wreturn-stack-address") template <class Key, class T> Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefaultValue) const @@ -648,6 +650,8 @@ Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefault return n ? n->value : adefaultValue; } +QT_WARNING_POP + template <class Key, class T> Q_INLINE_TEMPLATE const T QMap<Key, T>::operator[](const Key &akey) const { |