Tidy nullptr usage

Move away from using 0 as pointer literal.

Done using clang-tidy. This is not complete as
run-clang-tidy can't handle all of qtbase in one go.

Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2019-11-22 14:46:58 +01:00
parent b19220d17f
commit ece0c0a5e7
502 changed files with 4329 additions and 4329 deletions

View File

@ -220,7 +220,7 @@ QUnifiedTimer::QUnifiedTimer() :
QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false), currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false),
startTimersPending(false), stopTimerPending(false), startTimersPending(false), stopTimerPending(false),
slowdownFactor(5.0f), profilerCallback(0), slowdownFactor(5.0f), profilerCallback(nullptr),
driverStartTime(0), temporalDrift(0) driverStartTime(0), temporalDrift(0)
{ {
time.invalidate(); time.invalidate();
@ -922,7 +922,7 @@ qint64 QAnimationDriver::elapsed() const
The default animation driver just spins the timer... The default animation driver just spins the timer...
*/ */
QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer) QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer)
: QAnimationDriver(0), m_unified_timer(timer) : QAnimationDriver(nullptr), m_unified_timer(timer)
{ {
connect(this, SIGNAL(started()), this, SLOT(startTimer())); connect(this, SIGNAL(started()), this, SLOT(startTimer()));
connect(this, SIGNAL(stopped()), this, SLOT(stopTimer())); connect(this, SIGNAL(stopped()), this, SLOT(stopTimer()));
@ -1035,7 +1035,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
\sa QVariantAnimation, QAnimationGroup \sa QVariantAnimation, QAnimationGroup
*/ */
QAbstractAnimation::QAbstractAnimation(QObject *parent) QAbstractAnimation::QAbstractAnimation(QObject *parent)
: QObject(*new QAbstractAnimationPrivate, 0) : QObject(*new QAbstractAnimationPrivate, nullptr)
{ {
// Allow auto-add on reparent // Allow auto-add on reparent
setParent(parent); setParent(parent);
@ -1045,7 +1045,7 @@ QAbstractAnimation::QAbstractAnimation(QObject *parent)
\internal \internal
*/ */
QAbstractAnimation::QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent) QAbstractAnimation::QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent)
: QObject(dd, 0) : QObject(dd, nullptr)
{ {
// Allow auto-add on reparent // Allow auto-add on reparent
setParent(parent); setParent(parent);

View File

@ -133,7 +133,7 @@ QAbstractAnimation *QAnimationGroup::animationAt(int index) const
if (index < 0 || index >= d->animations.size()) { if (index < 0 || index >= d->animations.size()) {
qWarning("QAnimationGroup::animationAt: index is out of bounds"); qWarning("QAnimationGroup::animationAt: index is out of bounds");
return 0; return nullptr;
} }
return d->animations.at(index); return d->animations.at(index);
@ -243,14 +243,14 @@ QAbstractAnimation *QAnimationGroup::takeAnimation(int index)
Q_D(QAnimationGroup); Q_D(QAnimationGroup);
if (index < 0 || index >= d->animations.size()) { if (index < 0 || index >= d->animations.size()) {
qWarning("QAnimationGroup::takeAnimation: no animation at index %d", index); qWarning("QAnimationGroup::takeAnimation: no animation at index %d", index);
return 0; return nullptr;
} }
QAbstractAnimation *animation = d->animations.at(index); QAbstractAnimation *animation = d->animations.at(index);
QAbstractAnimationPrivate::get(animation)->group = 0; QAbstractAnimationPrivate::get(animation)->group = nullptr;
// ### removing from list before doing setParent to avoid inifinite recursion // ### removing from list before doing setParent to avoid inifinite recursion
// in ChildRemoved event // in ChildRemoved event
d->animations.removeAt(index); d->animations.removeAt(index);
animation->setParent(0); animation->setParent(nullptr);
d->animationRemoved(index, animation); d->animationRemoved(index, animation);
return animation; return animation;
} }

View File

@ -259,7 +259,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
QVariantAnimation::updateState(newState, oldState); QVariantAnimation::updateState(newState, oldState);
QPropertyAnimation *animToStop = 0; QPropertyAnimation *animToStop = nullptr;
{ {
static QBasicMutex mutex; static QBasicMutex mutex;
auto locker = qt_unique_lock(mutex); auto locker = qt_unique_lock(mutex);

View File

@ -282,7 +282,7 @@ QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs)
if (index < 0 || index > d->animations.size()) { if (index < 0 || index > d->animations.size()) {
qWarning("QSequentialAnimationGroup::insertPause: index is out of bounds"); qWarning("QSequentialAnimationGroup::insertPause: index is out of bounds");
return 0; return nullptr;
} }
QPauseAnimation *pause = new QPauseAnimation(msecs); QPauseAnimation *pause = new QPauseAnimation(msecs);
@ -430,7 +430,7 @@ void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool inter
if (index == -1) { if (index == -1) {
Q_ASSERT(animations.isEmpty()); Q_ASSERT(animations.isEmpty());
currentAnimationIndex = -1; currentAnimationIndex = -1;
currentAnimation = 0; currentAnimation = nullptr;
return; return;
} }
@ -503,7 +503,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
*/ */
void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
{ {
if (currentAnimation == 0) if (currentAnimation == nullptr)
setCurrentAnimation(0); // initialize the current animation setCurrentAnimation(0); // initialize the current animation
if (currentAnimationIndex == index if (currentAnimationIndex == index

View File

@ -209,7 +209,7 @@ void QVariantAnimationPrivate::updateInterpolator()
if (type == currentInterval.end.second.userType()) if (type == currentInterval.end.second.userType())
interpolator = getInterpolator(type); interpolator = getInterpolator(type);
else else
interpolator = 0; interpolator = nullptr;
//we make sure that the interpolator is always set to something //we make sure that the interpolator is always set to something
if (!interpolator) if (!interpolator)
@ -445,7 +445,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in
{ {
QInterpolatorVector *interpolators = registeredInterpolators(); QInterpolatorVector *interpolators = registeredInterpolators();
const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); const auto locker = qt_scoped_lock(registeredInterpolatorsMutex);
QVariantAnimation::Interpolator ret = 0; QVariantAnimation::Interpolator ret = nullptr;
if (interpolationType < interpolators->count()) { if (interpolationType < interpolators->count()) {
ret = interpolators->at(interpolationType); ret = interpolators->at(interpolationType);
if (ret) return ret; if (ret) return ret;
@ -479,7 +479,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in
case QMetaType::QRectF: case QMetaType::QRectF:
return castToInterpolator(_q_interpolateVariant<QRectF>); return castToInterpolator(_q_interpolateVariant<QRectF>);
default: default:
return 0; //this type is not handled return nullptr; //this type is not handled
} }
} }

View File

@ -381,7 +381,7 @@ static QTextCodec *loadQtCodec(const char *name)
return QIsciiCodec::create(name); return QIsciiCodec::create(name);
#endif #endif
return 0; return nullptr;
} }
/// \threadsafe /// \threadsafe
@ -438,7 +438,7 @@ QTextCodec *QIcuCodec::defaultCodecUnlocked()
{ {
QCoreGlobalData *globalData = QCoreGlobalData::instance(); QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData) if (!globalData)
return 0; return nullptr;
QTextCodec *c = globalData->codecForLocale.loadAcquire(); QTextCodec *c = globalData->codecForLocale.loadAcquire();
if (c) if (c)
return c; return c;
@ -523,13 +523,13 @@ QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name)
return c; return c;
if (qt_only) if (qt_only)
return 0; return nullptr;
// check whether there is really a converter for the name available. // check whether there is really a converter for the name available.
UConverter *conv = ucnv_open(standardName, &error); UConverter *conv = ucnv_open(standardName, &error);
if (!conv) { if (!conv) {
qDebug("codecForName: ucnv_open failed %s %s", standardName, u_errorName(error)); qDebug("codecForName: ucnv_open failed %s %s", standardName, u_errorName(error));
return 0; return nullptr;
} }
//qDebug() << "QIcuCodec: Standard name for " << name << "is" << standardName; //qDebug() << "QIcuCodec: Standard name for " << name << "is" << standardName;
ucnv_close(conv); ucnv_close(conv);
@ -552,7 +552,7 @@ QTextCodec *QIcuCodec::codecForMibUnlocked(int mib)
if (mib == 2107) if (mib == 2107)
return codecForNameUnlocked("TSCII"); return codecForNameUnlocked("TSCII");
return 0; return nullptr;
} }
@ -567,7 +567,7 @@ QIcuCodec::~QIcuCodec()
UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const
{ {
UConverter *conv = 0; UConverter *conv = nullptr;
if (state) { if (state) {
if (!state->d) { if (!state->d) {
// first time // first time
@ -609,7 +609,7 @@ QString QIcuCodec::convertToUnicode(const char *chars, int length, QTextCodec::C
ucnv_toUnicode(conv, ucnv_toUnicode(conv,
&uc, ucEnd, &uc, ucEnd,
&chars, end, &chars, end,
0, false, &error); nullptr, false, &error);
if (!U_SUCCESS(error) && error != U_BUFFER_OVERFLOW_ERROR) { if (!U_SUCCESS(error) && error != U_BUFFER_OVERFLOW_ERROR) {
qDebug("convertToUnicode failed: %s", u_errorName(error)); qDebug("convertToUnicode failed: %s", u_errorName(error));
break; break;
@ -646,7 +646,7 @@ QByteArray QIcuCodec::convertFromUnicode(const QChar *unicode, int length, QText
ucnv_fromUnicode(conv, ucnv_fromUnicode(conv,
&ch, chEnd, &ch, chEnd,
&uc, end, &uc, end,
0, false, &error); nullptr, false, &error);
if (!U_SUCCESS(error)) if (!U_SUCCESS(error))
qDebug("convertFromUnicode failed: %s", u_errorName(error)); qDebug("convertFromUnicode failed: %s", u_errorName(error));
convertedChars = ch - string.data(); convertedChars = ch - string.data();

View File

@ -74,7 +74,7 @@ QTextCodec *QIsciiCodec::create(const char *name)
if (qTextCodecNameMatch(name, codecs[i].name)) if (qTextCodecNameMatch(name, codecs[i].name))
return new QIsciiCodec(i); return new QIsciiCodec(i);
} }
return 0; return nullptr;
} }
QIsciiCodec::~QIsciiCodec() QIsciiCodec::~QIsciiCodec()

View File

@ -51,7 +51,7 @@ static const struct {
quint16 values[128]; quint16 values[128];
} unicodevalues[QSimpleTextCodec::numSimpleCodecs] = { } unicodevalues[QSimpleTextCodec::numSimpleCodecs] = {
// from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt
{ "KOI8-R", { "csKOI8R", 0 }, 2084, { "KOI8-R", { "csKOI8R", nullptr }, 2084,
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248,
@ -72,7 +72,7 @@ static const struct {
// it should be 0x2022 (BULLET). // it should be 0x2022 (BULLET).
// from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt // from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt
{ "KOI8-U", { "KOI8-RU", 0 }, 2088, { "KOI8-U", { "KOI8-RU", nullptr }, 2088,
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248,
@ -97,7 +97,7 @@ static const struct {
// $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
// then I inserted the files manually. // then I inserted the files manually.
{ "ISO-8859-2", {"latin2", "iso-ir-101", "csISOLatin2", 0 }, 5, { "ISO-8859-2", {"latin2", "iso-ir-101", "csISOLatin2", nullptr }, 5,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -114,7 +114,7 @@ static const struct {
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} },
{ "ISO-8859-3", { "latin3", "iso-ir-109", "csISOLatin3", 0 }, 6, { "ISO-8859-3", { "latin3", "iso-ir-109", "csISOLatin3", nullptr }, 6,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -131,7 +131,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7,
0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} }, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} },
{ "ISO-8859-4", { "latin4", "iso-ir-110", "csISOLatin4", 0 }, 7, { "ISO-8859-4", { "latin4", "iso-ir-110", "csISOLatin4", nullptr }, 7,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -148,7 +148,7 @@ static const struct {
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} }, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} },
{ "ISO-8859-5", { "cyrillic", "iso-ir-144", "csISOLatinCyrillic", 0 }, 8, { "ISO-8859-5", { "cyrillic", "iso-ir-144", "csISOLatinCyrillic", nullptr }, 8,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -165,7 +165,7 @@ static const struct {
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} }, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} },
{ "ISO-8859-6", { "ISO-8859-6-I", "ECMA-114", "ASMO-708", "arabic", "iso-ir-127", "csISOLatinArabic", 0 }, 82, { "ISO-8859-6", { "ISO-8859-6-I", "ECMA-114", "ASMO-708", "arabic", "iso-ir-127", "csISOLatinArabic", nullptr }, 82,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -182,7 +182,7 @@ static const struct {
0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F,
0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
{ "ISO-8859-7", { "ECMA-118", "greek", "iso-ir-126", "csISOLatinGreek", 0 }, 10, { "ISO-8859-7", { "ECMA-118", "greek", "iso-ir-126", "csISOLatinGreek", nullptr }, 10,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -199,7 +199,7 @@ static const struct {
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} },
{ "ISO-8859-8", { "ISO 8859-8-I", "iso-ir-138", "hebrew", "csISOLatinHebrew", 0 }, 85, { "ISO-8859-8", { "ISO 8859-8-I", "iso-ir-138", "hebrew", "csISOLatinHebrew", nullptr }, 85,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -216,7 +216,7 @@ static const struct {
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
{ "ISO-8859-9", { "iso-ir-148", "latin5", "csISOLatin5", 0 }, 12, { "ISO-8859-9", { "iso-ir-148", "latin5", "csISOLatin5", nullptr }, 12,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -233,7 +233,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} },
{ "ISO-8859-10", { "iso-ir-157", "latin6", "ISO-8859-10:1992", "csISOLatin6", 0 }, 13, { "ISO-8859-10", { "iso-ir-157", "latin6", "ISO-8859-10:1992", "csISOLatin6", nullptr }, 13,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -250,7 +250,7 @@ static const struct {
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169,
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} }, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} },
{ "ISO-8859-13", { 0 }, 109, { "ISO-8859-13", { nullptr }, 109,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -267,7 +267,7 @@ static const struct {
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} }, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} },
{ "ISO-8859-14", { "iso-ir-199", "latin8", "iso-celtic", 0 }, 110, { "ISO-8859-14", { "iso-ir-199", "latin8", "iso-celtic", nullptr }, 110,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -284,7 +284,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} }, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} },
{ "ISO-8859-16", { "iso-ir-226", "latin10", 0 }, 112, { "ISO-8859-16", { "iso-ir-226", "latin10", nullptr }, 112,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
@ -305,7 +305,7 @@ static const struct {
// next bits generated again from tables on the Unicode 3.0 CD. // next bits generated again from tables on the Unicode 3.0 CD.
// $ for a in CP* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done // $ for a in CP* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
{ "IBM850", { "CP850", "csPC850Multilingual", 0 }, 2009, { "IBM850", { "CP850", "csPC850Multilingual", nullptr }, 2009,
{ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
@ -322,7 +322,7 @@ static const struct {
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} }, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} },
{ "IBM874", { "CP874", 0 }, -874, //### what is the mib? { "IBM874", { "CP874", nullptr }, -874, //### what is the mib?
{ 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -339,7 +339,7 @@ static const struct {
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
{ "IBM866", { "CP866", "csIBM866", 0 }, 2086, { "IBM866", { "CP866", "csIBM866", nullptr }, 2086,
{ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
@ -357,7 +357,7 @@ static const struct {
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E,
0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} }, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} },
{ "windows-1250", { "CP1250", 0 }, 2250, { "windows-1250", { "CP1250", nullptr }, 2250,
{ 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021,
0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -374,7 +374,7 @@ static const struct {
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} },
{ "windows-1251", { "CP1251", 0 }, 2251, { "windows-1251", { "CP1251", nullptr }, 2251,
{ 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -391,7 +391,7 @@ static const struct {
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} }, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} },
{ "windows-1252", { "CP1252", 0 }, 2252, { "windows-1252", { "CP1252", nullptr }, 2252,
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -408,7 +408,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} },
{ "windows-1253", {"CP1253", 0 }, 2253, { "windows-1253", {"CP1253", nullptr }, 2253,
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -425,7 +425,7 @@ static const struct {
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} },
{ "windows-1254", { "CP1254", 0 }, 2254, { "windows-1254", { "CP1254", nullptr }, 2254,
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -442,7 +442,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} },
{ "windows-1255", { "CP1255", 0 }, 2255, { "windows-1255", { "CP1255", nullptr }, 2255,
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -459,7 +459,7 @@ static const struct {
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} }, 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} },
{ "windows-1256", { "CP1256", 0 }, 2256, { "windows-1256", { "CP1256", nullptr }, 2256,
{ 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -476,7 +476,7 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} }, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} },
{ "windows-1257", { "CP1257", 0 }, 2257, { "windows-1257", { "CP1257", nullptr }, 2257,
{ 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021,
0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8, 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -493,7 +493,7 @@ static const struct {
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} }, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} },
{ "windows-1258", { "CP1258", 0 }, 2258, { "windows-1258", { "CP1258", nullptr }, 2258,
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -511,7 +511,7 @@ static const struct {
0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} },
{ "macintosh", { "Apple Roman", "MacRoman", 0 }, 2027, { "macintosh", { "Apple Roman", "MacRoman", nullptr }, 2027,
{ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1,
0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3,
@ -532,7 +532,7 @@ static const struct {
// This one is based on the charmap file // This one is based on the charmap file
// /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted // /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted
// to this format by Boerre Gaup <boerre@subdimension.com> // to this format by Boerre Gaup <boerre@subdimension.com>
{ "WINSAMI2", { "WS2", 0 }, -165, { "WINSAMI2", { "WS2", nullptr }, -165,
{ 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE, { 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE,
0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, 0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -555,7 +555,7 @@ static const struct {
// to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too. // to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too.
// $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; (cut -c25- < TIS-620 ; cat /tmp/digits) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620 // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; (cut -c25- < TIS-620 ; cat /tmp/digits) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620
{ "TIS-620", { "ISO 8859-11", 0 }, 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) { "TIS-620", { "ISO 8859-11", nullptr }, 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent)
{ 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -582,7 +582,7 @@ static const struct {
Alias: r8 Alias: r8
Alias: csHPRoman8 Alias: csHPRoman8
*/ */
{ "hp-roman8", { "roman8", "csHPRoman8", 0 }, 2004, { "hp-roman8", { "roman8", "csHPRoman8", nullptr }, 2004,
{ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, { 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
@ -603,7 +603,7 @@ static const struct {
// if you add more chacater sets at the end, change LAST_MIB above // if you add more chacater sets at the end, change LAST_MIB above
}; };
QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(0) QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(nullptr)
{ {
} }
@ -640,7 +640,7 @@ static QByteArray *buildReverseMap(int forwardIndex)
QString QSimpleTextCodec::convertToUnicode(const char* chars, int len, ConverterState *) const QString QSimpleTextCodec::convertToUnicode(const char* chars, int len, ConverterState *) const
{ {
if (len <= 0 || chars == 0) if (len <= 0 || chars == nullptr)
return QString(); return QString();
const unsigned char * c = (const unsigned char *)chars; const unsigned char * c = (const unsigned char *)chars;
@ -665,7 +665,7 @@ QByteArray QSimpleTextCodec::convertFromUnicode(const QChar *in, int length, Con
QByteArray *rmap = reverseMap.loadAcquire(); QByteArray *rmap = reverseMap.loadAcquire();
if (!rmap){ if (!rmap){
rmap = buildReverseMap(this->forwardIndex); rmap = buildReverseMap(this->forwardIndex);
if (!reverseMap.testAndSetRelease(0, rmap)) { if (!reverseMap.testAndSetRelease(nullptr, rmap)) {
delete rmap; delete rmap;
rmap = reverseMap.loadAcquire(); rmap = reverseMap.loadAcquire();
} }

View File

@ -124,12 +124,12 @@ public:
QLibrarySettings *ls = qt_library_settings(); QLibrarySettings *ls = qt_library_settings();
if (ls) { if (ls) {
#ifndef QT_BUILD_QMAKE #ifndef QT_BUILD_QMAKE
if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != 0) if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != nullptr)
ls->load(); ls->load();
#endif #endif
return ls->settings.data(); return ls->settings.data();
} else { } else {
return 0; return nullptr;
} }
} }
}; };
@ -146,7 +146,7 @@ void QLibrarySettings::load()
// If we get any settings here, those won't change when the application shows up. // If we get any settings here, those won't change when the application shows up.
settings.reset(QLibraryInfoPrivate::findConfiguration()); settings.reset(QLibraryInfoPrivate::findConfiguration());
#ifndef QT_BUILD_QMAKE #ifndef QT_BUILD_QMAKE
reloadOnQAppAvailable = (settings.data() == 0 && QCoreApplication::instance() == 0); reloadOnQAppAvailable = (settings.data() == nullptr && QCoreApplication::instance() == nullptr);
bool haveDevicePaths; bool haveDevicePaths;
bool haveEffectivePaths; bool haveEffectivePaths;
bool havePaths; bool havePaths;
@ -169,7 +169,7 @@ void QLibrarySettings::load()
|| children.contains(QLatin1String("Paths")); || children.contains(QLatin1String("Paths"));
#ifndef QT_BUILD_QMAKE #ifndef QT_BUILD_QMAKE
if (!havePaths) if (!havePaths)
settings.reset(0); settings.reset(nullptr);
#else #else
} else { } else {
haveDevicePaths = false; haveDevicePaths = false;
@ -212,7 +212,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration()
return new QSettings(qtconfig, QSettings::IniFormat); return new QSettings(qtconfig, QSettings::IniFormat);
} }
#endif #endif
return 0; //no luck return nullptr; //no luck
} }
#endif // settings #endif // settings
@ -750,7 +750,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
// will binary-patch the Qt installation paths -- in such scenarios, Qt // will binary-patch the Qt installation paths -- in such scenarios, Qt
// will be built with a dummy path, thus the compile-time result of // will be built with a dummy path, thus the compile-time result of
// strlen is meaningless. // strlen is meaningless.
const char * volatile path = 0; const char * volatile path = nullptr;
if (loc == PrefixPath) { if (loc == PrefixPath) {
path = getPrefix( path = getPrefix(
#ifdef QT_BUILD_QMAKE #ifdef QT_BUILD_QMAKE

View File

@ -1315,7 +1315,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount)
if (function.startsWith(QLatin1String("_Z"))) { if (function.startsWith(QLatin1String("_Z"))) {
QScopedPointer<char, QScopedPointerPodDeleter> demangled( QScopedPointer<char, QScopedPointerPodDeleter> demangled(
abi::__cxa_demangle(function.toUtf8(), 0, 0, 0)); abi::__cxa_demangle(function.toUtf8(), nullptr, nullptr, nullptr));
if (demangled) if (demangled)
function = QString::fromUtf8(qCleanupFuncinfo(demangled.data())); function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
} }

View File

@ -251,7 +251,7 @@ QFile::QFile(QFilePrivate &dd)
Constructs a QFile object. Constructs a QFile object.
*/ */
QFile::QFile() QFile::QFile()
: QFileDevice(*new QFilePrivate, 0) : QFileDevice(*new QFilePrivate, nullptr)
{ {
} }
/*! /*!
@ -265,7 +265,7 @@ QFile::QFile(QObject *parent)
Constructs a new file object to represent the file with the given \a name. Constructs a new file object to represent the file with the given \a name.
*/ */
QFile::QFile(const QString &name) QFile::QFile(const QString &name)
: QFileDevice(*new QFilePrivate, 0) : QFileDevice(*new QFilePrivate, nullptr)
{ {
Q_D(QFile); Q_D(QFile);
d->fileName = name; d->fileName = name;

View File

@ -202,7 +202,7 @@ QFileDevice::QFileDevice(QFileDevicePrivate &dd)
\internal \internal
*/ */
QFileDevice::QFileDevice() QFileDevice::QFileDevice()
: QIODevice(*new QFileDevicePrivate, 0) : QIODevice(*new QFileDevicePrivate, nullptr)
{ {
} }
/*! /*!

View File

@ -1076,14 +1076,14 @@ bool QFileSystemEngine::cloneFile(int srcfd, int dstfd, const QFileSystemMetaDat
// sendfile(2) is limited in the kernel to 2G - 4k // sendfile(2) is limited in the kernel to 2G - 4k
const size_t SendfileSize = 0x7ffff000; const size_t SendfileSize = 0x7ffff000;
ssize_t n = ::sendfile(dstfd, srcfd, NULL, SendfileSize); ssize_t n = ::sendfile(dstfd, srcfd, nullptr, SendfileSize);
if (n == -1) { if (n == -1) {
// if we got an error here, give up and try at an upper layer // if we got an error here, give up and try at an upper layer
return false; return false;
} }
while (n) { while (n) {
n = ::sendfile(dstfd, srcfd, NULL, SendfileSize); n = ::sendfile(dstfd, srcfd, nullptr, SendfileSize);
if (n == -1) { if (n == -1) {
// uh oh, this is probably a real error (like ENOSPC), but we have // uh oh, this is probably a real error (like ENOSPC), but we have
// no way to notify QFile of partial success, so just erase any work // no way to notify QFile of partial success, so just erase any work

View File

@ -88,7 +88,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
} }
QFileSystemWatcherPrivate::QFileSystemWatcherPrivate() QFileSystemWatcherPrivate::QFileSystemWatcherPrivate()
: native(0), poller(0) : native(nullptr), poller(nullptr)
{ {
} }

View File

@ -242,7 +242,7 @@ QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject
if (fd == -1) { if (fd == -1) {
fd = inotify_init(); fd = inotify_init();
if (fd == -1) if (fd == -1)
return 0; return nullptr;
} }
return new QInotifyFileSystemWatcherEngine(fd, parent); return new QInotifyFileSystemWatcherEngine(fd, parent);
} }

View File

@ -461,7 +461,7 @@ QIODevice::QIODevice(QIODevicePrivate &dd)
*/ */
QIODevice::QIODevice() QIODevice::QIODevice()
: QObject(*new QIODevicePrivate, 0) : QObject(*new QIODevicePrivate, nullptr)
{ {
#if defined QIODEVICE_DEBUG #if defined QIODEVICE_DEBUG
QFile *file = qobject_cast<QFile *>(this); QFile *file = qobject_cast<QFile *>(this);

View File

@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE
\internal \internal
*/ */
QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0) QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)nullptr)
{ {
} }
@ -188,7 +188,7 @@ const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLen
{ {
if (atEnd()) { if (atEnd()) {
len = -1; len = -1;
return 0; return nullptr;
} }
if (maximumLength != -1) if (maximumLength != -1)
@ -241,7 +241,7 @@ const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLe
{ {
if (atEnd()) { if (atEnd()) {
len = -1; len = -1;
return 0; return nullptr;
} }
const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len);
@ -282,7 +282,7 @@ qint64 QNonContiguousByteDeviceRingBufferImpl::size() const
QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d)
: QNonContiguousByteDevice(), : QNonContiguousByteDevice(),
currentReadBuffer(0), currentReadBufferSize(16*1024), currentReadBuffer(nullptr), currentReadBufferSize(16*1024),
currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0),
eof(false) eof(false)
{ {
@ -301,10 +301,10 @@ const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLeng
{ {
if (eof == true) { if (eof == true) {
len = -1; len = -1;
return 0; return nullptr;
} }
if (currentReadBuffer == 0) if (currentReadBuffer == nullptr)
currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc
if (maximumLength == -1) if (maximumLength == -1)
@ -323,7 +323,7 @@ const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLeng
// size was unknown before, emit a readProgress with the final size // size was unknown before, emit a readProgress with the final size
if (size() == -1) if (size() == -1)
emit readProgress(totalAdvancements, totalAdvancements); emit readProgress(totalAdvancements, totalAdvancements);
return 0; return nullptr;
} }
currentReadBufferAmount = haveRead; currentReadBufferAmount = haveRead;
@ -349,7 +349,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount)
if (currentReadBufferPosition > currentReadBufferAmount) { if (currentReadBufferPosition > currentReadBufferAmount) {
qint64 i = currentReadBufferPosition - currentReadBufferAmount; qint64 i = currentReadBufferPosition - currentReadBufferAmount;
while (i > 0) { while (i > 0) {
if (device->getChar(0) == false) { if (device->getChar(nullptr) == false) {
emit readProgress(totalAdvancements - i, size()); emit readProgress(totalAdvancements - i, size());
return false; // ### FIXME handle eof return false; // ### FIXME handle eof
} }
@ -377,7 +377,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
totalAdvancements = 0; //reset the progress counter totalAdvancements = 0; //reset the progress counter
if (currentReadBuffer) { if (currentReadBuffer) {
delete currentReadBuffer; delete currentReadBuffer;
currentReadBuffer = 0; currentReadBuffer = nullptr;
} }
currentReadBufferAmount = 0; currentReadBufferAmount = 0;
currentReadBufferPosition = 0; currentReadBufferPosition = 0;
@ -405,7 +405,7 @@ qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() const
return device->pos(); return device->pos();
} }
QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)nullptr)
{ {
byteDevice = bd; byteDevice = bd;
connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead())); connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead()));

View File

@ -216,7 +216,7 @@ void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)
environment variables to be removed. environment variables to be removed.
*/ */
QProcessEnvironment::QProcessEnvironment() QProcessEnvironment::QProcessEnvironment()
: d(0) : d(nullptr)
{ {
} }
@ -436,18 +436,18 @@ void QProcessPrivate::Channel::clear()
case PipeSource: case PipeSource:
Q_ASSERT(process); Q_ASSERT(process);
process->stdinChannel.type = Normal; process->stdinChannel.type = Normal;
process->stdinChannel.process = 0; process->stdinChannel.process = nullptr;
break; break;
case PipeSink: case PipeSink:
Q_ASSERT(process); Q_ASSERT(process);
process->stdoutChannel.type = Normal; process->stdoutChannel.type = Normal;
process->stdoutChannel.process = 0; process->stdoutChannel.process = nullptr;
break; break;
} }
type = Normal; type = Normal;
file.clear(); file.clear();
process = 0; process = nullptr;
} }
/*! /*!
@ -869,8 +869,8 @@ QProcessPrivate::QProcessPrivate()
sequenceNumber = 0; sequenceNumber = 0;
exitCode = 0; exitCode = 0;
exitStatus = QProcess::NormalExit; exitStatus = QProcess::NormalExit;
startupSocketNotifier = 0; startupSocketNotifier = nullptr;
deathNotifier = 0; deathNotifier = nullptr;
childStartedPipe[0] = INVALID_Q_PIPE; childStartedPipe[0] = INVALID_Q_PIPE;
childStartedPipe[1] = INVALID_Q_PIPE; childStartedPipe[1] = INVALID_Q_PIPE;
forkfd = -1; forkfd = -1;
@ -924,23 +924,23 @@ void QProcessPrivate::cleanup()
if (stdoutChannel.notifier) { if (stdoutChannel.notifier) {
delete stdoutChannel.notifier; delete stdoutChannel.notifier;
stdoutChannel.notifier = 0; stdoutChannel.notifier = nullptr;
} }
if (stderrChannel.notifier) { if (stderrChannel.notifier) {
delete stderrChannel.notifier; delete stderrChannel.notifier;
stderrChannel.notifier = 0; stderrChannel.notifier = nullptr;
} }
if (stdinChannel.notifier) { if (stdinChannel.notifier) {
delete stdinChannel.notifier; delete stdinChannel.notifier;
stdinChannel.notifier = 0; stdinChannel.notifier = nullptr;
} }
if (startupSocketNotifier) { if (startupSocketNotifier) {
delete startupSocketNotifier; delete startupSocketNotifier;
startupSocketNotifier = 0; startupSocketNotifier = nullptr;
} }
if (deathNotifier) { if (deathNotifier) {
delete deathNotifier; delete deathNotifier;
deathNotifier = 0; deathNotifier = nullptr;
} }
closeChannel(&stdoutChannel); closeChannel(&stdoutChannel);
closeChannel(&stderrChannel); closeChannel(&stderrChannel);
@ -1229,7 +1229,7 @@ void QProcessPrivate::closeWriteChannel()
#endif #endif
if (stdinChannel.notifier) { if (stdinChannel.notifier) {
delete stdinChannel.notifier; delete stdinChannel.notifier;
stdinChannel.notifier = 0; stdinChannel.notifier = nullptr;
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// ### Find a better fix, feeding the process little by little // ### Find a better fix, feeding the process little by little
@ -2615,7 +2615,7 @@ QT_END_INCLUDE_NAMESPACE
QStringList QProcess::systemEnvironment() QStringList QProcess::systemEnvironment()
{ {
QStringList tmp; QStringList tmp;
char *entry = 0; char *entry = nullptr;
int count = 0; int count = 0;
while ((entry = environ[count++])) while ((entry = environ[count++]))
tmp << QString::fromLocal8Bit(entry); tmp << QString::fromLocal8Bit(entry);

View File

@ -338,11 +338,11 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Map &environme
{ {
*envc = 0; *envc = 0;
if (environment.isEmpty()) if (environment.isEmpty())
return 0; return nullptr;
char **envp = new char *[environment.count() + 2]; char **envp = new char *[environment.count() + 2];
envp[environment.count()] = 0; envp[environment.count()] = nullptr;
envp[environment.count() + 1] = 0; envp[environment.count() + 1] = nullptr;
auto it = environment.constBegin(); auto it = environment.constBegin();
const auto end = environment.constEnd(); const auto end = environment.constEnd();
@ -390,7 +390,7 @@ void QProcessPrivate::startProcess()
// Create argument list with right number of elements, and set the final // Create argument list with right number of elements, and set the final
// one to 0. // one to 0.
char **argv = new char *[arguments.count() + 2]; char **argv = new char *[arguments.count() + 2];
argv[arguments.count() + 1] = 0; argv[arguments.count() + 1] = nullptr;
// Encode the program name. // Encode the program name.
QByteArray encodedProgramName = QFile::encodeName(program); QByteArray encodedProgramName = QFile::encodeName(program);
@ -437,13 +437,13 @@ void QProcessPrivate::startProcess()
// Duplicate the environment. // Duplicate the environment.
int envc = 0; int envc = 0;
char **envp = 0; char **envp = nullptr;
if (environment.d.constData()) { if (environment.d.constData()) {
envp = _q_dupEnvironment(environment.d.constData()->vars, &envc); envp = _q_dupEnvironment(environment.d.constData()->vars, &envc);
} }
// Encode the working directory if it's non-empty, otherwise just pass 0. // Encode the working directory if it's non-empty, otherwise just pass 0.
const char *workingDirPtr = 0; const char *workingDirPtr = nullptr;
QByteArray encodedWorkingDirectory; QByteArray encodedWorkingDirectory;
if (!workingDirectory.isEmpty()) { if (!workingDirectory.isEmpty()) {
encodedWorkingDirectory = QFile::encodeName(workingDirectory); encodedWorkingDirectory = QFile::encodeName(workingDirectory);
@ -596,7 +596,7 @@ bool QProcessPrivate::processStarted(QString *errorMessage)
if (startupSocketNotifier) { if (startupSocketNotifier) {
startupSocketNotifier->setEnabled(false); startupSocketNotifier->setEnabled(false);
startupSocketNotifier->deleteLater(); startupSocketNotifier->deleteLater();
startupSocketNotifier = 0; startupSocketNotifier = nullptr;
} }
qt_safe_close(childStartedPipe[0]); qt_safe_close(childStartedPipe[0]);
childStartedPipe[0] = -1; childStartedPipe[0] = -1;
@ -889,7 +889,7 @@ bool QProcessPrivate::waitForDeadChild()
crashed = info.code != CLD_EXITED; crashed = info.code != CLD_EXITED;
delete deathNotifier; delete deathNotifier;
deathNotifier = 0; deathNotifier = nullptr;
EINTR_LOOP(ret, forkfd_close(forkfd)); EINTR_LOOP(ret, forkfd_close(forkfd));
forkfd = -1; // Child is dead, don't try to kill it anymore forkfd = -1; // Child is dead, don't try to kill it anymore
@ -935,7 +935,7 @@ bool QProcessPrivate::startDetached(qint64 *pid)
struct sigaction noaction; struct sigaction noaction;
memset(&noaction, 0, sizeof(noaction)); memset(&noaction, 0, sizeof(noaction));
noaction.sa_handler = SIG_IGN; noaction.sa_handler = SIG_IGN;
::sigaction(SIGPIPE, &noaction, 0); ::sigaction(SIGPIPE, &noaction, nullptr);
::setsid(); ::setsid();
@ -964,7 +964,7 @@ bool QProcessPrivate::startDetached(qint64 *pid)
char **argv = new char *[arguments.size() + 2]; char **argv = new char *[arguments.size() + 2];
for (int i = 0; i < arguments.size(); ++i) for (int i = 0; i < arguments.size(); ++i)
argv[i + 1] = ::strdup(QFile::encodeName(arguments.at(i)).constData()); argv[i + 1] = ::strdup(QFile::encodeName(arguments.at(i)).constData());
argv[arguments.size() + 1] = 0; argv[arguments.size() + 1] = nullptr;
// Duplicate the environment. // Duplicate the environment.
int envc = 0; int envc = 0;
@ -991,7 +991,7 @@ bool QProcessPrivate::startDetached(qint64 *pid)
struct sigaction noaction; struct sigaction noaction;
memset(&noaction, 0, sizeof(noaction)); memset(&noaction, 0, sizeof(noaction));
noaction.sa_handler = SIG_IGN; noaction.sa_handler = SIG_IGN;
::sigaction(SIGPIPE, &noaction, 0); ::sigaction(SIGPIPE, &noaction, nullptr);
// '\1' means execv failed // '\1' means execv failed
char c = '\1'; char c = '\1';
@ -1002,7 +1002,7 @@ bool QProcessPrivate::startDetached(qint64 *pid)
struct sigaction noaction; struct sigaction noaction;
memset(&noaction, 0, sizeof(noaction)); memset(&noaction, 0, sizeof(noaction));
noaction.sa_handler = SIG_IGN; noaction.sa_handler = SIG_IGN;
::sigaction(SIGPIPE, &noaction, 0); ::sigaction(SIGPIPE, &noaction, nullptr);
// '\2' means internal error // '\2' means internal error
char c = '\2'; char c = '\2';

View File

@ -1584,7 +1584,7 @@ QAbstractFileEngine::Iterator *QResourceFileEngine::beginEntryList(QDir::Filters
*/ */
QAbstractFileEngine::Iterator *QResourceFileEngine::endEntryList() QAbstractFileEngine::Iterator *QResourceFileEngine::endEntryList()
{ {
return 0; return nullptr;
} }
bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output)
@ -1594,7 +1594,7 @@ bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *
const MapExtensionOption *options = (const MapExtensionOption*)(option); const MapExtensionOption *options = (const MapExtensionOption*)(option);
MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output); MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output);
returnValue->address = d->map(options->offset, options->size, options->flags); returnValue->address = d->map(options->offset, options->size, options->flags);
return (returnValue->address != 0); return (returnValue->address != nullptr);
} }
if (extension == UnMapExtension) { if (extension == UnMapExtension) {
const UnMapExtensionOption *options = (const UnMapExtensionOption*)option; const UnMapExtensionOption *options = (const UnMapExtensionOption*)option;
@ -1623,7 +1623,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
if (offset < 0 || size <= 0 || !resource.isValid() || if (offset < 0 || size <= 0 || !resource.isValid() ||
add_overflow(offset, size, &end) || end > max) { add_overflow(offset, size, &end) || end > max) {
q->setError(QFile::UnspecifiedError, QString()); q->setError(QFile::UnspecifiedError, QString());
return 0; return nullptr;
} }
const uchar *address = resource.data(); const uchar *address = resource.data();

View File

@ -116,7 +116,7 @@ QSaveFile::QSaveFile(const QString &name)
Constructs a new file object to represent the file with the given \a name. Constructs a new file object to represent the file with the given \a name.
*/ */
QSaveFile::QSaveFile(const QString &name) QSaveFile::QSaveFile(const QString &name)
: QFileDevice(*new QSaveFilePrivate, 0) : QFileDevice(*new QSaveFilePrivate, nullptr)
{ {
Q_D(QSaveFile); Q_D(QSaveFile);
d->fileName = name; d->fileName = name;

View File

@ -206,7 +206,7 @@ QConfFile *QConfFile::fromName(const QString &fileName, bool _userPerms)
ConfFileHash *usedHash = usedHashFunc(); ConfFileHash *usedHash = usedHashFunc();
ConfFileCache *unusedCache = unusedCacheFunc(); ConfFileCache *unusedCache = unusedCacheFunc();
QConfFile *confFile = 0; QConfFile *confFile = nullptr;
const auto locker = qt_scoped_lock(settingsGlobalMutex); const auto locker = qt_scoped_lock(settingsGlobalMutex);
if (!(confFile = usedHash->value(absPath))) { if (!(confFile = usedHash->value(absPath))) {
@ -230,7 +230,7 @@ void QConfFile::clearCache()
// QSettingsPrivate // QSettingsPrivate
QSettingsPrivate::QSettingsPrivate(QSettings::Format format) QSettingsPrivate::QSettingsPrivate(QSettings::Format format)
: format(format), scope(QSettings::UserScope /* nothing better to put */), iniCodec(0), fallbacks(true), : format(format), scope(QSettings::UserScope /* nothing better to put */), iniCodec(nullptr), fallbacks(true),
pendingChanges(false), status(QSettings::NoError) pendingChanges(false), status(QSettings::NoError)
{ {
} }
@ -238,7 +238,7 @@ QSettingsPrivate::QSettingsPrivate(QSettings::Format format)
QSettingsPrivate::QSettingsPrivate(QSettings::Format format, QSettings::Scope scope, QSettingsPrivate::QSettingsPrivate(QSettings::Format format, QSettings::Scope scope,
const QString &organization, const QString &application) const QString &organization, const QString &application)
: format(format), scope(scope), organizationName(organization), applicationName(application), : format(format), scope(scope), organizationName(organization), applicationName(application),
iniCodec(0), fallbacks(true), pendingChanges(false), status(QSettings::NoError) iniCodec(nullptr), fallbacks(true), pendingChanges(false), status(QSettings::NoError)
{ {
} }
@ -924,8 +924,8 @@ QStringList QSettingsPrivate::splitArgs(const QString &s, int idx)
void QConfFileSettingsPrivate::initFormat() void QConfFileSettingsPrivate::initFormat()
{ {
extension = (format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"); extension = (format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini");
readFunc = 0; readFunc = nullptr;
writeFunc = 0; writeFunc = nullptr;
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity; caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity;
#else #else
@ -3338,7 +3338,7 @@ bool QSettings::contains(const QString &key) const
{ {
Q_D(const QSettings); Q_D(const QSettings);
QString k = d->actualKey(key); QString k = d->actualKey(key);
return d->get(k, 0); return d->get(k, nullptr);
} }
/*! /*!

View File

@ -61,7 +61,7 @@ Q_LOGGING_CATEGORY(lcCheckIndex, "qt.core.qabstractitemmodel.checkindex")
QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index) QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index)
{ {
Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list
QPersistentModelIndexData *d = 0; QPersistentModelIndexData *d = nullptr;
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model()); QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model());
QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes; QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes;
const auto it = indexes.constFind(index); const auto it = indexes.constFind(index);
@ -136,7 +136,7 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
*/ */
QPersistentModelIndex::QPersistentModelIndex() QPersistentModelIndex::QPersistentModelIndex()
: d(0) : d(nullptr)
{ {
} }
@ -158,7 +158,7 @@ QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other)
*/ */
QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index) QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index)
: d(0) : d(nullptr)
{ {
if (index.isValid()) { if (index.isValid()) {
d = QPersistentModelIndexData::create(index); d = QPersistentModelIndexData::create(index);
@ -176,7 +176,7 @@ QPersistentModelIndex::~QPersistentModelIndex()
{ {
if (d && !d->ref.deref()) { if (d && !d->ref.deref()) {
QPersistentModelIndexData::destroy(d); QPersistentModelIndexData::destroy(d);
d = 0; d = nullptr;
} }
} }
@ -257,7 +257,7 @@ QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other
d = QPersistentModelIndexData::create(other); d = QPersistentModelIndexData::create(other);
if (d) d->ref.ref(); if (d) d->ref.ref();
} else { } else {
d = 0; d = nullptr;
} }
return *this; return *this;
} }
@ -344,7 +344,7 @@ void *QPersistentModelIndex::internalPointer() const
{ {
if (d) if (d)
return d->index.internalPointer(); return d->index.internalPointer();
return 0; return nullptr;
} }
/*! /*!
@ -442,7 +442,7 @@ const QAbstractItemModel *QPersistentModelIndex::model() const
{ {
if (d) if (d)
return d->index.model(); return d->index.model();
return 0; return nullptr;
} }
/*! /*!
@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx)
class QEmptyItemModel : public QAbstractItemModel class QEmptyItemModel : public QAbstractItemModel
{ {
public: public:
explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {} explicit QEmptyItemModel(QObject *parent = nullptr) : QAbstractItemModel(parent) {}
QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); } QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); }
QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
int rowCount(const QModelIndex &) const override { return 0; } int rowCount(const QModelIndex &) const override { return 0; }
@ -1950,10 +1950,10 @@ QStringList QAbstractItemModel::mimeTypes() const
QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
{ {
if (indexes.count() <= 0) if (indexes.count() <= 0)
return 0; return nullptr;
QStringList types = mimeTypes(); QStringList types = mimeTypes();
if (types.isEmpty()) if (types.isEmpty())
return 0; return nullptr;
QMimeData *data = new QMimeData(); QMimeData *data = new QMimeData();
QString format = types.at(0); QString format = types.at(0);
QByteArray encoded; QByteArray encoded;

View File

@ -159,7 +159,7 @@ QAbstractItemModel *QAbstractProxyModel::sourceModel() const
{ {
Q_D(const QAbstractProxyModel); Q_D(const QAbstractProxyModel);
if (d->model == QAbstractItemModelPrivate::staticEmptyModel()) if (d->model == QAbstractItemModelPrivate::staticEmptyModel())
return 0; return nullptr;
return d->model; return d->model;
} }

View File

@ -497,7 +497,7 @@ void QConcatenateTablesProxyModel::removeSourceModel(QAbstractItemModel *sourceM
{ {
Q_D(QConcatenateTablesProxyModel); Q_D(QConcatenateTablesProxyModel);
Q_ASSERT(d->m_models.contains(sourceModel)); Q_ASSERT(d->m_models.contains(sourceModel));
disconnect(sourceModel, 0, this, 0); disconnect(sourceModel, nullptr, this, nullptr);
const int rowsRemoved = sourceModel->rowCount(); const int rowsRemoved = sourceModel->rowCount();
const int rowsPrior = d->computeRowsPrior(sourceModel); // location of removed section const int rowsPrior = d->computeRowsPrior(sourceModel); // location of removed section

View File

@ -656,7 +656,7 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m)
SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)) }, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)) },
{ SIGNAL(modelReset()), { SIGNAL(modelReset()),
SLOT(reset()) }, SLOT(reset()) },
{ 0, 0 } { nullptr, nullptr }
}; };
if (model == m) if (model == m)

View File

@ -530,10 +530,10 @@ void QCoreApplicationPrivate::eventDispatcherReady()
{ {
} }
QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0); QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(nullptr);
QThread *QCoreApplicationPrivate::mainThread() QThread *QCoreApplicationPrivate::mainThread()
{ {
Q_ASSERT(theMainThread.loadRelaxed() != 0); Q_ASSERT(theMainThread.loadRelaxed() != nullptr);
return theMainThread.loadRelaxed(); return theMainThread.loadRelaxed();
} }
@ -690,7 +690,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p)
#ifdef QT_NO_QOBJECT #ifdef QT_NO_QOBJECT
: d_ptr(&p) : d_ptr(&p)
#else #else
: QObject(p, 0) : QObject(p, nullptr)
#endif #endif
{ {
d_func()->q_ptr = this; d_func()->q_ptr = this;
@ -1139,7 +1139,7 @@ bool QCoreApplication::notify(QObject *receiver, QEvent *event)
static bool doNotify(QObject *receiver, QEvent *event) static bool doNotify(QObject *receiver, QEvent *event)
{ {
if (receiver == 0) { // serious error if (receiver == nullptr) { // serious error
qWarning("QCoreApplication::notify: Unexpected null receiver"); qWarning("QCoreApplication::notify: Unexpected null receiver");
return true; return true;
} }
@ -1388,7 +1388,7 @@ void QCoreApplicationPrivate::execCleanup()
if (!aboutToQuitEmitted) if (!aboutToQuitEmitted)
emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal()); emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal());
aboutToQuitEmitted = true; aboutToQuitEmitted = true;
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
} }
@ -1531,7 +1531,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
{ {
Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type()); Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type());
if (receiver == 0) { if (receiver == nullptr) {
qWarning("QCoreApplication::postEvent: Unexpected null receiver"); qWarning("QCoreApplication::postEvent: Unexpected null receiver");
delete event; delete event;
return; return;
@ -1635,7 +1635,7 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
for (int i = 0; i < postedEvents->size(); ++i) { for (int i = 0; i < postedEvents->size(); ++i) {
const QPostEvent &cur = postedEvents->at(i); const QPostEvent &cur = postedEvents->at(i);
if (cur.receiver != receiver if (cur.receiver != receiver
|| cur.event == 0 || cur.event == nullptr
|| cur.event->type() != event->type()) || cur.event->type() != event->type())
continue; continue;
// found an event for this receiver // found an event for this receiver
@ -1784,7 +1784,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// null out the event so if sendPostedEvents recurses, it // null out the event so if sendPostedEvents recurses, it
// will ignore this one, as it's been re-posted. // will ignore this one, as it's been re-posted.
const_cast<QPostEvent &>(pe).event = 0; const_cast<QPostEvent &>(pe).event = nullptr;
// re-post the copied event so it isn't lost // re-post the copied event so it isn't lost
data->postEventList.addEvent(pe_copy); data->postEventList.addEvent(pe_copy);
@ -1804,7 +1804,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// next, update the data structure so that we're ready // next, update the data structure so that we're ready
// for the next event. // for the next event.
const_cast<QPostEvent &>(pe).event = 0; const_cast<QPostEvent &>(pe).event = nullptr;
locker.unlock(); locker.unlock();
const auto relocker = qScopeGuard([&locker] { locker.lock(); }); const auto relocker = qScopeGuard([&locker] { locker.lock(); });
@ -1867,7 +1867,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType)
--pe.receiver->d_func()->postedEvents; --pe.receiver->d_func()->postedEvents;
pe.event->posted = false; pe.event->posted = false;
events.append(pe.event); events.append(pe.event);
const_cast<QPostEvent &>(pe).event = 0; const_cast<QPostEvent &>(pe).event = nullptr;
} else if (!data->postEventList.recursion) { } else if (!data->postEventList.recursion) {
if (i != j) if (i != j)
qSwap(data->postEventList[i], data->postEventList[j]); qSwap(data->postEventList[i], data->postEventList[j]);
@ -1929,7 +1929,7 @@ void QCoreApplicationPrivate::removePostedEvent(QEvent * event)
--pe.receiver->d_func()->postedEvents; --pe.receiver->d_func()->postedEvents;
pe.event->posted = false; pe.event->posted = false;
delete pe.event; delete pe.event;
const_cast<QPostEvent &>(pe).event = 0; const_cast<QPostEvent &>(pe).event = nullptr;
return; return;
} }
} }
@ -2204,7 +2204,7 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
// Declared in qglobal.h // Declared in qglobal.h
QString qtTrId(const char *id, int n) QString qtTrId(const char *id, int n)
{ {
return QCoreApplication::translate(0, id, 0, n); return QCoreApplication::translate(nullptr, id, nullptr, n);
} }
bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
@ -2956,7 +2956,7 @@ QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
{ {
if (QCoreApplicationPrivate::theMainThread.loadAcquire()) if (QCoreApplicationPrivate::theMainThread.loadAcquire())
return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher(); return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher();
return 0; return nullptr;
} }
/*! /*!

View File

@ -295,7 +295,7 @@ QT_BEGIN_NAMESPACE
Contructs an event object of type \a type. Contructs an event object of type \a type.
*/ */
QEvent::QEvent(Type type) QEvent::QEvent(Type type)
: d(0), t(type), posted(false), spont(false), m_accept(true) : d(nullptr), t(type), posted(false), spont(false), m_accept(true)
{ {
Q_TRACE(QEvent_ctor, this, t); Q_TRACE(QEvent_ctor, this, t);
} }

View File

@ -114,9 +114,9 @@ static GSourceFuncs socketNotifierSourceFuncs = {
socketNotifierSourcePrepare, socketNotifierSourcePrepare,
socketNotifierSourceCheck, socketNotifierSourceCheck,
socketNotifierSourceDispatch, socketNotifierSourceDispatch,
NULL, nullptr,
NULL, nullptr,
NULL nullptr
}; };
struct GTimerSource struct GTimerSource
@ -188,9 +188,9 @@ static GSourceFuncs timerSourceFuncs = {
timerSourcePrepare, timerSourcePrepare,
timerSourceCheck, timerSourceCheck,
timerSourceDispatch, timerSourceDispatch,
NULL, nullptr,
NULL, nullptr,
NULL nullptr
}; };
struct GIdleTimerSource struct GIdleTimerSource
@ -227,7 +227,7 @@ static gboolean idleTimerSourceCheck(GSource *source)
static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer) static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
{ {
GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource; GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource;
(void) timerSourceDispatch(&timerSource->source, 0, 0); (void) timerSourceDispatch(&timerSource->source, nullptr, nullptr);
return true; return true;
} }
@ -235,9 +235,9 @@ static GSourceFuncs idleTimerSourceFuncs = {
idleTimerSourcePrepare, idleTimerSourcePrepare,
idleTimerSourceCheck, idleTimerSourceCheck,
idleTimerSourceDispatch, idleTimerSourceDispatch,
NULL, nullptr,
NULL, nullptr,
NULL nullptr
}; };
struct GPostEventSource struct GPostEventSource
@ -267,7 +267,7 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
static gboolean postEventSourceCheck(GSource *source) static gboolean postEventSourceCheck(GSource *source)
{ {
return postEventSourcePrepare(source, 0); return postEventSourcePrepare(source, nullptr);
} }
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer) static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
@ -283,9 +283,9 @@ static GSourceFuncs postEventSourceFuncs = {
postEventSourcePrepare, postEventSourcePrepare,
postEventSourceCheck, postEventSourceCheck,
postEventSourceDispatch, postEventSourceDispatch,
NULL, nullptr,
NULL, nullptr,
NULL nullptr
}; };
@ -372,10 +372,10 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->timerSource->timerList.~QTimerInfoList(); d->timerSource->timerList.~QTimerInfoList();
g_source_destroy(&d->timerSource->source); g_source_destroy(&d->timerSource->source);
g_source_unref(&d->timerSource->source); g_source_unref(&d->timerSource->source);
d->timerSource = 0; d->timerSource = nullptr;
g_source_destroy(&d->idleTimerSource->source); g_source_destroy(&d->idleTimerSource->source);
g_source_unref(&d->idleTimerSource->source); g_source_unref(&d->idleTimerSource->source);
d->idleTimerSource = 0; d->idleTimerSource = nullptr;
// destroy socket notifier source // destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) { for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
@ -386,19 +386,19 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->socketNotifierSource->pollfds.~QList<GPollFDWithQSocketNotifier *>(); d->socketNotifierSource->pollfds.~QList<GPollFDWithQSocketNotifier *>();
g_source_destroy(&d->socketNotifierSource->source); g_source_destroy(&d->socketNotifierSource->source);
g_source_unref(&d->socketNotifierSource->source); g_source_unref(&d->socketNotifierSource->source);
d->socketNotifierSource = 0; d->socketNotifierSource = nullptr;
// destroy post event source // destroy post event source
g_source_destroy(&d->postEventSource->source); g_source_destroy(&d->postEventSource->source);
g_source_unref(&d->postEventSource->source); g_source_unref(&d->postEventSource->source);
d->postEventSource = 0; d->postEventSource = nullptr;
Q_ASSERT(d->mainContext != 0); Q_ASSERT(d->mainContext != nullptr);
#if GLIB_CHECK_VERSION (2, 22, 0) #if GLIB_CHECK_VERSION (2, 22, 0)
g_main_context_pop_thread_default (d->mainContext); g_main_context_pop_thread_default (d->mainContext);
#endif #endif
g_main_context_unref(d->mainContext); g_main_context_unref(d->mainContext);
d->mainContext = 0; d->mainContext = nullptr;
} }
bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)

View File

@ -465,7 +465,7 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags)
emit awake(); emit awake();
auto threadData = d->threadData.loadRelaxed(); auto threadData = d->threadData.loadRelaxed();
QCoreApplicationPrivate::sendPostedEvents(0, 0, threadData); QCoreApplicationPrivate::sendPostedEvents(nullptr, 0, threadData);
const bool include_timers = (flags & QEventLoop::X11ExcludeTimers) == 0; const bool include_timers = (flags & QEventLoop::X11ExcludeTimers) == 0;
const bool include_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers) == 0; const bool include_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers) == 0;

View File

@ -282,14 +282,14 @@ QObject *QMetaObject::newInstance(QGenericArgument val0,
idx = indexOfConstructor(norm.constData()); idx = indexOfConstructor(norm.constData());
} }
if (idx < 0) if (idx < 0)
return 0; return nullptr;
QObject *returnValue = 0; QObject *returnValue = nullptr;
void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(), void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(),
val5.data(), val6.data(), val7.data(), val8.data(), val9.data()}; val5.data(), val6.data(), val7.data(), val8.data(), val9.data()};
if (static_metacall(CreateInstance, idx, param) >= 0) if (static_metacall(CreateInstance, idx, param) >= 0)
return 0; return nullptr;
return returnValue; return returnValue;
} }
@ -301,7 +301,7 @@ int QMetaObject::static_metacall(Call cl, int idx, void **argv) const
Q_ASSERT(priv(d.data)->revision >= 6); Q_ASSERT(priv(d.data)->revision >= 6);
if (!d.static_metacall) if (!d.static_metacall)
return 0; return 0;
d.static_metacall(0, cl, idx, argv); d.static_metacall(nullptr, cl, idx, argv);
return -1; return -1;
} }
@ -691,7 +691,7 @@ static void argumentTypesFromString(const char *str, const char *end,
QByteArray QMetaObjectPrivate::decodeMethodSignature( QByteArray QMetaObjectPrivate::decodeMethodSignature(
const char *signature, QArgumentTypeArray &types) const char *signature, QArgumentTypeArray &types)
{ {
Q_ASSERT(signature != 0); Q_ASSERT(signature != nullptr);
const char *lparens = strchr(signature, '('); const char *lparens = strchr(signature, '(');
if (!lparens) if (!lparens)
return QByteArray(); return QByteArray();
@ -844,7 +844,7 @@ int QMetaObjectPrivate::indexOfConstructor(const QMetaObject *m, const QByteArra
*/ */
int QMetaObjectPrivate::absoluteSignalCount(const QMetaObject *m) int QMetaObjectPrivate::absoluteSignalCount(const QMetaObject *m)
{ {
Q_ASSERT(m != 0); Q_ASSERT(m != nullptr);
int n = priv(m->d.data)->signalCount; int n = priv(m->d.data)->signalCount;
for (m = m->d.superdata; m; m = m->d.superdata) for (m = m->d.superdata; m; m = m->d.superdata)
n += priv(m->d.data)->signalCount; n += priv(m->d.data)->signalCount;
@ -881,7 +881,7 @@ QMetaMethod QMetaObjectPrivate::signal(const QMetaObject *m, int signal_index)
QMetaMethod result; QMetaMethod result;
if (signal_index < 0) if (signal_index < 0)
return result; return result;
Q_ASSERT(m != 0); Q_ASSERT(m != nullptr);
int i = signal_index; int i = signal_index;
i -= signalOffset(m); i -= signalOffset(m);
if (i < 0 && m->d.superdata) if (i < 0 && m->d.superdata)
@ -1031,7 +1031,7 @@ int QMetaObject::indexOfProperty(const char *name) const
QAbstractDynamicMetaObject *me = QAbstractDynamicMetaObject *me =
const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this)); const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this));
return me->createProperty(name, 0); return me->createProperty(name, nullptr);
} }
return -1; return -1;
@ -1145,7 +1145,7 @@ QMetaProperty QMetaObject::property(int index) const
if (!result.menum.isValid()) { if (!result.menum.isValid()) {
const char *enum_name = type; const char *enum_name = type;
const char *scope_name = objectClassName(this); const char *scope_name = objectClassName(this);
char *scope_buffer = 0; char *scope_buffer = nullptr;
const char *colon = strrchr(enum_name, ':'); const char *colon = strrchr(enum_name, ':');
// ':' will always appear in pairs // ':' will always appear in pairs
@ -1159,7 +1159,7 @@ QMetaProperty QMetaObject::property(int index) const
enum_name = colon+1; enum_name = colon+1;
} }
const QMetaObject *scope = 0; const QMetaObject *scope = nullptr;
if (qstrcmp(scope_name, "Qt") == 0) if (qstrcmp(scope_name, "Qt") == 0)
scope = &QObject::staticQtMetaObject; scope = &QObject::staticQtMetaObject;
else else
@ -1542,14 +1542,14 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
return false; return false;
} }
QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, 1)); QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, 1));
} else if (type == Qt::BlockingQueuedConnection) { } else if (type == Qt::BlockingQueuedConnection) {
#if QT_CONFIG(thread) #if QT_CONFIG(thread)
if (currentThread == objectThread) if (currentThread == objectThread)
qWarning("QMetaObject::invokeMethod: Dead lock detected"); qWarning("QMetaObject::invokeMethod: Dead lock detected");
QSemaphore semaphore; QSemaphore semaphore;
QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, argv, &semaphore)); QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, argv, &semaphore));
semaphore.acquire(); semaphore.acquire();
#endif // QT_CONFIG(thread) #endif // QT_CONFIG(thread)
} else { } else {
@ -1988,7 +1988,7 @@ QList<QByteArray> QMetaMethod::parameterNames() const
const char *QMetaMethod::typeName() const const char *QMetaMethod::typeName() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
return QMetaMethodPrivate::get(this)->rawReturnTypeName(); return QMetaMethodPrivate::get(this)->rawReturnTypeName();
} }
@ -2020,7 +2020,7 @@ const char *QMetaMethod::typeName() const
const char *QMetaMethod::tag() const const char *QMetaMethod::tag() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
return QMetaMethodPrivate::get(this)->tag().constData(); return QMetaMethodPrivate::get(this)->tag().constData();
} }
@ -2303,7 +2303,7 @@ bool QMetaMethod::invoke(QObject *object,
return false; return false;
} }
QScopedPointer<QMetaCallEvent> event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, 0, -1, paramCount)); QScopedPointer<QMetaCallEvent> event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, nullptr, -1, paramCount));
int *types = event->types(); int *types = event->types();
void **args = event->args(); void **args = event->args();
@ -2340,7 +2340,7 @@ bool QMetaMethod::invoke(QObject *object,
QSemaphore semaphore; QSemaphore semaphore;
QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction,
0, -1, param, &semaphore)); nullptr, -1, param, &semaphore));
semaphore.acquire(); semaphore.acquire();
#endif // QT_CONFIG(thread) #endif // QT_CONFIG(thread)
} }
@ -2563,7 +2563,7 @@ bool QMetaMethod::invokeOnGadget(void* gadget, QGenericReturnArgument returnValu
const char *QMetaEnum::name() const const char *QMetaEnum::name() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
return rawStringData(mobj, mobj->d.data[handle]); return rawStringData(mobj, mobj->d.data[handle]);
} }
@ -2582,7 +2582,7 @@ const char *QMetaEnum::name() const
const char *QMetaEnum::enumName() const const char *QMetaEnum::enumName() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
const bool rev8p = priv(mobj->d.data)->revision >= 8; const bool rev8p = priv(mobj->d.data)->revision >= 8;
if (rev8p) if (rev8p)
return rawStringData(mobj, mobj->d.data[handle + 1]); return rawStringData(mobj, mobj->d.data[handle + 1]);
@ -2610,13 +2610,13 @@ int QMetaEnum::keyCount() const
const char *QMetaEnum::key(int index) const const char *QMetaEnum::key(int index) const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2; const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
int count = mobj->d.data[handle + offset]; int count = mobj->d.data[handle + offset];
int data = mobj->d.data[handle + offset + 1]; int data = mobj->d.data[handle + offset + 1];
if (index >= 0 && index < count) if (index >= 0 && index < count)
return rawStringData(mobj, mobj->d.data[data + 2*index]); return rawStringData(mobj, mobj->d.data[data + 2*index]);
return 0; return nullptr;
} }
/*! /*!
@ -2679,7 +2679,7 @@ bool QMetaEnum::isScoped() const
*/ */
const char *QMetaEnum::scope() const const char *QMetaEnum::scope() const
{ {
return mobj ? objectClassName(mobj) : 0; return mobj ? objectClassName(mobj) : nullptr;
} }
/*! /*!
@ -2695,7 +2695,7 @@ const char *QMetaEnum::scope() const
*/ */
int QMetaEnum::keyToValue(const char *key, bool *ok) const int QMetaEnum::keyToValue(const char *key, bool *ok) const
{ {
if (ok != 0) if (ok != nullptr)
*ok = false; *ok = false;
if (!mobj || !key) if (!mobj || !key)
return -1; return -1;
@ -2715,7 +2715,7 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const
const QByteArray className = stringData(mobj, priv(mobj->d.data)->className); const QByteArray className = stringData(mobj, priv(mobj->d.data)->className);
if ((!scope || (className.size() == int(scope) && strncmp(qualified_key, className.constData(), scope) == 0)) if ((!scope || (className.size() == int(scope) && strncmp(qualified_key, className.constData(), scope) == 0))
&& strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) { && strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) {
if (ok != 0) if (ok != nullptr)
*ok = true; *ok = true;
return mobj->d.data[data + 2*i + 1]; return mobj->d.data[data + 2*i + 1];
} }
@ -2734,14 +2734,14 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const
const char* QMetaEnum::valueToKey(int value) const const char* QMetaEnum::valueToKey(int value) const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2; const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
int count = mobj->d.data[handle + offset]; int count = mobj->d.data[handle + offset];
int data = mobj->d.data[handle + offset + 1]; int data = mobj->d.data[handle + offset + 1];
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
if (value == (int)mobj->d.data[data + 2*i + 1]) if (value == (int)mobj->d.data[data + 2*i + 1])
return rawStringData(mobj, mobj->d.data[data + 2*i]); return rawStringData(mobj, mobj->d.data[data + 2*i]);
return 0; return nullptr;
} }
/*! /*!
@ -2756,11 +2756,11 @@ const char* QMetaEnum::valueToKey(int value) const
*/ */
int QMetaEnum::keysToValue(const char *keys, bool *ok) const int QMetaEnum::keysToValue(const char *keys, bool *ok) const
{ {
if (ok != 0) if (ok != nullptr)
*ok = false; *ok = false;
if (!mobj || !keys) if (!mobj || !keys)
return -1; return -1;
if (ok != 0) if (ok != nullptr)
*ok = true; *ok = true;
const QString keysString = QString::fromLatin1(keys); const QString keysString = QString::fromLatin1(keys);
const QVector<QStringRef> splitKeys = keysString.splitRef(QLatin1Char('|')); const QVector<QStringRef> splitKeys = keysString.splitRef(QLatin1Char('|'));
@ -2793,7 +2793,7 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const
} }
} }
if (i < 0) { if (i < 0) {
if (ok != 0) if (ok != nullptr)
*ok = false; *ok = false;
value |= -1; value |= -1;
} }
@ -2896,7 +2896,7 @@ static QByteArray qualifiedName(const QMetaEnum &e)
\internal \internal
*/ */
QMetaProperty::QMetaProperty() QMetaProperty::QMetaProperty()
: mobj(0), handle(0), idx(0) : mobj(nullptr), handle(0), idx(0)
{ {
} }
@ -2909,7 +2909,7 @@ QMetaProperty::QMetaProperty()
const char *QMetaProperty::name() const const char *QMetaProperty::name() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx; int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawStringData(mobj, mobj->d.data[handle]); return rawStringData(mobj, mobj->d.data[handle]);
} }
@ -2922,7 +2922,7 @@ const char *QMetaProperty::name() const
const char *QMetaProperty::typeName() const const char *QMetaProperty::typeName() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx; int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]); return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]);
} }
@ -3112,7 +3112,7 @@ QVariant QMetaProperty::read(const QObject *object) const
t = enumMetaTypeId; t = enumMetaTypeId;
} else { } else {
int handle = priv(mobj->d.data)->propertyData + 3*idx; int handle = priv(mobj->d.data)->propertyData + 3*idx;
const char *typeName = 0; const char *typeName = nullptr;
Q_ASSERT(priv(mobj->d.data)->revision >= 7); Q_ASSERT(priv(mobj->d.data)->revision >= 7);
uint typeInfo = mobj->d.data[handle + 1]; uint typeInfo = mobj->d.data[handle + 1];
if (!(typeInfo & IsUnresolvedType)) if (!(typeInfo & IsUnresolvedType))
@ -3138,11 +3138,11 @@ QVariant QMetaProperty::read(const QObject *object) const
// changed: result stored directly in value // changed: result stored directly in value
int status = -1; int status = -1;
QVariant value; QVariant value;
void *argv[] = { 0, &value, &status }; void *argv[] = { nullptr, &value, &status };
if (t == QMetaType::QVariant) { if (t == QMetaType::QVariant) {
argv[0] = &value; argv[0] = &value;
} else { } else {
value = QVariant(t, (void*)0); value = QVariant(t, (void*)nullptr);
argv[0] = value.data(); argv[0] = value.data();
} }
if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) { if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) {
@ -3196,7 +3196,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
v.convert(QVariant::Int); v.convert(QVariant::Int);
} else { } else {
int handle = priv(mobj->d.data)->propertyData + 3*idx; int handle = priv(mobj->d.data)->propertyData + 3*idx;
const char *typeName = 0; const char *typeName = nullptr;
Q_ASSERT(priv(mobj->d.data)->revision >= 7); Q_ASSERT(priv(mobj->d.data)->revision >= 7);
uint typeInfo = mobj->d.data[handle + 1]; uint typeInfo = mobj->d.data[handle + 1];
if (!(typeInfo & IsUnresolvedType)) if (!(typeInfo & IsUnresolvedType))
@ -3213,7 +3213,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
if (!value.isValid()) { if (!value.isValid()) {
if (isResettable()) if (isResettable())
return reset(object); return reset(object);
v = QVariant(t, 0); v = QVariant(t, nullptr);
} else if (!v.convert(t)) { } else if (!v.convert(t)) {
return false; return false;
} }
@ -3229,7 +3229,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
// the flags variable is used by the declarative module to implement // the flags variable is used by the declarative module to implement
// interception of property writes. // interception of property writes.
int flags = 0; int flags = 0;
void *argv[] = { 0, &v, &status, &flags }; void *argv[] = { nullptr, &v, &status, &flags };
if (t == QMetaType::QVariant) if (t == QMetaType::QVariant)
argv[0] = &v; argv[0] = &v;
else else
@ -3254,7 +3254,7 @@ bool QMetaProperty::reset(QObject *object) const
{ {
if (!object || !mobj || !isResettable()) if (!object || !mobj || !isResettable())
return false; return false;
void *argv[] = { 0 }; void *argv[] = { nullptr };
if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall)
mobj->d.static_metacall(object, QMetaObject::ResetProperty, idx, argv); mobj->d.static_metacall(object, QMetaObject::ResetProperty, idx, argv);
else else
@ -3638,7 +3638,7 @@ bool QMetaProperty::isEditable(const QObject *object) const
const char *QMetaClassInfo::name() const const char *QMetaClassInfo::name() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
return rawStringData(mobj, mobj->d.data[handle]); return rawStringData(mobj, mobj->d.data[handle]);
} }
@ -3650,7 +3650,7 @@ const char *QMetaClassInfo::name() const
const char* QMetaClassInfo::value() const const char* QMetaClassInfo::value() const
{ {
if (!mobj) if (!mobj)
return 0; return nullptr;
return rawStringData(mobj, mobj->d.data[handle + 1]); return rawStringData(mobj, mobj->d.data[handle + 1]);
} }

