Move away from using 0 as a pointer constant

Cleans up most of corelib to use nullptr or default enums
where appropriate.

Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allan Sandfeld Jensen 2019-05-14 15:04:18 +02:00
parent 327bfdb671
commit b4ead57250
60 changed files with 502 additions and 490 deletions

View File

@ -48,7 +48,7 @@ QLatin1Codec::~QLatin1Codec()
QString QLatin1Codec::convertToUnicode(const char *chars, int len, ConverterState *) const
{
if (chars == 0)
if (chars == nullptr)
return QString();
return QString::fromLatin1(chars, len);
@ -104,7 +104,7 @@ QLatin15Codec::~QLatin15Codec()
QString QLatin15Codec::convertToUnicode(const char* chars, int len, ConverterState *) const
{
if (chars == 0)
if (chars == nullptr)
return QString();
QString str = QString::fromLatin1(chars, len);

View File

@ -159,7 +159,7 @@ static QTextCodec *setupLocaleMapper()
{
QCoreGlobalData *globalData = QCoreGlobalData::instance();
QTextCodec *locale = 0;
QTextCodec *locale = nullptr;
{
QMutexLocker locker(textCodecsMutex());
@ -208,7 +208,7 @@ static QTextCodec *setupLocaleMapper()
// First part is getting that locale name. First try setlocale() which
// definitely knows it, but since we cannot fully trust it, get ready
// to fall back to environment variables.
const QByteArray ctype = setlocale(LC_CTYPE, 0);
const QByteArray ctype = setlocale(LC_CTYPE, nullptr);
// Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG
// environment variables.
@ -532,13 +532,13 @@ QTextCodec::~QTextCodec()
QTextCodec *QTextCodec::codecForName(const QByteArray &name)
{
if (name.isEmpty())
return 0;
return nullptr;
QMutexLocker locker(textCodecsMutex());
QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData)
return 0;
return nullptr;
setup();
#if !QT_CONFIG(icu)
@ -567,7 +567,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
}
}
return 0;
return nullptr;
#else
return QIcuCodec::codecForNameUnlocked(name);
#endif
@ -585,7 +585,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData)
return 0;
return nullptr;
if (globalData->allCodecs.isEmpty())
setup();
@ -611,7 +611,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
#if QT_CONFIG(icu)
return QIcuCodec::codecForMibUnlocked(mib);
#else
return 0;
return nullptr;
#endif
}
@ -704,7 +704,7 @@ QTextCodec* QTextCodec::codecForLocale()
{
QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData)
return 0;
return nullptr;
QTextCodec *codec = globalData->codecForLocale.loadAcquire();
if (!codec) {
@ -830,7 +830,7 @@ QTextEncoder* QTextCodec::makeEncoder(QTextCodec::ConversionFlags flags) const
*/
QByteArray QTextCodec::fromUnicode(const QString& str) const
{
return convertFromUnicode(str.constData(), str.length(), 0);
return convertFromUnicode(str.constData(), str.length(), nullptr);
}
#endif
@ -863,7 +863,7 @@ QByteArray QTextCodec::fromUnicode(QStringView str) const
*/
QString QTextCodec::toUnicode(const QByteArray& a) const
{
return convertToUnicode(a.constData(), a.length(), 0);
return convertToUnicode(a.constData(), a.length(), nullptr);
}
/*!
@ -915,7 +915,7 @@ bool QTextCodec::canEncode(QStringView s) const
QString QTextCodec::toUnicode(const char *chars) const
{
int len = qstrlen(chars);
return convertToUnicode(chars, len, 0);
return convertToUnicode(chars, len, nullptr);
}
@ -1110,7 +1110,7 @@ QString QTextDecoder::toUnicode(const QByteArray &ba)
QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec)
{
// determine charset
QTextCodec *c = QTextCodec::codecForUtfText(ba, 0);
QTextCodec *c = QTextCodec::codecForUtfText(ba, nullptr);
if (!c) {
static Q_RELAXED_CONSTEXPR auto matcher = qMakeStaticByteArrayMatcher("meta ");
QByteArray header = ba.left(1024).toLower();

View File

@ -3612,7 +3612,7 @@ bool qEnvironmentVariableIsSet(const char *varName) noexcept
(void)getenv_s(&requiredSize, 0, 0, varName);
return requiredSize != 0;
#else
return ::getenv(varName) != 0;
return ::getenv(varName) != nullptr;
#endif
}

View File

@ -1100,8 +1100,8 @@ Q_DECLARE_TYPEINFO(QMessagePattern::BacktraceParams, Q_MOVABLE_TYPE);
QBasicMutex QMessagePattern::mutex;
QMessagePattern::QMessagePattern()
: literals(0)
, tokens(0)
: literals(nullptr)
, tokens(nullptr)
, fromEnvironment(false)
{
#ifndef QT_BOOTSTRAPPED
@ -1121,9 +1121,9 @@ QMessagePattern::~QMessagePattern()
for (int i = 0; literals[i]; ++i)
delete [] literals[i];
delete [] literals;
literals = 0;
literals = nullptr;
delete [] tokens;
tokens = 0;
tokens = nullptr;
}
void QMessagePattern::setPattern(const QString &pattern)
@ -1173,7 +1173,7 @@ void QMessagePattern::setPattern(const QString &pattern)
// tokenizer
QVarLengthArray<const char*> literalsVar;
tokens = new const char*[lexemes.size() + 1];
tokens[lexemes.size()] = 0;
tokens[lexemes.size()] = nullptr;
bool nestedIfError = false;
bool inIf = false;
@ -1280,7 +1280,7 @@ void QMessagePattern::setPattern(const QString &pattern)
qt_message_print(error);
literals = new const char*[literalsVar.size() + 1];
literals[literalsVar.size()] = 0;
literals[literalsVar.size()] = nullptr;
memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*));
}
@ -1406,7 +1406,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
#endif
// we do not convert file, function, line literals to local encoding due to overhead
for (int i = 0; pattern->tokens[i] != 0; ++i) {
for (int i = 0; pattern->tokens[i]; ++i) {
const char *token = pattern->tokens[i];
if (token == endifTokenC) {
skip = false;

View File

@ -74,18 +74,18 @@ void *qRealloc(void *ptr, size_t size)
void *qMallocAligned(size_t size, size_t alignment)
{
return qReallocAligned(0, size, 0, alignment);
return qReallocAligned(nullptr, size, 0, alignment);
}
void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment)
{
// fake an aligned allocation
void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0;
void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : nullptr;
if (alignment <= sizeof(void*)) {
// special, fast case
void **newptr = static_cast<void **>(realloc(actualptr, newsize + sizeof(void*)));
if (!newptr)
return 0;
return nullptr;
if (newptr == actualptr) {
// realloc succeeded without reallocating
return oldptr;
@ -105,7 +105,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
void *real = realloc(actualptr, newsize + alignment);
if (!real)
return 0;
return nullptr;
quintptr faked = reinterpret_cast<quintptr>(real) + alignment;
faked &= ~(alignment - 1);

View File

@ -159,7 +159,7 @@ QAbstractFileEngineHandler::~QAbstractFileEngineHandler()
*/
QAbstractFileEngine *qt_custom_file_engine_handler_create(const QString &path)
{
QAbstractFileEngine *engine = 0;
QAbstractFileEngine *engine = nullptr;
if (qt_file_engine_handlers_in_use) {
QReadLocker locker(fileEngineHandlerMutex());
@ -658,7 +658,7 @@ QStringList QAbstractFileEngine::entryList(QDir::Filters filters, const QStringL
QAbstractFileEngine::FileFlags QAbstractFileEngine::fileFlags(FileFlags type) const
{
Q_UNUSED(type);
return 0;
return nullptr;
}
/*!
@ -838,7 +838,7 @@ uchar *QAbstractFileEngine::map(qint64 offset, qint64 size, QFile::MemoryMapFlag
option.flags = flags;
MapExtensionReturn r;
if (!extension(MapExtension, &option, &r))
return 0;
return nullptr;
return r.address;
}
@ -1118,7 +1118,7 @@ QAbstractFileEngine::Iterator *QAbstractFileEngine::beginEntryList(QDir::Filters
{
Q_UNUSED(filters);
Q_UNUSED(filterNames);
return 0;
return nullptr;
}
/*!
@ -1126,7 +1126,7 @@ QAbstractFileEngine::Iterator *QAbstractFileEngine::beginEntryList(QDir::Filters
*/
QAbstractFileEngine::Iterator *QAbstractFileEngine::endEntryList()
{
return 0;
return nullptr;
}
/*!

View File

@ -50,7 +50,7 @@ class QBufferPrivate : public QIODevicePrivate
public:
QBufferPrivate()
: buf(0)
: buf(nullptr)
#ifndef QT_NO_QOBJECT
, writtenSinceLastEmit(0), signalConnectionCount(0), signalsEmitted(false)
#endif

View File

@ -1431,7 +1431,7 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters,
l.append(it.fileInfo());
}
QStringList ret;
d->sortFileList(sort, l, &ret, 0);
d->sortFileList(sort, l, &ret, nullptr);
return ret;
}
@ -1473,7 +1473,7 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter
l.append(it.fileInfo());
}
QFileInfoList ret;
d->sortFileList(sort, l, 0, &ret);
d->sortFileList(sort, l, nullptr, &ret);
return ret;
}

View File

@ -86,7 +86,7 @@ QFilePrivate::openExternalFile(int flags, int fd, QFile::FileHandleFlags handleF
return false;
#else
delete fileEngine;
fileEngine = 0;
fileEngine = nullptr;
QFSFileEngine *fe = new QFSFileEngine;
fileEngine = fe;
return fe->open(QIODevice::OpenMode(flags), fd, handleFlags);
@ -102,7 +102,7 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
return false;
#else
delete fileEngine;
fileEngine = 0;
fileEngine = nullptr;
QFSFileEngine *fe = new QFSFileEngine;
fileEngine = fe;
return fe->open(QIODevice::OpenMode(flags), fh, handleFlags);
@ -336,7 +336,7 @@ QFile::setFileName(const QString &name)
}
if(d->fileEngine) { //get a new file engine later
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
}
d->fileName = name;
}

View File

@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
#endif
QFileDevicePrivate::QFileDevicePrivate()
: fileEngine(0),
: fileEngine(nullptr),
cachedSize(0),
error(QFile::NoError), lastWasWrite(false)
{
@ -63,7 +63,7 @@ QFileDevicePrivate::QFileDevicePrivate()
QFileDevicePrivate::~QFileDevicePrivate()
{
delete fileEngine;
fileEngine = 0;
fileEngine = nullptr;
}
QAbstractFileEngine * QFileDevicePrivate::engine() const

View File

@ -52,7 +52,7 @@ QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const
return fileNames[(int)name];
QString ret;
if (fileEngine == 0) { // local file; use the QFileSystemEngine directly
if (fileEngine == nullptr) { // local file; use the QFileSystemEngine directly
switch (name) {
case QAbstractFileEngine::CanonicalName:
case QAbstractFileEngine::CanonicalPathName: {
@ -103,7 +103,7 @@ QString QFileInfoPrivate::getFileOwner(QAbstractFileEngine::FileOwner own) const
if (cache_enabled && !fileOwners[(int)own].isNull())
return fileOwners[(int)own];
QString ret;
if (fileEngine == 0) {
if (fileEngine == nullptr) {
switch (own) {
case QAbstractFileEngine::OwnerUser:
ret = QFileSystemEngine::resolveUserName(fileEntry, metaData);
@ -134,7 +134,7 @@ uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) cons
// extra syscall. Bundle detecton on Mac can be slow, expecially on network
// paths, so we separate out that as well.
QAbstractFileEngine::FileFlags req = 0;
QAbstractFileEngine::FileFlags req = nullptr;
uint cachedFlags = 0;
if (request & (QAbstractFileEngine::FlagsMask | QAbstractFileEngine::TypesMask)) {
@ -434,7 +434,7 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
return true;
Qt::CaseSensitivity sensitive;
if (d->fileEngine == 0 || fileinfo.d_ptr->fileEngine == 0) {
if (d->fileEngine == nullptr || fileinfo.d_ptr->fileEngine == nullptr) {
if (d->fileEngine != fileinfo.d_ptr->fileEngine) // one is native, the other is a custom file-engine
return false;
@ -649,7 +649,7 @@ bool QFileInfo::isRelative() const
Q_D(const QFileInfo);
if (d->isDefaultConstructed)
return true;
if (d->fileEngine == 0)
if (d->fileEngine == nullptr)
return d->fileEntry.isRelative();
return d->fileEngine->isRelativePath();
}
@ -682,7 +682,7 @@ bool QFileInfo::exists() const
Q_D(const QFileInfo);
if (d->isDefaultConstructed)
return false;
if (d->fileEngine == 0) {
if (d->fileEngine == nullptr) {
if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute))
QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ExistsAttribute);
return d->metaData.exists();
@ -982,7 +982,7 @@ bool QFileInfo::isNativePath() const
Q_D(const QFileInfo);
if (d->isDefaultConstructed)
return false;
if (d->fileEngine == 0)
if (d->fileEngine == nullptr)
return true;
return d->getFileFlags(QAbstractFileEngine::LocalDiskFlag);
}
@ -1075,7 +1075,7 @@ bool QFileInfo::isRoot() const
Q_D(const QFileInfo);
if (d->isDefaultConstructed)
return false;
if (d->fileEngine == 0) {
if (d->fileEngine == nullptr) {
if (d->fileEntry.isRoot()) {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
//the path is a drive root, but the drive may not exist

View File

@ -124,7 +124,7 @@ static inline bool _q_checkEntry(QAbstractFileEngine *&engine, bool resolvingEnt
if (resolvingEntry) {
if (!(engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::ExistsFlag)) {
delete engine;
engine = 0;
engine = nullptr;
return false;
}
}
@ -191,7 +191,7 @@ static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &ent
QAbstractFileEngine *QFileSystemEngine::resolveEntryAndCreateLegacyEngine(
QFileSystemEntry &entry, QFileSystemMetaData &data) {
QFileSystemEntry copy = entry;
QAbstractFileEngine *engine = 0;
QAbstractFileEngine *engine = nullptr;
if (_q_resolveEntryAndCreateLegacyEngine_recursive(copy, data, engine))
// Reset entry to resolved copy.

View File

@ -813,7 +813,7 @@ QString QFileSystemEngine::resolveUserName(uint userId)
#endif
#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_WASM)
struct passwd *pw = 0;
struct passwd *pw = nullptr;
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS)
struct passwd entry;
getpwuid_r(userId, &entry, buf.data(), buf.size(), &pw);
@ -837,7 +837,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
#endif
#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_WASM)
struct group *gr = 0;
struct group *gr = nullptr;
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
if (size_max == -1)

View File

@ -50,15 +50,15 @@ QT_BEGIN_NAMESPACE
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters,
const QStringList &nameFilters, QDirIterator::IteratorFlags flags)
: nativePath(entry.nativeFilePath())
, dir(0)
, dirEntry(0)
, dir(nullptr)
, dirEntry(nullptr)
, lastError(0)
{
Q_UNUSED(filters)
Q_UNUSED(nameFilters)
Q_UNUSED(flags)
if ((dir = QT_OPENDIR(nativePath.constData())) == 0) {
if ((dir = QT_OPENDIR(nativePath.constData())) == nullptr) {
lastError = errno;
} else {
if (!nativePath.endsWith('/'))

View File

@ -127,7 +127,7 @@ void QFSFileEnginePrivate::init()
is_link = 0;
openMode = QIODevice::NotOpen;
fd = -1;
fh = 0;
fh = nullptr;
lastIOCommand = IOFlushCommand;
lastFlushFailed = false;
closeFileHandle = false;
@ -240,7 +240,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode)
d->openMode = openMode;
d->lastFlushFailed = false;
d->tried_stat = 0;
d->fh = 0;
d->fh = nullptr;
d->fd = -1;
return d->nativeOpen(openMode);
@ -299,7 +299,7 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh)
QSystemError::stdString());
this->openMode = QIODevice::NotOpen;
this->fh = 0;
this->fh = nullptr;
return false;
}
@ -328,7 +328,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd, QFile::FileHandle
d->lastFlushFailed = false;
d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
d->fileEntry.clear();
d->fh = 0;
d->fh = nullptr;
d->fd = -1;
d->tried_stat = 0;
@ -344,7 +344,7 @@ bool QFSFileEnginePrivate::openFd(QIODevice::OpenMode openMode, int fd)
{
Q_Q(QFSFileEngine);
this->fd = fd;
fh = 0;
fh = nullptr;
// Seek to the end when in Append mode.
if (openMode & QFile::Append) {
@ -405,7 +405,7 @@ bool QFSFileEnginePrivate::closeFdFh()
// We must reset these guys regardless; calling close again after a
// failed close causes crashes on some systems.
fh = 0;
fh = nullptr;
fd = -1;
closed = (ret == 0);
}
@ -822,7 +822,7 @@ QAbstractFileEngine::Iterator *QFSFileEngine::beginEntryList(QDir::Filters filte
*/
QAbstractFileEngine::Iterator *QFSFileEngine::endEntryList()
{
return 0;
return nullptr;
}
#endif // QT_NO_FILESYSTEMITERATOR
@ -870,7 +870,7 @@ bool QFSFileEngine::extension(Extension extension, const ExtensionOption *option
const MapExtensionOption *options = (const MapExtensionOption*)(option);
MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output);
returnValue->address = d->map(options->offset, options->size, options->flags);
return (returnValue->address != 0);
return (returnValue->address != nullptr);
}
if (extension == UnMapExtension) {
const UnMapExtensionOption *options = (const UnMapExtensionOption*)option;

View File

@ -153,7 +153,7 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
}
}
fh = 0;
fh = nullptr;
}
closeFileHandle = true;
@ -451,14 +451,14 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
if (type & Refresh)
d->metaData.clear();
QAbstractFileEngine::FileFlags ret = 0;
QAbstractFileEngine::FileFlags ret = { };
if (type & FlagsMask)
ret |= LocalDiskFlag;
bool exists;
{
QFileSystemMetaData::MetaDataFlags queryFlags = 0;
QFileSystemMetaData::MetaDataFlags queryFlags = { };
queryFlags |= QFileSystemMetaData::MetaDataFlags(uint(type))
& QFileSystemMetaData::Permissions;
@ -590,9 +590,9 @@ bool QFSFileEngine::setPermissions(uint perms)
QSystemError error;
bool ok;
if (d->fd != -1)
ok = QFileSystemEngine::setPermissions(d->fd, QFile::Permissions(perms), error, 0);
ok = QFileSystemEngine::setPermissions(d->fd, QFile::Permissions(perms), error);
else
ok = QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error, 0);
ok = QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error);
if (!ok) {
setError(QFile::PermissionsError, error.toString());
return false;
@ -651,13 +651,13 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
Q_Q(QFSFileEngine);
if (openMode == QIODevice::NotOpen) {
q->setError(QFile::PermissionsError, qt_error_string(int(EACCES)));
return 0;
return nullptr;
}
if (offset < 0 || offset > maxFileOffset
|| size < 0 || quint64(size) > quint64(size_t(-1))) {
q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL)));
return 0;
return nullptr;
}
// If we know the mapping will extend beyond EOF, fail early to avoid
@ -685,14 +685,14 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
if (quint64(size + extra) > quint64((size_t)-1)) {
q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL)));
return 0;
return nullptr;
}
size_t realSize = (size_t)size + extra;
QT_OFF_T realOffset = QT_OFF_T(offset);
realOffset &= ~(QT_OFF_T(pageSize - 1));
void *mapAddress = QT_MMAP((void*)0, realSize,
void *mapAddress = QT_MMAP((void*)nullptr, realSize,
access, sharemode, nativeHandle(), realOffset);
if (MAP_FAILED != mapAddress) {
uchar *address = extra + static_cast<uchar*>(mapAddress);
@ -714,7 +714,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
q->setError(QFile::UnspecifiedError, qt_error_string(int(errno)));
break;
}
return 0;
return nullptr;
}
bool QFSFileEnginePrivate::unmap(uchar *ptr)

