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

loplugin:useuniqueptr in StreamTable

Change-Id: I6a6314a3e6df9edfb6d92d2afbc1567195946292
Reviewed-on: https://gerrit.libreoffice.org/52885Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2e0cf814
...@@ -165,19 +165,19 @@ public: ...@@ -165,19 +165,19 @@ public:
std::string document_module; std::string document_module;
std::string document_title; std::string document_title;
HashSet *appl_hidlist; std::unique_ptr<HashSet> appl_hidlist;
Hashtable *appl_keywords; std::unique_ptr<Hashtable> appl_keywords;
Stringtable *appl_helptexts; std::unique_ptr<Stringtable> appl_helptexts;
xmlDocPtr appl_doc; xmlDocPtr appl_doc;
StreamTable() : StreamTable() :
appl_hidlist(nullptr), appl_keywords(nullptr), appl_helptexts(nullptr), appl_doc(nullptr) appl_doc(nullptr)
{} {}
void dropappl() void dropappl()
{ {
delete appl_hidlist; appl_hidlist.reset();
delete appl_keywords; appl_keywords.reset();
delete appl_helptexts; appl_helptexts.reset();
if (appl_doc) xmlFreeDoc(appl_doc); if (appl_doc) xmlFreeDoc(appl_doc);
} }
~StreamTable() ~StreamTable()
......
...@@ -476,9 +476,9 @@ bool HelpCompiler::compile() ...@@ -476,9 +476,9 @@ bool HelpCompiler::compile()
streamTable.dropappl(); streamTable.dropappl();
streamTable.appl_doc = docResolvedDoc; streamTable.appl_doc = docResolvedDoc;
streamTable.appl_hidlist = aparser.hidlist.release(); streamTable.appl_hidlist = std::move(aparser.hidlist);
streamTable.appl_helptexts = aparser.helptexts.release(); streamTable.appl_helptexts = std::move(aparser.helptexts);
streamTable.appl_keywords = aparser.keywords.release(); streamTable.appl_keywords = std::move(aparser.keywords);
streamTable.document_id = documentId; streamTable.document_id = documentId;
streamTable.document_path = fileName; streamTable.document_path = fileName;
......
...@@ -383,7 +383,7 @@ void HelpLinker::link() ...@@ -383,7 +383,7 @@ void HelpLinker::link()
// add once this as its own id. // add once this as its own id.
addBookmark( pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB); addBookmark( pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB);
const HashSet *hidlist = streamTable.appl_hidlist; const HashSet *hidlist = streamTable.appl_hidlist.get();
if (hidlist && !hidlist->empty()) if (hidlist && !hidlist->empty())
{ {
// now iterate over all elements of the hidlist // now iterate over all elements of the hidlist
...@@ -403,7 +403,7 @@ void HelpLinker::link() ...@@ -403,7 +403,7 @@ void HelpLinker::link()
} }
// now the keywords // now the keywords
const Hashtable *anchorToLL = streamTable.appl_keywords; const Hashtable *anchorToLL = streamTable.appl_keywords.get();
if (anchorToLL && !anchorToLL->empty()) if (anchorToLL && !anchorToLL->empty())
{ {
std::string fakedHid = URLEncoder::encode(documentPath); std::string fakedHid = URLEncoder::encode(documentPath);
...@@ -424,7 +424,7 @@ void HelpLinker::link() ...@@ -424,7 +424,7 @@ void HelpLinker::link()
} }
// and last the helptexts // and last the helptexts
const Stringtable *helpTextHash = streamTable.appl_helptexts; const Stringtable *helpTextHash = streamTable.appl_helptexts.get();
if (helpTextHash && !helpTextHash->empty()) if (helpTextHash && !helpTextHash->empty())
{ {
for (auto const& elem : *helpTextHash) for (auto const& elem : *helpTextHash)
......
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