Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarFile_windows.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-09-12 23:31:18 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-09-12 23:31:18 +1000
commit261ba6d643542cc10ba07711a278fac7d3e09997 (patch)
tree8f449ef17886586a43e9669344a5994c722e9f36 /source/core/StarFile_windows.cpp
parent79d8ca62d31ad8841eb8fa3070a04861be749d4b (diff)
parent0da6aa1bd91827b84396cce775fa951ff7ef5934 (diff)
Merge branch 'main' into wip/net-n-btree
Diffstat (limited to 'source/core/StarFile_windows.cpp')
-rw-r--r--source/core/StarFile_windows.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/core/StarFile_windows.cpp b/source/core/StarFile_windows.cpp
index d9719b1..54d6c82 100644
--- a/source/core/StarFile_windows.cpp
+++ b/source/core/StarFile_windows.cpp
@@ -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)