Merge branch 'main' into wip/net-n-btree
This commit is contained in:
commit
261ba6d643
@ -377,12 +377,10 @@ size_t File::pread(void* f, char* data, size_t len, StreamOffset position) {
|
||||
HANDLE file = (HANDLE)f;
|
||||
DWORD numRead = 0;
|
||||
OVERLAPPED overlapped = makeOverlapped(position);
|
||||
|
||||
StreamOffset pos = ftell(f);
|
||||
if (pos != 0) fseek(f, 0, IOSeek::Absolute);
|
||||
fseek(f, 0, IOSeek::Absolute);
|
||||
int ret = ReadFile(file, data, len, &numRead, &overlapped);
|
||||
if (pos != 0) fseek(f, pos, IOSeek::Absolute);
|
||||
|
||||
fseek(f, pos, IOSeek::Absolute);
|
||||
if (ret == 0) {
|
||||
auto err = GetLastError();
|
||||
if (err != ERROR_IO_PENDING)
|
||||
@ -396,12 +394,10 @@ size_t File::pwrite(void* f, char const* data, size_t len, StreamOffset position
|
||||
HANDLE file = (HANDLE)f;
|
||||
DWORD numWritten = 0;
|
||||
OVERLAPPED overlapped = makeOverlapped(position);
|
||||
|
||||
StreamOffset pos = ftell(f);
|
||||
if (pos != 0) fseek(f, 0, IOSeek::Absolute);
|
||||
fseek(f, 0, IOSeek::Absolute);
|
||||
int ret = WriteFile(file, data, len, &numWritten, &overlapped);
|
||||
if (pos != 0) fseek(f, pos, IOSeek::Absolute);
|
||||
|
||||
fseek(f, pos, IOSeek::Absolute);
|
||||
if (ret == 0) {
|
||||
auto err = GetLastError();
|
||||
if (err != ERROR_IO_PENDING)
|
||||
|
Loading…
x
Reference in New Issue
Block a user