View File

@ -210,7 +210,7 @@ public:
: flags(0) : flags(0)
{ {
superClass = &QObject::staticMetaObject; superClass = &QObject::staticMetaObject;
staticMetacallFunction = 0; staticMetacallFunction = nullptr;
} }
bool hasRevisionedProperties() const; bool hasRevisionedProperties() const;
@ -749,7 +749,7 @@ void QMetaObjectBuilder::addMetaObject
Q_ASSERT(priv(prototype->d.data)->revision >= 2); Q_ASSERT(priv(prototype->d.data)->revision >= 2);
const auto *objects = prototype->d.relatedMetaObjects; const auto *objects = prototype->d.relatedMetaObjects;
if (objects) { if (objects) {
while (*objects != 0) { while (*objects != nullptr) {
addRelatedMetaObject(*objects); addRelatedMetaObject(*objects);
++objects; ++objects;
} }
@ -831,7 +831,7 @@ const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const
if (index >= 0 && index < d->relatedMetaObjects.size()) if (index >= 0 && index < d->relatedMetaObjects.size())
return d->relatedMetaObjects[index]; return d->relatedMetaObjects[index];
else else
return 0; return nullptr;
} }
/*! /*!
@ -1196,8 +1196,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
ALIGN(size, int); ALIGN(size, int);
if (buf) { if (buf) {
if (!relocatable) meta->d.superdata = d->superClass; if (!relocatable) meta->d.superdata = d->superClass;
meta->d.relatedMetaObjects = 0; meta->d.relatedMetaObjects = nullptr;
meta->d.extradata = 0; meta->d.extradata = nullptr;
meta->d.static_metacall = d->staticMetacallFunction; meta->d.static_metacall = d->staticMetacallFunction;
} }
@ -1494,7 +1494,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
*/ */
QMetaObject *QMetaObjectBuilder::toMetaObject() const QMetaObject *QMetaObjectBuilder::toMetaObject() const
{ {
int size = buildMetaObject(d, 0, 0, false); int size = buildMetaObject(d, nullptr, 0, false);
char *buf = reinterpret_cast<char *>(malloc(size)); char *buf = reinterpret_cast<char *>(malloc(size));
memset(buf, 0, size); memset(buf, 0, size);
buildMetaObject(d, buf, size, false); buildMetaObject(d, buf, size, false);
@ -1517,7 +1517,7 @@ QMetaObject *QMetaObjectBuilder::toMetaObject() const
*/ */
QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const
{ {
int size = buildMetaObject(d, 0, 0, true); int size = buildMetaObject(d, nullptr, 0, true);
if (size == -1) { if (size == -1) {
if (ok) *ok = false; if (ok) *ok = false;
return QByteArray(); return QByteArray();
@ -1555,9 +1555,9 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output,
output->d.superdata = superclass; output->d.superdata = superclass;
output->d.stringdata = reinterpret_cast<const QByteArrayData *>(buf + stringdataOffset); output->d.stringdata = reinterpret_cast<const QByteArrayData *>(buf + stringdataOffset);
output->d.data = reinterpret_cast<const uint *>(buf + dataOffset); output->d.data = reinterpret_cast<const uint *>(buf + dataOffset);
output->d.extradata = 0; output->d.extradata = nullptr;
output->d.relatedMetaObjects = 0; output->d.relatedMetaObjects = nullptr;
output->d.static_metacall = 0; output->d.static_metacall = nullptr;
} }
/*! /*!
@ -1720,14 +1720,14 @@ void QMetaObjectBuilder::deserialize
d->enumerators.clear(); d->enumerators.clear();
d->constructors.clear(); d->constructors.clear();
d->relatedMetaObjects.clear(); d->relatedMetaObjects.clear();
d->staticMetacallFunction = 0; d->staticMetacallFunction = nullptr;
// Read the class and super class names. // Read the class and super class names.
stream >> d->className; stream >> d->className;
stream >> name; stream >> name;
if (name.isEmpty()) { if (name.isEmpty()) {
d->superClass = 0; d->superClass = nullptr;
} else if ((cl = resolveClassName(references, name)) != 0) { } else if ((cl = resolveClassName(references, name)) != nullptr) {
d->superClass = cl; d->superClass = cl;
} else { } else {
stream.setStatus(QDataStream::ReadCorruptData); stream.setStatus(QDataStream::ReadCorruptData);
@ -1877,7 +1877,7 @@ QMetaMethodBuilderPrivate *QMetaMethodBuilder::d_func() const
else if (_mobj && -_index >= 1 && -_index <= int(_mobj->d->constructors.size())) else if (_mobj && -_index >= 1 && -_index <= int(_mobj->d->constructors.size()))
return &(_mobj->d->constructors[(-_index) - 1]); return &(_mobj->d->constructors[(-_index) - 1]);
else else
return 0; return nullptr;
} }
/*! /*!
@ -2116,7 +2116,7 @@ QMetaPropertyBuilderPrivate *QMetaPropertyBuilder::d_func() const
if (_mobj && _index >= 0 && _index < int(_mobj->d->properties.size())) if (_mobj && _index >= 0 && _index < int(_mobj->d->properties.size()))
return &(_mobj->d->properties[_index]); return &(_mobj->d->properties[_index]);
else else
return 0; return nullptr;
} }
/*! /*!
@ -2588,7 +2588,7 @@ QMetaEnumBuilderPrivate *QMetaEnumBuilder::d_func() const
if (_mobj && _index >= 0 && _index < int(_mobj->d->enumerators.size())) if (_mobj && _index >= 0 && _index < int(_mobj->d->enumerators.size()))
return &(_mobj->d->enumerators[_index]); return &(_mobj->d->enumerators[_index]);
else else
return 0; return nullptr;
} }
/*! /*!

View File

@ -1113,8 +1113,8 @@ static int registerNormalizedType(const NS(QByteArray) &normalizedTypeName,
QCustomTypeInfo inf; QCustomTypeInfo inf;
inf.typeName = normalizedTypeName; inf.typeName = normalizedTypeName;
#ifndef QT_NO_DATASTREAM #ifndef QT_NO_DATASTREAM
inf.loadOp = 0; inf.loadOp = nullptr;
inf.saveOp = 0; inf.saveOp = nullptr;
#endif #endif
inf.alias = -1; inf.alias = -1;
inf.typedConstructor = typedConstructor; inf.typedConstructor = typedConstructor;
@ -1955,7 +1955,7 @@ public:
return Q_LIKELY(qMetaTypeWidgetsHelper) return Q_LIKELY(qMetaTypeWidgetsHelper)
? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject
: nullptr; : nullptr;
return 0; return nullptr;
} }
}; };

View File

@ -319,7 +319,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
Constructs a new MIME data object with no data in it. Constructs a new MIME data object with no data in it.
*/ */
QMimeData::QMimeData() QMimeData::QMimeData()
: QObject(*new QMimeDataPrivate, 0) : QObject(*new QMimeDataPrivate, nullptr)
{ {
} }

View File

@ -109,7 +109,7 @@ static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
"(Make sure '%s' is registered using qRegisterMetaType().)", "(Make sure '%s' is registered using qRegisterMetaType().)",
typeName.constData(), typeName.constData()); typeName.constData(), typeName.constData());
delete [] types; delete [] types;
return 0; return nullptr;
} }
} }
types[typeNames.count()] = 0; types[typeNames.count()] = 0;
@ -133,7 +133,7 @@ static int *queuedConnectionTypes(const QArgumentType *argumentTypes, int argc)
qWarning("QObject::connect: Cannot queue arguments of type '%s'\n" qWarning("QObject::connect: Cannot queue arguments of type '%s'\n"
"(Make sure '%s' is registered using qRegisterMetaType().)", "(Make sure '%s' is registered using qRegisterMetaType().)",
type.name().constData(), type.name().constData()); type.name().constData(), type.name().constData());
return 0; return nullptr;
} }
} }
types[argc] = 0; types[argc] = 0;
@ -160,13 +160,13 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
{} {}
#endif #endif
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr;
void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = nullptr;
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = nullptr;
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0; void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr;
int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = 0; bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = 0; void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = nullptr;
/*! /*!
\fn QObjectData::QObjectData() \fn QObjectData::QObjectData()
@ -182,7 +182,7 @@ QMetaObject *QObjectData::dynamicMetaObject() const
} }
QObjectPrivate::QObjectPrivate(int version) QObjectPrivate::QObjectPrivate(int version)
: threadData(0), currentChildBeingDeleted(0) : threadData(nullptr), currentChildBeingDeleted(nullptr)
{ {
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
// Don't check the version parameter in internal builds. // Don't check the version parameter in internal builds.
@ -195,8 +195,8 @@ QObjectPrivate::QObjectPrivate(int version)
#endif #endif
// QObjectData initialization // QObjectData initialization
q_ptr = 0; q_ptr = nullptr;
parent = 0; // no parent yet. It is set by setParent() parent = nullptr; // no parent yet. It is set by setParent()
isWidget = false; // assume not a widget object isWidget = false; // assume not a widget object
blockSig = false; // not blocking signals blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher wasDeleted = false; // double-delete catcher
@ -204,8 +204,8 @@ QObjectPrivate::QObjectPrivate(int version)
sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent
receiveChildEvents = true; receiveChildEvents = true;
postedEvents = 0; postedEvents = 0;
extraData = 0; extraData = nullptr;
metaObject = 0; metaObject = nullptr;
isWindow = false; isWindow = false;
deleteLaterCalled = false; deleteLaterCalled = false;
} }
@ -926,8 +926,8 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
d->threadData.storeRelaxed(threadData); d->threadData.storeRelaxed(threadData);
if (parent) { if (parent) {
QT_TRY { QT_TRY {
if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : 0, threadData)) if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : nullptr, threadData))
parent = 0; parent = nullptr;
if (d->isWidget) { if (d->isWidget) {
if (parent) { if (parent) {
d->parent = parent; d->parent = parent;
@ -1095,7 +1095,7 @@ QObject::~QObject()
Q_TRACE(QObject_dtor, this); Q_TRACE(QObject_dtor, this);
if (d->parent) // remove it from parent object if (d->parent) // remove it from parent object
d->setParent_helper(0); d->setParent_helper(nullptr);
} }
QObjectPrivate::Connection::~Connection() QObjectPrivate::Connection::~Connection()
@ -1541,7 +1541,7 @@ void QObject::moveToThread(QThread *targetThread)
return; return;
} }
if (d->parent != 0) { if (d->parent != nullptr) {
qWarning("QObject::moveToThread: Cannot move objects with a parent"); qWarning("QObject::moveToThread: Cannot move objects with a parent");
return; return;
} }
@ -1618,7 +1618,7 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
if (pe.receiver == q) { if (pe.receiver == q) {
// move this post event to the targetList // move this post event to the targetList
targetData->postEventList.addEvent(pe); targetData->postEventList.addEvent(pe);
const_cast<QPostEvent &>(pe).event = 0; const_cast<QPostEvent &>(pe).event = nullptr;
++eventsMoved; ++eventsMoved;
} }
} }
@ -2065,7 +2065,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re
QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options) QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
{ {
if (!parent) if (!parent)
return 0; return nullptr;
const QObjectList &children = parent->children(); const QObjectList &children = parent->children();
QObject *obj; QObject *obj;
int i; int i;
@ -2081,7 +2081,7 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
return obj; return obj;
} }
} }
return 0; return nullptr;
} }
/*! /*!
@ -2109,7 +2109,7 @@ void QObjectPrivate::deleteChildren()
delete currentChildBeingDeleted; delete currentChildBeingDeleted;
} }
children.clear(); children.clear();
currentChildBeingDeleted = 0; currentChildBeingDeleted = nullptr;
isDeletingChildren = false; isDeletingChildren = false;
} }
@ -2161,7 +2161,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
// object hierarchies are constrained to a single thread // object hierarchies are constrained to a single thread
if (threadData != parent->d_func()->threadData) { if (threadData != parent->d_func()->threadData) {
qWarning("QObject::setParent: Cannot set parent, new parent is in a different thread"); qWarning("QObject::setParent: Cannot set parent, new parent is in a different thread");
parent = 0; parent = nullptr;
return; return;
} }
parent->d_func()->children.append(q); parent->d_func()->children.append(q);
@ -2232,7 +2232,7 @@ void QObject::installEventFilter(QObject *obj)
d->extraData = new QObjectPrivate::ExtraData; d->extraData = new QObjectPrivate::ExtraData;
// clean up unused items in the list // clean up unused items in the list
d->extraData->eventFilters.removeAll((QObject*)0); d->extraData->eventFilters.removeAll((QObject*)nullptr);
d->extraData->eventFilters.removeAll(obj); d->extraData->eventFilters.removeAll(obj);
d->extraData->eventFilters.prepend(obj); d->extraData->eventFilters.prepend(obj);
} }
@ -2256,7 +2256,7 @@ void QObject::removeEventFilter(QObject *obj)
if (d->extraData) { if (d->extraData) {
for (int i = 0; i < d->extraData->eventFilters.count(); ++i) { for (int i = 0; i < d->extraData->eventFilters.count(); ++i) {
if (d->extraData->eventFilters.at(i) == obj) if (d->extraData->eventFilters.at(i) == obj)
d->extraData->eventFilters[i] = 0; d->extraData->eventFilters[i] = nullptr;
} }
} }
} }
@ -2379,7 +2379,7 @@ void QObject::deleteLater()
const char *qFlagLocation(const char *method) const char *qFlagLocation(const char *method)
{ {
QThreadData *currentThreadData = QThreadData::current(false); QThreadData *currentThreadData = QThreadData::current(false);
if (currentThreadData != 0) if (currentThreadData != nullptr)
currentThreadData->flaggedSignatures.store(method); currentThreadData->flaggedSignatures.store(method);
return method; return method;
} }
@ -2398,7 +2398,7 @@ static const char * extract_location(const char *member)
if (*location != '\0') if (*location != '\0')
return location; return location;
} }
return 0; return nullptr;
} }
static bool check_signal_macro(const QObject *sender, const char *signal, static bool check_signal_macro(const QObject *sender, const char *signal,
@ -2437,7 +2437,7 @@ static void err_method_notfound(const QObject *object,
case QSIGNAL_CODE: type = "signal"; break; case QSIGNAL_CODE: type = "signal"; break;
} }
const char *loc = extract_location(method); const char *loc = extract_location(method);
if (strchr(method,')') == 0) // common typing mistake if (strchr(method,')') == nullptr) // common typing mistake
qWarning("QObject::%s: Parentheses expected, %s %s::%s%s%s", qWarning("QObject::%s: Parentheses expected, %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1, func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : ""); loc ? " in ": "", loc ? loc : "");
@ -2497,7 +2497,7 @@ QObject *QObject::sender() const
return cd->currentSender->sender; return cd->currentSender->sender;
} }
return 0; return nullptr;
} }
/*! /*!
@ -2676,7 +2676,7 @@ void QMetaObjectPrivate::memberIndexes(const QObject *obj,
return; return;
const QMetaObject *m = obj->metaObject(); const QMetaObject *m = obj->metaObject();
// Check that member is member of obj class // Check that member is member of obj class
while (m != 0 && m != member.mobj) while (m != nullptr && m != member.mobj)
m = m->d.superdata; m = m->d.superdata;
if (!m) if (!m)
return; return;
@ -2787,18 +2787,18 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
const QObject *receiver, const char *method, const QObject *receiver, const char *method,
Qt::ConnectionType type) Qt::ConnectionType type)
{ {
if (sender == 0 || receiver == 0 || signal == 0 || method == 0) { if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) {
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
sender ? sender->metaObject()->className() : "(null)", sender ? sender->metaObject()->className() : "(null)",
(signal && *signal) ? signal+1 : "(null)", (signal && *signal) ? signal+1 : "(null)",
receiver ? receiver->metaObject()->className() : "(null)", receiver ? receiver->metaObject()->className() : "(null)",
(method && *method) ? method+1 : "(null)"); (method && *method) ? method+1 : "(null)");
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
QByteArray tmp_signal_name; QByteArray tmp_signal_name;
if (!check_signal_macro(sender, signal, "connect", "bind")) if (!check_signal_macro(sender, signal, "connect", "bind"))
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
const QMetaObject *smeta = sender->metaObject(); const QMetaObject *smeta = sender->metaObject();
const char *signal_arg = signal; const char *signal_arg = signal;
++signal; //skip code ++signal; //skip code
@ -2821,7 +2821,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
if (signal_index < 0) { if (signal_index < 0) {
err_method_notfound(sender, signal_arg, "connect"); err_method_notfound(sender, signal_arg, "connect");
err_info_about_objects("connect", sender, receiver); err_info_about_objects("connect", sender, receiver);
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
signal_index = QMetaObjectPrivate::originalClone(smeta, signal_index); signal_index = QMetaObjectPrivate::originalClone(smeta, signal_index);
signal_index += QMetaObjectPrivate::signalOffset(smeta); signal_index += QMetaObjectPrivate::signalOffset(smeta);
@ -2830,7 +2830,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
int membcode = extract_code(method); int membcode = extract_code(method);
if (!check_method_code(membcode, receiver, method, "connect")) if (!check_method_code(membcode, receiver, method, "connect"))
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
const char *method_arg = method; const char *method_arg = method;
++method; // skip code ++method; // skip code
@ -2873,7 +2873,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
if (method_index_relative < 0) { if (method_index_relative < 0) {
err_method_notfound(receiver, method_arg, "connect"); err_method_notfound(receiver, method_arg, "connect");
err_info_about_objects("connect", sender, receiver); err_info_about_objects("connect", sender, receiver);
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
if (!QMetaObjectPrivate::checkConnectArgs(signalTypes.size(), signalTypes.constData(), if (!QMetaObjectPrivate::checkConnectArgs(signalTypes.size(), signalTypes.constData(),
@ -2882,13 +2882,13 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
"\n %s::%s --> %s::%s", "\n %s::%s --> %s::%s",
sender->metaObject()->className(), signal, sender->metaObject()->className(), signal,
receiver->metaObject()->className(), method); receiver->metaObject()->className(), method);
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
int *types = 0; int *types = nullptr;
if ((type == Qt::QueuedConnection) if ((type == Qt::QueuedConnection)
&& !(types = queuedConnectionTypes(signalTypes.constData(), signalTypes.size()))) { && !(types = queuedConnectionTypes(signalTypes.constData(), signalTypes.size()))) {
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
@ -2925,8 +2925,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
const QObject *receiver, const QMetaMethod &method, const QObject *receiver, const QMetaMethod &method,
Qt::ConnectionType type) Qt::ConnectionType type)
{ {
if (sender == 0 if (sender == nullptr
|| receiver == 0 || receiver == nullptr
|| signal.methodType() != QMetaMethod::Signal || signal.methodType() != QMetaMethod::Signal
|| method.methodType() == QMetaMethod::Constructor) { || method.methodType() == QMetaMethod::Constructor) {
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
@ -2934,7 +2934,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
signal.methodSignature().constData(), signal.methodSignature().constData(),
receiver ? receiver->metaObject()->className() : "(null)", receiver ? receiver->metaObject()->className() : "(null)",
method.methodSignature().constData() ); method.methodSignature().constData() );
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
int signal_index; int signal_index;
@ -2950,12 +2950,12 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
if (signal_index == -1) { if (signal_index == -1) {
qWarning("QObject::connect: Can't find signal %s on instance of class %s", qWarning("QObject::connect: Can't find signal %s on instance of class %s",
signal.methodSignature().constData(), smeta->className()); signal.methodSignature().constData(), smeta->className());
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
if (method_index == -1) { if (method_index == -1) {
qWarning("QObject::connect: Can't find method %s on instance of class %s", qWarning("QObject::connect: Can't find method %s on instance of class %s",
method.methodSignature().constData(), rmeta->className()); method.methodSignature().constData(), rmeta->className());
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) { if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) {
@ -2963,19 +2963,19 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
"\n %s::%s --> %s::%s", "\n %s::%s --> %s::%s",
smeta->className(), signal.methodSignature().constData(), smeta->className(), signal.methodSignature().constData(),
rmeta->className(), method.methodSignature().constData()); rmeta->className(), method.methodSignature().constData());
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
int *types = 0; int *types = nullptr;
if ((type == Qt::QueuedConnection) if ((type == Qt::QueuedConnection)
&& !(types = queuedConnectionTypes(signal.parameterTypes()))) && !(types = queuedConnectionTypes(signal.parameterTypes())))
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
check_and_warn_compat(smeta, signal, rmeta, method); check_and_warn_compat(smeta, signal, rmeta, method);
#endif #endif
QMetaObject::Connection handle = QMetaObject::Connection(QMetaObjectPrivate::connect( QMetaObject::Connection handle = QMetaObject::Connection(QMetaObjectPrivate::connect(
sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, 0, type, types)); sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, nullptr, type, types));
return handle; return handle;
} }
@ -3058,7 +3058,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
bool QObject::disconnect(const QObject *sender, const char *signal, bool QObject::disconnect(const QObject *sender, const char *signal,
const QObject *receiver, const char *method) const QObject *receiver, const char *method)
{ {
if (sender == 0 || (receiver == 0 && method != 0)) { if (sender == nullptr || (receiver == nullptr && method != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter"); qWarning("QObject::disconnect: Unexpected null parameter");
return false; return false;
} }
@ -3130,7 +3130,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
} }
if (!method) { if (!method) {
res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, 0); res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, nullptr);
} else { } else {
const QMetaObject *rmeta = receiver->metaObject(); const QMetaObject *rmeta = receiver->metaObject();
do { do {
@ -3141,7 +3141,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
rmeta = rmeta->superClass(); rmeta = rmeta->superClass();
if (method_index < 0) if (method_index < 0)
break; break;
res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, 0); res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, nullptr);
method_found = true; method_found = true;
} while ((rmeta = rmeta->superClass())); } while ((rmeta = rmeta->superClass()));
} }
@ -3193,7 +3193,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &method) const QObject *receiver, const QMetaMethod &method)
{ {
if (sender == 0 || (receiver == 0 && method.mobj != 0)) { if (sender == nullptr || (receiver == nullptr && method.mobj != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter"); qWarning("QObject::disconnect: Unexpected null parameter");
return false; return false;
} }
@ -3242,7 +3242,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
return false; return false;
} }
if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, 0)) if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, nullptr))
return false; return false;
if (!signal.isValid()) { if (!signal.isValid()) {
@ -3381,7 +3381,7 @@ QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_i
signal_index = methodIndexToSignalIndex(&smeta, signal_index); signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return Connection(QMetaObjectPrivate::connect(sender, signal_index, smeta, return Connection(QMetaObjectPrivate::connect(sender, signal_index, smeta,
receiver, method_index, receiver, method_index,
0, //FIXME, we could speed this connection up by computing the relative index nullptr, //FIXME, we could speed this connection up by computing the relative index
type, types)); type, types));
} }
@ -3457,7 +3457,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index,
const QMetaObject *smeta = sender->metaObject(); const QMetaObject *smeta = sender->metaObject();
signal_index = methodIndexToSignalIndex(&smeta, signal_index); signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index, smeta, return QMetaObjectPrivate::disconnect(sender, signal_index, smeta,
receiver, method_index, 0); receiver, method_index, nullptr);
} }
/*! /*!
@ -3473,7 +3473,7 @@ bool QMetaObject::disconnectOne(const QObject *sender, int signal_index,
const QMetaObject *smeta = sender->metaObject(); const QMetaObject *smeta = sender->metaObject();
signal_index = methodIndexToSignalIndex(&smeta, signal_index); signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index, smeta, return QMetaObjectPrivate::disconnect(sender, signal_index, smeta,
receiver, method_index, 0, receiver, method_index, nullptr,
QMetaObjectPrivate::DisconnectOne); QMetaObjectPrivate::DisconnectOne);
} }
@ -3682,7 +3682,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
argumentTypes = queuedConnectionTypes(m.parameterTypes()); argumentTypes = queuedConnectionTypes(m.parameterTypes());
if (!argumentTypes) // cannot queue arguments if (!argumentTypes) // cannot queue arguments
argumentTypes = &DIRECT_CONNECTION_ONLY; argumentTypes = &DIRECT_CONNECTION_ONLY;
if (!c->argumentTypes.testAndSetOrdered(0, argumentTypes)) { if (!c->argumentTypes.testAndSetOrdered(nullptr, argumentTypes)) {
if (argumentTypes != &DIRECT_CONNECTION_ONLY) if (argumentTypes != &DIRECT_CONNECTION_ONLY)
delete [] argumentTypes; delete [] argumentTypes;
argumentTypes = c->argumentTypes.loadRelaxed(); argumentTypes = c->argumentTypes.loadRelaxed();
@ -4293,10 +4293,10 @@ QObjectUserData* QObject::userData(uint id) const
{ {
Q_D(const QObject); Q_D(const QObject);
if (!d->extraData) if (!d->extraData)
return 0; return nullptr;
if ((int)id < d->extraData->userData.size()) if ((int)id < d->extraData->userData.size())
return d->extraData->userData.at(id); return d->extraData->userData.at(id);
return 0; return nullptr;
} }
#endif // QT_NO_USERDATA #endif // QT_NO_USERDATA
@ -4952,7 +4952,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
if (!senderMetaObject) { if (!senderMetaObject) {
qWarning("QObject::connect: signal not found in %s", sender->metaObject()->className()); qWarning("QObject::connect: signal not found in %s", sender->metaObject()->className());
slotObj->destroyIfLastRef(); slotObj->destroyIfLastRef();
return QMetaObject::Connection(0); return QMetaObject::Connection(nullptr);
} }
signal_index += QMetaObjectPrivate::signalOffset(senderMetaObject); signal_index += QMetaObjectPrivate::signalOffset(senderMetaObject);
return QObjectPrivate::connectImpl(sender, signal_index, receiver, slot, slotObj, type, types, senderMetaObject); return QObjectPrivate::connectImpl(sender, signal_index, receiver, slot, slotObj, type, types, senderMetaObject);
@ -5138,7 +5138,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject) bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject)
{ {
if (sender == 0 || (receiver == 0 && slot != 0)) { if (sender == nullptr || (receiver == nullptr && slot != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter"); qWarning("QObject::disconnect: Unexpected null parameter");
return false; return false;
} }
@ -5178,7 +5178,7 @@ QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signa
const QMetaObject *senderMetaObject = sender->metaObject(); const QMetaObject *senderMetaObject = sender->metaObject();
signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index); signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index);
return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/0, slotObj, type, /*types*/0, senderMetaObject); return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/nullptr, slotObj, type, /*types*/nullptr, senderMetaObject);
} }
/*! /*!
@ -5235,7 +5235,7 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C
Creates a Connection instance. Creates a Connection instance.
*/ */
QMetaObject::Connection::Connection() : d_ptr(0) {} QMetaObject::Connection::Connection() : d_ptr(nullptr) {}
/*! /*!
Destructor for QMetaObject::Connection. Destructor for QMetaObject::Connection.

View File

@ -94,7 +94,7 @@ QObjectCleanupHandler::~QObjectCleanupHandler()
QObject *QObjectCleanupHandler::add(QObject* object) QObject *QObjectCleanupHandler::add(QObject* object)
{ {
if (!object) if (!object)
return 0; return nullptr;
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
cleanupObjects.insert(0, object); cleanupObjects.insert(0, object);

View File

@ -441,7 +441,7 @@ bool QSharedMemory::attach(AccessMode mode)
bool QSharedMemory::isAttached() const bool QSharedMemory::isAttached() const
{ {
Q_D(const QSharedMemory); Q_D(const QSharedMemory);
return (0 != d->memory); return (nullptr != d->memory);
} }
/*! /*!

View File

@ -182,9 +182,9 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
} }
// grab the memory // grab the memory
memory = shmat(id, 0, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0)); memory = shmat(id, nullptr, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0));
if ((void*) - 1 == memory) { if ((void*) - 1 == memory) {
memory = 0; memory = nullptr;
setErrorString(QLatin1String("QSharedMemory::attach (shmat)")); setErrorString(QLatin1String("QSharedMemory::attach (shmat)"));
return false; return false;
} }
@ -216,7 +216,7 @@ bool QSharedMemoryPrivate::detach()
} }
return false; return false;
} }
memory = 0; memory = nullptr;
size = 0; size = 0;
// Get the number of current attachments // Get the number of current attachments

View File

@ -68,7 +68,7 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() :
#ifndef QT_NO_QOBJECT #ifndef QT_NO_QOBJECT
QObjectPrivate(), QObjectPrivate(),
#endif #endif
memory(0), size(0), error(QSharedMemory::NoError), memory(nullptr), size(0), error(QSharedMemory::NoError),
#ifndef QT_NO_SYSTEMSEMAPHORE #ifndef QT_NO_SYSTEMSEMAPHORE
systemSemaphore(QString()), lockedByMe(false), systemSemaphore(QString()), lockedByMe(false),
#endif #endif

View File

@ -55,7 +55,7 @@ Q_CORE_EXPORT void QTestPrivate::qSleep(int ms)
Sleep(uint(ms)); Sleep(uint(ms));
#else #else
struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 }; struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL); nanosleep(&ts, nullptr);
#endif #endif
} }

View File

@ -277,7 +277,7 @@ protected:
}; };
QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char *member) QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char *member)
: QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(0) : QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(nullptr)
{ {
timerId = startTimer(msec, timerType); timerId = startTimer(msec, timerType);
connect(this, SIGNAL(timeout()), r, member); connect(this, SIGNAL(timeout()), r, member);
@ -290,7 +290,7 @@ QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObj
if (r && thread() != r->thread()) { if (r && thread() != r->thread()) {
// Avoid leaking the QSingleShotTimer instance in case the application exits before the timer fires // Avoid leaking the QSingleShotTimer instance in case the application exits before the timer fires
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater); connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
setParent(0); setParent(nullptr);
moveToThread(r->thread()); moveToThread(r->thread());
} }
} }
@ -316,7 +316,7 @@ void QSingleShotTimer::timerEvent(QTimerEvent *)
if (Q_LIKELY(!receiver.isNull() || !hasValidReceiver)) { if (Q_LIKELY(!receiver.isNull() || !hasValidReceiver)) {
// We allocate only the return type - we previously checked the function had // We allocate only the return type - we previously checked the function had
// no arguments. // no arguments.
void *args[1] = { 0 }; void *args[1] = { nullptr };
slotObj->call(const_cast<QObject*>(receiver.data()), args); slotObj->call(const_cast<QObject*>(receiver.data()), args);
} }
} else { } else {

View File

@ -83,7 +83,7 @@ QTimerInfoList::QTimerInfoList()
} }
#endif #endif
firstTimerInfo = 0; firstTimerInfo = nullptr;
} }
timespec QTimerInfoList::updateCurrentTime() timespec QTimerInfoList::updateCurrentTime()
@ -389,7 +389,7 @@ bool QTimerInfoList::timerWait(timespec &tm)
repairTimersIfNeeded(); repairTimersIfNeeded();
// Find first waiting timer not already active // Find first waiting timer not already active
QTimerInfo *t = 0; QTimerInfo *t = nullptr;
for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
if (!(*it)->activateRef) { if (!(*it)->activateRef) {
t = *it; t = *it;
@ -450,7 +450,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
t->interval = interval; t->interval = interval;
t->timerType = timerType; t->timerType = timerType;
t->obj = object; t->obj = object;
t->activateRef = 0; t->activateRef = nullptr;
timespec expected = updateCurrentTime() + interval; timespec expected = updateCurrentTime() + interval;
@ -514,9 +514,9 @@ bool QTimerInfoList::unregisterTimer(int timerId)
// found it // found it
removeAt(i); removeAt(i);
if (t == firstTimerInfo) if (t == firstTimerInfo)
firstTimerInfo = 0; firstTimerInfo = nullptr;
if (t->activateRef) if (t->activateRef)
*(t->activateRef) = 0; *(t->activateRef) = nullptr;
delete t; delete t;
return true; return true;
} }
@ -535,9 +535,9 @@ bool QTimerInfoList::unregisterTimers(QObject *object)
// object found // object found
removeAt(i); removeAt(i);
if (t == firstTimerInfo) if (t == firstTimerInfo)
firstTimerInfo = 0; firstTimerInfo = nullptr;
if (t->activateRef) if (t->activateRef)
*(t->activateRef) = 0; *(t->activateRef) = nullptr;
delete t; delete t;
// move back one so that we don't skip the new current item // move back one so that we don't skip the new current item
--i; --i;
@ -571,7 +571,7 @@ int QTimerInfoList::activateTimers()
return 0; // nothing to do return 0; // nothing to do
int n_act = 0, maxCount = 0; int n_act = 0, maxCount = 0;
firstTimerInfo = 0; firstTimerInfo = nullptr;
timespec currentTime = updateCurrentTime(); timespec currentTime = updateCurrentTime();
// qDebug() << "Thread" << QThread::currentThreadId() << "woken up at" << currentTime; // qDebug() << "Thread" << QThread::currentThreadId() << "woken up at" << currentTime;
@ -643,11 +643,11 @@ int QTimerInfoList::activateTimers()
QCoreApplication::sendEvent(currentTimerInfo->obj, &e); QCoreApplication::sendEvent(currentTimerInfo->obj, &e);
if (currentTimerInfo) if (currentTimerInfo)
currentTimerInfo->activateRef = 0; currentTimerInfo->activateRef = nullptr;
} }
} }
firstTimerInfo = 0; firstTimerInfo = nullptr;
// qDebug() << "Thread" << QThread::currentThreadId() << "activated" << n_act << "timers"; // qDebug() << "Thread" << QThread::currentThreadId() << "activated" << n_act << "timers";
return n_act; return n_act;
} }

View File

@ -289,8 +289,8 @@ public:
#if defined(QT_USE_MMAP) #if defined(QT_USE_MMAP)
used_mmap(0), used_mmap(0),
#endif #endif
unmapPointer(0), unmapLength(0), resource(0), unmapPointer(nullptr), unmapLength(0), resource(nullptr),
messageArray(0), offsetArray(0), contextArray(0), numerusRulesArray(0), messageArray(nullptr), offsetArray(nullptr), contextArray(nullptr), numerusRulesArray(nullptr),
messageLength(0), offsetLength(0), contextLength(0), numerusRulesLength(0) {} messageLength(0), offsetLength(0), contextLength(0), numerusRulesLength(0) {}
#if defined(QT_USE_MMAP) #if defined(QT_USE_MMAP)
@ -539,7 +539,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
ok = true; ok = true;
} else { } else {
delete resource; delete resource;
resource = 0; resource = nullptr;
} }
} }
@ -610,8 +610,8 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
delete [] unmapPointer; delete [] unmapPointer;
delete d->resource; delete d->resource;
d->resource = 0; d->resource = nullptr;
d->unmapPointer = 0; d->unmapPointer = nullptr;
d->unmapLength = 0; d->unmapLength = 0;
return false; return false;
@ -874,10 +874,10 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
} }
if (!ok) { if (!ok) {
messageArray = 0; messageArray = nullptr;
contextArray = 0; contextArray = nullptr;
offsetArray = 0; offsetArray = nullptr;
numerusRulesArray = 0; numerusRulesArray = nullptr;
messageLength = 0; messageLength = 0;
contextLength = 0; contextLength = 0;
offsetLength = 0; offsetLength = 0;
@ -890,7 +890,7 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
static QString getMessage(const uchar *m, const uchar *end, const char *context, static QString getMessage(const uchar *m, const uchar *end, const char *context,
const char *sourceText, const char *comment, uint numerus) const char *sourceText, const char *comment, uint numerus)
{ {
const uchar *tn = 0; const uchar *tn = nullptr;
uint tn_length = 0; uint tn_length = 0;
const uint sourceTextLen = uint(strlen(sourceText)); const uint sourceTextLen = uint(strlen(sourceText));
const uint contextLen = uint(strlen(context)); const uint contextLen = uint(strlen(context));
@ -957,11 +957,11 @@ end:
QString QTranslatorPrivate::do_translate(const char *context, const char *sourceText, QString QTranslatorPrivate::do_translate(const char *context, const char *sourceText,
const char *comment, int n) const const char *comment, int n) const
{ {
if (context == 0) if (context == nullptr)
context = ""; context = "";
if (sourceText == 0) if (sourceText == nullptr)
sourceText = ""; sourceText = "";
if (comment == 0) if (comment == nullptr)
comment = ""; comment = "";
uint numerus = 0; uint numerus = 0;
@ -1076,13 +1076,13 @@ void QTranslatorPrivate::clear()
} }
delete resource; delete resource;
resource = 0; resource = nullptr;
unmapPointer = 0; unmapPointer = nullptr;
unmapLength = 0; unmapLength = 0;
messageArray = 0; messageArray = nullptr;
contextArray = 0; contextArray = nullptr;
offsetArray = 0; offsetArray = nullptr;
numerusRulesArray = 0; numerusRulesArray = nullptr;
messageLength = 0; messageLength = 0;
contextLength = 0; contextLength = 0;
offsetLength = 0; offsetLength = 0;

View File

@ -2523,7 +2523,7 @@ void QVariant::load(QDataStream &s)
return; return;
} }
} }
create(typeId, 0); create(typeId, nullptr);
d.is_null = is_null; d.is_null = is_null;
if (!isValid()) { if (!isValid()) {

View File

@ -487,7 +487,7 @@ QMimeDatabase::QMimeDatabase() :
*/ */
QMimeDatabase::~QMimeDatabase() QMimeDatabase::~QMimeDatabase()
{ {
d = 0; d = nullptr;
} }
/*! /*!

View File

@ -130,7 +130,7 @@ bool QMimeBinaryProvider::CacheFile::reload()
if (file.isOpen()) { if (file.isOpen()) {
file.close(); file.close();
} }
data = 0; data = nullptr;
return load(); return load();
} }
@ -306,7 +306,7 @@ bool QMimeBinaryProvider::matchMagicRule(QMimeBinaryProvider::CacheFile *cacheFi
const int valueLength = cacheFile->getUint32(off + 12); const int valueLength = cacheFile->getUint32(off + 12);
const int valueOffset = cacheFile->getUint32(off + 16); const int valueOffset = cacheFile->getUint32(off + 16);
const int maskOffset = cacheFile->getUint32(off + 20); const int maskOffset = cacheFile->getUint32(off + 20);
const char *mask = maskOffset ? cacheFile->getCharStar(maskOffset) : NULL; const char *mask = maskOffset ? cacheFile->getCharStar(maskOffset) : nullptr;
if (!QMimeMagicRule::matchSubstring(dataPtr, dataSize, rangeStart, rangeLength, valueLength, cacheFile->getCharStar(valueOffset), mask)) if (!QMimeMagicRule::matchSubstring(dataPtr, dataSize, rangeStart, rangeLength, valueLength, cacheFile->getCharStar(valueOffset), mask))
continue; continue;

View File

@ -212,7 +212,7 @@ void QFactoryLoader::update()
QStringList(QLatin1String("libplugins_%1_*.so").arg(d->suffix)), QStringList(QLatin1String("libplugins_%1_*.so").arg(d->suffix)),
#endif #endif
QDir::Files); QDir::Files);
QLibraryPrivate *library = 0; QLibraryPrivate *library = nullptr;
for (int j = 0; j < plugins.count(); ++j) { for (int j = 0; j < plugins.count(); ++j) {
QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
@ -383,7 +383,7 @@ QObject *QFactoryLoader::instance(int index) const
{ {
Q_D(const QFactoryLoader); Q_D(const QFactoryLoader);
if (index < 0) if (index < 0)
return 0; return nullptr;
#if QT_CONFIG(library) #if QT_CONFIG(library)
QMutexLocker lock(&d->mutex); QMutexLocker lock(&d->mutex);
@ -399,7 +399,7 @@ QObject *QFactoryLoader::instance(int index) const
return obj; return obj;
} }
} }
return 0; return nullptr;
} }
index -= d->libraryList.size(); index -= d->libraryList.size();
lock.unlock(); lock.unlock();
@ -416,7 +416,7 @@ QObject *QFactoryLoader::instance(int index) const
--index; --index;
} }
return 0; return nullptr;
} }
QMultiMap<int, QString> QFactoryLoader::keyMap() const QMultiMap<int, QString> QFactoryLoader::keyMap() const

View File

@ -256,7 +256,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
qsizetype fdlen = qMin(file.size(), MaxMemoryMapSize); qsizetype fdlen = qMin(file.size(), MaxMemoryMapSize);
const char *filedata = reinterpret_cast<char *>(file.map(0, fdlen)); const char *filedata = reinterpret_cast<char *>(file.map(0, fdlen));
if (filedata == 0) { if (filedata == nullptr) {
// Try reading the data into memory instead (up to 64 MB). // Try reading the data into memory instead (up to 64 MB).
data = file.read(64 * 1024 * 1024); data = file.read(64 * 1024 * 1024);
filedata = data.constData(); filedata = data.constData();
@ -387,12 +387,12 @@ private:
}; };
static QBasicMutex qt_library_mutex; static QBasicMutex qt_library_mutex;
static QLibraryStore *qt_library_data = 0; static QLibraryStore *qt_library_data = nullptr;
static bool qt_library_data_once; static bool qt_library_data_once;
QLibraryStore::~QLibraryStore() QLibraryStore::~QLibraryStore()
{ {
qt_library_data = 0; qt_library_data = nullptr;
} }
inline void QLibraryStore::cleanup() inline void QLibraryStore::cleanup()
@ -459,7 +459,7 @@ inline QLibraryPrivate *QLibraryStore::findOrCreate(const QString &fileName, con
QLibraryStore *data = instance(); QLibraryStore *data = instance();
// check if this library is already loaded // check if this library is already loaded
QLibraryPrivate *lib = 0; QLibraryPrivate *lib = nullptr;
if (Q_LIKELY(data)) { if (Q_LIKELY(data)) {
lib = data->libraryMap.value(fileName); lib = data->libraryMap.value(fileName);
if (lib) if (lib)
@ -498,7 +498,7 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib)
} }
QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version, QLibrary::LoadHints loadHints) QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version, QLibrary::LoadHints loadHints)
: pHnd(0), fileName(canonicalFileName), fullVersion(version), instance(0), : pHnd(nullptr), fileName(canonicalFileName), fullVersion(version), instance(nullptr),
libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin) libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin)
{ {
loadHintsInt.storeRelaxed(loadHints); loadHintsInt.storeRelaxed(loadHints);
@ -528,7 +528,7 @@ void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh)
QFunctionPointer QLibraryPrivate::resolve(const char *symbol) QFunctionPointer QLibraryPrivate::resolve(const char *symbol)
{ {
if (!pHnd) if (!pHnd)
return 0; return nullptr;
return resolve_sys(symbol); return resolve_sys(symbol);
} }
@ -584,12 +584,12 @@ bool QLibraryPrivate::unload(UnloadFlag flag)
//when the library is unloaded, we release the reference on it so that 'this' //when the library is unloaded, we release the reference on it so that 'this'
//can get deleted //can get deleted
libraryRefCount.deref(); libraryRefCount.deref();
pHnd = 0; pHnd = nullptr;
instance = 0; instance = nullptr;
} }
} }
return (pHnd == 0); return (pHnd == nullptr);
} }
void QLibraryPrivate::release() void QLibraryPrivate::release()
@ -847,7 +847,7 @@ bool QLibrary::isLoaded() const
Constructs a library with the given \a parent. Constructs a library with the given \a parent.
*/ */
QLibrary::QLibrary(QObject *parent) QLibrary::QLibrary(QObject *parent)
:QObject(parent), d(0), did_load(false) :QObject(parent), d(nullptr), did_load(false)
{ {
} }
@ -862,7 +862,7 @@ QLibrary::QLibrary(QObject *parent)
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/ */
QLibrary::QLibrary(const QString& fileName, QObject *parent) QLibrary::QLibrary(const QString& fileName, QObject *parent)
:QObject(parent), d(0), did_load(false) :QObject(parent), d(nullptr), did_load(false)
{ {
setFileName(fileName); setFileName(fileName);
} }
@ -879,7 +879,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent)
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/ */
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
:QObject(parent), d(0), did_load(false) :QObject(parent), d(nullptr), did_load(false)
{ {
setFileNameAndVersion(fileName, verNum); setFileNameAndVersion(fileName, verNum);
} }
@ -895,7 +895,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/ */
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent) QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
:QObject(parent), d(0), did_load(false) :QObject(parent), d(nullptr), did_load(false)
{ {
setFileNameAndVersion(fileName, version); setFileNameAndVersion(fileName, version);
} }
@ -942,7 +942,7 @@ void QLibrary::setFileName(const QString &fileName)
if (d) { if (d) {
lh = d->loadHints(); lh = d->loadHints();
d->release(); d->release();
d = 0; d = nullptr;
did_load = false; did_load = false;
} }
d = QLibraryPrivate::findOrCreate(fileName, QString(), lh); d = QLibraryPrivate::findOrCreate(fileName, QString(), lh);
@ -970,7 +970,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, int verNum)
if (d) { if (d) {
lh = d->loadHints(); lh = d->loadHints();
d->release(); d->release();
d = 0; d = nullptr;
did_load = false; did_load = false;
} }
d = QLibraryPrivate::findOrCreate(fileName, verNum >= 0 ? QString::number(verNum) : QString(), lh); d = QLibraryPrivate::findOrCreate(fileName, verNum >= 0 ? QString::number(verNum) : QString(), lh);
@ -991,7 +991,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver
if (d) { if (d) {
lh = d->loadHints(); lh = d->loadHints();
d->release(); d->release();
d = 0; d = nullptr;
did_load = false; did_load = false;
} }
d = QLibraryPrivate::findOrCreate(fileName, version, lh); d = QLibraryPrivate::findOrCreate(fileName, version, lh);
@ -1020,7 +1020,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver
QFunctionPointer QLibrary::resolve(const char *symbol) QFunctionPointer QLibrary::resolve(const char *symbol)
{ {
if (!isLoaded() && !load()) if (!isLoaded() && !load())
return 0; return nullptr;
return d->resolve(symbol); return d->resolve(symbol);
} }

