MCPcopy Create free account
hub / github.com/MyGUI/mygui / load_buffer_impl

Method load_buffer_impl

UnitTests/TestApp/pugixml.cpp:5820–5858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5818 }
5819
5820 PUGI__FN xml_parse_result xml_document::load_buffer_impl(
5821 void* contents,
5822 size_t size,
5823 unsigned int options,
5824 xml_encoding encoding,
5825 bool is_mutable,
5826 bool own)
5827 {
5828 reset();
5829
5830 // check input buffer
5831 assert(contents || size == 0);
5832
5833 // get actual encoding
5834 xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size);
5835
5836 // get private buffer
5837 char_t* buffer = nullptr;
5838 size_t length = 0;
5839
5840 if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable))
5841 return impl::make_parse_result(status_out_of_memory);
5842
5843 // delete original buffer if we performed a conversion
5844 if (own && buffer != contents && contents)
5845 impl::xml_memory::deallocate(contents);
5846
5847 // parse
5848 xml_parse_result res = impl::xml_parser::parse(buffer, length, _root, options);
5849
5850 // remember encoding
5851 res.encoding = buffer_encoding;
5852
5853 // grab onto buffer if it's our buffer, user is responsible for deallocating contens himself
5854 if (own || buffer != contents)
5855 _buffer = buffer;
5856
5857 return res;
5858 }
5859
5860 PUGI__FN xml_parse_result
5861 xml_document::load_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding)

Callers

nothing calls this directly

Calls 4

resetFunction · 0.85
convert_bufferFunction · 0.70
make_parse_resultFunction · 0.70
parseFunction · 0.50

Tested by

no test coverage detected