From a1e08d59a3a7c4b4831216afa755c4e0579b2ed7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Feb 2019 19:49:00 +0300 Subject: added operator[] for XMLConstHandle & XMLHandle, making Xpath much shorter --- plugins/SmileyAdd/src/smileys.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins/SmileyAdd') diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 56e0c144b7..b661ce2f0c 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -438,11 +438,7 @@ bool SmileyPackType::LoadSmileyFileXEP(const CMStringW &fileName, bool onlyInfo) } if (!onlyInfo) { - auto *pDataRoot = doc.FirstChildElement("dataroot"); - if (pDataRoot == nullptr) - return false; - - auto *pImages = tinyxml2::XMLConstHandle(&doc).FirstChildElement("lists").FirstChildElement("images").ToElement(); + auto *pImages = TiXmlConst(&doc)["lists"]["images"].ToElement(); if (pImages) { IStream *pStream = DecodeBase64Data(pImages->GetText()); if (pStream) { @@ -453,7 +449,7 @@ bool SmileyPackType::LoadSmileyFileXEP(const CMStringW &fileName, bool onlyInfo) } } - for (auto *nRec : TiXmlFilter(pDataRoot, "record")) { + for (auto *nRec : TiXmlFilter(doc.FirstChildElement("dataroot"), "record")) { int idx = nRec->IntAttribute("ImageIndex", -1); if (idx == -1) continue; -- cgit v1.2.3