View File

@ -277,7 +277,7 @@ bool QLibraryPrivate::load_sys()
qualifiedFileName = attempt; qualifiedFileName = attempt;
errorString.clear(); errorString.clear();
} }
return (pHnd != 0); return (pHnd != nullptr);
} }
bool QLibraryPrivate::unload_sys() bool QLibraryPrivate::unload_sys()

View File

@ -136,7 +136,7 @@ QT_BEGIN_NAMESPACE
Constructs a plugin loader with the given \a parent. Constructs a plugin loader with the given \a parent.
*/ */
QPluginLoader::QPluginLoader(QObject *parent) QPluginLoader::QPluginLoader(QObject *parent)
: QObject(parent), d(0), did_load(false) : QObject(parent), d(nullptr), did_load(false)
{ {
} }
@ -152,7 +152,7 @@ QPluginLoader::QPluginLoader(QObject *parent)
\sa setFileName() \sa setFileName()
*/ */
QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
: QObject(parent), d(0), did_load(false) : QObject(parent), d(nullptr), did_load(false)
{ {
setFileName(fileName); setFileName(fileName);
setLoadHints(QLibrary::PreventUnloadHint); setLoadHints(QLibrary::PreventUnloadHint);
@ -195,7 +195,7 @@ QPluginLoader::~QPluginLoader()
QObject *QPluginLoader::instance() QObject *QPluginLoader::instance()
{ {
if (!isLoaded() && !load()) if (!isLoaded() && !load())
return 0; return nullptr;
if (!d->inst && d->instance) if (!d->inst && d->instance)
d->inst = d->instance(); d->inst = d->instance();
return d->inst.data(); return d->inst.data();
@ -363,7 +363,7 @@ void QPluginLoader::setFileName(const QString &fileName)
if (d) { if (d) {
lh = d->loadHints(); lh = d->loadHints();
d->release(); d->release();
d = 0; d = nullptr;
did_load = false; did_load = false;
} }

View File

@ -84,19 +84,19 @@ QT_BEGIN_NAMESPACE
QAbstractStatePrivate::QAbstractStatePrivate(StateType type) QAbstractStatePrivate::QAbstractStatePrivate(StateType type)
: stateType(type), isMachine(false), active(false), parentState(0) : stateType(type), isMachine(false), active(false), parentState(nullptr)
{ {
} }
QStateMachine *QAbstractStatePrivate::machine() const QStateMachine *QAbstractStatePrivate::machine() const
{ {
QObject *par = parent; QObject *par = parent;
while (par != 0) { while (par != nullptr) {
if (QStateMachine *mach = qobject_cast<QStateMachine*>(par)) if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
return mach; return mach;
par = par->parent(); par = par->parent();
} }
return 0; return nullptr;
} }
void QAbstractStatePrivate::callOnEntry(QEvent *e) void QAbstractStatePrivate::callOnEntry(QEvent *e)

View File

@ -144,7 +144,7 @@ QStateMachine *QAbstractTransitionPrivate::machine() const
Q_Q(const QAbstractTransition); Q_Q(const QAbstractTransition);
if (QHistoryState *parent = qobject_cast<QHistoryState *>(q->parent())) if (QHistoryState *parent = qobject_cast<QHistoryState *>(q->parent()))
return parent->machine(); return parent->machine();
return 0; return nullptr;
} }
bool QAbstractTransitionPrivate::callEventTest(QEvent *e) bool QAbstractTransitionPrivate::callEventTest(QEvent *e)
@ -223,7 +223,7 @@ void QAbstractTransition::setTargetState(QAbstractState* target)
{ {
Q_D(QAbstractTransition); Q_D(QAbstractTransition);
if ((d->targetStates.size() == 1 && target == d->targetStates.at(0).data()) || if ((d->targetStates.size() == 1 && target == d->targetStates.at(0).data()) ||
(d->targetStates.isEmpty() && target == 0)) { (d->targetStates.isEmpty() && target == nullptr)) {
return; return;
} }
if (!target) if (!target)

View File

@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE
*/ */
QEventTransitionPrivate::QEventTransitionPrivate() QEventTransitionPrivate::QEventTransitionPrivate()
{ {
object = 0; object = nullptr;
eventType = QEvent::None; eventType = QEvent::None;
registered = false; registered = false;
} }

View File

@ -147,7 +147,7 @@ protected:
QHistoryStatePrivate::QHistoryStatePrivate() QHistoryStatePrivate::QHistoryStatePrivate()
: QAbstractStatePrivate(HistoryState) : QAbstractStatePrivate(HistoryState)
, defaultTransition(0) , defaultTransition(nullptr)
, historyType(QHistoryState::ShallowHistory) , historyType(QHistoryState::ShallowHistory)
{ {
} }

View File

@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
QSignalTransitionPrivate::QSignalTransitionPrivate() QSignalTransitionPrivate::QSignalTransitionPrivate()
{ {
sender = 0; sender = nullptr;
signalIndex = -1; signalIndex = -1;
} }

View File

@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE
QStatePrivate::QStatePrivate() QStatePrivate::QStatePrivate()
: QAbstractStatePrivate(StandardState), : QAbstractStatePrivate(StandardState),
errorState(0), initialState(0), childMode(QState::ExclusiveStates), errorState(nullptr), initialState(nullptr), childMode(QState::ExclusiveStates),
childStatesListNeedsRefresh(true), transitionsListNeedsRefresh(true) childStatesListNeedsRefresh(true), transitionsListNeedsRefresh(true)
{ {
} }
@ -293,11 +293,11 @@ QAbstractState *QState::errorState() const
void QState::setErrorState(QAbstractState *state) void QState::setErrorState(QAbstractState *state)
{ {
Q_D(QState); Q_D(QState);
if (state != 0 && qobject_cast<QStateMachine*>(state)) { if (state != nullptr && qobject_cast<QStateMachine*>(state)) {
qWarning("QStateMachine::setErrorState: root state cannot be error state"); qWarning("QStateMachine::setErrorState: root state cannot be error state");
return; return;
} }
if (state != 0 && (!state->machine() || ((state->machine() != machine()) && !qobject_cast<QStateMachine*>(this)))) { if (state != nullptr && (!state->machine() || ((state->machine() != machine()) && !qobject_cast<QStateMachine*>(this)))) {
qWarning("QState::setErrorState: error state cannot belong " qWarning("QState::setErrorState: error state cannot belong "
"to a different state machine"); "to a different state machine");
return; return;
@ -360,15 +360,15 @@ QSignalTransition *QState::addTransition(const QObject *sender, const char *sign
{ {
if (!sender) { if (!sender) {
qWarning("QState::addTransition: sender cannot be null"); qWarning("QState::addTransition: sender cannot be null");
return 0; return nullptr;
} }
if (!signal) { if (!signal) {
qWarning("QState::addTransition: signal cannot be null"); qWarning("QState::addTransition: signal cannot be null");
return 0; return nullptr;
} }
if (!target) { if (!target) {
qWarning("QState::addTransition: cannot add transition to null state"); qWarning("QState::addTransition: cannot add transition to null state");
return 0; return nullptr;
} }
int offset = (*signal == '0'+QSIGNAL_CODE) ? 1 : 0; int offset = (*signal == '0'+QSIGNAL_CODE) ? 1 : 0;
const QMetaObject *meta = sender->metaObject(); const QMetaObject *meta = sender->metaObject();
@ -376,7 +376,7 @@ QSignalTransition *QState::addTransition(const QObject *sender, const char *sign
if (meta->indexOfSignal(QMetaObject::normalizedSignature(signal+offset)) == -1) { if (meta->indexOfSignal(QMetaObject::normalizedSignature(signal+offset)) == -1) {
qWarning("QState::addTransition: no such signal %s::%s", qWarning("QState::addTransition: no such signal %s::%s",
meta->className(), signal+offset); meta->className(), signal+offset);
return 0; return nullptr;
} }
} }
QSignalTransition *trans = new QSignalTransition(sender, signal); QSignalTransition *trans = new QSignalTransition(sender, signal);
@ -409,7 +409,7 @@ QAbstractTransition *QState::addTransition(QAbstractState *target)
{ {
if (!target) { if (!target) {
qWarning("QState::addTransition: cannot add transition to null state"); qWarning("QState::addTransition: cannot add transition to null state");
return 0; return nullptr;
} }
UnconditionalTransition *trans = new UnconditionalTransition(target); UnconditionalTransition *trans = new UnconditionalTransition(target);
addTransition(trans); addTransition(trans);
@ -438,7 +438,7 @@ void QState::removeTransition(QAbstractTransition *transition)
QStateMachinePrivate *mach = QStateMachinePrivate::get(d->machine()); QStateMachinePrivate *mach = QStateMachinePrivate::get(d->machine());
if (mach) if (mach)
mach->unregisterTransition(transition); mach->unregisterTransition(transition);
transition->setParent(0); transition->setParent(nullptr);
} }
/*! /*!
@ -544,7 +544,7 @@ bool QState::event(QEvent *e)
d->childStatesListNeedsRefresh = true; d->childStatesListNeedsRefresh = true;
d->transitionsListNeedsRefresh = true; d->transitionsListNeedsRefresh = true;
if ((e->type() == QEvent::ChildRemoved) && (static_cast<QChildEvent *>(e)->child() == d->initialState)) if ((e->type() == QEvent::ChildRemoved) && (static_cast<QChildEvent *>(e)->child() == d->initialState))
d->initialState = 0; d->initialState = nullptr;
} }
return QAbstractState::event(e); return QAbstractState::event(e);
} }

View File

@ -197,7 +197,7 @@ struct CalculationCache {
bool transitionDomainIsKnown : 1; bool transitionDomainIsKnown : 1;
TransitionInfo() TransitionInfo()
: transitionDomain(0) : transitionDomain(nullptr)
, effectiveTargetStatesIsKnown(false) , effectiveTargetStatesIsKnown(false)
, exitSetIsKnown(false) , exitSetIsKnown(false)
, transitionDomainIsKnown(false) , transitionDomainIsKnown(false)
@ -289,9 +289,9 @@ child of a child, etc.) Otherwise returns 'false'.
*/ */
static inline bool isDescendant(const QAbstractState *state1, const QAbstractState *state2) static inline bool isDescendant(const QAbstractState *state1, const QAbstractState *state2)
{ {
Q_ASSERT(state1 != 0); Q_ASSERT(state1 != nullptr);
for (QAbstractState *it = state1->parentState(); it != 0; it = it->parentState()) { for (QAbstractState *it = state1->parentState(); it != nullptr; it = it->parentState()) {
if (it == state2) if (it == state2)
return true; return true;
} }
@ -311,7 +311,7 @@ static bool containsDecendantOf(const QSet<QAbstractState *> &states, const QAbs
static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor) static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor)
{ {
int depth = 0; int depth = 0;
for (const QAbstractState *it = state; it != 0; it = it->parentState()) { for (const QAbstractState *it = state; it != nullptr; it = it->parentState()) {
if (it == ancestor) if (it == ancestor)
break; break;
++depth; ++depth;
@ -332,7 +332,7 @@ this returns the empty set.
*/ */
static QVector<QState*> getProperAncestors(const QAbstractState *state, const QAbstractState *upperBound) static QVector<QState*> getProperAncestors(const QAbstractState *state, const QAbstractState *upperBound)
{ {
Q_ASSERT(state != 0); Q_ASSERT(state != nullptr);
QVector<QState*> result; QVector<QState*> result;
result.reserve(16); result.reserve(16);
for (QState *it = state->parentState(); it && it != upperBound; it = it->parentState()) { for (QState *it = state->parentState(); it && it != upperBound; it = it->parentState()) {
@ -405,7 +405,7 @@ QStateMachinePrivate::QStateMachinePrivate()
stopProcessingReason = EventQueueEmpty; stopProcessingReason = EventQueueEmpty;
error = QStateMachine::NoError; error = QStateMachine::NoError;
globalRestorePolicy = QState::DontRestoreProperties; globalRestorePolicy = QState::DontRestoreProperties;
signalEventGenerator = 0; signalEventGenerator = nullptr;
#if QT_CONFIG(animation) #if QT_CONFIG(animation)
animated = true; animated = true;
#endif #endif
@ -437,7 +437,7 @@ static QEvent *cloneEvent(QEvent *e)
Q_ASSERT_X(false, "cloneEvent()", "not implemented"); Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break; break;
} }
return 0; return nullptr;
} }
const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = { const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = {
@ -474,10 +474,10 @@ bool QStateMachinePrivate::transitionStateEntryLessThan(QAbstractTransition *t1,
} else if (isDescendant(s2, s1)) { } else if (isDescendant(s2, s1)) {
return false; return false;
} else { } else {
Q_ASSERT(s1->machine() != 0); Q_ASSERT(s1->machine() != nullptr);
QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
Q_ASSERT(lca != 0); Q_ASSERT(lca != nullptr);
int s1Depth = descendantDepth(s1, lca); int s1Depth = descendantDepth(s1, lca);
int s2Depth = descendantDepth(s2, lca); int s2Depth = descendantDepth(s2, lca);
if (s1Depth == s2Depth) if (s1Depth == s2Depth)
@ -497,10 +497,10 @@ bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState
} else if (isDescendant(s2, s1)) { } else if (isDescendant(s2, s1)) {
return true; return true;
} else { } else {
Q_ASSERT(s1->machine() != 0); Q_ASSERT(s1->machine() != nullptr);
QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
Q_ASSERT(lca != 0); Q_ASSERT(lca != nullptr);
return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
} }
} }
@ -515,10 +515,10 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState
} else if (isDescendant(s2, s1)) { } else if (isDescendant(s2, s1)) {
return false; return false;
} else { } else {
Q_ASSERT(s1->machine() != 0); Q_ASSERT(s1->machine() != nullptr);
QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
Q_ASSERT(lca != 0); Q_ASSERT(lca != nullptr);
return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));
} }
} }
@ -526,7 +526,7 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState
QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states, bool onlyCompound) QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states, bool onlyCompound)
{ {
if (states.isEmpty()) if (states.isEmpty())
return 0; return nullptr;
QVector<QState*> ancestors = getProperAncestors(states.at(0), rootState()->parentState()); QVector<QState*> ancestors = getProperAncestors(states.at(0), rootState()->parentState());
for (int i = 0; i < ancestors.size(); ++i) { for (int i = 0; i < ancestors.size(); ++i) {
QState *anc = ancestors.at(i); QState *anc = ancestors.at(i);
@ -792,7 +792,7 @@ QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr
lst.prepend(t->sourceState()); lst.prepend(t->sourceState());
domain = findLCCA(lst); domain = findLCCA(lst);
Q_ASSERT(domain != 0); Q_ASSERT(domain != nullptr);
} }
for (QAbstractState* s : qAsConst(configuration)) { for (QAbstractState* s : qAsConst(configuration)) {
@ -918,7 +918,7 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t
Q_ASSERT(cache); Q_ASSERT(cache);
if (effectiveTargetStates.isEmpty()) if (effectiveTargetStates.isEmpty())
return 0; return nullptr;
QAbstractState *domain = nullptr; QAbstractState *domain = nullptr;
if (cache->transitionDomain(t, &domain)) if (cache->transitionDomain(t, &domain))
@ -1234,28 +1234,28 @@ QState *QStateMachinePrivate::toStandardState(QAbstractState *state)
{ {
if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState))
return static_cast<QState*>(state); return static_cast<QState*>(state);
return 0; return nullptr;
} }
const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state) const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state)
{ {
if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState))
return static_cast<const QState*>(state); return static_cast<const QState*>(state);
return 0; return nullptr;
} }
QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state) QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state)
{ {
if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState)) if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState))
return static_cast<QFinalState*>(state); return static_cast<QFinalState*>(state);
return 0; return nullptr;
} }
QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state) QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state)
{ {
if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState)) if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState))
return static_cast<QHistoryState*>(state); return static_cast<QHistoryState*>(state);
return 0; return nullptr;
} }
bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const
@ -1455,13 +1455,13 @@ QHash<QAbstractState*, QVector<QPropertyAssignment> > QStateMachinePrivate::comp
QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context) QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)
{ {
// Find error state recursively in parent hierarchy if not set explicitly for context state // Find error state recursively in parent hierarchy if not set explicitly for context state
QAbstractState *errorState = 0; QAbstractState *errorState = nullptr;
if (context != 0) { if (context != nullptr) {
QState *s = toStandardState(context); QState *s = toStandardState(context);
if (s != 0) if (s != nullptr)
errorState = s->errorState(); errorState = s->errorState();
if (errorState == 0) if (errorState == nullptr)
errorState = findErrorState(context->parentState()); errorState = findErrorState(context->parentState());
} }
@ -1475,21 +1475,21 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
error = errorCode; error = errorCode;
switch (errorCode) { switch (errorCode) {
case QStateMachine::NoInitialStateError: case QStateMachine::NoInitialStateError:
Q_ASSERT(currentContext != 0); Q_ASSERT(currentContext != nullptr);
errorString = QStateMachine::tr("Missing initial state in compound state '%1'") errorString = QStateMachine::tr("Missing initial state in compound state '%1'")
.arg(currentContext->objectName()); .arg(currentContext->objectName());
break; break;
case QStateMachine::NoDefaultStateInHistoryStateError: case QStateMachine::NoDefaultStateInHistoryStateError:
Q_ASSERT(currentContext != 0); Q_ASSERT(currentContext != nullptr);
errorString = QStateMachine::tr("Missing default state in history state '%1'") errorString = QStateMachine::tr("Missing default state in history state '%1'")
.arg(currentContext->objectName()); .arg(currentContext->objectName());
break; break;
case QStateMachine::NoCommonAncestorForTransitionError: case QStateMachine::NoCommonAncestorForTransitionError:
Q_ASSERT(currentContext != 0); Q_ASSERT(currentContext != nullptr);
errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'") errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'")
.arg(currentContext->objectName()); .arg(currentContext->objectName());
@ -1513,11 +1513,11 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
// Avoid infinite loop if the error state itself has an error // Avoid infinite loop if the error state itself has an error
if (currentContext == currentErrorState) if (currentContext == currentErrorState)
currentErrorState = 0; currentErrorState = nullptr;
Q_ASSERT(currentErrorState != rootState()); Q_ASSERT(currentErrorState != rootState());
if (currentErrorState != 0) { if (currentErrorState != nullptr) {
#ifdef QSTATEMACHINE_DEBUG #ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext; qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext;
#endif #endif
@ -1549,7 +1549,7 @@ QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
} }
} else { } else {
QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation); QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);
if (animation != 0 if (animation != nullptr
&& prop.object == animation->targetObject() && prop.object == animation->targetObject()
&& prop.propertyName == animation->propertyName()) { && prop.propertyName == animation->propertyName()) {
@ -1568,7 +1568,7 @@ void QStateMachinePrivate::_q_animationFinished()
{ {
Q_Q(QStateMachine); Q_Q(QStateMachine);
QAbstractAnimation *anim = qobject_cast<QAbstractAnimation*>(q->sender()); QAbstractAnimation *anim = qobject_cast<QAbstractAnimation*>(q->sender());
Q_ASSERT(anim != 0); Q_ASSERT(anim != nullptr);
QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished())); QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
if (resetAnimationEndValues.contains(anim)) { if (resetAnimationEndValues.contains(anim)) {
qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); // ### generalize qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); // ### generalize
@ -1576,7 +1576,7 @@ void QStateMachinePrivate::_q_animationFinished()
} }
QAbstractState *state = stateForAnimation.take(anim); QAbstractState *state = stateForAnimation.take(anim);
Q_ASSERT(state != 0); Q_ASSERT(state != nullptr);
#ifndef QT_NO_PROPERTIES #ifndef QT_NO_PROPERTIES
// Set the final property value. // Set the final property value.
@ -1638,7 +1638,7 @@ void QStateMachinePrivate::terminateActiveAnimations(QAbstractState *state,
resetAnimationEndValues.remove(anim); resetAnimationEndValues.remove(anim);
} }
QPropertyAssignment assn = propertyForAnimation.take(anim); QPropertyAssignment assn = propertyForAnimation.take(anim);
Q_ASSERT(assn.object != 0); Q_ASSERT(assn.object != nullptr);
// If there is no property assignment that sets this property, // If there is no property assignment that sets this property,
// set the property to its target value. // set the property to its target value.
bool found = false; bool found = false;
@ -1745,7 +1745,7 @@ QAbstractTransition *QStateMachinePrivate::createInitialTransition() const
}; };
QState *root = rootState(); QState *root = rootState();
Q_ASSERT(root != 0); Q_ASSERT(root != nullptr);
QList<QAbstractState *> targets; QList<QAbstractState *> targets;
switch (root->childMode()) { switch (root->childMode()) {
case QState::ExclusiveStates: case QState::ExclusiveStates:
@ -1891,26 +1891,26 @@ void QStateMachinePrivate::_q_process()
enabledTransitions = selectTransitions(e, &calculationCache); enabledTransitions = selectTransitions(e, &calculationCache);
if (enabledTransitions.isEmpty()) { if (enabledTransitions.isEmpty()) {
delete e; delete e;
e = 0; e = nullptr;
} }
while (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != 0)) { while (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != nullptr)) {
#ifdef QSTATEMACHINE_DEBUG #ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": dequeued internal event" << e << "of type" << e->type(); qDebug() << q << ": dequeued internal event" << e << "of type" << e->type();
#endif #endif
enabledTransitions = selectTransitions(e, &calculationCache); enabledTransitions = selectTransitions(e, &calculationCache);
if (enabledTransitions.isEmpty()) { if (enabledTransitions.isEmpty()) {
delete e; delete e;
e = 0; e = nullptr;
} }
} }
while (enabledTransitions.isEmpty() && ((e = dequeueExternalEvent()) != 0)) { while (enabledTransitions.isEmpty() && ((e = dequeueExternalEvent()) != nullptr)) {
#ifdef QSTATEMACHINE_DEBUG #ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": dequeued external event" << e << "of type" << e->type(); qDebug() << q << ": dequeued external event" << e << "of type" << e->type();
#endif #endif
enabledTransitions = selectTransitions(e, &calculationCache); enabledTransitions = selectTransitions(e, &calculationCache);
if (enabledTransitions.isEmpty()) { if (enabledTransitions.isEmpty()) {
delete e; delete e;
e = 0; e = nullptr;
} }
} }
if (enabledTransitions.isEmpty()) { if (enabledTransitions.isEmpty()) {
@ -2009,7 +2009,7 @@ QEvent *QStateMachinePrivate::dequeueInternalEvent()
{ {
QMutexLocker locker(&internalEventMutex); QMutexLocker locker(&internalEventMutex);
if (internalEventQueue.isEmpty()) if (internalEventQueue.isEmpty())
return 0; return nullptr;
return internalEventQueue.takeFirst(); return internalEventQueue.takeFirst();
} }
@ -2017,7 +2017,7 @@ QEvent *QStateMachinePrivate::dequeueExternalEvent()
{ {
QMutexLocker locker(&externalEventMutex); QMutexLocker locker(&externalEventMutex);
if (externalEventQueue.isEmpty()) if (externalEventQueue.isEmpty())
return 0; return nullptr;
return externalEventQueue.takeFirst(); return externalEventQueue.takeFirst();
} }
@ -2175,15 +2175,15 @@ void QStateMachinePrivate::goToState(QAbstractState *targetState)
return; return;
Q_ASSERT(state == Running); Q_ASSERT(state == Running);
QState *sourceState = 0; QState *sourceState = nullptr;
QSet<QAbstractState*>::const_iterator it; QSet<QAbstractState*>::const_iterator it;
for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
sourceState = toStandardState(*it); sourceState = toStandardState(*it);
if (sourceState != 0) if (sourceState != nullptr)
break; break;
} }
Q_ASSERT(sourceState != 0); Q_ASSERT(sourceState != nullptr);
// Reuse previous GoToStateTransition in case of several calls to // Reuse previous GoToStateTransition in case of several calls to
// goToState() in a row. // goToState() in a row.
GoToStateTransition *trans = sourceState->findChild<GoToStateTransition*>(); GoToStateTransition *trans = sourceState->findChild<GoToStateTransition*>();
@ -2327,7 +2327,7 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit
Q_ASSERT(connectedSignalIndexes.size() > signalIndex); Q_ASSERT(connectedSignalIndexes.size() > signalIndex);
Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0); Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0);
if (--connectedSignalIndexes[signalIndex] == 0) { if (--connectedSignalIndexes[signalIndex] == 0) {
Q_ASSERT(signalEventGenerator != 0); Q_ASSERT(signalEventGenerator != nullptr);
static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset(); static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset();
QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset); QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset);
int sum = 0; int sum = 0;
@ -2454,7 +2454,7 @@ void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalInd
Constructs a new state machine with the given \a parent. Constructs a new state machine with the given \a parent.
*/ */
QStateMachine::QStateMachine(QObject *parent) QStateMachine::QStateMachine(QObject *parent)
: QState(*new QStateMachinePrivate, /*parentState=*/0) : QState(*new QStateMachinePrivate, /*parentState=*/nullptr)
{ {
// Can't pass the parent to the QState constructor, as it expects a QState // Can't pass the parent to the QState constructor, as it expects a QState
// But this works as expected regardless of whether parent is a QState or not // But this works as expected regardless of whether parent is a QState or not
@ -2472,7 +2472,7 @@ QStateMachine::QStateMachine(QObject *parent)
state machine is invalid, and might work incorrectly. state machine is invalid, and might work incorrectly.
*/ */
QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent) QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent)
: QState(*new QStateMachinePrivate, /*parentState=*/0) : QState(*new QStateMachinePrivate, /*parentState=*/nullptr)
{ {
Q_D(QStateMachine); Q_D(QStateMachine);
d->childMode = childMode; d->childMode = childMode;
@ -2495,7 +2495,7 @@ QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent)
\internal \internal
*/ */
QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent)
: QState(dd, /*parentState=*/0) : QState(dd, /*parentState=*/nullptr)
{ {
setParent(parent); setParent(parent);
} }
@ -2637,7 +2637,7 @@ void QStateMachine::removeState(QAbstractState *state)
state, QAbstractStatePrivate::get(state)->machine(), this); state, QAbstractStatePrivate::get(state)->machine(), this);
return; return;
} }
state->setParent(0); state->setParent(nullptr);
} }
bool QStateMachine::isRunning() const bool QStateMachine::isRunning() const
@ -2661,7 +2661,7 @@ void QStateMachine::start()
{ {
Q_D(QStateMachine); Q_D(QStateMachine);
if ((childMode() == QState::ExclusiveStates) && (initialState() == 0)) { if ((childMode() == QState::ExclusiveStates) && (initialState() == nullptr)) {
qWarning("QStateMachine::start: No initial state set for machine. Refusing to start."); qWarning("QStateMachine::start: No initial state set for machine. Refusing to start.");
return; return;
} }
@ -2897,7 +2897,7 @@ bool QStateMachine::event(QEvent *e)
d->delayedEventsMutex.lock(); d->delayedEventsMutex.lock();
int id = d->timerIdToDelayedEventId.take(tid); int id = d->timerIdToDelayedEventId.take(tid);
QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id); QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id);
if (ee.event != 0) { if (ee.event != nullptr) {
Q_ASSERT(ee.timerId == tid); Q_ASSERT(ee.timerId == tid);
killTimer(tid); killTimer(tid);
d->delayedEventIdFreeList.release(id); d->delayedEventIdFreeList.release(id);
@ -3103,7 +3103,7 @@ void QSignalEventGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c
const QMetaObject QSignalEventGenerator::staticMetaObject = { const QMetaObject QSignalEventGenerator::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data, { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data,
qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 } qt_meta_data_QSignalEventGenerator, qt_static_metacall, nullptr, nullptr }
}; };
const QMetaObject *QSignalEventGenerator::metaObject() const const QMetaObject *QSignalEventGenerator::metaObject() const
@ -3113,7 +3113,7 @@ const QMetaObject *QSignalEventGenerator::metaObject() const
void *QSignalEventGenerator::qt_metacast(const char *_clname) void *QSignalEventGenerator::qt_metacast(const char *_clname)
{ {
if (!_clname) return 0; if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata)) if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata))
return static_cast<void*>(const_cast< QSignalEventGenerator*>(this)); return static_cast<void*>(const_cast< QSignalEventGenerator*>(this));
return QObject::qt_metacast(_clname); return QObject::qt_metacast(_clname);

