| 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 | { |
nothing calls this directly
no test coverage detected