| 5225 | } |
| 5226 | |
| 5227 | PUGI__FN xml_parse_result xml_document::load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own) |
| 5228 | { |
| 5229 | reset(); |
| 5230 | |
| 5231 | // check input buffer |
| 5232 | assert(contents || size == 0); |
| 5233 | |
| 5234 | // get actual encoding |
| 5235 | xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); |
| 5236 | |
| 5237 | // get private buffer |
| 5238 | char_t* buffer = 0; |
| 5239 | size_t length = 0; |
| 5240 | |
| 5241 | if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory); |
| 5242 | |
| 5243 | // delete original buffer if we performed a conversion |
| 5244 | if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents); |
| 5245 | |
| 5246 | // parse |
| 5247 | xml_parse_result res = impl::xml_parser::parse(buffer, length, _root, options); |
| 5248 | |
| 5249 | // remember encoding |
| 5250 | res.encoding = buffer_encoding; |
| 5251 | |
| 5252 | // grab onto buffer if it's our buffer, user is responsible for deallocating contens himself |
| 5253 | if (own || buffer != contents) _buffer = buffer; |
| 5254 | |
| 5255 | return res; |
| 5256 | } |
| 5257 | |
| 5258 | PUGI__FN xml_parse_result xml_document::load_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding) |
| 5259 | { |
nothing calls this directly
no test coverage detected