Kaydet (Commit) a2f86708 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in BasicCodeTagger

Change-Id: I85b7d5b3030d4b3ec5318e4ee6793927c1f16355
Reviewed-on: https://gerrit.libreoffice.org/47835Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 21525441
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <deque> #include <deque>
#include <memory>
#include <vector> #include <vector>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
...@@ -30,7 +31,7 @@ class L10N_DLLPUBLIC BasicCodeTagger ...@@ -30,7 +31,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
private: private:
xmlDocPtr m_pDocument; xmlDocPtr m_pDocument;
std::vector<xmlNodePtr> m_BasicCodeContainerTags; std::vector<xmlNodePtr> m_BasicCodeContainerTags;
LibXmlTreeWalker *m_pXmlTreeWalker; std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
SyntaxHighlighter m_Highlighter; SyntaxHighlighter m_Highlighter;
bool m_bTaggingCompleted; bool m_bTaggingCompleted;
void tagParagraph( xmlNodePtr paragraph ); void tagParagraph( xmlNodePtr paragraph );
......
...@@ -62,8 +62,6 @@ BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ): ...@@ -62,8 +62,6 @@ BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
BasicCodeTagger::~BasicCodeTagger() BasicCodeTagger::~BasicCodeTagger()
{ {
if ( m_pXmlTreeWalker != nullptr )
delete m_pXmlTreeWalker;
} }
//!Gathers all the <bascode> tag nodes from xml tree. //!Gathers all the <bascode> tag nodes from xml tree.
/*! /*!
...@@ -75,9 +73,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes() ...@@ -75,9 +73,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
m_BasicCodeContainerTags.clear(); m_BasicCodeContainerTags.clear();
if ( m_pXmlTreeWalker != nullptr ) m_pXmlTreeWalker.reset(new LibXmlTreeWalker( m_pDocument ));
delete m_pXmlTreeWalker;
m_pXmlTreeWalker = new LibXmlTreeWalker( m_pDocument );
currentNode = m_pXmlTreeWalker->currentNode(); currentNode = m_pXmlTreeWalker->currentNode();
if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) ) if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment