* Reduce number of read calls when not asking for progress reporting.
Also, when asking for progress reporting, cap the number of updates at approximately 100 instead of fileSize/4k.
* Add readUntilEOF option to file reading primitive and set it to true by default
* Address review comments - change readUntilEOF to readUntilLength
We were using the wrong buffer when creating the result, forming the
wrong deallocation for the buffer. Remove the unnecessary mapping and
correct the buffer usage to prevent a cross-domain free of the data.
This adjusts the data reading path for supporting Windows which does not
have the `mmap` function but does provide memory-mapped IO. The
difference in the API is sufficient to create a separate path for the
wrapping function rather than trying to have a single shared
implementation that simply uses different APIs for the system
integration.
Use the Windows POSIX API spellings to avoid the warnings. Take the
opportunity to change the environment handling to ensure that we are
able to handle weird unicode environment variables which may not be
rendered properly in the ASCII environment representation. Adjust some
types to better match the implementation on Windows which is a minor uop
to avoid unnecessary `trunc` and `sext` or `zext`.
This allows us to get further into building FoundationEssentials once
again on Windows. Much of the file system work has resulted in this
module no longer being viable on Windows and will need to be replaced to
allow building on Windows which does not have the `fts` APIs.