summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_xml.h3
-rw-r--r--libs/win32/mir_core.libbin450166 -> 450814 bytes
-rw-r--r--libs/win64/mir_core.libbin455008 -> 455676 bytes
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp12
-rw-r--r--src/mir_core/src/mir_core.def2
-rw-r--r--src/mir_core/src/mir_core64.def2
-rw-r--r--src/mir_core/src/tinyxml2.h8
9 files changed, 24 insertions, 14 deletions
diff --git a/include/m_xml.h b/include/m_xml.h
index ee50229082..4dd02b271c 100644
--- a/include/m_xml.h
+++ b/include/m_xml.h
@@ -44,6 +44,9 @@ typedef tinyxml2::XMLText TiXmlText;
typedef tinyxml2::XMLElement TiXmlElement;
typedef tinyxml2::XMLDocument TiXmlDocument;
+typedef tinyxml2::XMLHandle TiXmlHandle;
+typedef tinyxml2::XMLConstHandle TiXmlConst;
+
/////////////////////////////////////////////////////////////////////////////////////////
// simple element iterator
//
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index c3d3e97184..2ca60efda1 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index c47fb2787c..cafde673c6 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
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;
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index a4bbb7dde7..d05ab14865 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -84,8 +84,7 @@ bool GaduProto::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
// if this url returned xml data (before and after 11.2013 gg convention)
TiXmlDocument doc;
if (doc.Parse(resp->pData) == 0) {
- tinyxml2::XMLConstHandle pRoot(doc.FirstChildElement("result"));
- auto *node = pRoot.FirstChildElement("users").FirstChildElement("user").FirstChildElement("avatars").FirstChildElement("avatar").ToElement();
+ auto *node = TiXmlConst(doc.FirstChildElement("result"))["users"]["user"]["avatars"]["avatar"].ToElement();
const char *blank = (node != nullptr) ? node->Attribute("blank") : nullptr;
if (mir_strcmp(blank, "1")) {
auto *p = node->FirstChildElement("timestamp");
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 4142ac5598..805f92bed0 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -304,11 +304,11 @@ int GaduProto::oauth_receivetoken()
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
TiXmlDocument doc;
if (0 == doc.Parse(resp->pData)) {
- tinyxml2::XMLConstHandle hXml(doc.FirstChildElement("result"));
- if (auto *p = hXml.FirstChildElement("oauth_token").ToElement())
+ TiXmlConst hXml(doc.FirstChildElement("result"));
+ if (auto *p = hXml["oauth_token"].ToElement())
token = mir_strdup(p->GetText());
- if (auto *p = hXml.FirstChildElement("oauth_token_secret").ToElement())
+ if (auto *p = hXml["oauth_token_secret"].ToElement())
token_secret = mir_strdup(p->GetText());
}
}
@@ -373,11 +373,11 @@ int GaduProto::oauth_receivetoken()
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
TiXmlDocument doc;
if (0 == doc.Parse(resp->pData)) {
- tinyxml2::XMLConstHandle hXml(doc.FirstChildElement("result"));
- if (auto *p = hXml.FirstChildElement("oauth_token").ToElement())
+ TiXmlConst hXml(doc.FirstChildElement("result"));
+ if (auto *p = hXml["oauth_token"].ToElement())
token = mir_strdup(p->GetText());
- if (auto *p = hXml.FirstChildElement("oauth_token_secret").ToElement())
+ if (auto *p = hXml["oauth_token_secret"].ToElement())
token_secret = mir_strdup(p->GetText());
}
}
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 5a39a144d7..112500b679 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1413,3 +1413,5 @@ db_event_edit @1268
?SetText@XMLElement@tinyxml2@@QAEXPB_W@Z @1626 NONAME
?SetAttribute@XMLAttribute@tinyxml2@@QAEXPB_W@Z @1627 NONAME
?SetAttribute@XMLElement@tinyxml2@@QAEXPBDPB_W@Z @1628 NONAME
+??AXMLConstHandle@tinyxml2@@QBE?BV01@PBD@Z @1629 NONAME
+??AXMLHandle@tinyxml2@@QAE?AV01@PBD@Z @1630 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 8df59970ba..eac6cc4c13 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1413,3 +1413,5 @@ db_event_edit @1268
?SetText@XMLElement@tinyxml2@@QEAAXPEB_W@Z @1626 NONAME
?SetAttribute@XMLAttribute@tinyxml2@@QEAAXPEB_W@Z @1627 NONAME
?SetAttribute@XMLElement@tinyxml2@@QEAAXPEBDPEB_W@Z @1628 NONAME
+??AXMLConstHandle@tinyxml2@@QEBA?BV01@PEBD@Z @1629 NONAME
+??AXMLHandle@tinyxml2@@QEAA?AV01@PEBD@Z @1630 NONAME
diff --git a/src/mir_core/src/tinyxml2.h b/src/mir_core/src/tinyxml2.h
index 7cdd917a2d..168f825d1a 100644
--- a/src/mir_core/src/tinyxml2.h
+++ b/src/mir_core/src/tinyxml2.h
@@ -2012,6 +2012,10 @@ public:
return *this;
}
+ XMLHandle operator[]( const char* name ) {
+ return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
+ }
+
/// Get the first child of this handle.
XMLHandle FirstChild() {
return XMLHandle( _node ? _node->FirstChild() : 0 );
@@ -2090,6 +2094,10 @@ public:
return *this;
}
+ const XMLConstHandle operator[]( const char* name ) const {
+ return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
+ }
+
const XMLConstHandle FirstChild() const {
return XMLConstHandle( _node ? _node->FirstChild() : 0 );
}