MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / reallocate

Method reallocate

libcppcryptfs/file/iobufferpool.cpp:40–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void IoBuffer::reallocate(size_t bufferSize, size_t ivbufferSize)
41{
42 auto total_size = bufferSize + ivbufferSize;
43
44 if (m_storage.size() < total_size) {
45 m_storage.clear();
46 m_storage.resize(max(total_size, min(m_storage.size() * 2, IoBufferPool::m_max_pool_buffer_size)));
47 }
48
49 if (bufferSize > 0) {
50 m_pBuf = &m_storage[0];
51 } else {
52 m_pBuf = nullptr;
53 }
54
55 if (ivbufferSize > 0) {
56 m_pIvBuf = &m_storage[bufferSize];
57 } else {
58 m_pIvBuf = nullptr;
59 }
60}
61
62IoBuffer::IoBuffer(bool fromPool, size_t bufferSize, size_t ivbufferSize) : m_bIsFromPool(fromPool)
63{

Callers 1

GetIoBufferMethod · 0.80

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected