MCPcopy Create free account
hub / github.com/MyGUI/mygui / convert_buffer_latin1

Function convert_buffer_latin1

Tools/EditorFramework/pugixml.cpp:1429–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1427}
1428
1429PUGI__FN bool convert_buffer_latin1(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size)
1430{
1431 const uint8_t* data = static_cast<const uint8_t*>(contents);
1432
1433 // get length in wchar_t units
1434 out_length = size;
1435
1436 // allocate buffer of suitable length
1437 out_buffer = static_cast<char_t*>(xml_memory::allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
1438 if (!out_buffer)
1439 return false;
1440
1441 // convert latin1 input to wchar_t
1442 wchar_writer::value_type out_begin = reinterpret_cast<wchar_writer::value_type>(out_buffer);
1443 wchar_writer::value_type out_end = utf_decoder<wchar_writer>::decode_latin1_block(data, size, out_begin);
1444
1445 assert(out_end == out_begin + out_length);
1446 (void)!out_end;
1447
1448 return true;
1449}
1450
1451PUGI__FN bool convert_buffer(
1452 char_t*& out_buffer,

Callers 1

convert_bufferFunction · 0.70

Calls 2

get_mutable_bufferFunction · 0.70

Tested by

no test coverage detected