MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / doRead

Method doRead

source/core/StarBuffer.cpp:168–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168size_t Buffer::doRead(size_t pos, char* data, size_t len) {
169 if (len == 0)
170 return 0;
171
172 if (!isReadable())
173 throw IOException("Error, read called on non-readable Buffer");
174
175 if (pos >= m_bytes.size())
176 return 0;
177
178 size_t l = min(m_bytes.size() - pos, len);
179 memcpy(data, m_bytes.ptr() + pos, l);
180 return l;
181}
182
183size_t Buffer::doWrite(size_t pos, char const* data, size_t len) {
184 if (len == 0)

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected