summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-04 01:00:07 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-04 01:00:07 +0100
commitd025c1a75f722f3adfd77f8d7f887e754c925d17 (patch)
tree22efcb332a975652cbde1db81e15b844c4007137 /src/corelib
parent2ed59f0d42d2817a5855be167f5e3ccf23563e39 (diff)
parentdc7fa56948a2a7953f645c7f9d7237925b3f9abe (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qvariant.cpp4
-rw-r--r--src/corelib/time/qdatetimeparser.cpp12
-rw-r--r--src/corelib/time/qtimezoneprivate_mac.mm36
3 files changed, 26 insertions, 26 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 705cae6cf4..762a761026 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2577,8 +2577,8 @@ void QVariant::save(QDataStream &s) const
} else if (typeId >= QMetaType::QKeySequence && typeId <= QMetaType::QQuaternion) {
// and as a result these types received lower ids too
typeId +=1;
- } else if (typeId == QMetaType::QPolygonF) {
- // This existed in Qt 4 only as a custom type
+ } else if (typeId == QMetaType::QPolygonF || typeId == QMetaType::QUuid) {
+ // These existed in Qt 4 only as a custom type
typeId = 127;
fakeUserType = true;
}
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 70d6f280bf..2501bbaab7 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -369,13 +369,6 @@ static QString unquote(const QStringRef &str)
}
return ret;
}
-/*!
- \internal
-
- Parses the format \a newFormat. If successful, returns \c true and
- sets up the format. Else keeps the old format and returns \c false.
-
-*/
static inline int countRepeat(const QString &str, int index, int maxCount)
{
@@ -394,7 +387,12 @@ static inline void appendSeparator(QStringList *list, const QString &string, int
list->append(lastQuote >= from ? unquote(separator) : separator.toString());
}
+/*!
+ \internal
+ Parses the format \a newFormat. If successful, returns \c true and sets up
+ the format. Else keeps the old format and returns \c false.
+*/
bool QDateTimeParser::parseFormat(const QString &newFormat)
{
const QLatin1Char quote('\'');
diff --git a/src/corelib/time/qtimezoneprivate_mac.mm b/src/corelib/time/qtimezoneprivate_mac.mm
index 4509e316f9..1fb48a31d3 100644
--- a/src/corelib/time/qtimezoneprivate_mac.mm
+++ b/src/corelib/time/qtimezoneprivate_mac.mm
@@ -60,22 +60,24 @@ QT_BEGIN_NAMESPACE
// Create the system default time zone
QMacTimeZonePrivate::QMacTimeZonePrivate()
- : m_nstz(0)
{
- init(systemTimeZoneId());
+ // Reset the cached system tz then instantiate it:
+ [NSTimeZone resetSystemTimeZone];
+ m_nstz = [NSTimeZone.systemTimeZone retain];
+ Q_ASSERT(m_nstz);
+ m_id = QString::fromNSString(m_nstz.name).toUtf8();
}
// Create a named time zone
QMacTimeZonePrivate::QMacTimeZonePrivate(const QByteArray &ianaId)
- : m_nstz(0)
+ : m_nstz(nil)
{
init(ianaId);
}
QMacTimeZonePrivate::QMacTimeZonePrivate(const QMacTimeZonePrivate &other)
- : QTimeZonePrivate(other), m_nstz(0)
+ : QTimeZonePrivate(other), m_nstz([other.m_nstz copy])
{
- m_nstz = [other.m_nstz copy];
}
QMacTimeZonePrivate::~QMacTimeZonePrivate()
@@ -109,7 +111,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
QString QMacTimeZonePrivate::comment() const
{
- return QString::fromNSString([m_nstz description]);
+ return QString::fromNSString(m_nstz.description);
}
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
@@ -212,7 +214,7 @@ bool QMacTimeZonePrivate::hasTransitions() const
// TODO Not sure what is returned in event of no transitions, assume will be before requested date
NSDate *epoch = [NSDate dateWithTimeIntervalSince1970:0];
const NSDate *date = [m_nstz nextDaylightSavingTimeTransitionAfterDate:epoch];
- const bool result = ([date timeIntervalSince1970] > [epoch timeIntervalSince1970]);
+ const bool result = (date.timeIntervalSince1970 > epoch.timeIntervalSince1970);
return result;
}
@@ -222,7 +224,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0;
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds];
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
- const NSTimeInterval nextSecs = [nextDate timeIntervalSince1970];
+ const NSTimeInterval nextSecs = nextDate.timeIntervalSince1970;
if (nextDate == nil || nextSecs <= seconds) {
[nextDate release];
return invalidData();
@@ -248,7 +250,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs];
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
if (nextDate != nil
- && (tranSecs = [nextDate timeIntervalSince1970]) < endSecs) {
+ && (tranSecs = nextDate.timeIntervalSince1970) < endSecs) {
// There's a transition within the last year before endSecs:
nextSecs = tranSecs;
} else {
@@ -257,7 +259,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
if (nextDate != nil) {
NSTimeInterval lateSecs = nextSecs;
- nextSecs = [nextDate timeIntervalSince1970];
+ nextSecs = nextDate.timeIntervalSince1970;
Q_ASSERT(nextSecs <= endSecs - year || nextSecs == tranSecs);
/*
We're looking at the first ever transition for our zone, at
@@ -283,8 +285,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
NSTimeInterval middle = nextSecs / 2 + lateSecs / 2;
NSDate *split = [NSDate dateWithTimeIntervalSince1970:middle];
split = [m_nstz nextDaylightSavingTimeTransitionAfterDate:split];
- if (split != nil
- && (tranSecs = [split timeIntervalSince1970]) < endSecs) {
+ if (split != nil && (tranSecs = split.timeIntervalSince1970) < endSecs) {
nextDate = split;
nextSecs = tranSecs;
} else {
@@ -301,7 +302,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
while (nextDate != nil && nextSecs < endSecs) {
prevSecs = nextSecs;
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
- nextSecs = [nextDate timeIntervalSince1970];
+ nextSecs = nextDate.timeIntervalSince1970;
if (nextSecs <= prevSecs) // presumably no later data available
break;
}
@@ -316,18 +317,19 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
{
// Reset the cached system tz then return the name
[NSTimeZone resetSystemTimeZone];
- return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8();
+ Q_ASSERT(NSTimeZone.systemTimeZone);
+ return QString::fromNSString(NSTimeZone.systemTimeZone.name).toUtf8();
}
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
{
- NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator];
- QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
+ NSEnumerator *enumerator = NSTimeZone.knownTimeZoneNames.objectEnumerator;
+ QByteArray tzid = QString::fromNSString(enumerator.nextObject).toUtf8();
QList<QByteArray> list;
while (!tzid.isEmpty()) {
list << tzid;
- tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
+ tzid = QString::fromNSString(enumerator.nextObject).toUtf8();
}
std::sort(list.begin(), list.end());