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")