| 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 | { |
no test coverage detected