From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/text/qtextdocument_p.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui/text/qtextdocument_p.cpp') diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 2f02f62a57..524931ebde 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -185,7 +185,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() docChangeOldLength(0), docChangeLength(0), framesDirty(true), - rtFrame(0), + rtFrame(nullptr), initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; @@ -195,7 +195,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() undoState = 0; revision = -1; // init() inserts a block, bringing it to 0 - lout = 0; + lout = nullptr; modified = false; modifiedState = 0; @@ -272,7 +272,7 @@ void QTextDocumentPrivate::clear() blocks.clear(); cachedResources.clear(); delete rtFrame; - rtFrame = 0; + rtFrame = nullptr; init(); cursors = oldCursors; { @@ -290,7 +290,7 @@ void QTextDocumentPrivate::clear() QTextDocumentPrivate::~QTextDocumentPrivate() { for (QTextCursorPrivate *curs : qAsConst(cursors)) - curs->priv = 0; + curs->priv = nullptr; cursors.clear(); undoState = 0; undoEnabled = true; @@ -643,7 +643,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O // qDebug("remove_block at %d", key); Q_ASSERT(X->size_array[0] == 1 && isValidBlockSeparator(text.at(X->stringPosition))); b = blocks.previous(b); - B = 0; + B = nullptr; c.command = blocks.size(b) == 1 ? QTextUndoCommand::BlockDeleted : QTextUndoCommand::BlockRemoved; w = remove_block(key, &c.blockFormat, QTextUndoCommand::BlockAdded, op); @@ -1437,7 +1437,7 @@ static QTextFrame *findChildFrame(QTextFrame *f, int pos) else return c; } - return 0; + return nullptr; } QTextFrame *QTextDocumentPrivate::rootFrame() const @@ -1467,7 +1467,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f) for (int i = 0; i < f->d_func()->childFrames.count(); ++i) clearFrame(f->d_func()->childFrames.at(i)); f->d_func()->childFrames.clear(); - f->d_func()->parentFrame = 0; + f->d_func()->parentFrame = nullptr; } void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded) @@ -1551,7 +1551,7 @@ QTextFrame *QTextDocumentPrivate::insertFrame(int start, int end, const QTextFra Q_ASSERT(start <= end || end == -1); if (start != end && frameAt(start) != frameAt(end)) - return 0; + return nullptr; beginEditBlock(); @@ -1599,7 +1599,7 @@ void QTextDocumentPrivate::removeFrame(QTextFrame *frame) QTextObject *QTextDocumentPrivate::objectForIndex(int objectIndex) const { if (objectIndex < 0) - return 0; + return nullptr; QTextObject *object = objects.value(objectIndex, 0); if (!object) { -- cgit v1.2.3