diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index 43bbe0ea79..fd621983d3 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -61,7 +61,7 @@ void QCollatorPrivate::init() collator = ucol_open(name.constData(), &status); if (U_FAILURE(status)) { qWarning("Could not create collator: %d", status); - collator = 0; + collator = nullptr; dirty = false; return; } @@ -100,7 +100,7 @@ void QCollatorPrivate::cleanup() { if (collator) ucol_close(collator); - collator = 0; + collator = nullptr; } int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h index 18a43f0de6..f244a7721a 100644 --- a/src/corelib/tools/qcollator_p.h +++ b/src/corelib/tools/qcollator_p.h @@ -68,21 +68,25 @@ QT_BEGIN_NAMESPACE #if QT_CONFIG(icu) typedef UCollator *CollatorType; typedef QByteArray CollatorKeyType; +const CollatorType NoCollator = nullptr; #elif defined(Q_OS_OSX) typedef CollatorRef CollatorType; typedef QVector CollatorKeyType; +const CollatorType NoCollator = 0; #elif defined(Q_OS_WIN) typedef QString CollatorKeyType; typedef int CollatorType; +const CollatorType NoCollator = 0; # ifdef Q_OS_WINRT # define USE_COMPARESTRINGEX # endif -#else //posix +#else // posix - ignores CollatorType collator, only handles system locale typedef QVector CollatorKeyType; typedef int CollatorType; +const CollatorType NoCollator = 0; #endif class QCollatorPrivate @@ -102,14 +106,14 @@ public: bool ignorePunctuation = false; bool dirty = true; - CollatorType collator = 0; + CollatorType collator = NoCollator; QCollatorPrivate(const QLocale &locale) : locale(locale) {} ~QCollatorPrivate() { cleanup(); } void clear() { cleanup(); - collator = 0; + collator = NoCollator; } // Implemented by each back-end, in its own way: