summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-18 09:29:17 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-20 08:00:26 +0200
commite32f1a4d61f0c55d066a43657ad607131be8ca34 (patch)
tree81ea388722187e1650b2c2b2d9c22eafae5c0527 /src/corelib
parentfdb956a3ede6cb0a25112c1e1af6c93fd2051de1 (diff)
parentee2eed350f95285b65e3dd9647e5f366e16fd5a4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qcompilerdetection.h22
-rw-r--r--src/corelib/global/qglobal.cpp42
-rw-r--r--src/corelib/global/qsysinfo.h8
-rw-r--r--src/corelib/global/qsystemdetection.h27
-rw-r--r--src/corelib/io/qfileselector.cpp6
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h3
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp59
-rw-r--r--src/corelib/kernel/qfunctions_winrt.h3
-rw-r--r--src/corelib/kernel/qmetaobject.h2
-rw-r--r--src/corelib/kernel/qppsobject.cpp4
-rw-r--r--src/corelib/thread/qthread_unix.cpp55
-rw-r--r--src/corelib/tools/qstring.cpp1
13 files changed, 163 insertions, 71 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 669ab136ac..33e42a944d 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1073,16 +1073,18 @@
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
#endif
-#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR constexpr
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR constexpr
-#elif defined Q_COMPILER_CONSTEXPR
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR const
+#if defined Q_COMPILER_CONSTEXPR
+# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR constexpr
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR constexpr
+# else
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR const
+# endif
#else
# define Q_DECL_CONSTEXPR
# define Q_DECL_RELAXED_CONSTEXPR
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6ca2ecff91..d87e4da9f7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1187,6 +1187,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_10_9 OS X 10.9
\value MV_10_10 OS X 10.10
\value MV_10_11 OS X 10.11
+ \value MV_10_12 macOS 10.12
\value MV_Unknown An unknown and currently unsupported platform
\value MV_CHEETAH Apple codename for MV_10_0
@@ -1201,6 +1202,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_MAVERICKS Apple codename for MV_10_9
\value MV_YOSEMITE Apple codename for MV_10_10
\value MV_ELCAPITAN Apple codename for MV_10_11
+ \value MV_SIERRA Apple codename for MV_10_12
\value MV_IOS iOS (any)
\value MV_IOS_4_3 iOS 4.3
@@ -1216,6 +1218,10 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_IOS_8_3 iOS 8.3
\value MV_IOS_8_4 iOS 8.4
\value MV_IOS_9_0 iOS 9.0
+ \value MV_IOS_9_1 iOS 9.1
+ \value MV_IOS_9_2 iOS 9.2
+ \value MV_IOS_9_3 iOS 9.3
+ \value MV_IOS_10_0 iOS 10.0
\value MV_None Not a Darwin operating system
@@ -1230,10 +1236,24 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
+ \macro Q_OS_MAC
+ \relates <QtGlobal>
+
+ Deprecated synonym for \c Q_OS_DARWIN. Do not use.
+ */
+
+/*!
\macro Q_OS_OSX
\relates <QtGlobal>
- Defined on OS X.
+ Deprecated synonym for \c Q_OS_MACOS. Do not use.
+ */
+
+/*!
+ \macro Q_OS_MACOS
+ \relates <QtGlobal>
+
+ Defined on macOS.
*/
/*!
@@ -2648,10 +2668,12 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X
+ \b{Darwin, OS X and iOS note}: this function returns "macos" for macOS
systems, "ios" for iOS systems and "darwin" in case the system could not be
determined.
+ \b{OS X note}: this function returns "osx" for versions of macOS prior to 10.12.
+
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2683,8 +2705,11 @@ QString QSysInfo::productType()
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
-#elif defined(Q_OS_OSX)
- return QStringLiteral("osx");
+#elif defined(Q_OS_MACOS)
+ const QAppleOperatingSystemVersion version = qt_apple_os_version();
+ if (version.major == 10 && version.minor < 12)
+ return QStringLiteral("osx");
+ return QStringLiteral("macos");
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
@@ -2766,7 +2791,7 @@ QString QSysInfo::prettyProductName()
{
#if defined(Q_OS_IOS)
return QLatin1String("iOS ") + productVersion();
-#elif defined(Q_OS_OSX)
+#elif defined(Q_OS_MACOS)
// get the known codenames
const char *basename = 0;
switch (int(MacintoshVersion)) {
@@ -2800,12 +2825,15 @@ QString QSysInfo::prettyProductName()
case MV_ELCAPITAN:
basename = "OS X El Capitan (";
break;
+ case MV_SIERRA:
+ basename = "macOS Sierra (";
+ break;
}
if (basename)
return QLatin1String(basename) + productVersion() + QLatin1Char(')');
- // a future version of OS X
- return QLatin1String("OS X ") + productVersion();
+ // a future version of macOS
+ return QLatin1String("macOS ") + productVersion();
#elif defined(Q_OS_WINPHONE)
return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
#elif defined(Q_OS_WIN)
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index b74fc80468..d1a4102f29 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -145,6 +145,7 @@ public:
MV_10_9 = Q_MV_OSX(10, 9),
MV_10_10 = Q_MV_OSX(10, 10),
MV_10_11 = Q_MV_OSX(10, 11),
+ MV_10_12 = Q_MV_OSX(10, 12),
/* codenames */
MV_CHEETAH = MV_10_0,
@@ -159,6 +160,7 @@ public:
MV_MAVERICKS = MV_10_9,
MV_YOSEMITE = MV_10_10,
MV_ELCAPITAN = MV_10_11,
+ MV_SIERRA = MV_10_12,
/* iOS */
MV_IOS = 1 << 8,
@@ -174,7 +176,11 @@ public:
MV_IOS_8_2 = Q_MV_IOS(8, 2),
MV_IOS_8_3 = Q_MV_IOS(8, 3),
MV_IOS_8_4 = Q_MV_IOS(8, 4),
- MV_IOS_9_0 = Q_MV_IOS(9, 0)
+ MV_IOS_9_0 = Q_MV_IOS(9, 0),
+ MV_IOS_9_1 = Q_MV_IOS(9, 1),
+ MV_IOS_9_2 = Q_MV_IOS(9, 2),
+ MV_IOS_9_3 = Q_MV_IOS(9, 3),
+ MV_IOS_10_0 = Q_MV_IOS(10, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 1e95d1a2ec..1e852ae538 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -48,7 +48,7 @@
The operating system, must be one of: (Q_OS_x)
DARWIN - Any Darwin system (OS X, iOS, watchOS, tvOS)
- OSX - OS X
+ MACOS - macOS
IOS - iOS
WATCHOS - watchOS
TVOS - tvOS
@@ -115,7 +115,7 @@
# else
# // there is no "real" OS X define (rdar://22640089),
# // assume any non iOS-based platform is OS X for now
-# define Q_OS_OSX
+# define Q_OS_MACOS
# endif
# else
# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
@@ -229,15 +229,16 @@
#ifdef Q_OS_DARWIN64
#define Q_OS_MAC64
#endif
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#define Q_OS_MACX
+#define Q_OS_OSX
#endif
#ifdef Q_OS_DARWIN
# include <Availability.h>
# include <AvailabilityMacros.h>
#
-# ifdef Q_OS_OSX
+# ifdef Q_OS_MACOS
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
# undef __MAC_OS_X_VERSION_MIN_REQUIRED
# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
@@ -266,6 +267,9 @@
# if !defined(__MAC_10_11)
# define __MAC_10_11 101100
# endif
+# if !defined(__MAC_10_12)
+# define __MAC_10_12 101200
+# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
@@ -281,6 +285,9 @@
# if !defined(MAC_OS_X_VERSION_10_11)
# define MAC_OS_X_VERSION_10_11 101100
# endif
+# if !defined(MAC_OS_X_VERSION_10_12)
+# define MAC_OS_X_VERSION_10_12 101200
+# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
@@ -321,6 +328,18 @@
# if !defined(__IPHONE_9_0)
# define __IPHONE_9_0 90000
# endif
+# if !defined(__IPHONE_9_1)
+# define __IPHONE_9_1 90100
+# endif
+# if !defined(__IPHONE_9_2)
+# define __IPHONE_9_2 90200
+# endif
+# if !defined(__IPHONE_9_3)
+# define __IPHONE_9_3 90300
+# endif
+# if !defined(__IPHONE_10_0)
+# define __IPHONE_10_0 100000
+# endif
#endif
#ifdef __LSB_VERSION__
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 4ac12fc9ea..29ef0f937e 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -386,8 +386,12 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
# endif
QString productName = QSysInfo::productType();
+# ifdef Q_OS_MACOS
+ if (productName != QStringLiteral("osx"))
+ ret << QStringLiteral("osx"); // compatibility
+# endif
if (productName != QLatin1String("unknown"))
- ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
+ ret << productName; // "opensuse", "fedora", "macos", "ios", "android"
#endif
return ret;
}
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index fd204b00de..f31ac75425 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1186,8 +1186,6 @@ QByteArray QIODevice::read(qint64 maxSize)
}
/*!
- \overload
-
Reads all remaining data from the device, and returns it as a
byte array.
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 6e59790d5c..f92e418ebf 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -111,7 +111,8 @@ public:
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
bool filterNativeEvent(const QByteArray &eventType, void *message, long *result);
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED bool filterEvent(void *message) { return filterNativeEvent("", message, 0); }
+ QT_DEPRECATED bool filterEvent(void *message)
+ { return filterNativeEvent("", message, Q_NULLPTR); }
#endif
Q_SIGNALS:
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 601733b939..0e2d4e2324 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -55,7 +55,10 @@ QT_BEGIN_NAMESPACE
int appCmdShow = 0;
-#if defined(Q_OS_WINRT)
+// GetModuleFileName only exists for MSVC2015 and upwards for WinRT, meaning
+// Windows 10 (Mobile). Hence take the first argument passed to the
+// QCoreApplication contructor for older versions as a fallback on older platforms.
+#if defined(Q_OS_WINRT) && _MSC_VER < 1900
Q_CORE_EXPORT QString qAppFileName()
{
@@ -67,31 +70,7 @@ QString QCoreApplicationPrivate::appName() const
return QFileInfo(QCoreApplication::arguments().constFirst()).baseName();
}
-#else
-
-Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
-{
- return GetModuleHandle(0);
-}
-
-Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle
-{
- return 0;
-}
-
-Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command
-{
-#if defined(Q_OS_WINCE)
- return appCmdShow;
-#else
- STARTUPINFO startupInfo;
- GetStartupInfo(&startupInfo);
-
- return (startupInfo.dwFlags & STARTF_USESHOWWINDOW)
- ? startupInfo.wShowWindow
- : SW_SHOWDEFAULT;
-#endif
-}
+#else // !(defined(Q_OS_WINRT) && _MSC_VER < 1900)
Q_CORE_EXPORT QString qAppFileName() // get application file name
{
@@ -139,6 +118,34 @@ QString QCoreApplicationPrivate::appName() const
return QFileInfo(qAppFileName()).baseName();
}
+#endif // !(defined(Q_OS_WINRT) && _MSC_VER < 1900)
+
+#ifndef Q_OS_WINRT
+
+Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
+{
+ return GetModuleHandle(0);
+}
+
+Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle
+{
+ return 0;
+}
+
+Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command
+{
+#if defined(Q_OS_WINCE)
+ return appCmdShow;
+#else
+ STARTUPINFO startupInfo;
+ GetStartupInfo(&startupInfo);
+
+ return (startupInfo.dwFlags & STARTF_USESHOWWINDOW)
+ ? startupInfo.wShowWindow
+ : SW_SHOWDEFAULT;
+#endif
+}
+
/*****************************************************************************
qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp
*****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index 4012f8019c..e0777b8df8 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -211,6 +211,9 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
return hr;
+ hr = asyncInfo->Close();
+ if (FAILED(hr))
+ return hr;
return ec;
}
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index f7c60cc309..85ac7e77e4 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -187,7 +187,7 @@ private:
// signature() has been renamed to methodSignature() in Qt 5.
// Warning, that function returns a QByteArray; check the life time if
// you convert to char*.
- char *signature(struct renamedInQt5_warning_checkTheLifeTime * = 0) Q_DECL_EQ_DELETE;
+ char *signature(struct renamedInQt5_warning_checkTheLifeTime * = Q_NULLPTR) Q_DECL_EQ_DELETE;
#endif
static QMetaMethod fromSignalImpl(const QMetaObject *, void **);
diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp
index dbff997c88..30498a380d 100644
--- a/src/corelib/kernel/qppsobject.cpp
+++ b/src/corelib/kernel/qppsobject.cpp
@@ -175,7 +175,7 @@ QPpsAttribute QPpsObjectPrivate::decodeNumber(pps_decoder_t *decoder)
// In order to support more number types, we have to do something stupid because the PPS
// library won't let us work any other way. Basically, we have to probe the encoded type in
// order to try to get exactly what we want.
- long long llValue;
+ int64_t llValue;
double dValue;
int iValue;
QPpsAttribute::Flags flags;
@@ -193,7 +193,7 @@ QPpsAttribute QPpsObjectPrivate::decodeNumber(pps_decoder_t *decoder)
return QPpsAttribute();
}
flags = readFlags(decoder);
- return QPpsAttributePrivate::createPpsAttribute(llValue, flags);
+ return QPpsAttributePrivate::createPpsAttribute(static_cast<long long>(llValue), flags);
default:
qWarning("QPpsObjectPrivate::decodeNumber: pps_decoder_get_int failed");
return QPpsAttribute();
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index e7a31e0b70..deedd61c17 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_THREAD
-Q_STATIC_ASSERT(sizeof(pthread_t) == sizeof(Qt::HANDLE));
+Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE));
enum { ThreadPriorityResetFlag = 0x80000000 };
@@ -210,6 +210,30 @@ static void clear_thread_data()
pthread_setspecific(current_thread_data_key, 0);
}
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, Qt::HANDLE>::Type to_HANDLE(T id)
+{
+ return reinterpret_cast<Qt::HANDLE>(static_cast<intptr_t>(id));
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type from_HANDLE(Qt::HANDLE id)
+{
+ return static_cast<T>(reinterpret_cast<intptr_t>(id));
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, Qt::HANDLE>::Type to_HANDLE(T id)
+{
+ return id;
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, T>::Type from_HANDLE(Qt::HANDLE id)
+{
+ return static_cast<T>(id);
+}
+
void QThreadData::clearCurrentThreadData()
{
clear_thread_data();
@@ -231,7 +255,7 @@ QThreadData *QThreadData::current(bool createIfNecessary)
}
data->deref();
data->isAdopted = true;
- data->threadId = (Qt::HANDLE)pthread_self();
+ data->threadId = to_HANDLE(pthread_self());
if (!QCoreApplicationPrivate::theMainThread)
QCoreApplicationPrivate::theMainThread = data->thread.load();
}
@@ -311,7 +335,7 @@ void *QThreadPrivate::start(void *arg)
thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag));
}
- data->threadId = (Qt::HANDLE)pthread_self();
+ data->threadId = to_HANDLE(pthread_self());
set_thread_data(data);
data->ref();
@@ -328,7 +352,7 @@ void *QThreadPrivate::start(void *arg)
// sets the name of the current thread.
QString objectName = thr->objectName();
- pthread_t thread_id = reinterpret_cast<pthread_t>(data->threadId);
+ pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId);
if (Q_LIKELY(objectName.isEmpty()))
setCurrentThreadName(thread_id, thr->metaObject()->className());
else
@@ -391,7 +415,7 @@ void QThreadPrivate::finish(void *arg)
Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
{
// requires a C cast here otherwise we run into trouble on AIX
- return (Qt::HANDLE)pthread_self();
+ return to_HANDLE(pthread_self());
}
#if defined(QT_LINUXBASE) && !defined(_SC_NPROCESSORS_ONLN)
@@ -617,18 +641,17 @@ void QThread::start(Priority priority)
}
}
- int code =
- pthread_create(reinterpret_cast<pthread_t *>(&d->data->threadId), &attr,
- QThreadPrivate::start, this);
+ pthread_t threadId;
+ int code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);
if (code == EPERM) {
// caller does not have permission to set the scheduling
// parameters/policy
#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING)
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
#endif
- code = pthread_create(reinterpret_cast<pthread_t *>(&d->data->threadId), &attr,
- QThreadPrivate::start, this);
+ code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);
}
+ d->data->threadId = to_HANDLE(threadId);
pthread_attr_destroy(&attr);
@@ -650,7 +673,7 @@ void QThread::terminate()
if (!d->data->threadId)
return;
- int code = pthread_cancel(reinterpret_cast<pthread_t>(d->data->threadId));
+ int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId));
if (code) {
qWarning("QThread::start: Thread termination error: %s",
qPrintable(qt_error_string((code))));
@@ -663,7 +686,7 @@ bool QThread::wait(unsigned long time)
Q_D(QThread);
QMutexLocker locker(&d->mutex);
- if (reinterpret_cast<pthread_t>(d->data->threadId) == pthread_self()) {
+ if (from_HANDLE<pthread_t>(d->data->threadId) == pthread_self()) {
qWarning("QThread::wait: Thread tried to wait on itself");
return false;
}
@@ -705,7 +728,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
int sched_policy;
sched_param param;
- if (pthread_getschedparam(reinterpret_cast<pthread_t>(data->threadId), &sched_policy, &param) != 0) {
+ if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param) != 0) {
// failed to get the scheduling policy, don't bother setting
// the priority
qWarning("QThread::setPriority: Cannot get scheduler parameters");
@@ -721,15 +744,15 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
}
param.sched_priority = prio;
- int status = pthread_setschedparam(reinterpret_cast<pthread_t>(data->threadId), sched_policy, &param);
+ int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);
# ifdef SCHED_IDLE
// were we trying to set to idle priority and failed?
if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) {
// reset to lowest priority possible
- pthread_getschedparam(reinterpret_cast<pthread_t>(data->threadId), &sched_policy, &param);
+ pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param);
param.sched_priority = sched_get_priority_min(sched_policy);
- pthread_setschedparam(reinterpret_cast<pthread_t>(data->threadId), sched_policy, &param);
+ pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);
}
# else
Q_UNUSED(status);
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 85da174366..629a0bc744 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -601,6 +601,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
}
# else
// 32-bit, we can't do MOVQ to load 8 bytes
+ Q_UNUSED(nullmask);
enum { MaxTailLength = 15 };
# endif