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

Class TempBuffer

libcppcryptfs/util/util.h:131–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130template <typename T, size_t L>
131class TempBuffer {
132private:
133 vector<T> m_vec;
134 size_t m_len;
135 T m_buf[L];
136public:
137 TempBuffer(size_t len = 0) : m_len(len) {}
138 T* get(size_t len = 0)
139 {
140 if (len)
141 m_len = len;
142
143 if (m_len <= L) {
144 return m_buf;
145 } else {
146 if (m_vec.size() < m_len) {
147 try {
148 m_vec.resize(m_len);
149 } catch (const std::bad_alloc&) {
150 return nullptr;
151 }
152 }
153 return &m_vec[0];
154 }
155 }
156};
157
158HANDLE OpenTokenForCurrentProcess();
159

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected