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

Function get_mutable_buffer

src/include/pugixml.cpp:1159–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157 }
1158
1159 PUGI__FN bool get_mutable_buffer(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, bool is_mutable)
1160 {
1161 if (is_mutable)
1162 {
1163 out_buffer = static_cast<char_t*>(const_cast<void*>(contents));
1164 }
1165 else
1166 {
1167 void* buffer = xml_memory::allocate(size > 0 ? size : 1);
1168 if (!buffer) return false;
1169
1170 memcpy(buffer, contents, size);
1171
1172 out_buffer = static_cast<char_t*>(buffer);
1173 }
1174
1175 out_length = size / sizeof(char_t);
1176
1177 return true;
1178 }
1179
1180#ifdef PUGIXML_WCHAR_MODE
1181 PUGI__FN bool need_endian_swap_utf(xml_encoding le, xml_encoding re)

Callers 2

convert_bufferFunction · 0.85
convert_buffer_latin1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected