Skip to content

Commit 4f09675

Browse files
authored
Update asyncfile.nim: support write to > 2GB file on Windows (#25105)
`DWORD` is defined as `int32`, so `DWORD(...)` would not work as expected. When writing to files larger than 2GB, exception occurs: ``` unhandled exception: value out of range: 4294967295 notin -2147483648 .. 2147483647 [RangeDefect] ``` This PR is a quick fix for this. P.S. Why `DWORD` is defined as `int32`?
1 parent 76d07e8 commit 4f09675

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/pure/asyncfile.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ proc write*(f: AsyncFile, data: string): Future[void] =
428428
dealloc buffer
429429
buffer = nil
430430
)
431-
ol.offset = DWORD(f.offset and 0xffffffff)
431+
ol.offset = cast[DWORD](f.offset and 0xffffffff)
432432
ol.offsetHigh = DWORD(f.offset shr 32)
433433
f.offset.inc(data.len)
434434

0 commit comments

Comments
 (0)