View File

@ -169,7 +169,7 @@ QIODevicePrivate::QIODevicePrivate()
, baseReadLineDataCalled(false)
, accessMode(Unset)
#ifdef QT_NO_QOBJECT
, q_ptr(0)
, q_ptr(nullptr)
#endif
{
}

View File

@ -67,7 +67,7 @@ static const QChar *checkedToAscii(Buffer &buffer, const QChar *begin, const QCh
*dst++ = *src++;
}
*dst = '\0';
return 0;
return nullptr;
}
static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptLeadingZero);
@ -175,7 +175,7 @@ const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end
memset(address, 0, sizeof address);
if (colonCount == 2 && end - begin == 2) // "::"
return 0;
return nullptr;
// if there's a double colon ("::"), this is how many zeroes it means
int zeroWordsToFill;
@ -236,7 +236,7 @@ const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end
address[13] = ip4 >> 16;
address[14] = ip4 >> 8;
address[15] = ip4;
return 0;
return nullptr;
}
address[pos++] = x >> 8;
@ -248,7 +248,7 @@ const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end
return begin + (endptr - buffer.data());
ptr = endptr + 1;
}
return pos == 16 ? 0 : end;
return pos == 16 ? nullptr : end;
}
static inline QChar toHex(uchar c)

View File

@ -214,8 +214,8 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
Note that \a category must be kept valid during the lifetime of this object.
*/
QLoggingCategory::QLoggingCategory(const char *category)
: d(0),
name(0)
: d(nullptr),
name(nullptr)
{
init(category, QtDebugMsg);
}
@ -231,8 +231,8 @@ QLoggingCategory::QLoggingCategory(const char *category)
\since 5.4
*/
QLoggingCategory::QLoggingCategory(const char *category, QtMsgType enableForLevel)
: d(0),
name(0)
: d(nullptr),
name(nullptr)
{
init(category, enableForLevel);
}

View File

@ -165,7 +165,7 @@ void QLoggingRule::parse(const QStringRef &pattern)
p = QStringRef(p.string(), p.position() + 1, p.length() - 1);
}
if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end
flags = 0;
flags = PatternFlags();
}
category = p.toString();
@ -415,7 +415,7 @@ QLoggingRegistry::installFilter(QLoggingCategory::CategoryFilter filter)
{
QMutexLocker locker(&registryMutex);
if (filter == 0)
if (!filter)
filter = defaultCategoryFilter;
QLoggingCategory::CategoryFilter old = categoryFilter;

View File

@ -147,7 +147,7 @@ private:
public:
mutable QAtomicInt ref;
inline QResourceRoot(): tree(0), names(0), payloads(0), version(0) {}
inline QResourceRoot(): tree(nullptr), names(nullptr), payloads(nullptr), version(0) {}
inline QResourceRoot(int version, const uchar *t, const uchar *n, const uchar *d) { setSource(version, t, n, d); }
virtual ~QResourceRoot() { }
int findNode(const QString &path, const QLocale &locale=QLocale()) const;
@ -165,7 +165,7 @@ public:
quint64 lastModified(int node) const;
QStringList children(int node) const;
virtual QString mappingRoot() const { return QString(); }
bool mappingRootSubdir(const QString &path, QString *match=0) const;
bool mappingRootSubdir(const QString &path, QString *match = nullptr) const;
inline bool operator==(const QResourceRoot &other) const
{ return tree == other.tree && names == other.names && payloads == other.payloads && version == other.version; }
inline bool operator!=(const QResourceRoot &other) const
@ -320,7 +320,7 @@ QResourcePrivate::clear()
{
absoluteFilePath.clear();
compressionAlgo = QResource::NoCompression;
data = 0;
data = nullptr;
size = 0;
children.clear();
lastModified = 0;
@ -864,7 +864,7 @@ const uchar *QResourceRoot::data(int node, qint64 *size) const
{
if(node == -1) {
*size = 0;
return 0;
return nullptr;
}
int offset = findOffset(node) + 4; //jump past name
@ -881,7 +881,7 @@ const uchar *QResourceRoot::data(int node, qint64 *size) const
return ret;
}
*size = 0;
return 0;
return nullptr;
}
quint64 QResourceRoot::lastModified(int node) const
@ -991,7 +991,7 @@ class QDynamicBufferResourceRoot: public QResourceRoot
const uchar *buffer;
public:
inline QDynamicBufferResourceRoot(const QString &_root) : root(_root), buffer(0) { }
inline QDynamicBufferResourceRoot(const QString &_root) : root(_root), buffer(nullptr) { }
inline ~QDynamicBufferResourceRoot() { }
inline const uchar *mappingBuffer() const { return buffer; }
QString mappingRoot() const override { return root; }
@ -1063,12 +1063,14 @@ class QDynamicFileResourceRoot: public QDynamicBufferResourceRoot
qsizetype unmapLength;
public:
inline QDynamicFileResourceRoot(const QString &_root) : QDynamicBufferResourceRoot(_root), unmapPointer(0), unmapLength(0) { }
QDynamicFileResourceRoot(const QString &_root)
: QDynamicBufferResourceRoot(_root), unmapPointer(nullptr), unmapLength(0)
{ }
~QDynamicFileResourceRoot() {
#if defined(QT_USE_MMAP)
if (unmapPointer) {
munmap((char*)unmapPointer, unmapLength);
unmapPointer = 0;
unmapPointer = nullptr;
unmapLength = 0;
} else
#endif

View File

@ -151,7 +151,7 @@ QSaveFile::~QSaveFile()
if (d->fileEngine) {
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
}
}
@ -252,7 +252,7 @@ bool QSaveFile::open(OpenMode mode)
return true;
d->setError(d->fileEngine->error(), d->fileEngine->errorString());
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
} else {
QString msg =
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback "
@ -285,7 +285,7 @@ bool QSaveFile::open(OpenMode mode)
err = QFileDevice::OpenError;
d->setError(err, d->fileEngine->errorString());
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
return false;
}
@ -339,7 +339,7 @@ bool QSaveFile::commit()
d->fileEngine->remove();
d->writeError = QFileDevice::NoError;
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
return false;
}
// atomically replace old file with new file
@ -349,12 +349,12 @@ bool QSaveFile::commit()
d->setError(d->fileEngine->error(), d->fileEngine->errorString());
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
return false;
}
}
delete d->fileEngine;
d->fileEngine = 0;
d->fileEngine = nullptr;
return true;
}

View File

@ -327,7 +327,7 @@ bool QTemporaryFileEngine::isReallyOpen() const
{
Q_D(const QFSFileEngine);
if (!((0 == d->fh) && (-1 == d->fd)
if (!((nullptr == d->fh) && (-1 == d->fd)
#if defined Q_OS_WIN
&& (INVALID_HANDLE_VALUE == d->fileHandle)
#endif
@ -902,7 +902,7 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file)
{
if (QAbstractFileEngine *engine = file.d_func()->engine()) {
if(engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::LocalDiskFlag)
return 0; //native already
return nullptr; // native already
//cache
bool wasOpen = file.isOpen();
qint64 old_off = 0;
@ -934,7 +934,7 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file)
//done
return ret;
}
return 0;
return nullptr;
}
/*!

View File

@ -523,7 +523,7 @@ public:
Error *cloneError() const;
void clearError();
void setError(ErrorCode errorCode, const QString &source, int supplement = -1);
ErrorCode validityError(QString *source = 0, int *position = 0) const;
ErrorCode validityError(QString *source = nullptr, int *position = nullptr) const;
bool validateComponent(Section section, const QString &input, int begin, int end);
bool validateComponent(Section section, const QString &input)
{ return validateComponent(section, input, 0, uint(input.length())); }
@ -591,7 +591,7 @@ public:
inline QUrlPrivate::QUrlPrivate()
: ref(1), port(-1),
error(0),
error(nullptr),
sectionIsPresent(0),
flags(0)
{
@ -619,13 +619,13 @@ inline QUrlPrivate::~QUrlPrivate()
inline QUrlPrivate::Error *QUrlPrivate::cloneError() const
{
return error ? new Error(*error) : 0;
return error ? new Error(*error) : nullptr;
}
inline void QUrlPrivate::clearError()
{
delete error;
error = 0;
error = nullptr;
}
inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, int supplement)
@ -826,7 +826,7 @@ recodeFromUser(const QString &input, const ushort *actions, int from, int to)
QString output;
const QChar *begin = input.constData() + from;
const QChar *end = input.constData() + to;
if (qt_urlRecode(output, begin, end, 0, actions))
if (qt_urlRecode(output, begin, end, nullptr, actions))
return output;
return input.mid(from, to - from);
@ -954,7 +954,7 @@ inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptio
{
appendToUser(appendTo, fragment, options,
options & QUrl::EncodeDelimiters ? fragmentInUrl :
appendingTo == FullUrl ? 0 : fragmentInIsolation);
appendingTo == FullUrl ? nullptr : fragmentInIsolation);
}
inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
@ -1179,7 +1179,7 @@ inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions o
if (host.at(0).unicode() == '[') {
// IPv6 addresses might contain a zone-id which needs to be recoded
if (options != 0)
if (qt_urlRecode(appendTo, host.constBegin(), host.constEnd(), options, 0))
if (qt_urlRecode(appendTo, host.constBegin(), host.constEnd(), options, nullptr))
return;
appendTo += host;
} else {
@ -1221,7 +1221,7 @@ static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar
--end;
QString decoded;
if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, QUrl::FullyDecoded, 0)) {
if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, QUrl::FullyDecoded, nullptr)) {
begin = decoded.constBegin();
end = decoded.constEnd();
}
@ -1233,13 +1233,13 @@ static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar
host += *begin;
else if (begin->unicode() >= '0' && begin->unicode() <= '9')
host += *begin;
else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != 0)
else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != nullptr)
host += *begin;
else
return decoded.isEmpty() ? begin : &origBegin[2];
}
host += QLatin1Char(']');
return 0;
return nullptr;
}
return &origBegin[2];
}
@ -1286,7 +1286,7 @@ static const QChar *parseIp6(QString &host, const QChar *begin, const QChar *end
host += zoneId;
}
host += QLatin1Char(']');
return 0;
return nullptr;
}
inline bool QUrlPrivate::setHost(const QString &value, int from, int iend, QUrl::ParsingMode mode)
@ -1352,7 +1352,7 @@ inline bool QUrlPrivate::setHost(const QString &value, int from, int iend, QUrl:
// check for percent-encoding first
QString s;
if (mode == QUrl::TolerantMode && qt_urlRecode(s, begin, end, 0, 0)) {
if (mode == QUrl::TolerantMode && qt_urlRecode(s, begin, end, { }, nullptr)) {
// something was decoded
// anything encoded left?
int pos = s.indexOf(QChar(0x25)); // '%'
@ -1837,7 +1837,7 @@ inline void QUrlPrivate::validate() const
\sa setUrl(), fromEncoded(), TolerantMode
*/
QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)
QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(nullptr)
{
setUrl(url, parsingMode);
}
@ -1845,7 +1845,7 @@ QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)
/*!
Constructs an empty QUrl object.
*/
QUrl::QUrl() : d(0)
QUrl::QUrl() : d(nullptr)
{
}
@ -1879,7 +1879,7 @@ QUrl::~QUrl()
bool QUrl::isValid() const
{
if (isEmpty()) {
// also catches d == 0
// also catches d == nullptr
return false;
}
return d->validityError() == QUrlPrivate::NoError;
@ -1907,7 +1907,7 @@ void QUrl::clear()
{
if (d && !d->ref.deref())
delete d;
d = 0;
d = nullptr;
}
/*!
@ -4187,7 +4187,7 @@ static QUrl adjustFtpPath(QUrl url)
static bool isIp6(const QString &text)
{
QIPAddressUtils::IPv6Address address;
return !text.isEmpty() && QIPAddressUtils::parseIp6(address, text.begin(), text.end()) == 0;
return !text.isEmpty() && QIPAddressUtils::parseIp6(address, text.begin(), text.end()) == nullptr;
}
/*!

View File

@ -1444,7 +1444,7 @@ static void mapToLowerCase(QString *str, int from)
{
int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
ushort *d = 0;
ushort *d = nullptr;
for (int i = from; i < str->size(); ++i) {
uint uc = str->at(i).unicode();
if (uc < 0x80) {
@ -1474,7 +1474,7 @@ static void mapToLowerCase(QString *str, int from)
else
str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
i += l - 1;
d = 0;
d = nullptr;
} else {
if (!d)
d = reinterpret_cast<ushort *>(str->data());
@ -2404,7 +2404,7 @@ static const char * const idn_whitelist[] = {
};
static const size_t idn_whitelist_size = sizeof idn_whitelist / sizeof *idn_whitelist;
static QStringList *user_idn_whitelist = 0;
static QStringList *user_idn_whitelist = nullptr;
static bool lessThan(const QChar *a, int l, const char *c)
{

View File

@ -262,7 +262,7 @@ inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::Compon
if (!(encoding & QUrl::EncodeDelimiters)) {
QString output;
if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
encoding, 0))
encoding, nullptr))
return output;
return input;
}
@ -290,7 +290,7 @@ void QUrlQueryPrivate::setQuery(const QString &query)
const QChar *const end = pos + query.size();
while (pos != end) {
const QChar *begin = pos;
const QChar *delimiter = 0;
const QChar *delimiter = nullptr;
while (pos != end) {
// scan for the component parts of this pair
if (!delimiter && pos->unicode() == valueDelimiter)
@ -345,7 +345,7 @@ QSharedDataPointer<QUrlQueryPrivate>::clone()
\sa setQuery(), addQueryItem()
*/
QUrlQuery::QUrlQuery()
: d(0)
: d(nullptr)
{
}
@ -356,7 +356,7 @@ QUrlQuery::QUrlQuery()
set the query with setQuery().
*/
QUrlQuery::QUrlQuery(const QString &queryString)
: d(queryString.isEmpty() ? 0 : new QUrlQueryPrivate(queryString))
: d(queryString.isEmpty() ? nullptr : new QUrlQueryPrivate(queryString))
{
}
@ -369,7 +369,7 @@ QUrlQuery::QUrlQuery(const QString &queryString)
\sa QUrl::query()
*/
QUrlQuery::QUrlQuery(const QUrl &url)
: d(0)
: d(nullptr)
{
// use internals to avoid unnecessary recoding
// ### FIXME: actually do it

View File

@ -377,7 +377,7 @@ static int recode(QString &result, const ushort *begin, const ushort *end, QUrl:
{
const int origSize = result.size();
const ushort *input = begin;
ushort *output = 0;
ushort *output = nullptr;
EncodingAction action = EncodeCharacter;
for ( ; input != end; ++input) {

View File

@ -216,11 +216,11 @@ QString QCoreApplicationPrivate::appVersion() const
}
#endif
QString *QCoreApplicationPrivate::cachedApplicationFilePath = 0;
QString *QCoreApplicationPrivate::cachedApplicationFilePath = nullptr;
bool QCoreApplicationPrivate::checkInstance(const char *function)
{
bool b = (QCoreApplication::self != 0);
bool b = (QCoreApplication::self != nullptr);
if (!b)
qWarning("QApplication::%s: Please instantiate the QApplication object first", function);
return b;
@ -257,7 +257,7 @@ void QCoreApplicationPrivate::processCommandLineArguments()
}
if (j < argc) {
argv[j] = 0;
argv[j] = nullptr;
argc = j;
}
}
@ -367,11 +367,11 @@ Q_CORE_EXPORT uint qGlobalPostedEventsCount()
return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset;
}
QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = 0;
QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = nullptr;
#endif // QT_NO_QOBJECT
QCoreApplication *QCoreApplication::self = 0;
QCoreApplication *QCoreApplication::self = nullptr;
uint QCoreApplicationPrivate::attribs =
(1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents) |
(1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents);
@ -455,12 +455,12 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
, aboutToQuitEmitted(false)
, threadData_clean(false)
#else
, q_ptr(0)
, q_ptr(nullptr)
#endif
{
app_compile_version = flags & 0xffffff;
static const char *const empty = "";
if (argc == 0 || argv == 0) {
if (argc == 0 || argv == nullptr) {
argc = 0;
argv = const_cast<char **>(&empty);
}
@ -886,7 +886,7 @@ QCoreApplication::~QCoreApplication()
{
qt_call_post_routines();
self = 0;
self = nullptr;
#ifndef QT_NO_QOBJECT
QCoreApplicationPrivate::is_app_closing = true;
QCoreApplicationPrivate::is_app_running = false;
@ -894,7 +894,7 @@ QCoreApplication::~QCoreApplication()
#if QT_CONFIG(thread)
// Synchronize and stop the global thread pool threads.
QThreadPool *globalThreadPool = 0;
QThreadPool *globalThreadPool = nullptr;
QT_TRY {
globalThreadPool = QThreadPool::globalInstance();
} QT_CATCH (...) {
@ -905,10 +905,10 @@ QCoreApplication::~QCoreApplication()
#endif
#ifndef QT_NO_QOBJECT
d_func()->threadData->eventDispatcher = 0;
d_func()->threadData->eventDispatcher = nullptr;
if (QCoreApplicationPrivate::eventDispatcher)
QCoreApplicationPrivate::eventDispatcher->closingDown();
QCoreApplicationPrivate::eventDispatcher = 0;
QCoreApplicationPrivate::eventDispatcher = nullptr;
#endif
#if QT_CONFIG(library)

View File

@ -48,7 +48,7 @@ Q_GLOBAL_STATIC(QCoreGlobalData, globalInstance)
QCoreGlobalData::QCoreGlobalData()
#if QT_CONFIG(textcodec)
: codecForLocale(0)
: codecForLocale(nullptr)
#endif
{
}
@ -56,7 +56,7 @@ QCoreGlobalData::QCoreGlobalData()
QCoreGlobalData::~QCoreGlobalData()
{
#if QT_CONFIG(textcodec)
codecForLocale = 0;
codecForLocale = nullptr;
QList<QTextCodec *> tmp = allCodecs;
allCodecs.clear();
codecCache.clear();

View File

@ -517,12 +517,12 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
QT_FOR_EACH_STATIC_TYPE(QT_ADD_STATIC_METATYPE)
QT_FOR_EACH_STATIC_ALIAS_TYPE(QT_ADD_STATIC_METATYPE_ALIASES_ITER)
QT_FOR_EACH_STATIC_HACKS_TYPE(QT_ADD_STATIC_METATYPE_HACKS_ITER)
{0, 0, QMetaType::UnknownType}
{nullptr, 0, QMetaType::UnknownType}
};
Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper = 0;
Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper = 0;
Q_CORE_EXPORT const QMetaObject *qMetaObjectWidgetsHelper = 0;
Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper = nullptr;
Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper = nullptr;
Q_CORE_EXPORT const QMetaObject *qMetaObjectWidgetsHelper = nullptr;
class QCustomTypeInfo : public QMetaTypeInterface
{
@ -557,7 +557,7 @@ public:
{
const QWriteLocker locker(&lock);
const T* &fun = map[k];
if (fun != 0)
if (fun)
return false;
fun = f;
return true;
@ -566,7 +566,7 @@ public:
const T *function(Key k) const
{
const QReadLocker locker(&lock);
return map.value(k, 0);
return map.value(k, nullptr);
}
void remove(int from, int to)
@ -973,7 +973,7 @@ static inline int qMetaTypeStaticType(const char *typeName, int length)
The extra \a firstInvalidIndex parameter is an easy way to avoid
iterating over customTypes() a second time in registerNormalizedType().
*/
static int qMetaTypeCustomType_unlocked(const char *typeName, int length, int *firstInvalidIndex = 0)
static int qMetaTypeCustomType_unlocked(const char *typeName, int length, int *firstInvalidIndex = nullptr)
{
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (!ct)
@ -1006,7 +1006,7 @@ int QMetaType::registerType(const char *typeName, Deleter deleter,
{
return registerType(typeName, deleter, creator,
QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct,
QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0);
QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), nullptr);
}
/*!
@ -1613,7 +1613,7 @@ void *QMetaType::create(int type, const void *copy)
QMetaType info(type);
if (int size = info.sizeOf())
return info.construct(operator new(size), copy);
return 0;
return nullptr;
}
/*!
@ -1639,14 +1639,18 @@ class TypeConstructor {
static void *Construct(const int type, void *where, const void *copy)
{
if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0;
return Q_LIKELY(qMetaTypeGuiHelper)
? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy)
: nullptr;
if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0;
return Q_LIKELY(qMetaTypeWidgetsHelper)
? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy)
: nullptr;
// This point can be reached only for known types that definition is not available, for example
// in bootstrap mode. We have no other choice then ignore it.
return 0;
return nullptr;
}
};
public:
@ -1670,7 +1674,7 @@ private:
{
QReadLocker locker(customTypesLock());
if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User))
return 0;
return nullptr;
const auto &typeInfo = ct->at(type - QMetaType::User);
ctor = typeInfo.constructor;
tctor = typeInfo.typedConstructor;
@ -1715,7 +1719,7 @@ private:
void *QMetaType::construct(int type, void *where, const void *copy)
{
if (!where)
return 0;
return nullptr;
TypeConstructor constructor(type, where);
return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
}
@ -1861,7 +1865,7 @@ private:
int QMetaType::sizeOf(int type)
{
SizeOf sizeOf(type);
return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
return QMetaTypeSwitcher::switcher<int>(sizeOf, type);
}
namespace {
@ -1925,7 +1929,7 @@ private:
QMetaType::TypeFlags QMetaType::typeFlags(int type)
{
Flags flags(type);
return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0));
return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type));
}
#ifndef QT_BOOTSTRAPPED
@ -1948,17 +1952,21 @@ public:
{
static const QMetaObject *MetaObject(int type) {
if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].metaObject : 0;
return Q_LIKELY(qMetaTypeGuiHelper)
? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].metaObject
: nullptr;
if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject : 0;
return Q_LIKELY(qMetaTypeWidgetsHelper)
? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject
: nullptr;
return 0;
}
};
template <typename T>
const QMetaObject *delegate(const T *) { return MetaObjectImpl<T>::MetaObject(m_type); }
const QMetaObject *delegate(const void*) { return 0; }
const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
const QMetaObject *delegate(const void*) { return nullptr; }
const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return nullptr; }
const QMetaObject *delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customMetaObject(m_type); }
private:
const int m_type;
@ -1966,10 +1974,10 @@ private:
{
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (Q_UNLIKELY(!ct || type < QMetaType::User))
return 0;
return nullptr;
QReadLocker locker(customTypesLock());
if (Q_UNLIKELY(ct->count() <= type - QMetaType::User))
return 0;
return nullptr;
return ct->at(type - QMetaType::User).metaObject;
}
};
@ -1987,10 +1995,10 @@ const QMetaObject *QMetaType::metaObjectForType(int type)
{
#ifndef QT_BOOTSTRAPPED
MetaObject mo(type);
return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0);
return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type);
#else
Q_UNUSED(type);
return 0;
return nullptr;
#endif
}
@ -2187,7 +2195,7 @@ private:
QMetaType QMetaType::typeInfo(const int type)
{
TypeInfo typeInfo(type);
QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0);
QMetaTypeSwitcher::switcher<void>(typeInfo, type);
return (typeInfo.info.constructor || typeInfo.info.typedConstructor)
? QMetaType(static_cast<ExtensionFlag>(QMetaType::CreateEx | QMetaType::DestroyEx |
(typeInfo.info.typedConstructor ? QMetaType::ConstructEx | QMetaType::DestructEx : 0))
@ -2307,7 +2315,7 @@ void QMetaType::dtor()
void *QMetaType::createExtended(const void *copy) const
{
if (m_typeId == QMetaType::UnknownType)
return 0;
return nullptr;
if (Q_UNLIKELY(m_typedConstructor && !m_constructor))
return m_typedConstructor(m_typeId, operator new(m_size), copy);
return m_constructor(operator new(m_size), copy);
@ -2387,7 +2395,7 @@ uint QMetaType::sizeExtended() const
*/
QMetaType::TypeFlags QMetaType::flagsExtended() const
{
return 0;
return { };
}
/*!
@ -2400,7 +2408,7 @@ QMetaType::TypeFlags QMetaType::flagsExtended() const
*/
const QMetaObject *QMetaType::metaObjectExtended() const
{
return 0;
return nullptr;
}
@ -2409,7 +2417,7 @@ namespace QtPrivate
const QMetaObject *metaObjectForQWidget()
{
if (!qMetaTypeWidgetsHelper)
return 0;
return nullptr;
return qMetaObjectWidgetsHelper;
}
}

View File

@ -140,12 +140,12 @@ public:
/*saveOp*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Save), \
/*loadOp*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Load),
# define QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type) \
/*saveOp*/ 0, \
/*loadOp*/ 0,
/*saveOp*/ nullptr, \
/*loadOp*/ nullptr,
#else
# define QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type) \
/*saveOp*/ 0, \
/*loadOp*/ 0,
/*saveOp*/ nullptr, \
/*loadOp*/ nullptr,
# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type)
#endif
@ -153,7 +153,7 @@ public:
#ifndef QT_BOOTSTRAPPED
#define METAOBJECT_DELEGATE(Type) (QtPrivate::MetaObjectForType<Type>::value())
#else
#define METAOBJECT_DELEGATE(Type) 0
#define METAOBJECT_DELEGATE(Type) nullptr
#endif
#define QT_METATYPE_INTERFACE_INIT_IMPL(Type, DATASTREAM_DELEGATE) \
@ -184,11 +184,11 @@ public:
#define QT_METATYPE_INTERFACE_INIT_EMPTY() \
{ \
QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(void) \
/*constructor*/ 0, \
/*destructor*/ 0, \
/*constructor*/ nullptr, \
/*destructor*/ nullptr, \
/*size*/ 0, \
/*flags*/ 0, \
/*metaObject*/ 0 , \
/*metaObject*/ nullptr , \
/*typedConstructor*/ nullptr, \
/*typedDestructor*/ nullptr \
}

View File

@ -60,7 +60,7 @@ public:
class NotBuiltinType; // type is not a built-in type, but it may be a custom type or an unknown type
class UnknownType; // type not known to QMetaType system
template<class ReturnType, class DelegateObject>
static ReturnType switcher(DelegateObject &logic, int type, const void *data);
static ReturnType switcher(DelegateObject &logic, int type, const void *data = nullptr);
};

View File

@ -112,7 +112,7 @@ static QString windowsErrorString(int errorCode)
static QString standardLibraryErrorString(int errorCode)
{
const char *s = 0;
const char *s = nullptr;
QString ret;
switch (errorCode) {
case 0:

View File

@ -119,19 +119,19 @@ namespace { // annonymous used to hide QVariant handlers
static void construct(QVariant::Private *x, const void *copy)
{
QVariantConstructor<CoreTypesFilter> constructor(x, copy);
QMetaTypeSwitcher::switcher<void>(constructor, x->type, 0);
QMetaTypeSwitcher::switcher<void>(constructor, x->type);
}
static void clear(QVariant::Private *d)
{
QVariantDestructor<CoreTypesFilter> cleaner(d);
QMetaTypeSwitcher::switcher<void>(cleaner, d->type, 0);
QMetaTypeSwitcher::switcher<void>(cleaner, d->type);
}
static bool isNull(const QVariant::Private *d)
{
QVariantIsNull<CoreTypesFilter> isNull(d);
return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0);
return QMetaTypeSwitcher::switcher<bool>(isNull, d->type);
}
/*!
@ -143,7 +143,7 @@ static bool isNull(const QVariant::Private *d)
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
QVariantComparator<CoreTypesFilter> comparator(a, b);
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type);
}
/*!
@ -1401,7 +1401,7 @@ static void streamDebug(QDebug dbg, const QVariant &v)
{
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
QVariantDebugStream<CoreTypesFilter> stream(dbg, d);
QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
QMetaTypeSwitcher::switcher<void>(stream, d->type);
}
#endif
@ -1410,16 +1410,16 @@ const QVariant::Handler qt_kernel_variant_handler = {
clear,
isNull,
#ifndef QT_NO_DATASTREAM
0,
0,
nullptr,
nullptr,
#endif
compare,
convert,
0,
nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
0
nullptr
#endif
};
@ -1436,16 +1436,16 @@ const QVariant::Handler qt_dummy_variant_handler = {
dummyClear,
dummyIsNull,
#ifndef QT_NO_DATASTREAM
0,
0,
nullptr,
nullptr,
#endif
dummyCompare,
dummyConvert,
0,
nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
dummyStreamDebug
#else
0
nullptr
#endif
};
@ -1555,16 +1555,16 @@ const QVariant::Handler qt_custom_variant_handler = {
customClear,
customIsNull,
#ifndef QT_NO_DATASTREAM
0,
0,
nullptr,
nullptr,
#endif
customCompare,
customConvert,
0,
nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
customStreamDebug
#else
0
nullptr
#endif
};
@ -2125,7 +2125,7 @@ QVariant::QVariant(const char *val)
*/
QVariant::QVariant(Type type)
{ create(type, 0); }
{ create(type, nullptr); }
QVariant::QVariant(int typeId, const void *copy)
{ create(typeId, copy); d.is_null = false; }
@ -2667,7 +2667,7 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han
return ret;
}
handlerManager[d.type]->convert(&d, targetType, &ret, 0);
handlerManager[d.type]->convert(&d, targetType, &ret, nullptr);
return ret;
}
@ -3217,7 +3217,7 @@ bool QVariant::toBool() const
return d.data.b;
bool res = false;
handlerManager[d.type]->convert(&d, Bool, &res, 0);
handlerManager[d.type]->convert(&d, Bool, &res, nullptr);
return res;
}
@ -3735,7 +3735,7 @@ bool QVariant::convert(int targetTypeId)
if (!oldValue.canConvert(targetTypeId))
return false;
create(targetTypeId, 0);
create(targetTypeId, nullptr);
// Fail if the value is not initialized or was forced null by a previous failed convert.
if (oldValue.d.is_null && oldValue.d.type != QMetaType::Nullptr)
return false;
@ -3760,7 +3760,7 @@ bool QVariant::convert(int targetTypeId)
*/
bool QVariant::convert(const int type, void *ptr) const
{
return handlerManager[type]->convert(&d, type, ptr, 0);
return handlerManager[type]->convert(&d, type, ptr, nullptr);
}

View File

@ -277,7 +277,7 @@ QT_BEGIN_NAMESPACE
QDataStream::QDataStream()
{
dev = 0;
dev = nullptr;
owndev = false;
byteorder = BigEndian;
ver = Qt_DefaultCompiledVersion;
@ -433,7 +433,7 @@ bool QDataStream::atEnd() const
*/
QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const
{
return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
return d ? d->floatingPointPrecision : QDataStream::DoublePrecision;
}
/*!
@ -458,7 +458,7 @@ QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const
*/
void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision)
{
if (d == 0)
if (!d)
d.reset(new QDataStreamPrivate());
d->floatingPointPrecision = precision;
}
@ -639,7 +639,7 @@ void QDataStream::startTransaction()
{
CHECK_STREAM_PRECOND(Q_VOID)
if (d == 0)
if (!d)
d.reset(new QDataStreamPrivate());
if (++d->transactionDepth == 1) {
@ -1043,7 +1043,7 @@ QDataStream &QDataStream::operator>>(char *&s)
QDataStream &QDataStream::readBytes(char *&s, uint &l)
{
s = 0;
s = nullptr;
l = 0;
CHECK_STREAM_PRECOND(*this)
@ -1054,8 +1054,8 @@ QDataStream &QDataStream::readBytes(char *&s, uint &l)
const quint32 Step = 1024 * 1024;
quint32 allocated = 0;
char *prevBuf = 0;
char *curBuf = 0;
char *prevBuf = nullptr;
char *curBuf = nullptr;
do {
int blockSize = qMin(Step, len - allocated);

View File

@ -132,7 +132,7 @@ QT_BEGIN_NAMESPACE
Creates an empty array.
*/
QJsonArray::QJsonArray()
: d(0), a(0)
: d(nullptr), a(nullptr)
{
}
@ -168,8 +168,8 @@ QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array)
*/
void QJsonArray::initialize()
{
d = 0;
a = 0;
d = nullptr;
a = nullptr;
}
/*!

View File

@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
* Constructs an empty and invalid document.
*/
QJsonDocument::QJsonDocument()
: d(0)
: d(nullptr)
{
}
@ -92,7 +92,7 @@ QJsonDocument::QJsonDocument()
* Creates a QJsonDocument from \a object.
*/
QJsonDocument::QJsonDocument(const QJsonObject &object)
: d(0)
: d(nullptr)
{
setObject(object);
}
@ -101,7 +101,7 @@ QJsonDocument::QJsonDocument(const QJsonObject &object)
* Constructs a QJsonDocument from \a array.
*/
QJsonDocument::QJsonDocument(const QJsonArray &array)
: d(0)
: d(nullptr)
{
setArray(array);
}
@ -236,7 +236,7 @@ const char *QJsonDocument::rawData(int *size) const
{
if (!d) {
*size = 0;
return 0;
return nullptr;
}
*size = d->alloc;
return d->rawData;
@ -635,7 +635,7 @@ bool QJsonDocument::operator==(const QJsonDocument &other) const
*/
bool QJsonDocument::isNull() const
{
return (d == 0);
return (d == nullptr);
}
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)

View File

@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE
\sa isEmpty()
*/
QJsonObject::QJsonObject()
: d(0), o(0)
: d(nullptr), o(nullptr)
{
}
@ -149,8 +149,8 @@ QJsonObject::QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object)
void QJsonObject::initialize()
{
d = 0;
o = 0;
d = nullptr;
o = nullptr;
}
/*!

View File

@ -198,7 +198,9 @@ QString QJsonParseError::errorString() const
using namespace QJsonPrivate;
Parser::Parser(const char *json, int length)
: head(json), json(json), data(0), dataLength(0), current(0), nestingLevel(0), lastError(QJsonParseError::NoError)
: head(json), json(json), data(nullptr)
, dataLength(0), current(0), nestingLevel(0)
, lastError(QJsonParseError::NoError)
{
end = json + length;
}

View File

@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE
The default is to create a Null value.
*/
QJsonValue::QJsonValue(Type type)
: ui(0), d(0), t(type)
: ui(0), d(nullptr), t(type)
{
}
@ -120,7 +120,7 @@ QJsonValue::QJsonValue(Type type)
\internal
*/
QJsonValue::QJsonValue(QJsonPrivate::Data *data, QJsonPrivate::Base *base, const QJsonPrivate::Value &v)
: d(0)
: d(nullptr)
{
t = (Type)(uint)v.type;
switch (t) {
@ -154,7 +154,7 @@ QJsonValue::QJsonValue(QJsonPrivate::Data *data, QJsonPrivate::Base *base, const
Creates a value of type Bool, with value \a b.
*/
QJsonValue::QJsonValue(bool b)
: d(0), t(Bool)
: d(nullptr), t(Bool)
{
this->b = b;
}
@ -163,7 +163,7 @@ QJsonValue::QJsonValue(bool b)
Creates a value of type Double, with value \a n.
*/
QJsonValue::QJsonValue(double n)
: d(0), t(Double)
: d(nullptr), t(Double)
{
this->dbl = n;
}
@ -173,7 +173,7 @@ QJsonValue::QJsonValue(double n)
Creates a value of type Double, with value \a n.
*/
QJsonValue::QJsonValue(int n)
: d(0), t(Double)
: d(nullptr), t(Double)
{
this->dbl = n;
}
@ -185,7 +185,7 @@ QJsonValue::QJsonValue(int n)
If you pass in values outside this range expect a loss of precision to occur.
*/
QJsonValue::QJsonValue(qint64 n)
: d(0), t(Double)
: d(nullptr), t(Double)
{
this->dbl = double(n);
}
@ -194,7 +194,7 @@ QJsonValue::QJsonValue(qint64 n)
Creates a value of type String, with value \a s.
*/
QJsonValue::QJsonValue(const QString &s)
: d(0), t(String)
: d(nullptr), t(String)
{
stringDataFromQStringHelper(s);
}
@ -221,7 +221,7 @@ void QJsonValue::stringDataFromQStringHelper(const QString &string)
Creates a value of type String, with value \a s.
*/
QJsonValue::QJsonValue(QLatin1String s)
: d(0), t(String)
: d(nullptr), t(String)
{
// ### FIXME: Avoid creating the temp QString below
QString str(s);

View File

@ -327,7 +327,7 @@ QT_BEGIN_NAMESPACE
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
:
#if QT_CONFIG(textcodec)
readConverterSavedState(0),
readConverterSavedState(nullptr),
#endif
readConverterSavedStateOffset(0),
locale(QLocale::c())
@ -381,7 +381,7 @@ void QTextStreamPrivate::Params::reset()
padChar = QLatin1Char(' ');
fieldAlignment = QTextStream::AlignRight;
realNumberNotation = QTextStream::SmartNotation;
numberFlags = 0;
numberFlags = { };
}
/*!
@ -391,9 +391,9 @@ void QTextStreamPrivate::reset()
{
params.reset();
device = 0;
device = nullptr;
deleteDevice = false;
string = 0;
string = nullptr;
stringOffset = 0;
stringOpenMode = QIODevice::NotOpen;
@ -406,7 +406,7 @@ void QTextStreamPrivate::reset()
resetCodecConverterStateHelper(&readConverterState);
resetCodecConverterStateHelper(&writeConverterState);
delete readConverterSavedState;
readConverterSavedState = 0;
readConverterSavedState = nullptr;
writeConverterState.flags |= QTextCodec::IgnoreHeader;
autoDetectUnicode = true;
#endif
@ -1207,7 +1207,7 @@ bool QTextStream::seek(qint64 pos)
resetCodecConverterStateHelper(&d->readConverterState);
resetCodecConverterStateHelper(&d->writeConverterState);
delete d->readConverterSavedState;
d->readConverterSavedState = 0;
d->readConverterSavedState = nullptr;
d->writeConverterState.flags |= QTextCodec::IgnoreHeader;
#endif
return true;
@ -1295,7 +1295,7 @@ void QTextStream::skipWhiteSpace()
{
Q_D(QTextStream);
CHECK_VALID_STREAM(Q_VOID);
d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);
d->scan(nullptr, nullptr, 0, QTextStreamPrivate::NotSpace);
d->consumeLastToken();
}
@ -1751,7 +1751,7 @@ QString QTextStream::read(qint64 maxlen)
*/
QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong *ret)
{
scan(0, 0, 0, NotSpace);
scan(nullptr, nullptr, 0, NotSpace);
consumeLastToken();
// detect int encoding
@ -1980,7 +1980,7 @@ bool QTextStreamPrivate::getReal(double *f)
ParserState state = Init;
InputToken input = None;
scan(0, 0, 0, NotSpace);
scan(nullptr, nullptr, 0, NotSpace);
consumeLastToken();
const int BufferSize = 128;
@ -2084,7 +2084,7 @@ QTextStream &QTextStream::operator>>(QChar &c)
{
Q_D(QTextStream);
CHECK_VALID_STREAM(*this);
d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);
d->scan(nullptr, nullptr, 0, QTextStreamPrivate::NotSpace);
if (!d->getChar(&c))
setStatus(ReadPastEnd);
return *this;
@ -2245,7 +2245,7 @@ QTextStream &QTextStream::operator>>(QString &str)
CHECK_VALID_STREAM(*this);
str.clear();
d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);
d->scan(nullptr, nullptr, 0, QTextStreamPrivate::NotSpace);
d->consumeLastToken();
const QChar *ptr;
@ -2273,7 +2273,7 @@ QTextStream &QTextStream::operator>>(QByteArray &array)
CHECK_VALID_STREAM(*this);
array.clear();
d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);
d->scan(nullptr, nullptr, 0, QTextStreamPrivate::NotSpace);
d->consumeLastToken();
const QChar *ptr;
@ -2308,7 +2308,7 @@ QTextStream &QTextStream::operator>>(char *c)
Q_D(QTextStream);
*c = 0;
CHECK_VALID_STREAM(*this);
d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);
d->scan(nullptr, nullptr, 0, QTextStreamPrivate::NotSpace);
d->consumeLastToken();
const QChar *ptr;

View File

@ -58,9 +58,9 @@
// case for most bootstrapped applications.
#define Q_DECLARE_TR_FUNCTIONS(context) \
public: \
static inline QString tr(const char *sourceText, const char *comment = 0) \
static inline QString tr(const char *sourceText, const char *comment = nullptr) \
{ Q_UNUSED(comment); return QString::fromLatin1(sourceText); } \
static inline QString trUtf8(const char *sourceText, const char *comment = 0) \
static inline QString trUtf8(const char *sourceText, const char *comment = nullptr) \
{ Q_UNUSED(comment); return QString::fromLatin1(sourceText); } \
static inline QString tr(const char *sourceText, const char*, int) \
{ return QString::fromLatin1(sourceText); } \
@ -548,7 +548,7 @@ void QXmlStreamReader::clear()
if (d->device) {
if (d->deleteDevice)
delete d->device;
d->device = 0;
d->device = nullptr;
}
}
@ -792,16 +792,16 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q)
:q_ptr(q)
{
device = 0;
device = nullptr;
deleteDevice = false;
#if QT_CONFIG(textcodec)
decoder = 0;
decoder = nullptr;
#endif
stack_size = 64;
sym_stack = 0;
state_stack = 0;
sym_stack = nullptr;
state_stack = nullptr;
reallocateStack();
entityResolver = 0;
entityResolver = nullptr;
init();
#define ADD_PREDEFINED(n, v) \
do { \
@ -843,11 +843,11 @@ void QXmlStreamReaderPrivate::init()
#if QT_CONFIG(textcodec)
codec = QTextCodec::codecForMib(106); // utf8
delete decoder;
decoder = 0;
decoder = nullptr;
#endif
attributeStack.clear();
attributeStack.reserve(16);
entityParser = 0;
entityParser = nullptr;
hasCheckedStartDocument = false;
normalizeLiterals = false;
hasSeenTag = false;
@ -3024,8 +3024,8 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
:autoFormattingIndent(4, ' ')
{
q_ptr = q;
device = 0;
stringDevice = 0;
device = nullptr;
stringDevice = nullptr;
deleteDevice = false;
#if QT_CONFIG(textcodec)
codec = QTextCodec::codecForMib(106); // utf8
@ -3315,7 +3315,7 @@ void QXmlStreamWriter::setDevice(QIODevice *device)
Q_D(QXmlStreamWriter);
if (device == d->device)
return;
d->stringDevice = 0;
d->stringDevice = nullptr;
if (d->deleteDevice) {
delete d->device;
d->deleteDevice = false;

View File

@ -506,7 +506,7 @@ public:
int fastScanLiteralContent();
int fastScanSpace();
int fastScanContentCharList();
int fastScanName(int *prefix = 0);
int fastScanName(int *prefix = nullptr);
inline int fastScanNMTOKEN();

View File

@ -615,7 +615,7 @@ int QDate::weekNumber(int *yearNumber) const
Q_ASSERT(week == 53 || week == 1);
}
if (yearNumber != 0)
if (yearNumber)
*yearNumber = year;
return week;
}
@ -2265,7 +2265,7 @@ QTime QTime::fromString(const QString &string, Qt::DateFormat format)
case Qt::ISODateWithMs:
case Qt::TextDate:
default:
return fromIsoTimeString(QStringRef(&string), format, 0);
return fromIsoTimeString(QStringRef(&string), format, nullptr);
}
}
@ -2512,7 +2512,7 @@ int QDateTimeParser::startsWithLocalTimeZone(const QStringRef name)
// then null date/time will be returned, you should adjust the date first if
// you need a guaranteed result.
static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStatus *daylightStatus,
QString *abbreviation, bool *ok = 0)
QString *abbreviation, bool *ok = nullptr)
{
const qint64 msec = time->msec();
int yy, mm, dd;
@ -2601,7 +2601,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// Use the reentrant version of localtime() where available
// as is thread-safe and doesn't use a shared static data area
tm *res = 0;
tm *res = nullptr;
res = localtime_r(&secsSinceEpoch, &local);
if (res)
valid = true;
@ -2611,7 +2611,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
#else
// Returns shared static data which may be overwritten at any time
// So copy the result asap
tm *res = 0;
tm *res = nullptr;
res = localtime(&secsSinceEpoch);
if (res) {
local = *res;
@ -2674,7 +2674,7 @@ static qint64 timeToMSecs(const QDate &date, const QTime &time)
// Convert an MSecs Since Epoch into Local Time
static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTime,
QDateTimePrivate::DaylightStatus *daylightStatus = 0)
QDateTimePrivate::DaylightStatus *daylightStatus = nullptr)
{
if (msecs < 0) {
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied
@ -2714,8 +2714,8 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
// values from mktime for the adjusted local date and time.
static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
QDateTimePrivate::DaylightStatus *daylightStatus,
QDate *localDate = 0, QTime *localTime = 0,
QString *abbreviation = 0)
QDate *localDate = nullptr, QTime *localTime = nullptr,
QString *abbreviation = nullptr)
{
QDate dt;
QTime tm;
@ -3018,7 +3018,7 @@ static void setDateTime(QDateTimeData &d, const QDate &date, const QTime &time)
if (!useTime.isValid() && date.isValid())
useTime = QTime::fromMSecsSinceStartOfDay(0);
QDateTimePrivate::StatusFlags newStatus = 0;
QDateTimePrivate::StatusFlags newStatus = { };
// Set date value and status
qint64 days = 0;
@ -3096,7 +3096,7 @@ inline QDateTime::Data::Data(Qt::TimeSpec spec)
// the structure is too small, we need to detach
d = new QDateTimePrivate;
d->ref.ref();
d->m_status = mergeSpec(0, spec);
d->m_status = mergeSpec(nullptr, spec);
}
}
@ -3550,7 +3550,7 @@ QDate QDateTime::date() const
if (!status.testFlag(QDateTimePrivate::ValidDate))
return QDate();
QDate dt;
msecsToTime(getMSecs(d), &dt, 0);
msecsToTime(getMSecs(d), &dt, nullptr);
return dt;
}
@ -3566,7 +3566,7 @@ QTime QDateTime::time() const
if (!status.testFlag(QDateTimePrivate::ValidTime))
return QTime();
QTime tm;
msecsToTime(getMSecs(d), 0, &tm);
msecsToTime(getMSecs(d), nullptr, &tm);
return tm;
}
@ -3684,7 +3684,7 @@ QString QDateTime::timeZoneAbbreviation() const
case Qt::LocalTime: {
QString abbrev;
auto status = extractDaylightStatus(getStatus(d));
localMSecsToEpochMSecs(getMSecs(d), &status, 0, 0, &abbrev);
localMSecsToEpochMSecs(getMSecs(d), &status, nullptr, nullptr, &abbrev);
return abbrev;
}
}
@ -4769,14 +4769,14 @@ qint64 QDateTime::currentMSecsSinceEpoch() noexcept
// posix compliant system
// we have milliseconds
struct timeval tv;
gettimeofday(&tv, 0);
gettimeofday(&tv, nullptr);
return qint64(tv.tv_sec) * Q_INT64_C(1000) + tv.tv_usec / 1000;
}
qint64 QDateTime::currentSecsSinceEpoch() noexcept
{
struct timeval tv;
gettimeofday(&tv, 0);
gettimeofday(&tv, nullptr);
return qint64(tv.tv_sec);
}
#else

