From 46eecd77e36919438cc88c563d8f9906a8f0144e Mon Sep 17 00:00:00 2001 From: clockblocker Date: Fri, 27 Nov 2026 09:15:58 +0100 Subject: [PATCH] Fix XML get_field_from_array index increment and write() indent forwarding --- include/rfl/xml/Reader.hpp | 4 ++-- include/rfl/xml/write.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rfl/xml/Reader.hpp b/include/rfl/xml/Reader.hpp index 6ef06975b..c3eb1f6d7 100644 --- a/include/rfl/xml/Reader.hpp +++ b/include/rfl/xml/Reader.hpp @@ -64,12 +64,12 @@ struct Reader { const size_t _idx, const InputArrayType& _arr) const noexcept { const auto name = _arr.node_.name(); size_t i = 0; - for (auto node = _arr.node_; node; node = node.next_sibling(name)) { + for (auto node = _arr.node_; node; node = node.next_sibling(name), ++i) { if (i == _idx) { return InputVarType(node); } } - return error("Index " + std::to_string(_idx) + " of of bounds."); + return error("Index " + std::to_string(_idx) + " out of bounds."); } /// Retrieves a field from an XML object by name. diff --git a/include/rfl/xml/write.hpp b/include/rfl/xml/write.hpp index c71d937a6..51841e172 100644 --- a/include/rfl/xml/write.hpp +++ b/include/rfl/xml/write.hpp @@ -87,7 +87,7 @@ template std::string write(const auto& _obj, const std::string& _indent = " ") { std::stringstream stream; - write<_root, Ps...>(_obj, stream); + write<_root, Ps...>(_obj, stream, _indent); return stream.str(); }