Files
Nim/lib/pure
c-blake c91ef1a09f Fix closeHandle bug, add setFileSize, make resize work on Windows (#21375)
* Add general purpose `setFileSize` (unexported for now).  Use to simplify
`memfiles.open` as well as make robust (via hard allocation, not merely
`ftruncate` address space allocation) on systems with `posix_fallocate`.

As part of this, fix a bad `closeHandle` return check bug on Windows and
add `MemFile.resize` for Windows now that setFileSize makes that easier.

* Adapt existing test to exercise newly portable `MemFile.resize`.

* Since Apple has never provided `posix_fallocate`, provide a fallback.
This is presently written in terms of `ftruncate`, but it can be
improved to use `F_PREALLOCATE` instead, as mentioned in a comment.
2023-02-15 17:41:28 +01:00
..
2022-12-16 08:01:15 +01:00
2015-10-01 12:05:45 -07:00
2021-04-08 14:08:58 +02:00
2022-12-26 13:20:05 +01:00
2021-01-09 00:24:41 +01:00
2022-02-14 22:15:59 +00:00
2022-12-26 13:20:05 +01:00
2022-12-16 08:01:15 +01:00
2022-02-02 17:10:11 +01:00
2022-02-02 17:10:11 +01:00
2022-12-03 21:25:49 +08:00
2023-01-18 09:03:03 +01:00
2022-11-03 09:48:51 +01:00
2021-02-08 09:46:07 +01:00
2022-02-02 17:10:11 +01:00