summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/kernel.pri3
-rw-r--r--src/corelib/kernel/qcore_unix.cpp14
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h14
-rw-r--r--src/corelib/kernel/qelapsedtimer.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_winrt.cpp11
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h10
-rw-r--r--src/corelib/kernel/qvariant.cpp4
7 files changed, 32 insertions, 26 deletions
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 7799113d30..61d0f2bdf1 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -151,9 +151,6 @@ unix|integrity {
kernel/qtimerinfo_unix_p.h
qtConfig(poll_select): SOURCES += kernel/qpoll.cpp
- qtConfig(poll_poll): DEFINES += QT_HAVE_POLL
- qtConfig(poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL
- qtConfig(poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS
qtConfig(glib) {
SOURCES += \
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 2042964427..686143f8c7 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -38,6 +38,7 @@
**
****************************************************************************/
+#include <QtCore/private/qglobal_p.h>
#include "qcore_unix_p.h"
#include "qelapsedtimer.h"
@@ -49,9 +50,8 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLLTS)
-# define ppoll pollts
-# define QT_HAVE_PPOLL
+#if QT_CONFIG(poll_pollts)
+# define ppoll pollts
#endif
static inline bool time_update(struct timespec *tv, const struct timespec &start,
@@ -64,7 +64,7 @@ static inline bool time_update(struct timespec *tv, const struct timespec &start
return tv->tv_sec >= 0;
}
-#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLL)
+#if QT_CONFIG(poll_poll)
static inline int timespecToMillisecs(const struct timespec *ts)
{
return (ts == NULL) ? -1 :
@@ -77,9 +77,9 @@ int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts);
static inline int qt_ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts)
{
-#if defined(QT_HAVE_PPOLL)
- return ::ppoll(fds, nfds, timeout_ts, Q_NULLPTR);
-#elif defined(QT_HAVE_POLL)
+#if QT_CONFIG(poll_ppoll) || QT_CONFIG(poll_pollts)
+ return ::ppoll(fds, nfds, timeout_ts, nullptr);
+#elif QT_CONFIG(poll_poll)
return ::poll(fds, nfds, timespecToMillisecs(timeout_ts));
#else
return qt_poll(fds, nfds, timeout_ts);
diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h
index 3b97b89359..aa0f735fcc 100644
--- a/src/corelib/kernel/qdeadlinetimer.h
+++ b/src/corelib/kernel/qdeadlinetimer.h
@@ -62,7 +62,7 @@ public:
: t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
- void swap(QDeadlineTimer &other)
+ void swap(QDeadlineTimer &other) Q_DECL_NOTHROW
{ qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
Q_DECL_CONSTEXPR bool isForever() const Q_DECL_NOTHROW
@@ -88,17 +88,17 @@ public:
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
- friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return d1.t1 == d2.t1 && d1.t2 == d2.t2; }
- friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return !(d1 == d2); }
- friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); }
- friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return d1 == d2 || d1 < d2; }
- friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return d2 < d1; }
- friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
+ friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
{ return !(d1 < d2); }
friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp
index 5e9d1317ac..e578b5b8b3 100644
--- a/src/corelib/kernel/qelapsedtimer.cpp
+++ b/src/corelib/kernel/qelapsedtimer.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
\snippet qelapsedtimer/main.cpp 2
- It is often more convenient to use \ref{QDeadlineTimer} in this case, which
+ It is often more convenient to use \l{QDeadlineTimer} in this case, which
counts towards a timeout in the future instead of tracking elapsed time.
\section1 Reference Clocks
diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp
index ff397fc750..33753ed507 100644
--- a/src/corelib/kernel/qeventdispatcher_winrt.cpp
+++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp
@@ -166,7 +166,7 @@ private:
timerIdToHandle.insert(id, handle);
timerIdToCancelHandle.insert(id, cancelHandle);
}
- timerIdToObject.insert(id, obj);
+
const quint64 targetTime = qt_msectime() + interval;
const WinRTTimerInfo info(id, interval, type, obj, targetTime);
QMutexLocker locker(&timerInfoLock);
@@ -587,15 +587,18 @@ bool QEventDispatcherWinRT::event(QEvent *e)
break;
info.inEvent = true;
+ QObject *timerObj = d->timerIdToObject.value(id);
locker.unlock();
QTimerEvent te(id);
- QCoreApplication::sendEvent(d->timerIdToObject.value(id), &te);
+ QCoreApplication::sendEvent(timerObj, &te);
locker.relock();
- // The timer might have been removed in the meanwhile
- if (id >= d->timerInfos.size())
+ // The timer might have been removed in the meanwhile. If the timer was
+ // the last one in the list, id is bigger than the list's size.
+ // Otherwise, the id will just be set to INVALID_TIMER_ID.
+ if (id >= d->timerInfos.size() || info.timerId == INVALID_TIMER_ID)
break;
if (info.interval == 0 && info.inEvent) {
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index e94e713e1f..79c9c8303e 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -229,8 +229,14 @@ namespace QtPrivate {
(std::is_floating_point<From>::value && std::is_integral<To>::value) ||
(std::is_floating_point<From>::value && std::is_floating_point<To>::value && sizeof(From) > sizeof(To)) ||
((std::is_integral<From>::value || std::is_enum<From>::value) && std::is_floating_point<To>::value) ||
- (std::is_integral<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || std::is_signed<From>::value != std::is_signed<To>::value)) ||
- (std::is_enum<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || IsEnumUnderlyingTypeSigned<From>::value != std::is_signed<To>::value))
+ (std::is_integral<From>::value && std::is_integral<To>::value
+ && (sizeof(From) > sizeof(To)
+ || (std::is_signed<From>::value ? !std::is_signed<To>::value
+ : (std::is_signed<To>::value && sizeof(From) == sizeof(To))))) ||
+ (std::is_enum<From>::value && std::is_integral<To>::value
+ && (sizeof(From) > sizeof(To)
+ || (IsEnumUnderlyingTypeSigned<From>::value ? !std::is_signed<To>::value
+ : (std::is_signed<To>::value && sizeof(From) == sizeof(To)))))
>
{
};
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 06a57a94a6..4a4d5b9294 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -319,7 +319,7 @@ template<typename TInput, typename LiteralWrapper>
inline bool qt_convertToBool(const QVariant::Private *const d)
{
TInput str = v_cast<TInput>(d)->toLower();
- return !(str == LiteralWrapper("0") || str == LiteralWrapper("false") || str.isEmpty());
+ return !(str.isEmpty() || str == LiteralWrapper("0") || str == LiteralWrapper("false"));
}
/*!
@@ -700,7 +700,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
bool *b = static_cast<bool *>(result);
switch(d->type) {
case QVariant::ByteArray:
- *b = qt_convertToBool<QByteArray, QByteArray>(d);
+ *b = qt_convertToBool<QByteArray, const char*>(d);
break;
case QVariant::String:
*b = qt_convertToBool<QString, QLatin1String>(d);