View File

@ -215,7 +215,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
headerSize += (alignment - Q_ALIGNOF(QArrayData));
if (headerSize > size_t(MaxAllocSize))
return 0;
return nullptr;
size_t allocSize = calculateBlockSize(capacity, objectSize, headerSize, options);
QArrayData *header = static_cast<QArrayData *>(::malloc(allocSize));

View File

@ -2072,7 +2072,7 @@ static inline QByteArray &qbytearray_insert(QByteArray *ba,
{
Q_ASSERT(pos >= 0);
if (pos < 0 || len <= 0 || arr == 0)
if (pos < 0 || len <= 0 || arr == nullptr)
return *ba;
int oldsize = ba->size();
@ -4775,7 +4775,7 @@ static void q_toPercentEncoding(QByteArray *ba, const char *dontEncode, const ch
QByteArray input = *ba;
int len = input.count();
const char *inputData = input.constData();
char *output = 0;
char *output = nullptr;
int length = 0;
for (int i = 0; i < len; ++i) {
@ -4815,7 +4815,7 @@ void q_toPercentEncoding(QByteArray *ba, const char *exclude, const char *includ
void q_normalizePercentEncoding(QByteArray *ba, const char *exclude)
{
q_fromPercentEncoding(ba, '%');
q_toPercentEncoding(ba, exclude, 0, '%');
q_toPercentEncoding(ba, exclude, nullptr, '%');
}
/*!

View File

@ -116,9 +116,9 @@ static inline int bm_find(const uchar *cc, int l, int index, const uchar *puc, u
Call setPattern() to give it a pattern to match.
*/
QByteArrayMatcher::QByteArrayMatcher()
: d(0)
: d(nullptr)
{
p.p = 0;
p.p = nullptr;
p.l = 0;
memset(p.q_skiptable, 0, sizeof(p.q_skiptable));
}
@ -129,7 +129,7 @@ QByteArrayMatcher::QByteArrayMatcher()
the destructor does not delete \a pattern.
*/
QByteArrayMatcher::QByteArrayMatcher(const char *pattern, int length)
: d(0)
: d(nullptr)
{
p.p = reinterpret_cast<const uchar *>(pattern);
p.l = length;
@ -141,7 +141,7 @@ QByteArrayMatcher::QByteArrayMatcher(const char *pattern, int length)
Call indexIn() to perform a search.
*/
QByteArrayMatcher::QByteArrayMatcher(const QByteArray &pattern)
: d(0), q_pattern(pattern)
: d(nullptr), q_pattern(pattern)
{
p.p = reinterpret_cast<const uchar *>(pattern.constData());
p.l = pattern.size();
@ -152,7 +152,7 @@ QByteArrayMatcher::QByteArrayMatcher(const QByteArray &pattern)
Copies the \a other byte array matcher to this byte array matcher.
*/
QByteArrayMatcher::QByteArrayMatcher(const QByteArrayMatcher &other)
: d(0)
: d(nullptr)
{
operator=(other);
}

View File

@ -1339,7 +1339,7 @@ static const unsigned short * QT_FASTCALL decompositionHelper
if (index == 0xffff) {
*length = 0;
*tag = QChar::NoDecomposition;
return 0;
return nullptr;
}
const unsigned short *decomposition = uc_decomposition_map+index;

View File

@ -471,7 +471,7 @@ static int countBits(int hint)
const int MinNumBits = 4;
const QHashData QHashData::shared_null = {
0, 0, Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, MinNumBits, 0, 0, 0, true, false, 0
nullptr, nullptr, Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, MinNumBits, 0, 0, 0, true, false, 0
};
void *QHashData::allocateNode(int nodeAlign)
@ -501,8 +501,8 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *),
if (this == &shared_null)
qt_initialize_qhash_seed(); // may throw
d = new QHashData;
d->fakeNext = 0;
d->buckets = 0;
d->fakeNext = nullptr;
d->buckets = nullptr;
d->ref.initializeOwned();
d->size = size;
d->nodeSize = nodeSize;

View File

@ -75,7 +75,7 @@ template class Q_CORE_EXPORT QVector<QPoint>;
the number of elements in the list.
*/
const QListData::Data QListData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, { 0 } };
const QListData::Data QListData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, { nullptr } };
/*!
* Detaches the QListData by allocating new memory for a list which will be bigger

View File

@ -301,9 +301,9 @@ QByteArray QLocaleId::name(char separator) const
const unsigned char *lang = language_code_list + 3 * language_id;
const unsigned char *script =
(script_id != QLocale::AnyScript ? script_code_list + 4 * script_id : 0);
(script_id != QLocale::AnyScript ? script_code_list + 4 * script_id : nullptr);
const unsigned char *country =
(country_id != QLocale::AnyCountry ? country_code_list + 3 * country_id : 0);
(country_id != QLocale::AnyCountry ? country_code_list + 3 * country_id : nullptr);
char len = (lang[2] != 0 ? 3 : 2) + (script ? 4+1 : 0) + (country ? (country[2] != 0 ? 3 : 2)+1 : 0);
QByteArray name(len, Qt::Uninitialized);
char *uc = name.data();
@ -373,7 +373,7 @@ static const QLocaleData *findLocaleDataById(const QLocaleId &localeId)
} while (data->m_language_id && data->m_language_id == localeId.language_id);
}
return 0;
return nullptr;
}
const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country)
@ -604,7 +604,7 @@ int qt_repeatCount(QStringView s)
return int(j);
}
static const QLocaleData *default_data = 0;
static const QLocaleData *default_data = nullptr;
static QLocale::NumberOptions default_number_options = QLocale::DefaultNumberOptions;
static const QLocaleData *const c_data = locale_data;

View File

@ -250,14 +250,14 @@ public:
if (qIsInf(d))
return float(d);
if (std::fabs(d) > std::numeric_limits<float>::max()) {
if (ok != nullptr)
if (ok)
*ok = false;
const float huge = std::numeric_limits<float>::infinity();
return d < 0 ? -huge : huge;
}
if (d != 0 && float(d) == 0) {
// Values that underflow double already failed. Match them:
if (ok != 0)
if (ok)
*ok = false;
return 0;
}

View File

@ -398,7 +398,7 @@ qstrtoull(const char * nptr, const char **endptr, int base, bool *ok)
*ok = true;
errno = 0;
char *endptr2 = 0;
char *endptr2 = nullptr;
unsigned long long result = qt_strtoull(nptr, &endptr2, base);
if (endptr)
*endptr = endptr2;
@ -415,7 +415,7 @@ qstrtoll(const char * nptr, const char **endptr, int base, bool *ok)
{
*ok = true;
errno = 0;
char *endptr2 = 0;
char *endptr2 = nullptr;
long long result = qt_strtoll(nptr, &endptr2, base);
if (endptr)
*endptr = endptr2;

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, 0, 0 }, 0 };
const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, nullptr, nullptr }, nullptr };
const QMapNodeBase *QMapNodeBase::nextNode() const
{
@ -92,7 +92,7 @@ void QMapDataBase::rotateLeft(QMapNodeBase *x)
QMapNodeBase *&root = header.left;
QMapNodeBase *y = x->right;
x->right = y->left;
if (y->left != 0)
if (y->left != nullptr)
y->left->setParent(x);
y->setParent(x->parent());
if (x == root)
@ -111,7 +111,7 @@ void QMapDataBase::rotateRight(QMapNodeBase *x)
QMapNodeBase *&root = header.left;
QMapNodeBase *y = x->left;
x->left = y->right;
if (y->right != 0)
if (y->right != nullptr)
y->right->setParent(x);
y->setParent(x->parent());
if (x == root)
@ -173,7 +173,7 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
QMapNodeBase *y = z;
QMapNodeBase *x;
QMapNodeBase *x_parent;
if (y->left == 0) {
if (y->left == nullptr) {
x = y->right;
if (y == mostLeftNode) {
if (x)
@ -182,11 +182,11 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
mostLeftNode = y->parent();
}
} else {
if (y->right == 0) {
if (y->right == nullptr) {
x = y->left;
} else {
y = y->right;
while (y->left != 0)
while (y->left != nullptr)
y = y->left;
x = y->right;
}
@ -228,7 +228,7 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
z->parent()->right = x;
}
if (y->color() != QMapNodeBase::Red) {
while (x != root && (x == 0 || x->color() == QMapNodeBase::Black)) {
while (x != root && (x == nullptr || x->color() == QMapNodeBase::Black)) {
if (x == x_parent->left) {
QMapNodeBase *w = x_parent->right;
if (w->color() == QMapNodeBase::Red) {
@ -237,13 +237,13 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
rotateLeft(x_parent);
w = x_parent->right;
}
if ((w->left == 0 || w->left->color() == QMapNodeBase::Black) &&
(w->right == 0 || w->right->color() == QMapNodeBase::Black)) {
if ((w->left == nullptr || w->left->color() == QMapNodeBase::Black) &&
(w->right == nullptr || w->right->color() == QMapNodeBase::Black)) {
w->setColor(QMapNodeBase::Red);
x = x_parent;
x_parent = x_parent->parent();
} else {
if (w->right == 0 || w->right->color() == QMapNodeBase::Black) {
if (w->right == nullptr || w->right->color() == QMapNodeBase::Black) {
if (w->left)
w->left->setColor(QMapNodeBase::Black);
w->setColor(QMapNodeBase::Red);
@ -265,13 +265,13 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
rotateRight(x_parent);
w = x_parent->left;
}
if ((w->right == 0 || w->right->color() == QMapNodeBase::Black) &&
(w->left == 0 || w->left->color() == QMapNodeBase::Black)) {
if ((w->right == nullptr || w->right->color() == QMapNodeBase::Black) &&
(w->left == nullptr|| w->left->color() == QMapNodeBase::Black)) {
w->setColor(QMapNodeBase::Red);
x = x_parent;
x_parent = x_parent->parent();
} else {
if (w->left == 0 || w->left->color() == QMapNodeBase::Black) {
if (w->left == nullptr || w->left->color() == QMapNodeBase::Black) {
if (w->right)
w->right->setColor(QMapNodeBase::Black);
w->setColor(QMapNodeBase::Red);
@ -363,8 +363,8 @@ QMapDataBase *QMapDataBase::createData()
d->size = 0;
d->header.p = 0;
d->header.left = 0;
d->header.right = 0;
d->header.left = nullptr;
d->header.right = nullptr;
d->mostLeftNode = &(d->header);
return d;

View File

@ -937,10 +937,10 @@ struct QRegExpMatchState
const QRegExpEngine *eng;
inline QRegExpMatchState() : bigArray(0), captured(0) {}
inline QRegExpMatchState() : bigArray(nullptr), captured(nullptr) {}
inline ~QRegExpMatchState() { free(bigArray); }
void drain() { free(bigArray); bigArray = 0; captured = 0; } // to save memory
void drain() { free(bigArray); bigArray = nullptr; captured = nullptr; } // to save memory
void prepareForMatch(QRegExpEngine *eng);
void match(const QChar *str, int len, int pos, bool minimal,
bool oneTest, int caretIndex);
@ -1428,7 +1428,7 @@ void QRegExpMatchState::match(const QChar *str0, int len0, int pos0,
#endif
{
in = str0;
if (in == 0)
if (in == nullptr)
in = &char_null;
pos = pos0;
caretPos = caretIndex;
@ -2910,7 +2910,7 @@ int QRegExpEngine::getEscape()
#ifndef QT_NO_REGEXP_ESCAPE
if ((prevCh & ~0xff) == 0) {
const char *p = strchr(tab, prevCh);
if (p != 0)
if (p != nullptr)
return Tok_Char | backTab[p - tab];
}
#endif
@ -3530,7 +3530,7 @@ int QRegExpEngine::parse(const QChar *pattern, int len)
#endif
box.cat(middleBox);
box.cat(rightBox);
yyCharClass.reset(0);
yyCharClass.reset();
#ifndef QT_NO_REGEXP_CAPTURE
for (int i = 0; i < nf; ++i) {
@ -3608,7 +3608,7 @@ int QRegExpEngine::parse(const QChar *pattern, int len)
void QRegExpEngine::parseAtom(Box *box)
{
#ifndef QT_NO_REGEXP_LOOKAHEAD
QRegExpEngine *eng = 0;
QRegExpEngine *eng = nullptr;
bool neg;
int len;
#endif
@ -3805,9 +3805,9 @@ struct QRegExpPrivate
QRegExpMatchState matchState;
inline QRegExpPrivate()
: eng(0), engineKey(QString(), QRegExp::RegExp, Qt::CaseSensitive), minimal(false) { }
: eng(nullptr), engineKey(QString(), QRegExp::RegExp, Qt::CaseSensitive), minimal(false) { }
inline QRegExpPrivate(const QRegExpEngineKey &key)
: eng(0), engineKey(key), minimal(false) {}
: eng(nullptr), engineKey(key), minimal(false) {}
};
#if !defined(QT_NO_REGEXP_OPTIM)
@ -3886,9 +3886,9 @@ static void prepareEngineForMatch(QRegExpPrivate *priv, const QString &str)
static void invalidateEngine(QRegExpPrivate *priv)
{
if (priv->eng != 0) {
if (priv->eng) {
derefEngine(priv->eng, priv->engineKey);
priv->eng = 0;
priv->eng = nullptr;
priv->matchState.drain();
}
}

View File

@ -105,7 +105,7 @@ const char *QRingBuffer::readPointerAtPosition(qint64 pos, qint64 &length) const
}
length = 0;
return 0;
return nullptr;
}
void QRingBuffer::free(qint64 bytes)

View File

@ -3044,7 +3044,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
{
// Copy after if it lies inside our own d->data() area (which we could
// possibly invalidate via a realloc or modify by replacement).
QChar *afterBuffer = 0;
QChar *afterBuffer = nullptr;
if (pointsIntoRange(after, d->data(), d->size)) // Use copy in place of vulnerable original:
after = afterBuffer = textCopy(after, alen);
@ -3129,7 +3129,7 @@ QString &QString::replace(const QChar *before, int blen,
return *this;
QStringMatcher matcher(before, blen, cs);
QChar *beforeBuffer = 0, *afterBuffer = 0;
QChar *beforeBuffer = nullptr, *afterBuffer = nullptr;
int index = 0;
while (1) {
@ -5591,7 +5591,7 @@ QString QString::fromUtf16(const ushort *unicode, int size)
while (unicode[size] != 0)
++size;
}
return QUtf16::convertToUnicode((const char *)unicode, size*2, 0);
return QUtf16::convertToUnicode((const char *)unicode, size*2, nullptr);
}
/*!
@ -5645,7 +5645,7 @@ QString QString::fromUcs4(const uint *unicode, int size)
while (unicode[size] != 0)
++size;
}
return QUtf32::convertToUnicode((const char *)unicode, size*4, 0);
return QUtf32::convertToUnicode((const char *)unicode, size*4, nullptr);
}
@ -8060,7 +8060,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
version = QChar::currentUnicodeVersion();
} else if (int(version) <= NormalizationCorrectionsVersionMax) {
const QString &s = *data;
QChar *d = 0;
QChar *d = nullptr;
for (int i = 0; i < NumNormalizationCorrections; ++i) {
const NormalizationCorrection &n = uc_normalization_corrections[i];
if (n.version > version) {

View File

@ -149,7 +149,7 @@ static inline qsizetype bm_find(const ushort *uc, qsizetype l, qsizetype index,
Call setPattern() to give it a pattern to match.
*/
QStringMatcher::QStringMatcher()
: d_ptr(0), q_cs(Qt::CaseSensitive)
: d_ptr(nullptr), q_cs(Qt::CaseSensitive)
{
memset(q_data, 0, sizeof(q_data));
}
@ -161,7 +161,7 @@ QStringMatcher::QStringMatcher()
Call indexIn() to perform a search.
*/
QStringMatcher::QStringMatcher(const QString &pattern, Qt::CaseSensitivity cs)
: d_ptr(0), q_pattern(pattern), q_cs(cs)
: d_ptr(nullptr), q_pattern(pattern), q_cs(cs)
{
p.uc = pattern.unicode();
p.len = pattern.size();
@ -200,7 +200,7 @@ QStringMatcher::QStringMatcher(QStringView str, Qt::CaseSensitivity cs)
Copies the \a other string matcher to this string matcher.
*/
QStringMatcher::QStringMatcher(const QStringMatcher &other)
: d_ptr(0)
: d_ptr(nullptr)
{
operator=(other);
}

View File

@ -136,7 +136,7 @@ public:
class QDomNodePrivate
{
public:
QDomNodePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0);
QDomNodePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = nullptr);
QDomNodePrivate(QDomNodePrivate* n, bool deep);
virtual ~QDomNodePrivate();
@ -159,11 +159,11 @@ public:
virtual void normalize();
virtual void clear();
inline QDomNodePrivate* parent() const { return hasParent ? ownerNode : 0; }
inline QDomNodePrivate* parent() const { return hasParent ? ownerNode : nullptr; }
inline void setParent(QDomNodePrivate *p) { ownerNode = p; hasParent = true; }
void setNoParent() {
ownerNode = hasParent ? (QDomNodePrivate*)ownerDocument() : 0;
ownerNode = hasParent ? (QDomNodePrivate*)ownerDocument() : nullptr;
hasParent = false;
}
@ -289,7 +289,7 @@ public:
class QDomDocumentTypePrivate : public QDomNodePrivate
{
public:
QDomDocumentTypePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0);
QDomDocumentTypePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = nullptr);
QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, bool deep);
~QDomDocumentTypePrivate();
void init();
@ -317,7 +317,7 @@ public:
class QDomDocumentFragmentPrivate : public QDomNodePrivate
{
public:
QDomDocumentFragmentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0);
QDomDocumentFragmentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = nullptr);
QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
@ -907,7 +907,7 @@ QDomImplementationPrivate* QDomImplementationPrivate::clone()
*/
QDomImplementation::QDomImplementation()
{
impl = 0;
impl = nullptr;
}
/*!
@ -1036,7 +1036,7 @@ QDomDocumentType QDomImplementation::createDocumentType(const QString& qName, co
if (!ok)
return QDomDocumentType();
QDomDocumentTypePrivate *dt = new QDomDocumentTypePrivate(0);
QDomDocumentTypePrivate *dt = new QDomDocumentTypePrivate(nullptr);
dt->name = fixedName;
if (systemId.isNull()) {
dt->publicId.clear();
@ -1070,7 +1070,7 @@ QDomDocument QDomImplementation::createDocument(const QString& nsURI, const QStr
*/
bool QDomImplementation::isNull()
{
return (impl == 0);
return (impl == nullptr);
}
/*!
@ -1244,14 +1244,14 @@ void QDomNodeListPrivate::createList()
QDomNodePrivate* QDomNodeListPrivate::item(int index)
{
if (!node_impl)
return 0;
return nullptr;
const QDomDocumentPrivate *const doc = node_impl->ownerDocument();
if (!doc || timestamp != doc->nodeListTime)
createList();
if (index >= list.size())
return 0;
return nullptr;
return list.at(index);
}
@ -1305,13 +1305,13 @@ int QDomNodeListPrivate::length() const
Creates an empty node list.
*/
QDomNodeList::QDomNodeList()
: impl(nullptr)
{
impl = 0;
}
QDomNodeList::QDomNodeList(QDomNodeListPrivate* p)
: impl(p)
{
impl = p;
}
/*!
@ -1443,10 +1443,10 @@ QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par)
setParent(par);
else
setOwnerDocument(doc);
prev = 0;
next = 0;
first = 0;
last = 0;
prev = nullptr;
next = nullptr;
first = nullptr;
last = nullptr;
createdWithDom1Interface = true;
lineNumber = -1;
columnNumber = -1;
@ -1455,10 +1455,10 @@ QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par)
QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep) : ref(1)
{
setOwnerDocument(n->ownerDocument());
prev = 0;
next = 0;
first = 0;
last = 0;
prev = nullptr;
next = nullptr;
first = nullptr;
last = nullptr;
name = n->name;
value = n->value;
@ -1488,8 +1488,8 @@ QDomNodePrivate::~QDomNodePrivate()
p->setNoParent();
p = n;
}
first = 0;
last = 0;
first = nullptr;
last = nullptr;
}
void QDomNodePrivate::clear()
@ -1503,8 +1503,8 @@ void QDomNodePrivate::clear()
delete p;
p = n;
}
first = 0;
last = 0;
first = nullptr;
last = nullptr;
}
QDomNodePrivate* QDomNodePrivate::namedItem(const QString &n)
@ -1515,7 +1515,7 @@ QDomNodePrivate* QDomNodePrivate::namedItem(const QString &n)
return p;
p = p->next;
}
return 0;
return nullptr;
}
@ -1523,15 +1523,15 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo
{
// Error check
if (!newChild)
return 0;
return nullptr;
// Error check
if (newChild == refChild)
return 0;
return nullptr;
// Error check
if (refChild && refChild->parent() != this)
return 0;
return nullptr;
// "mark lists as dirty"
QDomDocumentPrivate *const doc = ownerDocument();
@ -1542,7 +1542,7 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo
// all elements of the fragment instead of the fragment itself.
if (newChild->isDocumentFragment()) {
// Fragment is empty ?
if (newChild->first == 0)
if (newChild->first == nullptr)
return newChild;
// New parent
@ -1553,7 +1553,7 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo
}
// Insert at the beginning ?
if (!refChild || refChild->prev == 0) {
if (!refChild || refChild->prev == nullptr) {
if (first)
first->prev = newChild->last;
newChild->last->next = first;
@ -1572,8 +1572,8 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo
// does not decrease the reference.
// Remove the nodes from the fragment
newChild->first = 0;
newChild->last = 0;
newChild->first = nullptr;
newChild->last = nullptr;
return newChild;
}
@ -1596,7 +1596,7 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo
return newChild;
}
if (refChild->prev == 0) {
if (refChild->prev == nullptr) {
if (first)
first->prev = newChild;
newChild->next = first;
@ -1618,15 +1618,15 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
{
// Error check
if (!newChild)
return 0;
return nullptr;
// Error check
if (newChild == refChild)
return 0;
return nullptr;
// Error check
if (refChild && refChild->parent() != this)
return 0;
return nullptr;
// "mark lists as dirty"
QDomDocumentPrivate *const doc = ownerDocument();
@ -1637,7 +1637,7 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
// all elements of the fragment instead of the fragment itself.
if (newChild->isDocumentFragment()) {
// Fragment is empty ?
if (newChild->first == 0)
if (newChild->first == nullptr)
return newChild;
// New parent
@ -1648,7 +1648,7 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
}
// Insert at the end
if (!refChild || refChild->next == 0) {
if (!refChild || refChild->next == nullptr) {
if (last)
last->next = newChild->first;
newChild->first->prev = last;
@ -1666,8 +1666,8 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
// does not decrease the reference.
// Remove the nodes from the fragment
newChild->first = 0;
newChild->last = 0;
newChild->first = nullptr;
newChild->last = nullptr;
return newChild;
}
@ -1692,7 +1692,7 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
return newChild;
}
if (refChild->next == 0) {
if (refChild->next == nullptr) {
if (last)
last->next = newChild;
newChild->prev = last;
@ -1713,11 +1713,11 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod
QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild)
{
if (!newChild || !oldChild)
return 0;
return nullptr;
if (oldChild->parent() != this)
return 0;
return nullptr;
if (newChild == oldChild)
return 0;
return nullptr;
// mark lists as dirty
QDomDocumentPrivate *const doc = ownerDocument();
@ -1728,7 +1728,7 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo
// all elements of the fragment instead of the fragment itself.
if (newChild->isDocumentFragment()) {
// Fragment is empty ?
if (newChild->first == 0)
if (newChild->first == nullptr)
return newChild;
// New parent
@ -1753,15 +1753,15 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo
last = newChild->last;
oldChild->setNoParent();
oldChild->next = 0;
oldChild->prev = 0;
oldChild->next = nullptr;
oldChild->prev = nullptr;
// No need to increase the reference since QDomDocumentFragment
// does not decrease the reference.
// Remove the nodes from the fragment
newChild->first = 0;
newChild->last = 0;
newChild->first = nullptr;
newChild->last = nullptr;
// We are no longer interested in the old node
if (oldChild)
@ -1794,8 +1794,8 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo
last = newChild;
oldChild->setNoParent();
oldChild->next = 0;
oldChild->prev = 0;
oldChild->next = nullptr;
oldChild->prev = nullptr;
// We are no longer interested in the old node
if (oldChild)
@ -1808,7 +1808,7 @@ QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild)
{
// Error check
if (oldChild->parent() != this)
return 0;
return nullptr;
// "mark lists as dirty"
QDomDocumentPrivate *const doc = ownerDocument();
@ -1817,8 +1817,8 @@ QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild)
// Perhaps oldChild was just created with "createElement" or that. In this case
// its parent is QDomDocument but it is not part of the documents child list.
if (oldChild->next == 0 && oldChild->prev == 0 && first != oldChild)
return 0;
if (oldChild->next == nullptr && oldChild->prev == nullptr && first != oldChild)
return nullptr;
if (oldChild->next)
oldChild->next->prev = oldChild->prev;
@ -1831,8 +1831,8 @@ QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild)
first = oldChild->next;
oldChild->setNoParent();
oldChild->next = 0;
oldChild->prev = 0;
oldChild->next = nullptr;
oldChild->prev = nullptr;
// We are no longer interested in the old node
oldChild->ref.deref();
@ -1843,7 +1843,7 @@ QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild)
QDomNodePrivate* QDomNodePrivate::appendChild(QDomNodePrivate* newChild)
{
// No reference manipulation needed. Done in insertAfter.
return insertAfter(newChild, 0);
return insertAfter(newChild, nullptr);
}
QDomDocumentPrivate* QDomNodePrivate::ownerDocument()
@ -1869,7 +1869,7 @@ QDomNodePrivate* QDomNodePrivate::cloneNode(bool deep)
static void qNormalizeNode(QDomNodePrivate* n)
{
QDomNodePrivate* p = n->first;
QDomTextPrivate* t = 0;
QDomTextPrivate* t = nullptr;
while (p) {
if (p->isText()) {
@ -1884,7 +1884,7 @@ static void qNormalizeNode(QDomNodePrivate* n)
}
} else {
p = p->next;
t = 0;
t = nullptr;
}
}
}
@ -2009,8 +2009,8 @@ void QDomNodePrivate::setLocation(int lineNumber, int columnNumber)
Constructs a \l{isNull()}{null} node.
*/
QDomNode::QDomNode()
: impl(nullptr)
{
impl = 0;
}
/*!
@ -2619,7 +2619,7 @@ bool QDomNode::hasChildNodes() const
{
if (!impl)
return false;
return IMPL->first != 0;
return IMPL->first != nullptr;
}
/*!
@ -2628,7 +2628,7 @@ bool QDomNode::hasChildNodes() const
*/
bool QDomNode::isNull() const
{
return (impl == 0);
return (impl == nullptr);
}
/*!
@ -2641,7 +2641,7 @@ void QDomNode::clear()
{
if (impl && !impl->ref.deref())
delete impl;
impl = 0;
impl = nullptr;
}
/*!
@ -3094,13 +3094,13 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, cons
return n;
}
}
return 0;
return nullptr;
}
QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg)
{
if (readonly || !arg)
return 0;
return nullptr;
if (appendToParent)
return parent->appendChild(arg);
@ -3115,7 +3115,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg)
QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg)
{
if (readonly || !arg)
return 0;
return nullptr;
if (appendToParent)
return parent->appendChild(arg);
@ -3136,11 +3136,11 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg)
QDomNodePrivate* QDomNamedNodeMapPrivate::removeNamedItem(const QString& name)
{
if (readonly)
return 0;
return nullptr;
QDomNodePrivate* p = namedItem(name);
if (p == 0)
return 0;
if (p == nullptr)
return nullptr;
if (appendToParent)
return parent->removeChild(p);
@ -3153,7 +3153,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::removeNamedItem(const QString& name)
QDomNodePrivate* QDomNamedNodeMapPrivate::item(int index) const
{
if (index >= length() || index < 0)
return 0;
return nullptr;
return *(map.constBegin() + index);
}
@ -3164,12 +3164,12 @@ int QDomNamedNodeMapPrivate::length() const
bool QDomNamedNodeMapPrivate::contains(const QString& name) const
{
return map.value(name) != 0;
return map.contains(name);
}
bool QDomNamedNodeMapPrivate::containsNS(const QString& nsURI, const QString & localName) const
{
return namedItemNS(nsURI, localName) != 0;
return namedItemNS(nsURI, localName) != nullptr;
}
/**************************************************************
@ -3222,8 +3222,8 @@ bool QDomNamedNodeMapPrivate::containsNS(const QString& nsURI, const QString & l
Constructs an empty named node map.
*/
QDomNamedNodeMap::QDomNamedNodeMap()
: impl(nullptr)
{
impl = 0;
}
/*!
@ -3570,7 +3570,7 @@ QDomNodePrivate* QDomDocumentTypePrivate::removeChild(QDomNodePrivate* oldChild)
QDomNodePrivate* QDomDocumentTypePrivate::appendChild(QDomNodePrivate* newChild)
{
return insertAfter(newChild, 0);
return insertAfter(newChild, nullptr);
}
static QString quotedValue(const QString &data)
@ -4115,7 +4115,7 @@ QDomAttrPrivate::QDomAttrPrivate(QDomAttrPrivate* n, bool deep)
void QDomAttrPrivate::setNodeValue(const QString& v)
{
value = v;
QDomTextPrivate *t = new QDomTextPrivate(0, this, v);
QDomTextPrivate *t = new QDomTextPrivate(nullptr, this, v);
// keep the refcount balanced: appendChild() does a ref anyway.
t->ref.deref();
if (first) {
@ -4517,7 +4517,7 @@ QDomAttrPrivate* QDomElementPrivate::setAttributeNode(QDomAttrPrivate* newAttr)
QDomAttrPrivate* QDomElementPrivate::setAttributeNodeNS(QDomAttrPrivate* newAttr)
{
QDomNodePrivate* n = 0;
QDomNodePrivate* n = nullptr;
if (!newAttr->prefix.isNull())
n = m_attr->namedItemNS(newAttr->namespaceURI, newAttr->name);
@ -5184,10 +5184,10 @@ QDomTextPrivate* QDomTextPrivate::splitText(int offset)
{
if (!parent()) {
qWarning("QDomText::splitText The node has no parent. So I cannot split");
return 0;
return nullptr;
}
QDomTextPrivate* t = new QDomTextPrivate(ownerDocument(), 0, value.mid(offset));
QDomTextPrivate* t = new QDomTextPrivate(ownerDocument(), nullptr, value.mid(offset));
value.truncate(offset);
parent()->insertAfter(t, this);
@ -6144,7 +6144,7 @@ void QDomProcessingInstruction::setData(const QString& d)
**************************************************************/
QDomDocumentPrivate::QDomDocumentPrivate()
: QDomNodePrivate(0),
: QDomNodePrivate(nullptr),
impl(new QDomImplementationPrivate),
nodeListTime(1)
{
@ -6155,7 +6155,7 @@ QDomDocumentPrivate::QDomDocumentPrivate()
}
QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname)
: QDomNodePrivate(0),
: QDomNodePrivate(nullptr),
impl(new QDomImplementationPrivate),
nodeListTime(1)
{
@ -6167,11 +6167,11 @@ QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname)
}
QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt)
: QDomNodePrivate(0),
: QDomNodePrivate(nullptr),
impl(new QDomImplementationPrivate),
nodeListTime(1)
{
if (dt != 0) {
if (dt != nullptr) {
type = dt;
} else {
type = new QDomDocumentTypePrivate(this, this);
@ -6267,9 +6267,9 @@ QDomElementPrivate* QDomDocumentPrivate::createElement(const QString &tagName)
bool ok;
QString fixedName = fixedXmlName(tagName, &ok);
if (!ok)
return 0;
return nullptr;
QDomElementPrivate *e = new QDomElementPrivate(this, 0, fixedName);
QDomElementPrivate *e = new QDomElementPrivate(this, nullptr, fixedName);
e->ref.deref();
return e;
}
@ -6279,16 +6279,16 @@ QDomElementPrivate* QDomDocumentPrivate::createElementNS(const QString &nsURI, c
bool ok;
QString fixedName = fixedXmlName(qName, &ok, true);
if (!ok)
return 0;
return nullptr;
QDomElementPrivate *e = new QDomElementPrivate(this, 0, nsURI, fixedName);
QDomElementPrivate *e = new QDomElementPrivate(this, nullptr, nsURI, fixedName);
e->ref.deref();
return e;
}
QDomDocumentFragmentPrivate* QDomDocumentPrivate::createDocumentFragment()
{
QDomDocumentFragmentPrivate *f = new QDomDocumentFragmentPrivate(this, (QDomNodePrivate*)0);
QDomDocumentFragmentPrivate *f = new QDomDocumentFragmentPrivate(this, (QDomNodePrivate*)nullptr);
f->ref.deref();
return f;
}
@ -6298,9 +6298,9 @@ QDomTextPrivate* QDomDocumentPrivate::createTextNode(const QString &data)
bool ok;
QString fixedData = fixedCharData(data, &ok);
if (!ok)
return 0;
return nullptr;
QDomTextPrivate *t = new QDomTextPrivate(this, 0, fixedData);
QDomTextPrivate *t = new QDomTextPrivate(this, nullptr, fixedData);
t->ref.deref();
return t;
}
@ -6310,9 +6310,9 @@ QDomCommentPrivate* QDomDocumentPrivate::createComment(const QString &data)
bool ok;
QString fixedData = fixedComment(data, &ok);
if (!ok)
return 0;
return nullptr;
QDomCommentPrivate *c = new QDomCommentPrivate(this, 0, fixedData);
QDomCommentPrivate *c = new QDomCommentPrivate(this, nullptr, fixedData);
c->ref.deref();
return c;
}
@ -6322,9 +6322,9 @@ QDomCDATASectionPrivate* QDomDocumentPrivate::createCDATASection(const QString &
bool ok;
QString fixedData = fixedCDataSection(data, &ok);
if (!ok)
return 0;
return nullptr;
QDomCDATASectionPrivate *c = new QDomCDATASectionPrivate(this, 0, fixedData);
QDomCDATASectionPrivate *c = new QDomCDATASectionPrivate(this, nullptr, fixedData);
c->ref.deref();
return c;
}
@ -6335,13 +6335,13 @@ QDomProcessingInstructionPrivate* QDomDocumentPrivate::createProcessingInstructi
bool ok;
QString fixedData = fixedPIData(data, &ok);
if (!ok)
return 0;
return nullptr;
// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
QString fixedTarget = fixedXmlName(target, &ok);
if (!ok)
return 0;
return nullptr;
QDomProcessingInstructionPrivate *p = new QDomProcessingInstructionPrivate(this, 0, fixedTarget, fixedData);
QDomProcessingInstructionPrivate *p = new QDomProcessingInstructionPrivate(this, nullptr, fixedTarget, fixedData);
p->ref.deref();
return p;
}
@ -6350,9 +6350,9 @@ QDomAttrPrivate* QDomDocumentPrivate::createAttribute(const QString &aname)
bool ok;
QString fixedName = fixedXmlName(aname, &ok);
if (!ok)
return 0;
return nullptr;
QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, fixedName);
QDomAttrPrivate *a = new QDomAttrPrivate(this, nullptr, fixedName);
a->ref.deref();
return a;
}
@ -6362,9 +6362,9 @@ QDomAttrPrivate* QDomDocumentPrivate::createAttributeNS(const QString &nsURI, co
bool ok;
QString fixedName = fixedXmlName(qName, &ok, true);
if (!ok)
return 0;
return nullptr;
QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, nsURI, fixedName);
QDomAttrPrivate *a = new QDomAttrPrivate(this, nullptr, nsURI, fixedName);
a->ref.deref();
return a;
}
@ -6374,16 +6374,16 @@ QDomEntityReferencePrivate* QDomDocumentPrivate::createEntityReference(const QSt
bool ok;
QString fixedName = fixedXmlName(aname, &ok);
if (!ok)
return 0;
return nullptr;
QDomEntityReferencePrivate *e = new QDomEntityReferencePrivate(this, 0, fixedName);
QDomEntityReferencePrivate *e = new QDomEntityReferencePrivate(this, nullptr, fixedName);
e->ref.deref();
return e;
}
QDomNodePrivate* QDomDocumentPrivate::importNode(QDomNodePrivate *importedNode, bool deep)
{
QDomNodePrivate *node = 0;
QDomNodePrivate *node = nullptr;
switch (importedNode->nodeType()) {
case QDomNode::AttributeNode:
node = new QDomAttrPrivate((QDomAttrPrivate*)importedNode, true);
@ -6435,7 +6435,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
#if QT_CONFIG(textcodec) && QT_CONFIG(regularexpression)
const QDomNodePrivate* n = first;
QTextCodec *codec = 0;
QTextCodec *codec = nullptr;
if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
// we have an XML declaration
@ -6593,7 +6593,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
*/
QDomDocument::QDomDocument()
{
impl = 0;
impl = nullptr;
}
/*!
@ -6822,7 +6822,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QStri
{
if (!impl)
impl = new QDomDocumentPrivate();
return IMPL->setContent(source, reader, 0, errorMsg, errorLine, errorColumn);
return IMPL->setContent(source, reader, nullptr, errorMsg, errorLine, errorColumn);
}
/*!
@ -7369,7 +7369,7 @@ QDomComment QDomNode::toComment() const
QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, QXmlSimpleReader* areader, bool namespaceProcessing)
: errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false),
nsProcessing(namespaceProcessing), locator(0), reader(areader)
nsProcessing(namespaceProcessing), locator(nullptr), reader(areader)
{
}
@ -7443,7 +7443,7 @@ bool QDomHandler::characters(const QString& ch)
if (cdata) {
n.reset(doc->createCDATASection(ch));
} else if (!entityName.isEmpty()) {
QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName,
QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, nullptr, entityName,
QString(), QString(), QString()));
e->value = ch;
e->ref.deref();
@ -7528,7 +7528,7 @@ bool QDomHandler::comment(const QString& ch)
bool QDomHandler::unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString &notationName)
{
QDomEntityPrivate* e = new QDomEntityPrivate(doc, 0, name,
QDomEntityPrivate* e = new QDomEntityPrivate(doc, nullptr, name,
publicId, systemId, notationName);
// keep the refcount balanced: appendChild() does a ref anyway.
e->ref.deref();
@ -7543,7 +7543,7 @@ bool QDomHandler::externalEntityDecl(const QString &name, const QString &publicI
bool QDomHandler::notationDecl(const QString & name, const QString & publicId, const QString & systemId)
{
QDomNotationPrivate* n = new QDomNotationPrivate(doc, 0, name, publicId, systemId);
QDomNotationPrivate* n = new QDomNotationPrivate(doc, nullptr, name, publicId, systemId);
// keep the refcount balanced: appendChild() does a ref anyway.
n->ref.deref();
doc->doctype()->appendChild(n);

View File

@ -1079,12 +1079,12 @@ void QXmlInputSource::init()
d = new QXmlInputSourcePrivate;
QT_TRY {
d->inputDevice = 0;
d->inputStream = 0;
d->inputDevice = nullptr;
d->inputStream = nullptr;
setData(QString());
#if QT_CONFIG(textcodec)
d->encMapper = 0;
d->encMapper = nullptr;
#endif
d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
@ -1357,13 +1357,13 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
return QString();
if (beginning) {
delete d->encMapper;
d->encMapper = 0;
d->encMapper = nullptr;
}
int mib = 106; // UTF-8
// This is the initial UTF codec we will read the encoding declaration with
if (d->encMapper == 0) {
if (d->encMapper == nullptr) {
d->encodingDeclBytes.clear();
d->encodingDeclChars.clear();
d->lookingForEncodingDecl = true;
@ -2377,7 +2377,7 @@ bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&,
bool QXmlDefaultHandler::resolveEntity(const QString&, const QString&,
QXmlInputSource*& ret)
{
ret = 0;
ret = nullptr;
return true;
}
@ -2520,15 +2520,15 @@ inline void QXmlSimpleReaderPrivate::refClear()
QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
{
q_ptr = reader;
parseStack = 0;
parseStack = nullptr;
locator.reset(new QXmlSimpleReaderLocator(reader));
entityRes = 0;
dtdHnd = 0;
contentHnd = 0;
errorHnd = 0;
lexicalHnd = 0;
declHnd = 0;
entityRes = nullptr;
dtdHnd = nullptr;
contentHnd = nullptr;
errorHnd = nullptr;
lexicalHnd = nullptr;
declHnd = nullptr;
// default feature settings
useNamespaces = true;
@ -2932,7 +2932,7 @@ bool QXmlSimpleReader::feature(const QString& name, bool *ok) const
{
const QXmlSimpleReaderPrivate *d = d_func();
if (ok != 0)
if (ok)
*ok = true;
if (name == QLatin1String("http://xml.org/sax/features/namespaces")) {
return d->useNamespaces;
@ -2946,7 +2946,7 @@ bool QXmlSimpleReader::feature(const QString& name, bool *ok) const
return d->reportEntities;
} else {
qWarning("Unknown feature %s", name.toLatin1().data());
if (ok != 0)
if (ok)
*ok = false;
}
return false;
@ -3023,9 +3023,9 @@ bool QXmlSimpleReader::hasFeature(const QString& name) const
*/
void* QXmlSimpleReader::property(const QString&, bool *ok) const
{
if (ok != 0)
if (ok)
*ok = false;
return 0;
return nullptr;
}
/*! \reimp
@ -3206,7 +3206,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
d->initIncrementalParsing();
} else {
delete d->parseStack;
d->parseStack = 0;
d->parseStack = nullptr;
}
d->init(input);
@ -3251,7 +3251,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
bool QXmlSimpleReader::parseContinue()
{
Q_D(QXmlSimpleReader);
if (d->parseStack == 0 || d->parseStack->isEmpty())
if (d->parseStack == nullptr || d->parseStack->isEmpty())
return false;
d->initData();
int state = d->parseStack->pop().state;
@ -3268,7 +3268,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
if (state==0) {
if (!parseProlog()) {
if (incremental && error.isNull()) {
pushParseState(0, 0);
pushParseState(nullptr, 0);
return true;
} else {
clear(tags);
@ -3280,7 +3280,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
if (state==1) {
if (!parseElement()) {
if (incremental && error.isNull()) {
pushParseState(0, 1);
pushParseState(nullptr, 1);
return true;
} else {
clear(tags);
@ -3293,7 +3293,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
while (!atEnd()) {
if (!parseMisc()) {
if (incremental && error.isNull()) {
pushParseState(0, 2);
pushParseState(nullptr, 2);
return true;
} else {
clear(tags);
@ -3303,7 +3303,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
}
if (!atEndOrig && incremental) {
// we parsed something at all, so be prepared to come back later
pushParseState(0, 2);
pushParseState(nullptr, 2);
return true;
}
// is stack empty?
@ -3315,7 +3315,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
// call the handler
if (contentHnd) {
delete parseStack;
parseStack = 0;
parseStack = nullptr;
if (!contentHnd->endDocument()) {
reportParseError(contentHnd->errorString());
return false;
@ -3350,7 +3350,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
signed char state;
signed char input;
(4) if (d->parseStack == 0 || d->parseStack->isEmpty()) {
(4) if (d->parseStack == nullptr || d->parseStack->isEmpty()) {
(4a) ...
} else {
(4b) ...
@ -3440,7 +3440,7 @@ bool QXmlSimpleReaderPrivate::parseProlog()
signed char state;
signed char input;
if (parseStack == 0 || parseStack->isEmpty()) {
if (parseStack == nullptr|| parseStack->isEmpty()) {
xmldecl_possible = true;
doctype_read = false;
state = Init;
@ -3631,7 +3631,7 @@ bool QXmlSimpleReaderPrivate::parseElement()
int state;
int input;
if (parseStack == 0 || parseStack->isEmpty()) {
if (parseStack == nullptr|| parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -4000,7 +4000,7 @@ bool QXmlSimpleReaderPrivate::parseContent()
signed char state;
signed char input;
if (parseStack == 0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
contentCharDataRead = false;
state = Init;
} else {
@ -4303,7 +4303,7 @@ bool QXmlSimpleReaderPrivate::parseMisc()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -4458,7 +4458,7 @@ bool QXmlSimpleReaderPrivate::parsePI()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -4685,7 +4685,7 @@ bool QXmlSimpleReaderPrivate::parseDoctype()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
startDTDwasReported = false;
systemId.clear();
publicId.clear();
@ -4896,7 +4896,7 @@ bool QXmlSimpleReaderPrivate::parseExternalID()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
systemId.clear();
publicId.clear();
state = Init;
@ -5060,7 +5060,7 @@ bool QXmlSimpleReaderPrivate::parseMarkupdecl()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -5218,7 +5218,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -5255,7 +5255,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference()
} else if (entityRes) {
QMap<QString,QXmlSimpleReaderPrivate::ExternParameterEntity>::Iterator it2;
it2 = externParameterEntities.find(ref());
QXmlInputSource *ret = 0;
QXmlInputSource *ret = nullptr;
if (it2 != externParameterEntities.end()) {
if (!entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)) {
delete ret;
@ -5396,7 +5396,7 @@ bool QXmlSimpleReaderPrivate::parseAttlistDecl()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -5612,7 +5612,7 @@ bool QXmlSimpleReaderPrivate::parseAttType()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -5833,7 +5833,7 @@ bool QXmlSimpleReaderPrivate::parseAttValue()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -5975,7 +5975,7 @@ bool QXmlSimpleReaderPrivate::parseElementDecl()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -6184,7 +6184,7 @@ bool QXmlSimpleReaderPrivate::parseNotationDecl()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -6328,7 +6328,7 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -6557,7 +6557,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -6832,7 +6832,7 @@ bool QXmlSimpleReaderPrivate::parseEntityValue()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -6951,7 +6951,7 @@ bool QXmlSimpleReaderPrivate::parseComment()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -7063,7 +7063,7 @@ bool QXmlSimpleReaderPrivate::parseAttribute()
int state;
int input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -7162,7 +7162,7 @@ bool QXmlSimpleReaderPrivate::parseName()
};
int state;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -7248,7 +7248,7 @@ bool QXmlSimpleReaderPrivate::parseNmtoken()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@ -7356,7 +7356,7 @@ bool QXmlSimpleReaderPrivate::parseReference()
signed char state;
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
parseReference_charDataRead = false;
state = Init;
} else {
@ -7582,7 +7582,7 @@ bool QXmlSimpleReaderPrivate::processReference()
if (parseReference_context == InContent) {
if (contentCharDataRead) {
if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
if (contentHnd != 0 && !contentHnd->characters(string())) {
if (contentHnd != nullptr && !contentHnd->characters(string())) {
reportParseError(contentHnd->errorString());
return false;
}
@ -7610,7 +7610,7 @@ bool QXmlSimpleReaderPrivate::processReference()
// Included if validating
bool skipIt = true;
if (entityRes) {
QXmlInputSource *ret = 0;
QXmlInputSource *ret = nullptr;
if (!entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)) {
delete ret;
reportParseError(entityRes->errorString());
@ -7696,7 +7696,7 @@ bool QXmlSimpleReaderPrivate::parseString()
signed char state; // state in this function is the position in the string s
signed char input;
if (parseStack==0 || parseStack->isEmpty()) {
if (parseStack == nullptr || parseStack->isEmpty()) {
Done = parseString_s.length();
state = 0;
} else {
@ -7800,7 +7800,7 @@ void QXmlSimpleReaderPrivate::next()
c = inputSource->next();
// If we are not incremental parsing, we just skip over EndOfData chars to give the
// parser an uninterrupted stream of document chars.
if (c == QXmlInputSource::EndOfData && parseStack == 0)
if (c == QXmlInputSource::EndOfData && parseStack == nullptr)
c = inputSource->next();
if (uc == '\n') {
lineNr++;
@ -7832,7 +7832,7 @@ bool QXmlSimpleReaderPrivate::eat_ws()
}
next();
}
if (parseStack != 0) {
if (parseStack != nullptr) {
unexpectedEof(&QXmlSimpleReaderPrivate::eat_ws, 0);
return false;
}
@ -7922,7 +7922,7 @@ void QXmlSimpleReaderPrivate::reportParseError(const QString& error)
*/
void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state)
{
if (parseStack == 0) {
if (parseStack == nullptr) {
reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
} else {
if (c == QXmlInputSource::EndOfDocument) {
@ -7942,7 +7942,7 @@ void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state)
*/
void QXmlSimpleReaderPrivate::parseFailed(ParseFunction where, int state)
{
if (parseStack!=0 && error.isNull()) {
if (parseStack != nullptr && error.isNull()) {
pushParseState(where, state);
}
}