MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / onReadSource

Method onReadSource

framework/data_source/cache/cachedSource.cpp:20–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 }
19
20 int cachedSource::onReadSource(uint8_t *buffer, int size, uint64_t pos)
21 {
22 int sizeRead = 0;
23 int64_t seekPos = mDataSource->Seek(pos, SEEK_SET);
24
25 if (seekPos < 0) {
26 return seekPos;
27 }
28
29 while (size > 0) {
30 int ret;
31 ret = mDataSource->Read(buffer + sizeRead, static_cast<size_t>(size));
32
33 if (ret < 0) {
34 return ret;
35 }
36
37 if (ret == 0) {
38 break;
39 }
40
41 size -= ret;
42 sizeRead += ret;
43 }
44
45 return sizeRead;
46 }
47
48 cachedSource::~cachedSource()
49 {

Callers 2

getSliceFromSourceMethod · 0.80
readAtMethod · 0.80

Calls 2

SeekMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected