From e71280221ff9f024f99e7b276f114498e227f465 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Wed, 11 Sep 2019 22:13:25 -0400 Subject: [PATCH] Fix nullptr warnings --- src/CutAndPaste.cpp | 9 ++++----- src/insets/InsetPreview.cpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index c71697ffda..d7a3a1fd36 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -141,7 +141,7 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, InsetText * target_inset = cur.inset().asInsetText(); if (!target_inset) { InsetTabular * it = cur.inset().asInsetTabular(); - target_inset = it ? it->cell(cur.idx())->asInsetText() : 0; + target_inset = it ? it->cell(cur.idx())->asInsetText() : nullptr; } LASSERT(target_inset, return PasteReturnValue(pit, pos, need_update)); @@ -304,8 +304,7 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, InsetIterator const i_end = inset_iterator_end(in); for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) { // Even though this will also be done later, it has to be done here - // since some inset might going to try to access - // the buffer() member. + // since some inset might try to access the buffer() member. it->setBuffer(const_cast(buffer)); switch (it->lyxCode()) { @@ -580,7 +579,7 @@ Buffer * copyToTempBuffer(ParagraphList const & paragraphs, DocumentClassConstPt // Use a clone for the complicated stuff so that we do not need to clean // up in order to avoid a crash. Buffer * buffer = staticbuffer->cloneBufferOnly(); - LASSERT(buffer, return 0); + LASSERT(buffer, return nullptr); // This needs doing every time. // Since setDocumentClass() causes deletion of the old document class @@ -723,7 +722,7 @@ void copySelectionHelper(Buffer const & buf, Text const & text, it = copy_pars.begin(); for (; it != it_end; ++it) { it->resetBuffer(); - it->setInsetOwner(0); + it->setInsetOwner(nullptr); } cutstack.push(make_pair(copy_pars, dc)); diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp index c306ae91d2..7b89e1ba6b 100644 --- a/src/insets/InsetPreview.cpp +++ b/src/insets/InsetPreview.cpp @@ -99,7 +99,7 @@ void InsetPreview::preparePreview(DocIterator const & pos) const dit.forwardInset(); for (; dit != dend; dit.forwardInset()) { InsetMath * im = dit.nextInset()->asInsetMath(); - InsetMathHull * hull = im ? im->asHullInset() : 0; + InsetMathHull * hull = im ? im->asHullInset() : nullptr; if (!hull) continue; for (idx_type idx = 0; idx < hull->nargs(); ++idx)