View File

@ -79,7 +79,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_SYSTEMLOCALE #ifndef QT_NO_SYSTEMLOCALE
static QSystemLocale *_systemLocale = 0; static QSystemLocale *_systemLocale = nullptr;
class QSystemLocaleSingleton: public QSystemLocale class QSystemLocaleSingleton: public QSystemLocale
{ {
public: public:
@ -695,7 +695,7 @@ QSystemLocale::QSystemLocale(bool)
QSystemLocale::~QSystemLocale() QSystemLocale::~QSystemLocale()
{ {
if (_systemLocale == this) { if (_systemLocale == this) {
_systemLocale = 0; _systemLocale = nullptr;
globalLocaleData.m_language_id = 0; globalLocaleData.m_language_id = 0;
} }
@ -2429,7 +2429,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal); QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal);
dt.setDefaultLocale(*this); dt.setDefaultLocale(*this);
if (dt.parseFormat(format)) if (dt.parseFormat(format))
dt.fromString(string, 0, &time); dt.fromString(string, nullptr, &time);
#else #else
Q_UNUSED(cal); Q_UNUSED(cal);
Q_UNUSED(string); Q_UNUSED(string);
@ -2468,7 +2468,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
dt.setDefaultLocale(*this); dt.setDefaultLocale(*this);
if (dt.parseFormat(format)) if (dt.parseFormat(format))
dt.fromString(string, &date, 0); dt.fromString(string, &date, nullptr);
#else #else
Q_UNUSED(string); Q_UNUSED(string);
Q_UNUSED(format); Q_UNUSED(format);

View File

@ -322,7 +322,7 @@ double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
conv_flags = double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES conv_flags = double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES
| double_conversion::StringToDoubleConverter::ALLOW_TRAILING_SPACES; | double_conversion::StringToDoubleConverter::ALLOW_TRAILING_SPACES;
} }
double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_qnan(), 0, 0); double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_qnan(), nullptr, nullptr);
d = conv.StringToDouble(num, numLen, &processed); d = conv.StringToDouble(num, numLen, &processed);
if (!qIsFinite(d)) { if (!qIsFinite(d)) {

View File

@ -831,7 +831,7 @@ struct QRegularExpressionPrivate : QSharedData
QRegularExpression::MatchType matchType, QRegularExpression::MatchType matchType,
QRegularExpression::MatchOptions matchOptions, QRegularExpression::MatchOptions matchOptions,
CheckSubjectStringOption checkSubjectStringOption = CheckSubjectString, CheckSubjectStringOption checkSubjectStringOption = CheckSubjectString,
const QRegularExpressionMatchPrivate *previous = 0) const; const QRegularExpressionMatchPrivate *previous = nullptr) const;
int captureIndexForName(QStringView name) const; int captureIndexForName(QStringView name) const;
@ -990,7 +990,7 @@ void QRegularExpressionPrivate::compilePattern()
options, options,
&errorCode, &errorCode,
&patternErrorOffset, &patternErrorOffset,
NULL); nullptr);
if (!compiledPattern) { if (!compiledPattern) {
errorOffset = static_cast<int>(patternErrorOffset); errorOffset = static_cast<int>(patternErrorOffset);
@ -1049,7 +1049,7 @@ public:
{ {
// The default JIT stack size in PCRE is 32K, // The default JIT stack size in PCRE is 32K,
// we allocate from 32K up to 512K. // we allocate from 32K up to 512K.
stack = pcre2_jit_stack_create_16(32 * 1024, 512 * 1024, NULL); stack = pcre2_jit_stack_create_16(32 * 1024, 512 * 1024, nullptr);
} }
/*! /*!
\internal \internal
@ -1073,7 +1073,7 @@ static pcre2_jit_stack_16 *qtPcreCallback(void *)
if (jitStacks()->hasLocalData()) if (jitStacks()->hasLocalData())
return jitStacks()->localData()->stack; return jitStacks()->localData()->stack;
return 0; return nullptr;
} }
/*! /*!
@ -1240,9 +1240,9 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString
previousMatchWasEmpty = true; previousMatchWasEmpty = true;
} }
pcre2_match_context_16 *matchContext = pcre2_match_context_create_16(NULL); pcre2_match_context_16 *matchContext = pcre2_match_context_create_16(nullptr);
pcre2_jit_stack_assign_16(matchContext, &qtPcreCallback, NULL); pcre2_jit_stack_assign_16(matchContext, &qtPcreCallback, nullptr);
pcre2_match_data_16 *matchData = pcre2_match_data_create_from_pattern_16(compiledPattern, NULL); pcre2_match_data_16 *matchData = pcre2_match_data_create_from_pattern_16(compiledPattern, nullptr);
const unsigned short * const subjectUtf16 = subject.utf16() + subjectStart; const unsigned short * const subjectUtf16 = subject.utf16() + subjectStart;

View File

@ -161,10 +161,10 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int
*/ */
QTextBoundaryFinder::QTextBoundaryFinder() QTextBoundaryFinder::QTextBoundaryFinder()
: t(Grapheme) : t(Grapheme)
, chars(0) , chars(nullptr)
, length(0) , length(0)
, freePrivate(true) , freePrivate(true)
, d(0) , d(nullptr)
{ {
} }
@ -178,7 +178,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other)
, length(other.length) , length(other.length)
, pos(other.pos) , pos(other.pos)
, freePrivate(true) , freePrivate(true)
, d(0) , d(nullptr)
{ {
if (other.d) { if (other.d) {
Q_ASSERT(length > 0); Q_ASSERT(length > 0);
@ -199,7 +199,7 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o
if (other.d) { if (other.d) {
Q_ASSERT(other.length > 0); Q_ASSERT(other.length > 0);
uint newCapacity = (other.length + 1) * sizeof(QCharAttributes); uint newCapacity = (other.length + 1) * sizeof(QCharAttributes);
QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : 0, newCapacity); QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : nullptr, newCapacity);
Q_CHECK_PTR(newD); Q_CHECK_PTR(newD);
freePrivate = true; freePrivate = true;
d = newD; d = newD;
@ -216,7 +216,7 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o
} else { } else {
if (freePrivate) if (freePrivate)
free(d); free(d);
d = 0; d = nullptr;
} }
return *this; return *this;
@ -242,7 +242,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &strin
, length(string.length()) , length(string.length())
, pos(0) , pos(0)
, freePrivate(true) , freePrivate(true)
, d(0) , d(nullptr)
{ {
if (length > 0) { if (length > 0) {
d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes)); d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes));
@ -271,7 +271,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QChar *chars,
, length(length) , length(length)
, pos(0) , pos(0)
, freePrivate(true) , freePrivate(true)
, d(0) , d(nullptr)
{ {
if (!chars) { if (!chars) {
length = 0; length = 0;

View File

@ -199,7 +199,7 @@ void ExceptionStore::setException(const QException &e)
bool ExceptionStore::hasException() const bool ExceptionStore::hasException() const
{ {
return (exceptionHolder.exception() != 0); return (exceptionHolder.exception() != nullptr);
} }
ExceptionHolder ExceptionStore::exception() ExceptionHolder ExceptionStore::exception()

View File

@ -471,7 +471,7 @@ bool QFutureInterfaceBase::derefT() const
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState) QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
: refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0), : refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),
state(initialState), state(initialState),
manualProgress(false), m_expectedResultCount(0), runnable(0), m_pool(0) manualProgress(false), m_expectedResultCount(0), runnable(nullptr), m_pool(nullptr)
{ {
progressTime.invalidate(); progressTime.invalidate();
} }

View File

@ -70,7 +70,7 @@ class QRecursiveMutexPrivate : public QMutexData
{ {
public: public:
QRecursiveMutexPrivate() QRecursiveMutexPrivate()
: QMutexData(QMutex::Recursive), owner(0), count(0) {} : QMutexData(QMutex::Recursive), owner(nullptr), count(0) {}
// written to by the thread that first owns 'mutex'; // written to by the thread that first owns 'mutex';
// read during attempts to acquire ownership of 'mutex' from any other thread: // read during attempts to acquire ownership of 'mutex' from any other thread:
@ -186,7 +186,7 @@ public:
*/ */
QMutex::QMutex(RecursionMode mode) QMutex::QMutex(RecursionMode mode)
{ {
d_ptr.storeRelaxed(mode == Recursive ? new QRecursiveMutexPrivate : 0); d_ptr.storeRelaxed(mode == Recursive ? new QRecursiveMutexPrivate : nullptr);
} }
/*! /*!
@ -799,7 +799,7 @@ inline void QRecursiveMutexPrivate::unlock() noexcept
if (count > 0) { if (count > 0) {
count--; count--;
} else { } else {
owner.storeRelaxed(0); owner.storeRelaxed(nullptr);
mutex.QBasicMutex::unlock(); mutex.QBasicMutex::unlock();
} }
} }

View File

@ -106,7 +106,7 @@ static inline QMutexData *dummyFutexValue()
} }
template <bool IsTimed> static inline template <bool IsTimed> static inline
bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = 0) noexcept bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = nullptr) noexcept
{ {
if (!IsTimed) if (!IsTimed)
timeout = -1; timeout = -1;
@ -175,7 +175,7 @@ void QBasicMutex::unlockInternal() noexcept
Q_UNUSED(d); Q_UNUSED(d);
Q_ASSERT(!isRecursive()); Q_ASSERT(!isRecursive());
d_ptr.storeRelease(0); d_ptr.storeRelease(nullptr);
futexWakeOne(d_ptr); futexWakeOne(d_ptr);
} }

View File

@ -69,7 +69,7 @@ class QOrderedMutexLocker
public: public:
QOrderedMutexLocker(QBasicMutex *m1, QBasicMutex *m2) QOrderedMutexLocker(QBasicMutex *m1, QBasicMutex *m2)
: mtx1((m1 == m2) ? m1 : (std::less<QBasicMutex *>()(m1, m2) ? m1 : m2)), : mtx1((m1 == m2) ? m1 : (std::less<QBasicMutex *>()(m1, m2) ? m1 : m2)),
mtx2((m1 == m2) ? 0 : (std::less<QBasicMutex *>()(m1, m2) ? m2 : m1)), mtx2((m1 == m2) ? nullptr : (std::less<QBasicMutex *>()(m1, m2) ? m2 : m1)),
locked(false) locked(false)
{ {
relock(); relock();

View File

@ -227,7 +227,7 @@ bool QReadWriteLock::tryLockForRead(int timeout)
return true; return true;
while (true) { while (true) {
if (d == 0) { if (d == nullptr) {
if (!d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead, d)) if (!d_ptr.testAndSetAcquire(nullptr, dummyLockedForRead, d))
continue; continue;
return true; return true;
@ -341,7 +341,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout)
return true; return true;
while (true) { while (true) {
if (d == 0) { if (d == nullptr) {
if (!d_ptr.testAndSetAcquire(d, dummyLockedForWrite, d)) if (!d_ptr.testAndSetAcquire(d, dummyLockedForWrite, d))
continue; continue;
return true; return true;
@ -581,7 +581,7 @@ void QReadWriteLockPrivate::recursiveUnlock()
if (self == currentWriter) { if (self == currentWriter) {
if (--writerCount > 0) if (--writerCount > 0)
return; return;
currentWriter = 0; currentWriter = nullptr;
} else { } else {
auto it = currentReaders.find(self); auto it = currentReaders.find(self);
if (it == currentReaders.end()) { if (it == currentReaders.end()) {

View File

@ -192,7 +192,7 @@ int ResultStoreBase::addResults(int index, const void *results, int vectorSize,
ResultItem filteredIn(results, vectorSize); ResultItem filteredIn(results, vectorSize);
insertResultItem(index, filteredIn); insertResultItem(index, filteredIn);
} }
ResultItem filteredAway(0, totalCount - vectorSize); ResultItem filteredAway(nullptr, totalCount - vectorSize);
return insertResultItem(index + vectorSize, filteredAway); return insertResultItem(index + vectorSize, filteredAway);
} }
} }

View File

@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
QThreadData::QThreadData(int initialRefCount) QThreadData::QThreadData(int initialRefCount)
: _ref(initialRefCount), loopLevel(0), scopeLevel(0), : _ref(initialRefCount), loopLevel(0), scopeLevel(0),
eventDispatcher(0), eventDispatcher(nullptr),
quitNow(false), canWait(true), isAdopted(false), requiresCoreApplication(true) quitNow(false), canWait(true), isAdopted(false), requiresCoreApplication(true)
{ {
// fprintf(stderr, "QThreadData %p created\n", this); // fprintf(stderr, "QThreadData %p created\n", this);
@ -399,7 +399,7 @@ QThreadPrivate::~QThreadPrivate()
QThread *QThread::currentThread() QThread *QThread::currentThread()
{ {
QThreadData *data = QThreadData::current(); QThreadData *data = QThreadData::current();
Q_ASSERT(data != 0); Q_ASSERT(data != nullptr);
return data->thread.loadAcquire(); return data->thread.loadAcquire();
} }
@ -451,7 +451,7 @@ QThread::~QThread()
if (d->running && !d->finished && !d->data->isAdopted) if (d->running && !d->finished && !d->data->isAdopted)
qFatal("QThread: Destroyed while thread is still running"); qFatal("QThread: Destroyed while thread is still running");
d->data->thread = 0; d->data->thread = nullptr;
} }
} }

View File

@ -109,7 +109,7 @@ Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE));
enum { ThreadPriorityResetFlag = 0x80000000 }; enum { ThreadPriorityResetFlag = 0x80000000 };
static thread_local QThreadData *currentThreadData = 0; static thread_local QThreadData *currentThreadData = nullptr;
static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT; static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT;
static pthread_key_t current_thread_data_key; static pthread_key_t current_thread_data_key;
@ -144,7 +144,7 @@ static void destroy_current_thread_data(void *p)
#if defined(Q_OS_VXWORKS) #if defined(Q_OS_VXWORKS)
(void *)1); (void *)1);
#else #else
0); nullptr);
#endif #endif
} }
@ -182,8 +182,8 @@ static void set_thread_data(QThreadData *data)
static void clear_thread_data() static void clear_thread_data()
{ {
currentThreadData = 0; currentThreadData = nullptr;
pthread_setspecific(current_thread_data_key, 0); pthread_setspecific(current_thread_data_key, nullptr);
} }
template <typename T> template <typename T>
@ -226,7 +226,7 @@ QThreadData *QThreadData::current(bool createIfNecessary)
} QT_CATCH(...) { } QT_CATCH(...) {
clear_thread_data(); clear_thread_data();
data->deref(); data->deref();
data = 0; data = nullptr;
QT_RETHROW; QT_RETHROW;
} }
data->deref(); data->deref();
@ -294,7 +294,7 @@ static void setCurrentThreadName(const char *name)
void *QThreadPrivate::start(void *arg) void *QThreadPrivate::start(void *arg)
{ {
#if !defined(Q_OS_ANDROID) #if !defined(Q_OS_ANDROID)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, nullptr);
#endif #endif
pthread_cleanup_push(QThreadPrivate::finish, arg); pthread_cleanup_push(QThreadPrivate::finish, arg);
@ -336,7 +336,7 @@ void *QThreadPrivate::start(void *arg)
emit thr->started(QThread::QPrivateSignal()); emit thr->started(QThread::QPrivateSignal());
#if !defined(Q_OS_ANDROID) #if !defined(Q_OS_ANDROID)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr);
pthread_testcancel(); pthread_testcancel();
#endif #endif
thr->run(); thr->run();
@ -360,7 +360,7 @@ void *QThreadPrivate::start(void *arg)
// thrown. // thrown.
pthread_cleanup_pop(1); pthread_cleanup_pop(1);
return 0; return nullptr;
} }
void QThreadPrivate::finish(void *arg) void QThreadPrivate::finish(void *arg)
@ -379,13 +379,13 @@ void QThreadPrivate::finish(void *arg)
void *data = &d->data->tls; void *data = &d->data->tls;
locker.unlock(); locker.unlock();
emit thr->finished(QThread::QPrivateSignal()); emit thr->finished(QThread::QPrivateSignal());
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QThreadStorageData::finish((void **)data); QThreadStorageData::finish((void **)data);
locker.relock(); locker.relock();
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed(); QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed();
if (eventDispatcher) { if (eventDispatcher) {
d->data->eventDispatcher = 0; d->data->eventDispatcher = nullptr;
locker.unlock(); locker.unlock();
eventDispatcher->closingDown(); eventDispatcher->closingDown();
delete eventDispatcher; delete eventDispatcher;
@ -774,14 +774,14 @@ bool QThread::wait(QDeadlineTimer deadline)
void QThread::setTerminationEnabled(bool enabled) void QThread::setTerminationEnabled(bool enabled)
{ {
QThread *thr = currentThread(); QThread *thr = currentThread();
Q_ASSERT_X(thr != 0, "QThread::setTerminationEnabled()", Q_ASSERT_X(thr != nullptr, "QThread::setTerminationEnabled()",
"Current thread was not started with QThread."); "Current thread was not started with QThread.");
Q_UNUSED(thr) Q_UNUSED(thr)
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
Q_UNUSED(enabled); Q_UNUSED(enabled);
#else #else
pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, nullptr);
if (enabled) if (enabled)
pthread_testcancel(); pthread_testcancel();
#endif #endif

View File

@ -116,7 +116,7 @@ void **QThreadStorageData::get() const
QThreadData *data = QThreadData::current(); QThreadData *data = QThreadData::current();
if (!data) { if (!data) {
qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread"); qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread");
return 0; return nullptr;
} }
QVector<void *> &tls = data->tls; QVector<void *> &tls = data->tls;
if (tls.size() <= id) if (tls.size() <= id)
@ -128,7 +128,7 @@ void **QThreadStorageData::get() const
*v, *v,
data->thread.loadRelaxed()); data->thread.loadRelaxed());
return *v ? v : 0; return *v ? v : nullptr;
} }
void **QThreadStorageData::set(void *p) void **QThreadStorageData::set(void *p)
@ -136,7 +136,7 @@ void **QThreadStorageData::set(void *p)
QThreadData *data = QThreadData::current(); QThreadData *data = QThreadData::current();
if (!data) { if (!data) {
qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread"); qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread");
return 0; return nullptr;
} }
QVector<void *> &tls = data->tls; QVector<void *> &tls = data->tls;
if (tls.size() <= id) if (tls.size() <= id)
@ -144,7 +144,7 @@ void **QThreadStorageData::set(void *p)
void *&value = tls[id]; void *&value = tls[id];
// delete any previous data // delete any previous data
if (value != 0) { if (value != nullptr) {
DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p", DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
id, id,
value, value,
@ -156,7 +156,7 @@ void **QThreadStorageData::set(void *p)
locker.unlock(); locker.unlock();
void *q = value; void *q = value;
value = 0; value = nullptr;
if (destructor) if (destructor)
destructor(q); destructor(q);
@ -178,7 +178,7 @@ void QThreadStorageData::finish(void **p)
while (!tls->isEmpty()) { while (!tls->isEmpty()) {
void *&value = tls->last(); void *&value = tls->last();
void *q = value; void *q = value;
value = 0; value = nullptr;
int i = tls->size() - 1; int i = tls->size() - 1;
tls->resize(i); tls->resize(i);

View File

@ -173,7 +173,7 @@ public:
QWaitCondition::QWaitCondition() QWaitCondition::QWaitCondition()
{ {
d = new QWaitConditionPrivate; d = new QWaitConditionPrivate;
report_error(pthread_mutex_init(&d->mutex, NULL), "QWaitCondition", "mutex init"); report_error(pthread_mutex_init(&d->mutex, nullptr), "QWaitCondition", "mutex init");
qt_initialize_pthread_cond(&d->cond, "QWaitCondition"); qt_initialize_pthread_cond(&d->cond, "QWaitCondition");
d->waiters = d->wakeups = 0; d->waiters = d->wakeups = 0;
} }

View File

@ -1769,7 +1769,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
// dt.setDefaultLocale(QLocale::c()); ### Qt 6 // dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format)) if (dt.parseFormat(format))
dt.fromString(string, &date, 0); dt.fromString(string, &date, nullptr);
#else #else
Q_UNUSED(string); Q_UNUSED(string);
Q_UNUSED(format); Q_UNUSED(format);
@ -2499,7 +2499,7 @@ QTime QTime::fromString(const QString &string, const QString &format)
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar()); QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar());
// dt.setDefaultLocale(QLocale::c()); ### Qt 6 // dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format)) if (dt.parseFormat(format))
dt.fromString(string, 0, &time); dt.fromString(string, nullptr, &time);
#else #else
Q_UNUSED(string); Q_UNUSED(string);
Q_UNUSED(format); Q_UNUSED(format);

View File

@ -1152,7 +1152,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
} }
pos += separator.size(); pos += separator.size();
sectionNodes[index].pos = pos; sectionNodes[index].pos = pos;
int *current = 0; int *current = nullptr;
const SectionNode sn = sectionNodes.at(index); const SectionNode sn = sectionNodes.at(index);
ParsedSection sect; ParsedSection sect;

View File

@ -318,7 +318,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
*/ */
QTimeZone::QTimeZone() noexcept QTimeZone::QTimeZone() noexcept
: d(0) : d(nullptr)
{ {
} }

View File

@ -273,7 +273,7 @@ static int ucalDaylightOffset(const QByteArray &id)
// Create the system default time zone // Create the system default time zone
QIcuTimeZonePrivate::QIcuTimeZonePrivate() QIcuTimeZonePrivate::QIcuTimeZonePrivate()
: m_ucal(0) : m_ucal(nullptr)
{ {
// TODO No ICU C API to obtain sysem tz, assume default hasn't been changed // TODO No ICU C API to obtain sysem tz, assume default hasn't been changed
init(ucalDefaultTimeZoneId()); init(ucalDefaultTimeZoneId());
@ -281,7 +281,7 @@ QIcuTimeZonePrivate::QIcuTimeZonePrivate()
// Create a named time zone // Create a named time zone
QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QByteArray &ianaId) QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QByteArray &ianaId)
: m_ucal(0) : m_ucal(nullptr)
{ {
// Need to check validity here as ICu will create a GMT tz if name is invalid // Need to check validity here as ICu will create a GMT tz if name is invalid
if (availableTimeZoneIds().contains(ianaId)) if (availableTimeZoneIds().contains(ianaId))
@ -289,14 +289,14 @@ QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QByteArray &ianaId)
} }
QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QIcuTimeZonePrivate &other) QIcuTimeZonePrivate::QIcuTimeZonePrivate(const QIcuTimeZonePrivate &other)
: QTimeZonePrivate(other), m_ucal(0) : QTimeZonePrivate(other), m_ucal(nullptr)
{ {
// Clone the ucal so we don't close the shared object // Clone the ucal so we don't close the shared object
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
m_ucal = ucal_clone(other.m_ucal, &status); m_ucal = ucal_clone(other.m_ucal, &status);
if (!U_SUCCESS(status)) { if (!U_SUCCESS(status)) {
m_id.clear(); m_id.clear();
m_ucal = 0; m_ucal = nullptr;
} }
} }
@ -322,7 +322,7 @@ void QIcuTimeZonePrivate::init(const QByteArray &ianaId)
if (!U_SUCCESS(status)) { if (!U_SUCCESS(status)) {
m_id.clear(); m_id.clear();
m_ucal = 0; m_ucal = nullptr;
} }
} }
@ -493,7 +493,7 @@ QList<QByteArray> QIcuTimeZonePrivate::availableTimeZoneIds(int offsetFromUtc) c
// TODO Available directly in C++ api but not C api, from 4.8 onwards new filter method works // TODO Available directly in C++ api but not C api, from 4.8 onwards new filter method works
#if U_ICU_VERSION_MAJOR_NUM >= 49 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM == 8) #if U_ICU_VERSION_MAJOR_NUM >= 49 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM == 8)
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UEnumeration *uenum = ucal_openTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, 0, UEnumeration *uenum = ucal_openTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, nullptr,
&offsetFromUtc, &status); &offsetFromUtc, &status);
QList<QByteArray> result; QList<QByteArray> result;
if (U_SUCCESS(status)) if (U_SUCCESS(status))

