MCPcopy Create free account
hub / github.com/WheretIB/nullc / load_buffer_impl

Method load_buffer_impl

external/pugixml/pugixml.cpp:4617–4646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4615 }
4616
4617 xml_parse_result xml_document::load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own)
4618 {
4619 reset();
4620
4621 // check input buffer
4622 assert(contents || size == 0);
4623
4624 // get actual encoding
4625 xml_encoding buffer_encoding = get_buffer_encoding(encoding, contents, size);
4626
4627 // get private buffer
4628 char_t* buffer = 0;
4629 size_t length = 0;
4630
4631 if (!convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return make_parse_result(status_out_of_memory);
4632
4633 // delete original buffer if we performed a conversion
4634 if (own && buffer != contents && contents) global_deallocate(contents);
4635
4636 // parse
4637 xml_parse_result res = xml_parser::parse(buffer, length, _root, options);
4638
4639 // remember encoding
4640 res.encoding = buffer_encoding;
4641
4642 // grab onto buffer if it's our buffer, user is responsible for deallocating contens himself
4643 if (own || buffer != contents) _buffer = buffer;
4644
4645 return res;
4646 }
4647
4648 xml_parse_result xml_document::load_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding)
4649 {

Callers

nothing calls this directly

Calls 4

assertFunction · 0.85
get_buffer_encodingFunction · 0.85
convert_bufferFunction · 0.85
make_parse_resultFunction · 0.85

Tested by

no test coverage detected