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

Method appendWritable

valdi_core/src/valdi_core/cpp/Utils/ByteBuffer.cpp:130–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130Byte* ByteBuffer::appendWritable(size_t size) {
131 if (size == 0) {
132 return _data + _size;
133 }
134
135 auto nextSize = _size + size;
136 if (nextSize > _capacity) {
137 reallocate(
138 std::max(static_cast<size_t>(nextPowerOfTwo(static_cast<unsigned long>(nextSize))), kMinAllocationSize));
139 }
140
141 auto* ptr = _data + _size;
142 _size = nextSize;
143 return ptr;
144}
145
146void ByteBuffer::append(const Byte* begin, const Byte* end) {
147 auto size = static_cast<size_t>(end - begin);

Callers 4

TESTFunction · 0.80
doWriteMethod · 0.80
doAppendEntryMethod · 0.80
appendOperationMethod · 0.80

Calls 2

maxFunction · 0.85
nextPowerOfTwoFunction · 0.85

Tested by 1

TESTFunction · 0.64