View File

@ -512,7 +512,7 @@ PosixZone PosixZone::parse(const char *&pos, const char *end)
if (zoneEnd < end && (zoneEnd[0] == '+' || zoneEnd[0] == '-')) if (zoneEnd < end && (zoneEnd[0] == '+' || zoneEnd[0] == '-'))
++zoneEnd; ++zoneEnd;
while (zoneEnd < end) { while (zoneEnd < end) {
if (strchr(offsetChars, char(*zoneEnd)) == NULL) if (strchr(offsetChars, char(*zoneEnd)) == nullptr)
break; break;
++zoneEnd; ++zoneEnd;
} }

View File

@ -265,7 +265,7 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize,
return; return;
#endif #endif
Q_ASSERT_X(data == 0 || !data->ref.isStatic(), "QArrayData::deallocate", Q_ASSERT_X(data == nullptr || !data->ref.isStatic(), "QArrayData::deallocate",
"Static data cannot be deleted"); "Static data cannot be deleted");
::free(data); ::free(data);
} }

View File

@ -443,12 +443,12 @@ class QEasingCurvePrivate
public: public:
QEasingCurvePrivate() QEasingCurvePrivate()
: type(QEasingCurve::Linear), : type(QEasingCurve::Linear),
config(0), config(nullptr),
func(&easeNone) func(&easeNone)
{ } { }
QEasingCurvePrivate(const QEasingCurvePrivate &other) QEasingCurvePrivate(const QEasingCurvePrivate &other)
: type(other.type), : type(other.type),
config(other.config ? other.config->copy() : 0), config(other.config ? other.config->copy() : nullptr),
func(other.func) func(other.func)
{ } { }
~QEasingCurvePrivate() { delete config; } ~QEasingCurvePrivate() { delete config; }
@ -590,7 +590,7 @@ struct BezierEase : public QEasingCurveFunction
if (!(x < 1)) if (!(x < 1))
return 1; return 1;
SingleCubicBezier *singleCubicBezier = 0; SingleCubicBezier *singleCubicBezier = nullptr;
getBezierSegment(singleCubicBezier, x); getBezierSegment(singleCubicBezier, x);
return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x)); return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));
@ -1097,7 +1097,7 @@ static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve)
case QEasingCurve::CosineCurve: case QEasingCurve::CosineCurve:
return &easeCosineCurve; return &easeCosineCurve;
default: default:
return 0; return nullptr;
}; };
} }
@ -1127,7 +1127,7 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type)
return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158)); return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));
} }
return 0; return nullptr;
} }
/*! /*!
@ -1422,7 +1422,7 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType)
tcbPoints = std::move(config->_tcbPoints); tcbPoints = std::move(config->_tcbPoints);
delete config; delete config;
config = 0; config = nullptr;
} }
if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0) || if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0) ||
@ -1436,11 +1436,11 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType)
config->_o = overshoot; config->_o = overshoot;
config->_bezierCurves = std::move(bezierCurves); config->_bezierCurves = std::move(bezierCurves);
config->_tcbPoints = std::move(tcbPoints); config->_tcbPoints = std::move(tcbPoints);
func = 0; func = nullptr;
} else if (newType != QEasingCurve::Custom) { } else if (newType != QEasingCurve::Custom) {
func = curveToFunc(newType); func = curveToFunc(newType);
} }
Q_ASSERT((func == 0) == (config != 0)); Q_ASSERT((func == nullptr) == (config != nullptr));
type = newType; type = newType;
} }
@ -1487,7 +1487,7 @@ void QEasingCurve::setCustomType(EasingFunction func)
*/ */
QEasingCurve::EasingFunction QEasingCurve::customType() const QEasingCurve::EasingFunction QEasingCurve::customType() const
{ {
return d_ptr->type == Custom ? d_ptr->func : 0; return d_ptr->type == Custom ? d_ptr->func : nullptr;
} }
/*! /*!

View File

@ -72,7 +72,7 @@ int QDBusAdaptorConnector::relaySlotMethodIndex()
QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj) QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj)
{ {
if (!obj) if (!obj)
return 0; return nullptr;
const QObjectList &children = obj->children(); const QObjectList &children = obj->children();
QObjectList::ConstIterator it = children.constBegin(); QObjectList::ConstIterator it = children.constBegin();
QObjectList::ConstIterator end = children.constEnd(); QObjectList::ConstIterator end = children.constEnd();
@ -83,7 +83,7 @@ QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj)
return connector; return connector;
} }
} }
return 0; return nullptr;
} }
QDBusAdaptorConnector *qDBusFindAdaptorConnector(QDBusAbstractAdaptor *adaptor) QDBusAdaptorConnector *qDBusFindAdaptorConnector(QDBusAbstractAdaptor *adaptor)
@ -411,7 +411,7 @@ void QDBusAdaptorConnector::qt_static_metacall(QObject *_o, QMetaObject::Call _c
const QMetaObject QDBusAdaptorConnector::staticMetaObject = { const QMetaObject QDBusAdaptorConnector::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QDBusAdaptorConnector.data, { &QObject::staticMetaObject, qt_meta_stringdata_QDBusAdaptorConnector.data,
qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, 0, 0 } qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, nullptr, nullptr }
}; };
const QMetaObject *QDBusAdaptorConnector::metaObject() const const QMetaObject *QDBusAdaptorConnector::metaObject() const
@ -421,7 +421,7 @@ const QMetaObject *QDBusAdaptorConnector::metaObject() const
void *QDBusAdaptorConnector::qt_metacast(const char *_clname) void *QDBusAdaptorConnector::qt_metacast(const char *_clname)
{ {
if (!_clname) return 0; if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QDBusAdaptorConnector.stringdata)) if (!strcmp(_clname, qt_meta_stringdata_QDBusAdaptorConnector.stringdata))
return static_cast<void*>(const_cast< QDBusAdaptorConnector*>(this)); return static_cast<void*>(const_cast< QDBusAdaptorConnector*>(this));
return QObject::qt_metacast(_clname); return QObject::qt_metacast(_clname);
@ -443,7 +443,7 @@ int QDBusAdaptorConnector::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
// SIGNAL 0 // SIGNAL 0
void QDBusAdaptorConnector::relaySignal(QObject * _t1, const QMetaObject * _t2, int _t3, const QVariantList & _t4) void QDBusAdaptorConnector::relaySignal(QObject * _t1, const QMetaObject * _t2, int _t3, const QVariantList & _t4)
{ {
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) }; void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a); QMetaObject::activate(this, &staticMetaObject, 0, _a);
} }

View File

@ -159,7 +159,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
const char *expectedSignature = ""; const char *expectedSignature = "";
if (int(mp.type()) != QMetaType::QVariant) { if (int(mp.type()) != QMetaType::QVariant) {
expectedSignature = QDBusMetaType::typeToSignature(type); expectedSignature = QDBusMetaType::typeToSignature(type);
if (expectedSignature == 0) { if (expectedSignature == nullptr) {
qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be "
"used to read property %s.%s", "used to read property %s.%s",
mp.typeName(), qPrintable(interface), mp.name()); mp.typeName(), qPrintable(interface), mp.name());
@ -190,7 +190,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
} }
QByteArray foundSignature; QByteArray foundSignature;
const char *foundType = 0; const char *foundType = nullptr;
QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant(); QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant();
if (value.userType() == type || type == QMetaType::QVariant if (value.userType() == type || type == QMetaType::QVariant
@ -597,7 +597,7 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method,
QObject *receiver, QObject *receiver,
const char *slot) const char *slot)
{ {
return callWithCallback(method, args, receiver, slot, 0); return callWithCallback(method, args, receiver, slot, nullptr);
} }
/*! /*!

View File

@ -74,11 +74,11 @@ QByteArray QDBusArgumentPrivate::createSignature(int id)
marshaller->ba = &signature; marshaller->ba = &signature;
// run it // run it
void *null = 0; void *null = nullptr;
QVariant v(id, null); QVariant v(id, null);
QDBusArgument arg(marshaller); QDBusArgument arg(marshaller);
QDBusMetaType::marshall(arg, v.userType(), v.constData()); QDBusMetaType::marshall(arg, v.userType(), v.constData());
arg.d = 0; arg.d = nullptr;
// delete it // delete it
bool ok = marshaller->ok; bool ok = marshaller->ok;
@ -290,7 +290,7 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgument::QDBusArgument() QDBusArgument::QDBusArgument()
{ {
if (!qdbus_loadLibDBus()) { if (!qdbus_loadLibDBus()) {
d = 0; d = nullptr;
return; return;
} }

View File

@ -101,7 +101,7 @@ QDBusConnectionPrivate *QDBusConnectionManager::busConnection(QDBusConnection::B
Q_ASSERT(type == QDBusConnection::SessionBus || type == QDBusConnection::SystemBus); Q_ASSERT(type == QDBusConnection::SessionBus || type == QDBusConnection::SystemBus);
if (!qdbus_loadLibDBus()) if (!qdbus_loadLibDBus())
return 0; return nullptr;
// we'll start in suspended delivery mode if we're in the main thread // we'll start in suspended delivery mode if we're in the main thread
// (the event loop will resume delivery) // (the event loop will resume delivery)
@ -124,7 +124,7 @@ QDBusConnectionPrivate *QDBusConnectionManager::connection(const QString &name)
void QDBusConnectionManager::removeConnection(const QString &name) void QDBusConnectionManager::removeConnection(const QString &name)
{ {
QDBusConnectionPrivate *d = 0; QDBusConnectionPrivate *d = nullptr;
d = connectionHash.take(name); d = connectionHash.take(name);
if (d && !d->ref.deref()) if (d && !d->ref.deref())
d->deleteLater(); d->deleteLater();
@ -251,7 +251,7 @@ void QDBusConnectionManager::executeConnectionRequest(QDBusConnectionManager::Co
return; return;
d = new QDBusConnectionPrivate; d = new QDBusConnectionPrivate;
DBusConnection *c = 0; DBusConnection *c = nullptr;
QDBusErrorInternal error; QDBusErrorInternal error;
switch (data->type) { switch (data->type) {
case ConnectionRequestData::ConnectToStandardBus: case ConnectionRequestData::ConnectToStandardBus:
@ -275,7 +275,7 @@ void QDBusConnectionManager::executeConnectionRequest(QDBusConnectionManager::Co
// register on the bus // register on the bus
if (!q_dbus_bus_register(c, error)) { if (!q_dbus_bus_register(c, error)) {
q_dbus_connection_unref(c); q_dbus_connection_unref(c);
c = 0; c = nullptr;
} }
} }
break; break;
@ -427,7 +427,7 @@ void QDBusConnectionManager::createServer(const QString &address, void *server)
QDBusConnection::QDBusConnection(const QString &name) QDBusConnection::QDBusConnection(const QString &name)
{ {
if (name.isEmpty() || _q_manager.isDestroyed()) { if (name.isEmpty() || _q_manager.isDestroyed()) {
d = 0; d = nullptr;
} else { } else {
const auto locker = qt_scoped_lock(_q_manager()->mutex); const auto locker = qt_scoped_lock(_q_manager()->mutex);
d = _q_manager()->connection(name); d = _q_manager()->connection(name);
@ -492,7 +492,7 @@ QDBusConnection &QDBusConnection::operator=(const QDBusConnection &other)
QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name) QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name)
{ {
if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
QDBusConnectionPrivate *d = 0; QDBusConnectionPrivate *d = nullptr;
return QDBusConnection(d); return QDBusConnection(d);
} }
return QDBusConnection(_q_manager()->connectToBus(type, name, false)); return QDBusConnection(_q_manager()->connectToBus(type, name, false));
@ -506,7 +506,7 @@ QDBusConnection QDBusConnection::connectToBus(const QString &address,
const QString &name) const QString &name)
{ {
if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
QDBusConnectionPrivate *d = 0; QDBusConnectionPrivate *d = nullptr;
return QDBusConnection(d); return QDBusConnection(d);
} }
return QDBusConnection(_q_manager()->connectToBus(address, name)); return QDBusConnection(_q_manager()->connectToBus(address, name));
@ -521,7 +521,7 @@ QDBusConnection QDBusConnection::connectToPeer(const QString &address,
const QString &name) const QString &name)
{ {
if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) { if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
QDBusConnectionPrivate *d = 0; QDBusConnectionPrivate *d = nullptr;
return QDBusConnection(d); return QDBusConnection(d);
} }
return QDBusConnection(_q_manager()->connectToPeer(address, name)); return QDBusConnection(_q_manager()->connectToPeer(address, name));
@ -616,7 +616,7 @@ bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *rec
d->lastError = err; d->lastError = err;
return false; return false;
} }
return d->sendWithReplyAsync(message, receiver, returnMethod, errorMethod, timeout) != 0; return d->sendWithReplyAsync(message, receiver, returnMethod, errorMethod, timeout) != nullptr;
} }
/*! /*!
@ -639,7 +639,7 @@ bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *rec
bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *receiver, bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *receiver,
const char *returnMethod, int timeout) const const char *returnMethod, int timeout) const
{ {
return callWithCallback(message, receiver, returnMethod, 0, timeout); return callWithCallback(message, receiver, returnMethod, nullptr, timeout);
} }
/*! /*!
@ -705,10 +705,10 @@ QDBusMessage QDBusConnection::call(const QDBusMessage &message, QDBus::CallMode
QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int timeout) const QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int timeout) const
{ {
if (!d || !d->connection) { if (!d || !d->connection) {
return QDBusPendingCall(0); // null pointer -> disconnected return QDBusPendingCall(nullptr); // null pointer -> disconnected
} }
QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, 0, 0, 0, timeout); QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, nullptr, nullptr, nullptr, timeout);
return QDBusPendingCall(priv); return QDBusPendingCall(priv);
} }
@ -1015,7 +1015,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), "QDBusConnection::registeredObject", Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), "QDBusConnection::registeredObject",
"Invalid object path given"); "Invalid object path given");
if (!d || !d->connection || !QDBusUtil::isValidObjectPath(path)) if (!d || !d->connection || !QDBusUtil::isValidObjectPath(path))
return 0; return nullptr;
auto pathComponents = path.splitRef(QLatin1Char('/')); auto pathComponents = path.splitRef(QLatin1Char('/'));
if (pathComponents.constLast().isEmpty()) if (pathComponents.constLast().isEmpty())
@ -1040,7 +1040,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
node = it; node = it;
++i; ++i;
} }
return 0; return nullptr;
} }
@ -1052,7 +1052,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
QDBusConnectionInterface *QDBusConnection::interface() const QDBusConnectionInterface *QDBusConnection::interface() const
{ {
if (!d || d->mode != QDBusConnectionPrivate::ClientMode) if (!d || d->mode != QDBusConnectionPrivate::ClientMode)
return 0; return nullptr;
return d->busService; return d->busService;
} }
@ -1068,7 +1068,7 @@ QDBusConnectionInterface *QDBusConnection::interface() const
*/ */
void *QDBusConnection::internalPointer() const void *QDBusConnection::internalPointer() const
{ {
return d ? d->connection : 0; return d ? d->connection : nullptr;
} }
/*! /*!

View File

@ -64,7 +64,7 @@ QDBusContextPrivate *QDBusContextPrivate::set(QObject *obj, QDBusContextPrivate
return old; return old;
} }
return 0; return nullptr;
} }
/*! /*!
@ -104,7 +104,7 @@ QDBusContextPrivate *QDBusContextPrivate::set(QObject *obj, QDBusContextPrivate
Constructs an empty QDBusContext. Constructs an empty QDBusContext.
*/ */
QDBusContext::QDBusContext() QDBusContext::QDBusContext()
: d_ptr(0) : d_ptr(nullptr)
{ {
} }

