summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-06-20 16:45:12 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-06-20 16:45:12 +0200
commit6213b8145772d3dc584907a544f6c46b8cef74e2 (patch)
tree4c1902793bb78511e63c09cbe92f9eda6b3d7237 /src/corelib/kernel
parent75e9c7d6bc662e62e9ce8b641588183992c1e8bf (diff)
parent25739bebba0343a8b35775a073c49f0fba080762 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp tools/configure/configureapp.cpp Change-Id: I3092bd3276af14304b7ab3ae1e1cc05d11cdede0
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcore_unix.cpp2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h18
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/kernel/qmetatype.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_unix.cpp2
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp20
-rw-r--r--src/corelib/kernel/qtranslator.cpp2
-rw-r--r--src/corelib/kernel/qvariant.cpp48
8 files changed, 72 insertions, 26 deletions
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 241658acb1..98e697eb57 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -79,7 +79,7 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
{
if (!orig_timeout) {
// no timeout -> block forever
- register int ret;
+ int ret;
EINTR_LOOP(ret, select(nfds, fdread, fdwrite, fdexcept, 0));
return ret;
}
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index b68146cd6c..8c0589fdc6 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -168,7 +168,7 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- register int fd;
+ int fd;
EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode));
// unknown flags are ignored, so we have no way of verifying if
@@ -191,7 +191,7 @@ static inline int qt_safe_pipe(int pipefd[2], int flags = 0)
Q_ASSERT((flags & ~O_NONBLOCK) == 0);
#endif
- register int ret;
+ int ret;
#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC)
// use pipe2
flags |= O_CLOEXEC;
@@ -223,7 +223,7 @@ static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC
{
Q_ASSERT(flags == FD_CLOEXEC || flags == 0);
- register int ret;
+ int ret;
#ifdef F_DUPFD_CLOEXEC
// use this fcntl
if (flags & FD_CLOEXEC) {
@@ -247,7 +247,7 @@ static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC)
{
Q_ASSERT(flags == FD_CLOEXEC || flags == 0);
- register int ret;
+ int ret;
#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC)
// use dup3
if (flags & FD_CLOEXEC) {
@@ -291,7 +291,7 @@ static inline qint64 qt_safe_write_nosignal(int fd, const void *data, qint64 len
static inline int qt_safe_close(int fd)
{
- register int ret;
+ int ret;
EINTR_LOOP(ret, QT_CLOSE(fd));
return ret;
}
@@ -303,28 +303,28 @@ static inline int qt_safe_close(int fd)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
- register int ret;
+ int ret;
EINTR_LOOP(ret, ::execve(filename, argv, envp));
return ret;
}
static inline int qt_safe_execv(const char *path, char *const argv[])
{
- register int ret;
+ int ret;
EINTR_LOOP(ret, ::execv(path, argv));
return ret;
}
static inline int qt_safe_execvp(const char *file, char *const argv[])
{
- register int ret;
+ int ret;
EINTR_LOOP(ret, ::execvp(file, argv));
return ret;
}
static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
{
- register int ret;
+ int ret;
EINTR_LOOP(ret, ::waitpid(pid, status, options));
return ret;
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 878962ce04..c9f4ab23ec 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -938,7 +938,7 @@ bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiv
if (receiver->d_func()->threadData == this->threadData && extraData) {
// application event filters are only called for objects in the GUI thread
for (int i = 0; i < extraData->eventFilters.size(); ++i) {
- register QObject *obj = extraData->eventFilters.at(i);
+ QObject *obj = extraData->eventFilters.at(i);
if (!obj)
continue;
if (obj->d_func()->threadData != threadData) {
@@ -957,7 +957,7 @@ bool QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *receiver, Q
Q_Q(QCoreApplication);
if (receiver != q && receiver->d_func()->extraData) {
for (int i = 0; i < receiver->d_func()->extraData->eventFilters.size(); ++i) {
- register QObject *obj = receiver->d_func()->extraData->eventFilters.at(i);
+ QObject *obj = receiver->d_func()->extraData->eventFilters.at(i);
if (!obj)
continue;
if (obj->d_func()->threadData != receiver->d_func()->threadData) {
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 6b9fd7d563..35cb589843 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1678,7 +1678,7 @@ struct QMetaTypeIdQObject<T*, /* isPointerToTypeDerivedFromQObject */ true>
template <typename T>
inline int qRegisterMetaTypeStreamOperators()
{
- register int id = qMetaTypeId<T>();
+ int id = qMetaTypeId<T>();
QMetaType::registerStreamOperators(id, QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Save,
QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Load);
return id;
diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp
index 6e2838a8a5..073bd020ba 100644
--- a/src/corelib/kernel/qsystemsemaphore_unix.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp
@@ -212,7 +212,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
operation.sem_op = count;
operation.sem_flg = SEM_UNDO;
- register int res;
+ int res;
EINTR_LOOP(res, semop(semaphore, &operation, 1));
if (-1 == res) {
// If the semaphore was removed be nice and create it and then modifySemaphore again
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 0e33fa697a..f1bbbe5338 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -153,7 +153,7 @@ void QTimerInfoList::timerRepair(const timespec &diff)
{
// repair all timers
for (int i = 0; i < size(); ++i) {
- register QTimerInfo *t = at(i);
+ QTimerInfo *t = at(i);
t->timeout = t->timeout + diff;
}
}
@@ -182,7 +182,7 @@ void QTimerInfoList::timerInsert(QTimerInfo *ti)
{
int index = size();
while (index--) {
- register const QTimerInfo * const t = at(index);
+ const QTimerInfo * const t = at(index);
if (!(ti->timeout < t->timeout))
break;
}
@@ -244,8 +244,8 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime)
//
// The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups.
- register uint interval = uint(t->interval);
- register uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000;
+ uint interval = uint(t->interval);
+ uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000;
Q_ASSERT(interval >= 20);
// Calculate how much we can round and still keep within 5% error
@@ -256,14 +256,14 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime)
if (interval < 50) {
// round to even
// round towards multiples of 50 ms
- register bool roundUp = (msec % 50) >= 25;
+ bool roundUp = (msec % 50) >= 25;
msec >>= 1;
msec |= uint(roundUp);
msec <<= 1;
} else {
// round to multiple of 4
// round towards multiples of 100 ms
- register bool roundUp = (msec % 100) >= 50;
+ bool roundUp = (msec % 100) >= 50;
msec >>= 2;
msec |= uint(roundUp);
msec <<= 2;
@@ -423,7 +423,7 @@ int QTimerInfoList::timerRemainingTime(int timerId)
timespec tm = {0, 0};
for (int i = 0; i < count(); ++i) {
- register QTimerInfo *t = at(i);
+ QTimerInfo *t = at(i);
if (t->id == timerId) {
if (currentTime < t->timeout) {
// time to wait
@@ -509,7 +509,7 @@ bool QTimerInfoList::unregisterTimer(int timerId)
{
// set timer inactive
for (int i = 0; i < count(); ++i) {
- register QTimerInfo *t = at(i);
+ QTimerInfo *t = at(i);
if (t->id == timerId) {
// found it
removeAt(i);
@@ -530,7 +530,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object)
if (isEmpty())
return false;
for (int i = 0; i < count(); ++i) {
- register QTimerInfo *t = at(i);
+ QTimerInfo *t = at(i);
if (t->obj == object) {
// object found
removeAt(i);
@@ -550,7 +550,7 @@ QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObj
{
QList<QAbstractEventDispatcher::TimerInfo> list;
for (int i = 0; i < count(); ++i) {
- register const QTimerInfo * const t = at(i);
+ const QTimerInfo * const t = at(i);
if (t->obj == object) {
list << QAbstractEventDispatcher::TimerInfo(t->id,
(t->timerType == Qt::VeryCoarseTimer
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 9243d093df..903ab2e2cd 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -1084,8 +1084,6 @@ void QTranslatorPrivate::clear()
}
/*!
- \overload translate()
-
Returns the translation for the key (\a context, \a sourceText,
\a disambiguation). If none is found, also tries (\a context, \a
sourceText, ""). If that still fails, returns a null string.
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index a9e7549685..24bf25baea 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -162,6 +162,10 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d)
return qRound64(d->data.f);
case QVariant::Double:
return qRound64(d->data.d);
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QJsonValue:
+ return v_cast<QJsonValue>(d)->toDouble();
+#endif
}
Q_ASSERT(false);
return 0;
@@ -206,12 +210,14 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok)
case QMetaType::Long:
case QMetaType::Float:
case QMetaType::LongLong:
+ case QMetaType::QJsonValue:
return qMetaTypeNumber(d);
case QVariant::ULongLong:
case QVariant::UInt:
case QMetaType::UChar:
case QMetaType::UShort:
case QMetaType::ULong:
+
return qlonglong(qMetaTypeUNumber(d));
}
@@ -240,6 +246,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
case QMetaType::Long:
case QMetaType::Float:
case QMetaType::LongLong:
+ case QMetaType::QJsonValue:
return qulonglong(qMetaTypeNumber(d));
case QVariant::ULongLong:
case QVariant::UInt:
@@ -358,6 +365,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::Url:
*str = v_cast<QUrl>(d)->toString();
break;
+ case QMetaType::QJsonValue:
+ *str = v_cast<QJsonValue>(d)->toString();
+ break;
#endif
case QVariant::Uuid:
*str = v_cast<QUuid>(d)->toString();
@@ -598,6 +608,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QMetaType::ULong:
*b = qMetaTypeUNumber(d) != Q_UINT64_C(0);
break;
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QJsonValue:
+ *b = v_cast<QJsonValue>(d)->toBool();
+ break;
+#endif
default:
*b = false;
return false;
@@ -634,6 +649,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QMetaType::ULong:
*f = double(qMetaTypeUNumber(d));
break;
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QJsonValue:
+ *f = v_cast<QJsonValue>(d)->toDouble();
+ break;
+#endif
default:
*f = 0.0;
return false;
@@ -670,6 +690,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QMetaType::ULong:
*f = float(qMetaTypeUNumber(d));
break;
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QJsonValue:
+ *f = v_cast<QJsonValue>(d)->toDouble();
+ break;
+#endif
default:
*f = 0.0f;
return false;
@@ -2810,6 +2835,29 @@ bool QVariant::canConvert(int targetTypeId) const
if (targetTypeId >= QMetaType::User)
return canConvertMetaObject(currentType, targetTypeId, d.data.o);
+ if (currentType == QMetaType::QJsonValue) {
+ switch (targetTypeId) {
+ case QMetaType::QString:
+ case QMetaType::Bool:
+ case QMetaType::Int:
+ case QMetaType::UInt:
+ case QMetaType::Double:
+ case QMetaType::Float:
+ case QMetaType::ULong:
+ case QMetaType::Long:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ case QMetaType::UShort:
+ case QMetaType::UChar:
+ case QMetaType::Char:
+ case QMetaType::SChar:
+ case QMetaType::Short:
+ return true;
+ default:
+ return false;
+ }
+ }
+
// FIXME It should be LastCoreType intead of Uuid
if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) {
switch (uint(targetTypeId)) {