From 9539c488c29e7c2c06afa63abce70785cb5d15c5 Mon Sep 17 00:00:00 2001
From: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Date: Sun, 12 Apr 2015 22:06:17 -0700
Subject: [PATCH] Fix unused variable warning

Also fix test in wchar_t mode.
---
 src/pugixml.cpp           | 2 +-
 tests/test_dom_modify.cpp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 61aa5ae7..7c463cc9 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -5306,7 +5306,7 @@ namespace pugi
 
 		name_sentry sentry = { _root, _root->name };
 
-		_root->name = 0;
+		sentry.node->name = 0;
 
 		return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
 	}
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 41120e58..f2877ff5 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -905,7 +905,8 @@ TEST(dom_node_out_of_memory)
 	xml_attribute a = n.append_attribute(STR("a"));
 	CHECK(a);
 
-	CHECK_ALLOC_FAIL(while (n.append_child(node_comment) || n.append_attribute(STR("b"))) { /* nop */ });
+	CHECK_ALLOC_FAIL(while (n.append_child(node_comment)) { /* nop */ });
+	CHECK_ALLOC_FAIL(while (n.append_attribute(STR("b"))) { /* nop */ });
 
 	// verify all node modification operations
 	CHECK_ALLOC_FAIL(CHECK(!n.append_child()));
-- 
GitLab