MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / writeOffsetToFile

Method writeOffsetToFile

KittyMemoryEx/KittyIOFile.cpp:196–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194 }
195
196 buf->clear();
197 }
198
199 std::vector<char> buffer(KT_IO_CHUNK_SIZE, 0);
200 kt_off64_t offset = 0;
201 while (true)
202 {
203 ssize_t n = pread(offset, buffer.data(), buffer.size());
204 if (n <= 0)
205 break;
206
207 offset += n;
208 buf->insert(buf->end(), buffer.data(), buffer.data() + n);
209 }
210
211 return _error == 0;
212}
213
214bool KittyIOFile::copyToFd(int fd)
215{
216 _error = 0;
217
218 if (_fd < 0 || fd < 0)
219 return false;
220
221 std::vector<char> buffer(KT_IO_CHUNK_SIZE, 0);
222 kt_off64_t offset = 0;
223
224 while (true)
225 {
226 ssize_t nr = pread(offset, buffer.data(), buffer.size());

Callers

nothing calls this directly

Calls 2

openMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected