From effc46f0ed35a70a53db7f56e37141ae3cb3a92a Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Wed, 13 Apr 2022 12:25:01 +0300 Subject: [PATCH] Added bool set_value(const char_t* rhs, size_t sz). --- src/pugixml.cpp | 9 +++++++-- src/pugixml.hpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 60b55da..aada2ac 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -5329,11 +5329,16 @@ namespace pugi return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, impl::strlength(rhs)); } - PUGI__FN bool xml_attribute::set_value(const char_t* rhs) + PUGI__FN bool xml_attribute::set_value(const char_t* rhs, size_t sz) { if (!_attr) return false; - return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, impl::strlength(rhs)); + return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, sz); + } + + PUGI__FN bool xml_attribute::set_value(const char_t* rhs) + { + return set_value(rhs, impl::strlength(rhs)); } PUGI__FN bool xml_attribute::set_value(int rhs) diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 579f143..f9ffaa2 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -416,6 +416,7 @@ namespace pugi // Set attribute name/value (returns false if attribute is empty or there is not enough memory) bool set_name(const char_t* rhs); + bool set_value(const char_t* rhs, size_t sz); bool set_value(const char_t* rhs); // Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")