View File

@ -295,7 +295,7 @@ QVariant QDBusDemarshaller::toVariantInternal()
// qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'", // qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'",
// q_dbus_message_iter_get_arg_type(&iterator), // q_dbus_message_iter_get_arg_type(&iterator),
// q_dbus_message_iter_get_arg_type(&iterator)); // q_dbus_message_iter_get_arg_type(&iterator));
char *ptr = 0; char *ptr = nullptr;
ptr += q_dbus_message_iter_get_arg_type(&iterator); ptr += q_dbus_message_iter_get_arg_type(&iterator);
q_dbus_message_iter_next(&iterator); q_dbus_message_iter_next(&iterator);

View File

@ -127,7 +127,7 @@ void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *
"condition unknown") "condition unknown")
<< "in connection" << conn; << "in connection" << conn;
} }
qdbusThreadDebugFunc qdbusThreadDebug = 0; qdbusThreadDebugFunc qdbusThreadDebug = nullptr;
#endif #endif
typedef QVarLengthArray<QDBusSpyCallEvent::Hook, 4> QDBusSpyHookList; typedef QVarLengthArray<QDBusSpyCallEvent::Hook, 4> QDBusSpyHookList;
@ -400,7 +400,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
// match // match
node = it; node = it;
else else
node = 0; node = nullptr;
start = end + 1; start = end + 1;
} }
@ -413,7 +413,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
else else
// there really is no object here // there really is no object here
// we're just looking at an unused space in the QVector // we're just looking at an unused space in the QVector
node = 0; node = nullptr;
} }
return node; return node;
} }
@ -440,7 +440,7 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro
const QObjectList children = obj->children(); const QObjectList children = obj->children();
// find a child with the proper name // find a child with the proper name
QObject *next = 0; QObject *next = nullptr;
QObjectList::ConstIterator it = children.constBegin(); QObjectList::ConstIterator it = children.constBegin();
QObjectList::ConstIterator end = children.constEnd(); QObjectList::ConstIterator end = children.constEnd();
for ( ; it != end; ++it) for ( ; it != end; ++it)
@ -458,7 +458,7 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro
} }
// object not found // object not found
return 0; return nullptr;
} }
static QDBusConnectionPrivate::ArgMatchRules matchArgsForService(const QString &service, QDBusServiceWatcher::WatchMode mode) static QDBusConnectionPrivate::ArgMatchRules matchArgsForService(const QString &service, QDBusServiceWatcher::WatchMode mode)
@ -599,7 +599,7 @@ static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNo
haystack.children.end()); haystack.children.end());
if (needle == haystack.obj) { if (needle == haystack.obj) {
haystack.obj = 0; haystack.obj = nullptr;
haystack.flags = 0; haystack.flags = 0;
} }
} }
@ -609,7 +609,7 @@ static void huntAndUnregister(const QVector<QStringRef> &pathComponents, int i,
{ {
if (pathComponents.count() == i) { if (pathComponents.count() == i) {
// found it // found it
node->obj = 0; node->obj = nullptr;
node->flags = 0; node->flags = 0;
if (mode == QDBusConnection::UnregisterTree) { if (mode == QDBusConnection::UnregisterTree) {
@ -660,7 +660,7 @@ static void huntAndEmit(DBusConnection *connection, DBusMessage *msg,
qDBusDebug() << QThread::currentThread() << "emitting signal at" << p; qDBusDebug() << QThread::currentThread() << "emitting signal at" << p;
DBusMessage *msg2 = q_dbus_message_copy(msg); DBusMessage *msg2 = q_dbus_message_copy(msg);
q_dbus_message_set_path(msg2, p); q_dbus_message_set_path(msg2, p);
q_dbus_connection_send(connection, msg2, 0); q_dbus_connection_send(connection, msg2, nullptr);
q_dbus_message_unref(msg2); q_dbus_message_unref(msg2);
} }
} }
@ -727,12 +727,12 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
++i; ++i;
// make sure that the output parameters have signatures too // make sure that the output parameters have signatures too
if (returnType != QMetaType::UnknownType && returnType != QMetaType::Void && QDBusMetaType::typeToSignature(returnType) == 0) if (returnType != QMetaType::UnknownType && returnType != QMetaType::Void && QDBusMetaType::typeToSignature(returnType) == nullptr)
continue; continue;
bool ok = true; bool ok = true;
for (int j = i; ok && j < metaTypes.count(); ++j) for (int j = i; ok && j < metaTypes.count(); ++j)
if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == 0) if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == nullptr)
ok = false; ok = false;
if (!ok) if (!ok)
continue; continue;
@ -790,13 +790,13 @@ QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPriv
--n; --n;
if (msg.arguments().count() < n) if (msg.arguments().count() < n)
return 0; // too few arguments return nullptr; // too few arguments
// check that types match // check that types match
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() && if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() &&
msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>()) msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>())
return 0; // no match return nullptr; // no match
// we can deliver // we can deliver
// prepare for the call // prepare for the call
@ -944,7 +944,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
params.append(const_cast<void *>(arg.constData())); params.append(const_cast<void *>(arg.constData()));
else if (arg.userType() == qMetaTypeId<QDBusArgument>()) { else if (arg.userType() == qMetaTypeId<QDBusArgument>()) {
// convert to what the function expects // convert to what the function expects
void *null = 0; void *null = nullptr;
auxParameters.append(QVariant(id, null)); auxParameters.append(QVariant(id, null));
const QDBusArgument &in = const QDBusArgument &in =
@ -972,7 +972,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
// output arguments // output arguments
const int numMetaTypes = metaTypes.count(); const int numMetaTypes = metaTypes.count();
QVariantList outputArgs; QVariantList outputArgs;
void *null = 0; void *null = nullptr;
if (metaTypes[0] != QMetaType::Void && metaTypes[0] != QMetaType::UnknownType) { if (metaTypes[0] != QMetaType::Void && metaTypes[0] != QMetaType::UnknownType) {
outputArgs.reserve(numMetaTypes - i + 1); outputArgs.reserve(numMetaTypes - i + 1);
QVariant arg(metaTypes[0], null); QVariant arg(metaTypes[0], null);
@ -1026,8 +1026,8 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
extern bool qDBusInitThreads(); extern bool qDBusInitThreads();
QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
: QObject(p), ref(1), mode(InvalidMode), busService(0), : QObject(p), ref(1), mode(InvalidMode), busService(nullptr),
connection(0), connection(nullptr),
rootNode(QString(QLatin1Char('/'))), rootNode(QString(QLatin1Char('/'))),
anonymousAuthenticationAllowed(false), anonymousAuthenticationAllowed(false),
dispatchEnabled(true) dispatchEnabled(true)
@ -1087,11 +1087,11 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
} }
if (connection) if (connection)
q_dbus_connection_unref(connection); q_dbus_connection_unref(connection);
connection = 0; connection = nullptr;
} else if (lastMode == ServerMode) { } else if (lastMode == ServerMode) {
if (server) if (server)
q_dbus_server_unref(server); q_dbus_server_unref(server);
server = 0; server = nullptr;
} }
} }
@ -1531,7 +1531,7 @@ void QDBusConnectionPrivate::handleObjectCall(const QDBusMessage &msg)
// user code, if necessary. // user code, if necessary.
ObjectTreeNode result; ObjectTreeNode result;
int usedLength; int usedLength;
QThread *objThread = 0; QThread *objThread = nullptr;
QSemaphore sem; QSemaphore sem;
bool semWait; bool semWait;
@ -1718,7 +1718,7 @@ void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const
qDBusAddWatch, qDBusAddWatch,
qDBusRemoveWatch, qDBusRemoveWatch,
qDBusToggleWatch, qDBusToggleWatch,
this, 0); this, nullptr);
//qDebug() << "watch_functions_set" << watch_functions_set; //qDebug() << "watch_functions_set" << watch_functions_set;
Q_UNUSED(watch_functions_set); Q_UNUSED(watch_functions_set);
@ -1726,13 +1726,13 @@ void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const
qDBusAddTimeout, qDBusAddTimeout,
qDBusRemoveTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, qDBusToggleTimeout,
this, 0); this, nullptr);
//qDebug() << "time_functions_set" << time_functions_set; //qDebug() << "time_functions_set" << time_functions_set;
Q_UNUSED(time_functions_set); Q_UNUSED(time_functions_set);
q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0); q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, nullptr);
dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, 0); dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, nullptr);
//qDebug() << "data_set" << data_set; //qDebug() << "data_set" << data_set;
Q_UNUSED(data_set); Q_UNUSED(data_set);
} }
@ -1752,16 +1752,16 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
qDBusAddWatch, qDBusAddWatch,
qDBusRemoveWatch, qDBusRemoveWatch,
qDBusToggleWatch, qDBusToggleWatch,
this, 0); this, nullptr);
q_dbus_connection_set_timeout_functions(connection, q_dbus_connection_set_timeout_functions(connection,
qDBusAddTimeout, qDBusAddTimeout,
qDBusRemoveTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, qDBusToggleTimeout,
this, 0); this, nullptr);
q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, nullptr);
q_dbus_connection_add_filter(connection, q_dbus_connection_add_filter(connection,
qDBusSignalFilter, qDBusSignalFilter,
this, 0); this, nullptr);
watchForDBusDisconnection(); watchForDBusDisconnection();
@ -1772,7 +1772,7 @@ static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnecti
{ {
QDBusConnection::ConnectionCapabilities result; QDBusConnection::ConnectionCapabilities result;
typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int); typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int);
static can_send_type_t can_send_type = 0; static can_send_type_t can_send_type = nullptr;
#if defined(QT_LINKED_LIBDBUS) #if defined(QT_LINKED_LIBDBUS)
# if DBUS_VERSION-0 >= 0x010400 # if DBUS_VERSION-0 >= 0x010400
@ -1809,11 +1809,11 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
q_dbus_connection_set_exit_on_disconnect(connection, false); q_dbus_connection_set_exit_on_disconnect(connection, false);
q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch,
qDBusToggleWatch, this, 0); qDBusToggleWatch, this, nullptr);
q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, this, 0); qDBusToggleTimeout, this, nullptr);
q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, nullptr);
q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, nullptr);
// Initialize the hooks for the NameAcquired and NameLost signals // Initialize the hooks for the NameAcquired and NameLost signals
// we don't use connectSignal here because we don't need the rules to be sent to the bus // we don't use connectSignal here because we don't need the rules to be sent to the bus
@ -1904,7 +1904,7 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
if (call->pending) { if (call->pending) {
q_dbus_pending_call_unref(call->pending); q_dbus_pending_call_unref(call->pending);
call->pending = 0; call->pending = nullptr;
} }
// Are there any watchers? // Are there any watchers?
@ -2046,7 +2046,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
{ {
QDBusBlockingCallWatcher watcher(message); QDBusBlockingCallWatcher watcher(message);
QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, 0, 0, 0, timeout); QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, nullptr, nullptr, nullptr, timeout);
Q_ASSERT(pcall); Q_ASSERT(pcall);
if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) { if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) {
@ -2161,7 +2161,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *message, int timeout) void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *message, int timeout)
{ {
QDBusError error; QDBusError error;
DBusPendingCall *pending = 0; DBusPendingCall *pending = nullptr;
DBusMessage *msg = static_cast<DBusMessage *>(message); DBusMessage *msg = static_cast<DBusMessage *>(message);
bool isNoReply = !pcall; bool isNoReply = !pcall;
Q_ASSERT(isNoReply == !!q_dbus_message_get_no_reply(msg)); Q_ASSERT(isNoReply == !!q_dbus_message_get_no_reply(msg));
@ -2175,7 +2175,7 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
q_dbus_message_unref(msg); q_dbus_message_unref(msg);
pcall->pending = pending; pcall->pending = pending;
q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0); q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, nullptr);
// DBus won't notify us when a peer disconnects or server terminates so we need to track these ourselves // DBus won't notify us when a peer disconnects or server terminates so we need to track these ourselves
if (mode == QDBusConnectionPrivate::PeerMode || mode == QDBusConnectionPrivate::ClientMode) if (mode == QDBusConnectionPrivate::PeerMode || mode == QDBusConnectionPrivate::ClientMode)
@ -2261,7 +2261,7 @@ bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
if (connection) { if (connection) {
if (mode != QDBusConnectionPrivate::PeerMode) { if (mode != QDBusConnectionPrivate::PeerMode) {
qDBusDebug() << this << "Adding rule:" << hook.matchRule; qDBusDebug() << this << "Adding rule:" << hook.matchRule;
q_dbus_bus_add_match(connection, hook.matchRule, NULL); q_dbus_bus_add_match(connection, hook.matchRule, nullptr);
// Successfully connected the signal // Successfully connected the signal
// Do we need to watch for this name? // Do we need to watch for this name?
@ -2274,7 +2274,7 @@ bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
q_dbus_bus_add_match(connection, q_dbus_bus_add_match(connection,
buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(),
QDBusUtil::nameOwnerChanged(), rules, QString()), QDBusUtil::nameOwnerChanged(), rules, QString()),
NULL); nullptr);
data.owner = getNameOwnerNoCache(hook.service); data.owner = getNameOwnerNoCache(hook.service);
qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
<< data.owner << ")"; << data.owner << ")";
@ -2362,7 +2362,7 @@ QDBusConnectionPrivate::removeSignalHookNoLock(SignalHookHash::Iterator it)
if (connection && erase) { if (connection && erase) {
if (mode != QDBusConnectionPrivate::PeerMode) { if (mode != QDBusConnectionPrivate::PeerMode) {
qDBusDebug() << this << "Removing rule:" << hook.matchRule; qDBusDebug() << this << "Removing rule:" << hook.matchRule;
q_dbus_bus_remove_match(connection, hook.matchRule, NULL); q_dbus_bus_remove_match(connection, hook.matchRule, nullptr);
// Successfully disconnected the signal // Successfully disconnected the signal
// Were we watching for this name? // Were we watching for this name?
@ -2375,7 +2375,7 @@ QDBusConnectionPrivate::removeSignalHookNoLock(SignalHookHash::Iterator it)
q_dbus_bus_remove_match(connection, q_dbus_bus_remove_match(connection,
buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), buildMatchRule(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(),
QDBusUtil::nameOwnerChanged(), rules, QString()), QDBusUtil::nameOwnerChanged(), rules, QString()),
NULL); nullptr);
} }
} }
} }
@ -2575,7 +2575,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
// it doesn't exist yet, we have to create it // it doesn't exist yet, we have to create it
QDBusWriteLocker locker(FindMetaObject2Action, this); QDBusWriteLocker locker(FindMetaObject2Action, this);
QDBusMetaObject *mo = 0; QDBusMetaObject *mo = nullptr;
if (!interface.isEmpty()) if (!interface.isEmpty())
mo = cachedMetaObjects.value(interface, 0); mo = cachedMetaObjects.value(interface, 0);
if (mo) if (mo)
@ -2591,7 +2591,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
error = QDBusError(reply); error = QDBusError(reply);
lastError = error; lastError = error;
if (reply.type() != QDBusMessage::ErrorMessage || error.type() != QDBusError::UnknownMethod) if (reply.type() != QDBusMessage::ErrorMessage || error.type() != QDBusError::UnknownMethod)
return 0; // error return nullptr; // error
} }
// release the lock and return // release the lock and return

