MCPcopy Create free account
hub / github.com/Snapchat/Valdi / makeUTF8

Method makeUTF8

valdi_core/src/valdi_core/cpp/Utils/StaticString.cpp:153–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153Ref<StaticString> StaticString::makeUTF8(size_t size) {
154 StaticStringAllocator allocator;
155 auto ref = allocator.allocate((size * sizeof(char)) + 1, size, Encoding::UTF8);
156 // Always null terminate UTF8 strings
157 ref->utf8Data()[size] = 0;
158 return ref;
159}
160
161Ref<StaticString> StaticString::makeUTF16(size_t size) {
162 StaticStringAllocator allocator;

Callers

nothing calls this directly

Calls 4

utf8DataMethod · 0.80
allocateMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected