From 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Mar 2019 11:46:26 +0100 Subject: More nullptr usage in headers Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/gui/painting/qcosmeticstroker_p.h | 4 ++-- src/gui/painting/qdatabuffer_p.h | 4 ++-- src/gui/painting/qdrawhelper_p.h | 2 +- src/gui/painting/qoutlinemapper_p.h | 4 ++-- src/gui/painting/qpaintengine_p.h | 6 +++--- src/gui/painting/qpaintengine_raster_p.h | 2 +- src/gui/painting/qpainter_p.h | 6 +++--- src/gui/painting/qpainterpath_p.h | 4 ++-- src/gui/painting/qpathclipper_p.h | 12 ++++++------ src/gui/painting/qplatformbackingstore.h | 4 ++-- src/gui/painting/qrbtree_p.h | 14 +++++++------- src/gui/painting/qtextureglyphcache_p.h | 2 +- src/gui/painting/qvectorpath_p.h | 8 ++++---- 13 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index 082ddee30f..8571b0476a 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -98,8 +98,8 @@ public: : state(s), deviceRect(dr_unclipped), clip(dr), - pattern(0), - reversePattern(0), + pattern(nullptr), + reversePattern(nullptr), patternSize(0), patternLength(0), patternOffset(0), diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index 28d5f6d6c5..181d19da0b 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -69,7 +69,7 @@ public: buffer = (Type*) malloc(capacity * sizeof(Type)); Q_CHECK_PTR(buffer); } else { - buffer = 0; + buffer = nullptr; } siz = 0; } @@ -128,7 +128,7 @@ public: Q_CHECK_PTR(buffer); } else { free(buffer); - buffer = 0; + buffer = nullptr; } } diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 37108949d6..1e99a34842 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -328,7 +328,7 @@ struct QTextureData struct QSpanData { - QSpanData() : tempImage(0) {} + QSpanData() : tempImage(nullptr) {} ~QSpanData() { delete tempImage; } QRasterBuffer *rasterBuffer; diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h index 71999fbdee..04a68797c2 100644 --- a/src/gui/painting/qoutlinemapper_p.h +++ b/src/gui/painting/qoutlinemapper_p.h @@ -180,13 +180,13 @@ public: QT_FT_Outline *outline() { if (m_valid) return &m_outline; - return 0; + return nullptr; } QT_FT_Outline *convertPath(const QPainterPath &path); QT_FT_Outline *convertPath(const QVectorPath &path); - inline QPainterPath::ElementType *elementTypes() const { return m_element_types.size() == 0 ? 0 : m_element_types.data(); } + inline QPainterPath::ElementType *elementTypes() const { return m_element_types.size() == 0 ? nullptr : m_element_types.data(); } public: QDataBuffer m_element_types; diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h index 8ac3fcff5c..40b9474165 100644 --- a/src/gui/painting/qpaintengine_p.h +++ b/src/gui/painting/qpaintengine_p.h @@ -65,7 +65,7 @@ class Q_GUI_EXPORT QPaintEnginePrivate { Q_DECLARE_PUBLIC(QPaintEngine) public: - QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipDevice(0), hasSystemTransform(0), + QPaintEnginePrivate() : pdev(nullptr), q_ptr(nullptr), currentClipDevice(nullptr), hasSystemTransform(0), hasSystemViewport(0) {} virtual ~QPaintEnginePrivate(); @@ -138,8 +138,8 @@ public: static QPaintEnginePrivate *get(QPaintEngine *paintEngine) { return paintEngine->d_func(); } - virtual QPaintEngine *aggregateEngine() { return 0; } - virtual Qt::HANDLE nativeHandle() { return 0; } + virtual QPaintEngine *aggregateEngine() { return nullptr; } + virtual Qt::HANDLE nativeHandle() { return nullptr; } }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index c3734f1c62..500e0fae54 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -426,7 +426,7 @@ inline void QClipData::appendSpans(const QSpan *s, int num) class QRasterBuffer { public: - QRasterBuffer() : m_width(0), m_height(0), m_buffer(0) { init(); } + QRasterBuffer() : m_width(0), m_height(0), m_buffer(nullptr) { init(); } ~QRasterBuffer(); diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 9857a59070..bd2bc4c9b3 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -193,9 +193,9 @@ class QPainterPrivate Q_DECLARE_PUBLIC(QPainter) public: QPainterPrivate(QPainter *painter) - : q_ptr(painter), d_ptrs(0), state(0), dummyState(0), txinv(0), inDestructor(false), d_ptrs_size(0), - refcount(1), device(0), original_device(0), helper_device(0), engine(0), emulationEngine(0), - extended(0) + : q_ptr(painter), d_ptrs(nullptr), state(nullptr), dummyState(nullptr), txinv(0), inDestructor(false), d_ptrs_size(0), + refcount(1), device(nullptr), original_device(nullptr), helper_device(nullptr), engine(nullptr), emulationEngine(nullptr), + extended(nullptr) { } diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index a36c8005bc..98056483bc 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -168,7 +168,7 @@ public: fillRule(Qt::OddEvenFill), dirtyBounds(false), dirtyControlBounds(false), - pathConverter(0) + pathConverter(nullptr) { require_moveTo = false; convex = false; @@ -181,7 +181,7 @@ public: dirtyBounds(other.dirtyBounds), dirtyControlBounds(other.dirtyControlBounds), convex(other.convex), - pathConverter(0) + pathConverter(nullptr) { require_moveTo = false; elements = other.elements; diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index c25a479807..9444a87b71 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -82,7 +82,7 @@ public: bool intersect(); bool contains(); - static bool pathToRect(const QPainterPath &path, QRectF *rect = 0); + static bool pathToRect(const QPainterPath &path, QRectF *rect = nullptr); static QPainterPath intersect(const QPainterPath &path, const QRectF &rect); private: @@ -394,7 +394,7 @@ inline const QPathSegments::Intersection *QPathSegments::intersectionAt(int inde { const int intersection = m_segments.at(index).intersection; if (intersection < 0) - return 0; + return nullptr; else return &m_intersections.at(intersection); } @@ -428,12 +428,12 @@ inline int QWingedEdge::edgeCount() const inline QPathEdge *QWingedEdge::edge(int edge) { - return edge < 0 ? 0 : &m_edges.at(edge); + return edge < 0 ? nullptr : &m_edges.at(edge); } inline const QPathEdge *QWingedEdge::edge(int edge) const { - return edge < 0 ? 0 : &m_edges.at(edge); + return edge < 0 ? nullptr : &m_edges.at(edge); } inline int QWingedEdge::vertexCount() const @@ -449,12 +449,12 @@ inline int QWingedEdge::addVertex(const QPointF &p) inline QPathVertex *QWingedEdge::vertex(int vertex) { - return vertex < 0 ? 0 : &m_vertices.at(vertex); + return vertex < 0 ? nullptr : &m_vertices.at(vertex); } inline const QPathVertex *QWingedEdge::vertex(int vertex) const { - return vertex < 0 ? 0 : &m_vertices.at(vertex); + return vertex < 0 ? nullptr : &m_vertices.at(vertex); } inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h index de5ba964dc..414d2bf0de 100644 --- a/src/gui/painting/qplatformbackingstore.h +++ b/src/gui/painting/qplatformbackingstore.h @@ -85,7 +85,7 @@ public: }; Q_DECLARE_FLAGS(Flags, Flag) - explicit QPlatformTextureList(QObject *parent = 0); + explicit QPlatformTextureList(QObject *parent = nullptr); ~QPlatformTextureList(); int count() const; @@ -99,7 +99,7 @@ public: bool isLocked() const; void appendTexture(void *source, GLuint textureId, const QRect &geometry, - const QRect &clipRect = QRect(), Flags flags = 0); + const QRect &clipRect = QRect(), Flags flags = nullptr); void clear(); Q_SIGNALS: diff --git a/src/gui/painting/qrbtree_p.h b/src/gui/painting/qrbtree_p.h index d3ee23a91c..42e88889a1 100644 --- a/src/gui/painting/qrbtree_p.h +++ b/src/gui/painting/qrbtree_p.h @@ -60,7 +60,7 @@ struct QRBTree { struct Node { - inline Node() : parent(0), left(0), right(0), red(true) { } + inline Node() : parent(nullptr), left(nullptr), right(nullptr), red(true) { } inline ~Node() {if (left) delete left; if (right) delete right;} T data; Node *parent; @@ -69,7 +69,7 @@ struct QRBTree bool red; }; - inline QRBTree() : root(0), freeList(0) { } + inline QRBTree() : root(nullptr), freeList(nullptr) { } inline ~QRBTree(); inline void clear(); @@ -120,7 +120,7 @@ inline QRBTree::~QRBTree() while (freeList) { // Avoid recursively calling the destructor, as this list may become large. Node *next = freeList->right; - freeList->right = 0; + freeList->right = nullptr; delete freeList; freeList = next; } @@ -131,7 +131,7 @@ inline void QRBTree::clear() { if (root) delete root; - root = 0; + root = nullptr; } template @@ -359,7 +359,7 @@ void QRBTree::detach(Node *node) // call this before removing a node. ref = child; if (child) child->parent = node->parent; - node->left = node->right = node->parent = 0; + node->left = node->right = node->parent = nullptr; } // 'node' must be black. rebalance will reduce the depth of black nodes by one in the sibling tree. @@ -513,7 +513,7 @@ inline void QRBTree::deleteNode(Node *&node) detach(node); node->right = freeList; freeList = node; - node = 0; + node = nullptr; } template @@ -522,7 +522,7 @@ inline typename QRBTree::Node *QRBTree::newNode() if (freeList) { Node *node = freeList; freeList = freeList->right; - node->parent = node->left = node->right = 0; + node->parent = node->left = node->right = nullptr; node->red = true; return node; } diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 3da28872b1..1e83ab46d1 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -75,7 +75,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache { public: QTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix) - : QFontEngineGlyphCache(format, matrix), m_current_fontengine(0), + : QFontEngineGlyphCache(format, matrix), m_current_fontengine(nullptr), m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0) { } diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h index 1b649a5d2a..df5772d4cc 100644 --- a/src/gui/painting/qvectorpath_p.h +++ b/src/gui/painting/qvectorpath_p.h @@ -106,7 +106,7 @@ public: // ### Falcon: introduca a struct XY for points so lars is not so confused... QVectorPath(const qreal *points, int count, - const QPainterPath::ElementType *elements = 0, + const QPainterPath::ElementType *elements = nullptr, uint hints = ArbitraryShapeHint) : m_elements(elements), m_points(points), @@ -128,12 +128,12 @@ public: inline bool hasExplicitOpen() const { return m_hints & ExplicitOpen; } inline bool hasWindingFill() const { return m_hints & WindingFill; } - inline void makeCacheable() const { m_hints |= ShouldUseCacheHint; m_cache = 0; } + inline void makeCacheable() const { m_hints |= ShouldUseCacheHint; m_cache = nullptr; } inline uint hints() const { return m_hints; } inline const QPainterPath::ElementType *elements() const { return m_elements; } inline const qreal *points() const { return m_points; } - inline bool isEmpty() const { return m_points == 0; } + inline bool isEmpty() const { return m_points == nullptr; } inline int elementCount() const { return m_count; } inline const QPainterPath convertToPainterPath() const; @@ -165,7 +165,7 @@ public: return e; e = e->next; } - return 0; + return nullptr; } template static inline bool isRect(const T *pts, int elementCount) { -- cgit v1.2.3