View File

@ -149,7 +149,7 @@ static void copyArgument(void *to, int id, const QVariant &arg)
QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p,
const QString &iface, const QDBusConnection &con) const QString &iface, const QDBusConnection &con)
: QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0) : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(nullptr)
{ {
// QDBusAbstractInterfacePrivate's constructor checked the parameters for us // QDBusAbstractInterfacePrivate's constructor checked the parameters for us
if (connection.isConnected()) { if (connection.isConnected()) {
@ -245,7 +245,7 @@ const QMetaObject *QDBusInterface::metaObject() const
*/ */
void *QDBusInterface::qt_metacast(const char *_clname) void *QDBusInterface::qt_metacast(const char *_clname)
{ {
if (!_clname) return 0; if (!_clname) return nullptr;
if (!strcmp(_clname, "QDBusInterface")) if (!strcmp(_clname, "QDBusInterface"))
return static_cast<void*>(const_cast<QDBusInterface*>(this)); return static_cast<void*>(const_cast<QDBusInterface*>(this));
if (d_func()->interface.toLatin1() == _clname) if (d_func()->interface.toLatin1() == _clname)

View File

@ -358,7 +358,7 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) { if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) {
// we have to demarshall before writing // we have to demarshall before writing
void *null = 0; void *null = nullptr;
QVariant other(id, null); QVariant other(id, null);
if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) { if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) {
qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. "

View File

@ -197,7 +197,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
} }
QByteArray tmpSignature; QByteArray tmpSignature;
const char *signature = 0; const char *signature = nullptr;
if (id == QDBusMetaTypeId::argument()) { if (id == QDBusMetaTypeId::argument()) {
// take the signature from the QDBusArgument object we're marshalling // take the signature from the QDBusArgument object we're marshalling
tmpSignature = tmpSignature =
@ -243,7 +243,7 @@ inline void QDBusMarshaller::append(const QStringList &arg)
inline QDBusMarshaller *QDBusMarshaller::beginStructure() inline QDBusMarshaller *QDBusMarshaller::beginStructure()
{ {
return beginCommon(DBUS_TYPE_STRUCT, 0); return beginCommon(DBUS_TYPE_STRUCT, nullptr);
} }
inline QDBusMarshaller *QDBusMarshaller::beginArray(int id) inline QDBusMarshaller *QDBusMarshaller::beginArray(int id)
@ -301,7 +301,7 @@ inline QDBusMarshaller *QDBusMarshaller::beginMap(int kid, int vid)
inline QDBusMarshaller *QDBusMarshaller::beginMapEntry() inline QDBusMarshaller *QDBusMarshaller::beginMapEntry()
{ {
return beginCommon(DBUS_TYPE_DICT_ENTRY, 0); return beginCommon(DBUS_TYPE_DICT_ENTRY, nullptr);
} }
void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature) void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature)
@ -572,7 +572,7 @@ bool QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller *demarshaller)
QDBusMarshaller mrecursed(capabilities); // create on the stack makes it autoclose QDBusMarshaller mrecursed(capabilities); // create on the stack makes it autoclose
QByteArray subSignature; QByteArray subSignature;
const char *sig = 0; const char *sig = nullptr;
if (code == DBUS_TYPE_VARIANT || code == DBUS_TYPE_ARRAY) { if (code == DBUS_TYPE_VARIANT || code == DBUS_TYPE_ARRAY) {
subSignature = drecursed->currentSignature().toLatin1(); subSignature = drecursed->currentSignature().toLatin1();
if (!subSignature.isEmpty()) if (!subSignature.isEmpty())

View File

@ -64,11 +64,11 @@ Q_STATIC_ASSERT(QDBusMessage::SignalMessage == DBUS_MESSAGE_TYPE_SIGNAL);
static inline const char *data(const QByteArray &arr) static inline const char *data(const QByteArray &arr)
{ {
return arr.isEmpty() ? 0 : arr.constData(); return arr.isEmpty() ? nullptr : arr.constData();
} }
QDBusMessagePrivate::QDBusMessagePrivate() QDBusMessagePrivate::QDBusMessagePrivate()
: msg(0), reply(0), localReply(0), ref(1), type(QDBusMessage::InvalidMessage), : msg(nullptr), reply(nullptr), localReply(nullptr), ref(1), type(QDBusMessage::InvalidMessage),
delayedReply(false), localMessage(false), delayedReply(false), localMessage(false),
parametersValidated(false), autoStartService(true), parametersValidated(false), autoStartService(true),
interactiveAuthorizationAllowed(false) interactiveAuthorizationAllowed(false)
@ -113,10 +113,10 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
{ {
if (!qdbus_loadLibDBus()) { if (!qdbus_loadLibDBus()) {
*error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library")); *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library"));
return 0; return nullptr;
} }
DBusMessage *msg = 0; DBusMessage *msg = nullptr;
const QDBusMessagePrivate *d_ptr = message.d_ptr; const QDBusMessagePrivate *d_ptr = message.d_ptr;
switch (d_ptr->type) { switch (d_ptr->type) {
@ -127,13 +127,13 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
// only service and interface can be empty -> path and name must not be empty // only service and interface can be empty -> path and name must not be empty
if (!d_ptr->parametersValidated) { if (!d_ptr->parametersValidated) {
if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
return 0; return nullptr;
} }
msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(),
@ -153,7 +153,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
// error name can't be empty // error name can't be empty
if (!d_ptr->parametersValidated if (!d_ptr->parametersValidated
&& !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)) && !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error))
return 0; return nullptr;
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8()); q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8());
@ -166,13 +166,13 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
// only the service name can be empty here // only the service name can be empty here
if (!d_ptr->parametersValidated) { if (!d_ptr->parametersValidated) {
if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
return 0; return nullptr;
if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
return 0; return nullptr;
} }
msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(),
@ -203,7 +203,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
// not ok; // not ok;
q_dbus_message_unref(msg); q_dbus_message_unref(msg);
*error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString); *error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString);
return 0; return nullptr;
} }
/* /*

View File

@ -138,7 +138,7 @@ static int registerComplexDBusType(const char *typeName)
static void *construct(void *, const void *) static void *construct(void *, const void *)
{ {
qFatal("Cannot construct placeholder type QDBusRawType"); qFatal("Cannot construct placeholder type QDBusRawType");
return 0; return nullptr;
} }
}; };
@ -147,7 +147,7 @@ static int registerComplexDBusType(const char *typeName)
QDBusRawTypeHandler::construct, QDBusRawTypeHandler::construct,
sizeof(void *), sizeof(void *),
QMetaType::MovableType, QMetaType::MovableType,
0); nullptr);
} }
Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false; Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false;
@ -544,9 +544,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
// put the metaobject together // put the metaobject together
obj->d.data = uint_data; obj->d.data = uint_data;
obj->d.relatedMetaObjects = 0; obj->d.relatedMetaObjects = nullptr;
obj->d.static_metacall = 0; obj->d.static_metacall = nullptr;
obj->d.extradata = 0; obj->d.extradata = nullptr;
obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data); obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data);
obj->d.superdata = &QDBusAbstractInterface::staticMetaObject; obj->d.superdata = &QDBusAbstractInterface::staticMetaObject;
} }
@ -587,7 +587,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con
error = QDBusError(); error = QDBusError();
QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml); QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml);
QDBusMetaObject *we = 0; QDBusMetaObject *we = nullptr;
QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin(); QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin();
QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd(); QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd();
for ( ; it != end; ++it) { for ( ; it != end; ++it) {
@ -621,7 +621,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con
if (parsed.isEmpty()) { if (parsed.isEmpty()) {
// object didn't return introspection // object didn't return introspection
we = new QDBusMetaObject; we = new QDBusMetaObject;
QDBusMetaObjectGenerator generator(interface, 0); QDBusMetaObjectGenerator generator(interface, nullptr);
generator.write(we); generator.write(we);
we->cached = false; we->cached = false;
return we; return we;
@ -651,7 +651,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con
error = QDBusError(QDBusError::UnknownInterface, error = QDBusError(QDBusError::UnknownInterface,
QLatin1String("Interface '%1' was not found") QLatin1String("Interface '%1' was not found")
.arg(interface)); .arg(interface));
return 0; return nullptr;
} }
QDBusMetaObject::QDBusMetaObject() QDBusMetaObject::QDBusMetaObject()
@ -670,7 +670,7 @@ const int *QDBusMetaObject::inputTypesForMethod(int id) const
int handle = priv(d.data)->methodDBusData + id*intsPerMethod; int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
return reinterpret_cast<const int*>(d.data + d.data[handle]); return reinterpret_cast<const int*>(d.data + d.data[handle]);
} }
return 0; return nullptr;
} }
const int *QDBusMetaObject::outputTypesForMethod(int id) const const int *QDBusMetaObject::outputTypesForMethod(int id) const
@ -680,7 +680,7 @@ const int *QDBusMetaObject::outputTypesForMethod(int id) const
int handle = priv(d.data)->methodDBusData + id*intsPerMethod; int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
return reinterpret_cast<const int*>(d.data + d.data[handle + 1]); return reinterpret_cast<const int*>(d.data + d.data[handle + 1]);
} }
return 0; return nullptr;
} }
int QDBusMetaObject::propertyMetaType(int id) const int QDBusMetaObject::propertyMetaType(int id) const

View File

@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
class QDBusCustomTypeInfo class QDBusCustomTypeInfo
{ {
public: public:
QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0) QDBusCustomTypeInfo() : signature(), marshall(nullptr), demarshall(nullptr)
{ } { }
// Suggestion: // Suggestion:
@ -78,7 +78,7 @@ public:
}; };
template<typename T> template<typename T>
inline static void registerHelper(T * = 0) inline static void registerHelper(T * = nullptr)
{ {
void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper<T>; void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper<T>;
void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper<T>; void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper<T>;
@ -259,7 +259,7 @@ bool QDBusMetaType::marshall(QDBusArgument &arg, int id, const void *data)
const QDBusCustomTypeInfo &info = (*ct).at(id); const QDBusCustomTypeInfo &info = (*ct).at(id);
if (!info.marshall) { if (!info.marshall) {
mf = 0; // make gcc happy mf = nullptr; // make gcc happy
return false; return false;
} else } else
mf = info.marshall; mf = info.marshall;
@ -288,7 +288,7 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data)
const QDBusCustomTypeInfo &info = (*ct).at(id); const QDBusCustomTypeInfo &info = (*ct).at(id);
if (!info.demarshall) { if (!info.demarshall) {
df = 0; // make gcc happy df = nullptr; // make gcc happy
return false; return false;
} else } else
df = info.demarshall; df = info.demarshall;
@ -460,7 +460,7 @@ const char *QDBusMetaType::typeToSignature(int type)
{ {
QReadLocker locker(customTypesLock()); QReadLocker locker(customTypesLock());
if (type >= ct->size()) if (type >= ct->size())
return 0; // type not registered with us return nullptr; // type not registered with us
const QDBusCustomTypeInfo &info = (*ct).at(type); const QDBusCustomTypeInfo &info = (*ct).at(type);
@ -468,7 +468,7 @@ const char *QDBusMetaType::typeToSignature(int type)
return info.signature; return info.signature;
if (!info.marshall) if (!info.marshall)
return 0; // type not registered with us return nullptr; // type not registered with us
} }
// call to user code to construct the signature type // call to user code to construct the signature type

View File

@ -62,7 +62,7 @@ bool qDBusCheckAsyncTag(const char *tag)
return false; return false;
const char *p = strstr(tag, noReplyTag); const char *p = strstr(tag, noReplyTag);
if (p != NULL && if (p != nullptr &&
(p == tag || *(p-1) == ' ') && (p == tag || *(p-1) == ' ') &&
(p[sizeof noReplyTag - 1] == '\0' || p[sizeof noReplyTag - 1] == ' ')) (p[sizeof noReplyTag - 1] == '\0' || p[sizeof noReplyTag - 1] == ' '))
return true; return true;
@ -167,7 +167,7 @@ int qDBusParametersForMethod(const QList<QByteArray> &parameterTypes, QVector<in
if (id == 0) { if (id == 0) {
errorMsg = QLatin1String("Unregistered output type in parameter list: ") + QLatin1String(type); errorMsg = QLatin1String("Unregistered output type in parameter list: ") + QLatin1String(type);
return -1; return -1;
} else if (QDBusMetaType::typeToSignature(id) == 0) } else if (QDBusMetaType::typeToSignature(id) == nullptr)
return -1; return -1;
metaTypes.append( id ); metaTypes.append( id );
@ -195,7 +195,7 @@ int qDBusParametersForMethod(const QList<QByteArray> &parameterTypes, QVector<in
if (id == QDBusMetaTypeId::message()) if (id == QDBusMetaTypeId::message())
seenMessage = true; seenMessage = true;
else if (QDBusMetaType::typeToSignature(id) == 0) { else if (QDBusMetaType::typeToSignature(id) == nullptr) {
errorMsg = QLatin1String("Type not registered with QtDBus in parameter list: ") + QLatin1String(type); errorMsg = QLatin1String("Type not registered with QtDBus in parameter list: ") + QLatin1String(type);
return -1; return -1;
} }

View File

@ -182,7 +182,7 @@ bool QDBusPendingCallPrivate::setReplyCallback(QObject *target, const char *memb
if (metaTypes.at(count) == QDBusMetaTypeId::message()) if (metaTypes.at(count) == QDBusMetaTypeId::message())
--count; --count;
setMetaTypes(count, count ? metaTypes.constData() + 1 : 0); setMetaTypes(count, count ? metaTypes.constData() + 1 : nullptr);
return true; return true;
} }
@ -469,10 +469,10 @@ QDBusPendingCall QDBusPendingCall::fromError(const QDBusError &error)
*/ */
QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg) QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg)
{ {
QDBusPendingCallPrivate *d = 0; QDBusPendingCallPrivate *d = nullptr;
if (msg.type() == QDBusMessage::ErrorMessage || if (msg.type() == QDBusMessage::ErrorMessage ||
msg.type() == QDBusMessage::ReplyMessage) { msg.type() == QDBusMessage::ReplyMessage) {
d = new QDBusPendingCallPrivate(QDBusMessage(), 0); d = new QDBusPendingCallPrivate(QDBusMessage(), nullptr);
d->replyMessage = msg; d->replyMessage = msg;
d->ref.storeRelaxed(1); d->ref.storeRelaxed(1);
} }

View File

@ -247,7 +247,7 @@
*/ */
QDBusPendingReplyData::QDBusPendingReplyData() QDBusPendingReplyData::QDBusPendingReplyData()
: QDBusPendingCall(0) // initialize base class empty : QDBusPendingCall(nullptr) // initialize base class empty
{ {
} }
@ -262,7 +262,7 @@ void QDBusPendingReplyData::assign(const QDBusPendingCall &other)
void QDBusPendingReplyData::assign(const QDBusMessage &message) void QDBusPendingReplyData::assign(const QDBusMessage &message)
{ {
d = new QDBusPendingCallPrivate(QDBusMessage(), 0); // drops the reference to the old one d = new QDBusPendingCallPrivate(QDBusMessage(), nullptr); // drops the reference to the old one
d->replyMessage = message; d->replyMessage = message;
} }

View File

@ -202,7 +202,7 @@ void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data
} }
const char *expectedSignature = QDBusMetaType::typeToSignature(data.userType()); const char *expectedSignature = QDBusMetaType::typeToSignature(data.userType());
const char *receivedType = 0; const char *receivedType = nullptr;
QByteArray receivedSignature; QByteArray receivedSignature;
if (reply.arguments().count() >= 1) { if (reply.arguments().count() >= 1) {

View File

@ -135,7 +135,7 @@ QExplicitlySharedDataPointer<QDBusUnixFileDescriptorPrivate>::~QExplicitlyShared
\sa fileDescriptor(), isValid() \sa fileDescriptor(), isValid()
*/ */
QDBusUnixFileDescriptor::QDBusUnixFileDescriptor() QDBusUnixFileDescriptor::QDBusUnixFileDescriptor()
: d(0) : d(nullptr)
{ {
} }
@ -153,7 +153,7 @@ QDBusUnixFileDescriptor::QDBusUnixFileDescriptor()
\sa setFileDescriptor(), fileDescriptor() \sa setFileDescriptor(), fileDescriptor()
*/ */
QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(int fileDescriptor) QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(int fileDescriptor)
: d(0) : d(nullptr)
{ {
if (fileDescriptor != -1) if (fileDescriptor != -1)
setFileDescriptor(fileDescriptor); setFileDescriptor(fileDescriptor);

View File

@ -246,12 +246,12 @@ static const char fixedTypes[] = "ybnqiuxtdh";
static bool isBasicType(int c) static bool isBasicType(int c)
{ {
return c != DBUS_TYPE_INVALID && strchr(basicTypes, c) != NULL; return c != DBUS_TYPE_INVALID && strchr(basicTypes, c) != nullptr;
} }
static bool isFixedType(int c) static bool isFixedType(int c)
{ {
return c != DBUS_TYPE_INVALID && strchr(fixedTypes, c) != NULL; return c != DBUS_TYPE_INVALID && strchr(fixedTypes, c) != nullptr;
} }
// Returns a pointer to one-past-end of this type if it's valid; // Returns a pointer to one-past-end of this type if it's valid;
@ -260,10 +260,10 @@ static const char *validateSingleType(const char *signature)
{ {
char c = *signature; char c = *signature;
if (c == DBUS_TYPE_INVALID) if (c == DBUS_TYPE_INVALID)
return 0; return nullptr;
// is it one of the one-letter types? // is it one of the one-letter types?
if (strchr(oneLetterTypes, c) != NULL) if (strchr(oneLetterTypes, c) != nullptr)
return signature + 1; return signature + 1;
// is it an array? // is it an array?
@ -277,9 +277,9 @@ static const char *validateSingleType(const char *signature)
// and a free value // and a free value
c = *++signature; c = *++signature;
if (!isBasicType(c)) if (!isBasicType(c))
return 0; return nullptr;
signature = validateSingleType(signature + 1); signature = validateSingleType(signature + 1);
return signature && *signature == DBUS_DICT_ENTRY_END_CHAR ? signature + 1 : 0; return signature && *signature == DBUS_DICT_ENTRY_END_CHAR ? signature + 1 : nullptr;
} }
return validateSingleType(signature); return validateSingleType(signature);
@ -291,14 +291,14 @@ static const char *validateSingleType(const char *signature)
while (true) { while (true) {
signature = validateSingleType(signature); signature = validateSingleType(signature);
if (!signature) if (!signature)
return 0; return nullptr;
if (*signature == DBUS_STRUCT_END_CHAR) if (*signature == DBUS_STRUCT_END_CHAR)
return signature + 1; return signature + 1;
} }
} }
// invalid/unknown type // invalid/unknown type
return 0; return nullptr;
} }
/*! /*!

View File

@ -478,15 +478,15 @@ Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories) Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
Q_GLOBAL_STATIC(QList<QAccessible::ActivationObserver *>, qAccessibleActivationObservers) Q_GLOBAL_STATIC(QList<QAccessible::ActivationObserver *>, qAccessibleActivationObservers)
QAccessible::UpdateHandler QAccessible::updateHandler = 0; QAccessible::UpdateHandler QAccessible::updateHandler = nullptr;
QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; QAccessible::RootObjectHandler QAccessible::rootObjectHandler = nullptr;
static bool cleanupAdded = false; static bool cleanupAdded = false;
static QPlatformAccessibility *platformAccessibility() static QPlatformAccessibility *platformAccessibility()
{ {
QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
return pfIntegration ? pfIntegration->accessibility() : 0; return pfIntegration ? pfIntegration->accessibility() : nullptr;
} }
/*! /*!
@ -673,7 +673,7 @@ void QAccessible::removeActivationObserver(ActivationObserver *observer)
QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
{ {
if (!object) if (!object)
return 0; return nullptr;
if (Id id = QAccessibleCache::instance()->objectToId.value(object)) if (Id id = QAccessibleCache::instance()->objectToId.value(object))
return QAccessibleCache::instance()->interfaceForId(id); return QAccessibleCache::instance()->interfaceForId(id);
@ -696,7 +696,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
// Find a QAccessiblePlugin (factory) for the class name. If there's // Find a QAccessiblePlugin (factory) for the class name. If there's
// no entry in the cache try to create it using the plugin loader. // no entry in the cache try to create it using the plugin loader.
if (!qAccessiblePlugins()->contains(cn)) { if (!qAccessiblePlugins()->contains(cn)) {
QAccessiblePlugin *factory = 0; // 0 means "no plugin found". This is cached as well. QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well.
const int index = loader()->indexOf(cn); const int index = loader()->indexOf(cn);
if (index != -1) if (index != -1)
factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index)); factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index));
@ -724,7 +724,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
return appInterface; return appInterface;
} }
return 0; return nullptr;
} }
/*! /*!
@ -1113,7 +1113,7 @@ QAccessibleInterface::relations(QAccessible::Relation /*match = QAccessible::All
*/ */
QAccessibleInterface *QAccessibleInterface::focusChild() const QAccessibleInterface *QAccessibleInterface::focusChild() const
{ {
return 0; return nullptr;
} }
/*! /*!
@ -1758,12 +1758,12 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
*/ */
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
{ {
if (m_object == 0) if (m_object == nullptr)
return QAccessible::accessibleInterface(m_uniqueId); return QAccessible::accessibleInterface(m_uniqueId);
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
if (!iface || !iface->isValid()) if (!iface || !iface->isValid())
return 0; return nullptr;
if (m_child >= 0) { if (m_child >= 0) {
QAccessibleInterface *child = iface->child(m_child); QAccessibleInterface *child = iface->child(m_child);
@ -1791,7 +1791,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
*/ */
QWindow *QAccessibleInterface::window() const QWindow *QAccessibleInterface::window() const
{ {
return 0; return nullptr;
} }
/*! /*!

View File

@ -128,7 +128,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
if (childIface->isValid() && childIface->rect().contains(x,y)) if (childIface->isValid() && childIface->rect().contains(x,y))
return childIface; return childIface;
} }
return 0; return nullptr;
} }
/*! /*!
@ -152,7 +152,7 @@ QWindow *QAccessibleApplication::window() const
{ {
// an application can have several windows, and AFAIK we don't need // an application can have several windows, and AFAIK we don't need
// to notify about changes on the application. // to notify about changes on the application.
return 0; return nullptr;
} }
// all toplevel windows except popups and the desktop // all toplevel windows except popups and the desktop
@ -190,7 +190,7 @@ int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) cons
QAccessibleInterface *QAccessibleApplication::parent() const QAccessibleInterface *QAccessibleApplication::parent() const
{ {
return 0; return nullptr;
} }
QAccessibleInterface *QAccessibleApplication::child(int index) const QAccessibleInterface *QAccessibleApplication::child(int index) const
@ -198,7 +198,7 @@ QAccessibleInterface *QAccessibleApplication::child(int index) const
const QObjectList tlo(topLevelObjects()); const QObjectList tlo(topLevelObjects());
if (index >= 0 && index < tlo.count()) if (index >= 0 && index < tlo.count())
return QAccessible::queryAccessibleInterface(tlo.at(index)); return QAccessible::queryAccessibleInterface(tlo.at(index));
return 0; return nullptr;
} }
@ -207,7 +207,7 @@ QAccessibleInterface *QAccessibleApplication::focusChild() const
{ {
if (QWindow *window = QGuiApplication::focusWindow()) if (QWindow *window = QGuiApplication::focusWindow())
return window->accessibleRoot(); return window->accessibleRoot();
return 0; return nullptr;
} }
/*! \reimp */ /*! \reimp */

Some files were not shown because too many files have changed in this diff Show More