MCPcopy Create free account
hub / github.com/ElementsProject/elements / Read

Method Read

src/leveldb/util/env_windows.cc:194–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 ~WindowsRandomAccessFile() override = default;
193
194 Status Read(uint64_t offset, size_t n, Slice* result,
195 char* scratch) const override {
196 DWORD bytes_read = 0;
197 OVERLAPPED overlapped = {0};
198
199 overlapped.OffsetHigh = static_cast<DWORD>(offset >> 32);
200 overlapped.Offset = static_cast<DWORD>(offset);
201 if (!::ReadFile(handle_.get(), scratch, static_cast<DWORD>(n), &bytes_read,
202 &overlapped)) {
203 DWORD error_code = ::GetLastError();
204 if (error_code != ERROR_HANDLE_EOF) {
205 *result = Slice(scratch, 0);
206 return Status::IOError(filename_, GetWindowsErrorMessage(error_code));
207 }
208 }
209
210 *result = Slice(scratch, bytes_read);
211 return Status::OK();
212 }
213
214 std::string GetName() const override { return filename_; }
215

Callers

nothing calls this directly

Calls 5

IOErrorFunction · 0.85
GetWindowsErrorMessageFunction · 0.85
OKFunction · 0.85
SliceClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected