Use unique_ptr to store the XmlNode’s children

Also fix some constness things
This commit is contained in:
Florent Le Coz
2015-09-01 14:47:57 +02:00
parent 38564d77c7
commit f3b3d937ae
9 changed files with 69 additions and 71 deletions
+4 -4
View File
@@ -51,11 +51,11 @@ void HelloStep1(XmppComponent*, AdhocSession&, XmlNode& command_node)
void HelloStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node)
{
// Find out if the name was provided in the form.
XmlNode* x = command_node.get_child("x", "jabber:x:data");
const XmlNode* x = command_node.get_child("x", "jabber:x:data");
if (x)
{
XmlNode* name_field = nullptr;
for (XmlNode* field: x->get_children("field", "jabber:x:data"))
const XmlNode* name_field = nullptr;
for (const XmlNode* field: x->get_children("field", "jabber:x:data"))
if (field->get_tag("var") == "name")
{
name_field = field;
@@ -63,7 +63,7 @@ void HelloStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node)
}
if (name_field)
{
XmlNode* value = name_field->get_child("value", "jabber:x:data");
const XmlNode* value = name_field->get_child("value", "jabber:x:data");
if (value)
{
XmlNode note("note");