Properly use QT_CONFIG macro to check for ICU

And remove the QT_USE_ICU define.

Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Lars Knoll 2016-11-18 13:32:19 +01:00
parent 0c8f3229de
commit e3555fe970
11 changed files with 41 additions and 41 deletions

View File

@ -58,7 +58,7 @@
#if !defined(QT_BOOTSTRAPPED)
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
#if defined(QT_USE_ICU)
#if QT_CONFIG(icu)
#include "qicucodec_p.h"
#else
#if QT_CONFIG(iconv)
@ -79,7 +79,7 @@
# endif // !Q_OS_INTEGRITY
#endif // !QT_NO_BIG_CODECS
#endif // QT_USE_ICU
#endif // icu
#endif // QT_BOOTSTRAPPED
#include "qmutex.h"
@ -99,7 +99,7 @@ typedef QList<QByteArray>::ConstIterator ByteArrayListConstIt;
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive));
QMutex *qTextCodecsMutex() { return textCodecsMutex(); }
#if !defined(QT_USE_ICU)
#if !QT_CONFIG(icu)
static char qtolower(char c)
{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
static bool qisalnum(char c)
@ -306,7 +306,7 @@ static void setup()
}
#else
static void setup() {}
#endif // QT_USE_ICU
#endif // icu
/*!
\enum QTextCodec::ConversionFlag
@ -519,7 +519,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
return 0;
setup();
#ifndef QT_USE_ICU
#if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec;
if (cache) {
@ -586,7 +586,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
}
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
return QIcuCodec::codecForMibUnlocked(mib);
#else
return 0;
@ -618,7 +618,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
codecs += (*it)->aliases();
}
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
codecs += QIcuCodec::availableCodecs();
#endif
@ -634,7 +634,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
*/
QList<int> QTextCodec::availableMibs()
{
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
return QIcuCodec::availableMibs();
#else
QMutexLocker locker(textCodecsMutex());
@ -688,7 +688,7 @@ QTextCodec* QTextCodec::codecForLocale()
QTextCodec *codec = globalData->codecForLocale.loadAcquire();
if (!codec) {
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
textCodecsMutex()->lock();
codec = QIcuCodec::defaultCodecUnlocked();
textCodecsMutex()->unlock();

View File

@ -69,6 +69,7 @@
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_NO_DATASTREAM
#define QT_FEATURE_iconv -1
#define QT_FEATURE_icu -1
#define QT_FEATURE_journald -1
#define QT_NO_LIBRARY
#define QT_FEATURE_library -1

View File

@ -55,7 +55,7 @@
#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#include <CoreServices/CoreServices.h>
@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
@ -90,7 +90,7 @@ class Q_CORE_EXPORT QCollatorPrivate
public:
QAtomicInt ref;
QLocale locale;
#if defined(Q_OS_WIN) && !defined(QT_USE_ICU)
#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
#ifdef USE_COMPARESTRINGEX
QString localeName;
#else

View File

@ -2431,7 +2431,7 @@ Qt::LayoutDirection QLocale::textDirection() const
*/
QString QLocale::toUpper(const QString &str) const
{
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
bool ok = true;
QString result = QIcu::toUpper(d->bcp47Name('_'), str, &ok);
if (ok)
@ -2455,7 +2455,7 @@ QString QLocale::toUpper(const QString &str) const
*/
QString QLocale::toLower(const QString &str) const
{
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
bool ok = true;
const QString result = QIcu::toLower(d->bcp47Name('_'), str, &ok);
if (ok)

View File

@ -134,7 +134,7 @@ Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_MOVABLE_TYPE);
#endif
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
namespace QIcu {
QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
QString toLower(const QByteArray &localeId, const QString &str, bool *ok);

View File

@ -5575,7 +5575,7 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
#if QT_CONFIG(icu) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
#endif
@ -5621,7 +5621,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(thisString);
CFRelease(otherString);
return result;
#elif defined(QT_USE_ICU)
#elif QT_CONFIG(icu)
if (!defaultCollator()->hasLocalData())
defaultCollator()->setLocalData(QCollator());
return defaultCollator()->localData().compare(data1, length1, data2, length2);

View File

@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE
static QTimeZonePrivate *newBackendTimeZone()
{
#ifdef QT_NO_SYSTEMLOCALE
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
#endif // QT_USE_ICU
#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
@ -69,7 +69,7 @@ static QTimeZonePrivate *newBackendTimeZone()
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate();
#elif defined QT_USE_ICU
#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
@ -81,11 +81,11 @@ static QTimeZonePrivate *newBackendTimeZone()
static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
{
#ifdef QT_NO_SYSTEMLOCALE
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
#endif // QT_USE_ICU
#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
@ -96,7 +96,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate(ianaId);
#elif defined QT_USE_ICU
#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);

View File

@ -590,7 +590,7 @@ template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone()
}
/*
UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and QT_USE_ICU not set,
UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and ICU is not being used,
or for QDateTimes with a Qt:Spec of Qt::OffsetFromUtc.
*/

View File

@ -56,9 +56,9 @@
#include "qlocale_p.h"
#include "qvector.h"
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
#include <unicode/ucal.h>
#endif // QT_USE_ICU
#endif
#ifdef Q_OS_MAC
#ifdef __OBJC__
@ -227,7 +227,7 @@ private:
int m_offsetFromUtc;
};
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:
@ -268,7 +268,7 @@ private:
UCalendar *m_ucal;
};
#endif // QT_USE_ICU
#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
struct QTzTransitionTime
@ -337,9 +337,9 @@ private:
QVector<QTzTransitionTime> m_tranTimes;
QVector<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
mutable QSharedDataPointer<QTimeZonePrivate> m_icu;
#endif // QT_USE_ICU
#endif
QByteArray m_posixRule;
};
#endif // Q_OS_UNIX

View File

@ -598,18 +598,18 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
// Create the system default time zone
QTzTimeZonePrivate::QTzTimeZonePrivate()
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
: m_icu(0)
#endif // QT_USE_ICU
#endif
{
init(systemTimeZoneId());
}
// Create a named time zone
QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
: m_icu(0)
#endif // QT_USE_ICU
#endif
{
init(ianaId);
}
@ -617,9 +617,9 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other)
: QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes),
m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations),
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
m_icu(other.m_icu),
#endif // QT_USE_ICU
#endif
m_posixRule(other.m_posixRule)
{
}
@ -778,7 +778,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@ -788,7 +788,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
#else
Q_UNUSED(nameType)
Q_UNUSED(locale)
#endif // QT_USE_ICU
#endif
return abbreviation(atMSecsSinceEpoch);
}
@ -796,7 +796,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
#ifdef QT_USE_ICU
#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@ -807,7 +807,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
Q_UNUSED(timeType)
Q_UNUSED(nameType)
Q_UNUSED(locale)
#endif // QT_USE_ICU
#endif
// If no ICU available then have to use abbreviations instead
// Abbreviations don't have GenericTime
if (timeType == QTimeZone::GenericTime)

View File

@ -144,7 +144,6 @@ qtConfig(icu) {
SOURCES += tools/qlocale_icu.cpp \
tools/qcollator_icu.cpp
DEFINES += QT_USE_ICU
} else: win32 {
SOURCES += tools/qcollator_win.cpp
} else: macx {