Files
Nim/tests/stdlib
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-09-23 13:05:05 +02:00
2020-11-13 16:15:13 +08:00
2021-01-07 19:16:26 +01:00
2022-09-29 12:16:42 +02:00
2022-10-22 13:42:46 +02:00
2021-10-24 11:51:57 +02:00
2022-09-23 13:05:05 +02:00
2020-12-27 14:45:57 +01:00
2022-10-28 10:01:28 +02:00
2022-11-13 05:52:21 +01:00
2020-10-18 12:57:13 -04:00
2018-12-11 21:23:21 +01:00
2022-11-30 07:21:47 +08:00
2022-09-29 09:41:00 +02:00