MCPcopy Create free account
hub / github.com/dfranx/SHADERed / buffer

Method buffer

libs/cppdap/src/content_stream.cpp:141–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool ContentReader::buffer(size_t bytes) {
142 if (bytes < buf.size()) {
143 return true;
144 }
145 bytes -= buf.size();
146 while (bytes > 0) {
147 uint8_t chunk[256];
148 auto numWant = std::min(sizeof(chunk), bytes);
149 auto numGot = reader->read(chunk, numWant);
150 if (numGot == 0) {
151 return false;
152 }
153 for (size_t i = 0; i < numGot; i++) {
154 buf.push_back(chunk[i]);
155 }
156 bytes -= numGot;
157 }
158 return true;
159}
160
161////////////////////////////////////////////////////////////////////////////////
162// ContentWriter

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
readMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected