Fix some mis-guided fall-throughs #ifdef QT_BOOTSTRAPPED.

A switch had a case whose body was in a #ifndef; when that got elided,
this case fell through into an entirely misguided case.  Give the #if
a #else clause so that it break;s in the defined case.  Code review
revealed another, then I searched for more following the same pattern.

Change-Id: I57fb59b6c8d349604f3fc6c8b1d424fb3c775d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2016-01-18 12:40:41 +01:00
parent 19866d8861
commit 1185c28f2f

View File

@ -2697,10 +2697,11 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const
}
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
#ifdef QT_BOOTSTRAPPED
break;
#else
return zoneMSecsToEpochMSecs(m_msecs, m_timeZone);
#endif
break;
}
Q_UNREACHABLE();
return 0;
@ -3197,7 +3198,9 @@ QString QDateTime::timeZoneAbbreviation() const
case Qt::OffsetFromUTC:
return QTimeZonePrivate::utcQString() + toOffsetString(Qt::ISODate, d->m_offsetFromUtc);
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
#ifdef QT_BOOTSTRAPPED
break;
#else
return d->m_timeZone.d->abbreviation(d->toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
@ -3228,7 +3231,9 @@ bool QDateTime::isDaylightTime() const
case Qt::OffsetFromUTC:
return false;
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
#ifdef QT_BOOTSTRAPPED
break;
#else
return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
@ -4820,10 +4825,8 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
out << (qint8)QDateTimePrivate::OffsetFromUTC;
break;
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
out << (qint8)QDateTimePrivate::TimeZone;
break;
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime:
out << (qint8)QDateTimePrivate::LocalUnknown;
break;
@ -4896,10 +4899,11 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
spec = Qt::OffsetFromUTC;
break;
case QDateTimePrivate::TimeZone:
#ifndef QT_BOOTSTRAPPED
spec = Qt::TimeZone;
#ifndef QT_BOOTSTRAPPED
// FIXME: need to use a different constructor !
#endif
break;
#endif // QT_BOOTSTRAPPED
case QDateTimePrivate::LocalUnknown:
case QDateTimePrivate::LocalStandard:
case QDateTimePrivate::LocalDST:
@ -4955,8 +4959,8 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
dbg << ' ' << date.timeZone().id();
break;
#endif // QT_BOOTSTRAPPED
break;
case Qt::LocalTime:
break;
}