MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / load_buffer_impl

Method load_buffer_impl

src/include/pugixml.cpp:5230–5259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

resetFunction · 0.85
convert_bufferFunction · 0.85
make_parse_resultFunction · 0.85

Tested by

no test coverage detected