Eliminate a constant from qtimezoneprivate_win.cpp
Its MIN_YEAR was duplicating what's now provided by QDateTime::YearRange::First, so use that instead. In the process, tidy up an over-long line. Change-Id: I109f5435f63cb5cc97d54529a172b640f919dec0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
28088a3d74
commit
b9021ed1f7
@ -70,7 +70,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
static const wchar_t tzRegPath[] = LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones)";
|
static const wchar_t tzRegPath[] = LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones)";
|
||||||
static const wchar_t currTzRegPath[] = LR"(SYSTEM\CurrentControlSet\Control\TimeZoneInformation)";
|
static const wchar_t currTzRegPath[] = LR"(SYSTEM\CurrentControlSet\Control\TimeZoneInformation)";
|
||||||
|
|
||||||
constexpr qint64 MIN_YEAR = -292275056LL;
|
|
||||||
constexpr qint64 MSECS_PER_DAY = 86400000LL;
|
constexpr qint64 MSECS_PER_DAY = 86400000LL;
|
||||||
constexpr qint64 JULIAN_DAY_FOR_EPOCH = 2440588LL; // result of julianDayFromDate(1970, 1, 1)
|
constexpr qint64 JULIAN_DAY_FOR_EPOCH = 2440588LL; // result of julianDayFromDate(1970, 1, 1)
|
||||||
|
|
||||||
@ -487,9 +486,10 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
const auto endYear = dynamicKey.dwordValue(L"LastEntry");
|
const auto endYear = dynamicKey.dwordValue(L"LastEntry");
|
||||||
for (int year = int(startYear.first); year <= int(endYear.first); ++year) {
|
for (int year = int(startYear.first); year <= int(endYear.first); ++year) {
|
||||||
bool ruleOk;
|
bool ruleOk;
|
||||||
QWinTransitionRule rule = readRegistryRule(dynamicKey,
|
QWinTransitionRule rule =
|
||||||
reinterpret_cast<LPCWSTR>(QString::number(year).utf16()),
|
readRegistryRule(dynamicKey,
|
||||||
&ruleOk);
|
reinterpret_cast<LPCWSTR>(QString::number(year).utf16()),
|
||||||
|
&ruleOk);
|
||||||
if (ruleOk
|
if (ruleOk
|
||||||
// Don't repeat a recurrent rule:
|
// Don't repeat a recurrent rule:
|
||||||
&& (m_tranRules.isEmpty()
|
&& (m_tranRules.isEmpty()
|
||||||
@ -502,7 +502,8 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
"this may cause mistakes for %s from %d",
|
"this may cause mistakes for %s from %d",
|
||||||
ianaId.constData(), year);
|
ianaId.constData(), year);
|
||||||
}
|
}
|
||||||
rule.startYear = m_tranRules.isEmpty() ? MIN_YEAR : year;
|
rule.startYear =
|
||||||
|
m_tranRules.isEmpty() ? int(QDateTime::YearRange::First) : year;
|
||||||
m_tranRules.append(rule);
|
m_tranRules.append(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,7 +511,7 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
// No dynamic data so use the base data
|
// No dynamic data so use the base data
|
||||||
bool ruleOk;
|
bool ruleOk;
|
||||||
QWinTransitionRule rule = readRegistryRule(baseKey, L"TZI", &ruleOk);
|
QWinTransitionRule rule = readRegistryRule(baseKey, L"TZI", &ruleOk);
|
||||||
rule.startYear = MIN_YEAR;
|
rule.startYear = int(QDateTime::YearRange::First);
|
||||||
if (ruleOk)
|
if (ruleOk)
|
||||||
m_tranRules.append(rule);
|
m_tranRules.append(rule);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user