// For dng_stream void read(void* data, uint32 count, uint64 offset) { if (count == 0 && offset == 0) { return; } size_t sum; if (!safe_add_to_size_t(static_cast<uint64>(count), offset, &sum) || !this->bufferMoreData(sum)) { ThrowReadFile(); } if (!fStreamBuffer.read(data, static_cast<size_t>(offset), count)) { ThrowReadFile(); } }
void DoRead(void* data, uint32 count, uint64 offset) override { size_t sum; if (!safe_add_to_size_t(static_cast<uint64>(count), offset, &sum) || !fStream->read(data, static_cast<size_t>(offset), static_cast<size_t>(count))) { ThrowReadFile(); } }
uint64 getLength() override { if (!this->bufferMoreData(kReadToEnd)) { // read whole stream ThrowReadFile(); } return fStreamBuffer.bytesWritten(); }