From 1a5288047eb362195fbc3805891b8bfedb20c54a Mon Sep 17 00:00:00 2001 From: halx99 Date: Fri, 1 Oct 2021 17:22:58 +0800 Subject: [PATCH] Use new mask cover all tests --- src/pugixml.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index f748059..87cd0dc 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -432,15 +432,18 @@ PUGI__NS_BEGIN #endif // extra metadata bits + static const uintptr_t xml_memory_page_contents_const_mask = 128; static const uintptr_t xml_memory_page_contents_shared_mask = 64; static const uintptr_t xml_memory_page_name_allocated_mask = 32; static const uintptr_t xml_memory_page_value_allocated_mask = 16; static const uintptr_t xml_memory_page_type_mask = 15; // combined masks for string uniqueness + static const uintptr_t xml_memory_page_contents_const_or_shared_mask = xml_memory_page_contents_const_mask | xml_memory_page_contents_shared_mask; static const uintptr_t xml_memory_page_name_allocated_or_shared_mask = xml_memory_page_name_allocated_mask | xml_memory_page_contents_shared_mask; static const uintptr_t xml_memory_page_value_allocated_or_shared_mask = xml_memory_page_value_allocated_mask | xml_memory_page_contents_shared_mask; + #ifdef PUGIXML_COMPACT #define PUGI__GETHEADER_IMPL(object, page, flags) // unused #define PUGI__GETPAGE_IMPL(header) (header).get_page() @@ -2340,7 +2343,7 @@ PUGI__NS_BEGIN inline bool strcpy_insitu_allow(size_t length, const Header& header, uintptr_t header_mask, char_t* target) { // never reuse shared memory - if (header & xml_memory_page_contents_shared_mask) return false; + if (header & xml_memory_page_contents_const_or_shared_mask) return false; size_t target_length = strlength(target); @@ -2368,7 +2371,7 @@ PUGI__NS_BEGIN header &= ~header_mask; // mark dest as shared to avoid reuse document buffer memory - header |= xml_memory_page_contents_shared_mask; + header |= xml_memory_page_contents_const_mask; return true; } @@ -2402,7 +2405,7 @@ PUGI__NS_BEGIN header |= header_mask; // remove dest shared mask for continue reuse document buffer memory - header &= ~xml_memory_page_contents_shared_mask; + header &= ~xml_memory_page_contents_const_mask; return true; }