D-Programming-Language/phobos — pull request #2293 by tom-tan (2014-07-02 10:50:01+00:00)
Title: Mark std.file.read as @trusted

`std.file.read` contains the following unsafe operations, but we can verify that they can be trusted.

In Windows systems:
- Use of unsafe functions: `CreateFileW`, `CloseHandle`, `GetFileSize`, and `ReadFile`
- Taking address of a local variable (`numread`)

In Posix systems:
- Use of unsafe functions: `core.sys.posix.fcntl.open`, `core.sys.posix.sys.stat.fstat`, `core.sys.posix.unistd.read`, and `core.memory.GC.realloc`
- Taking address of a local variable (`statbuf`)
- Use of pointer arithmetic
- Use of pointer slicing

Question: In Windows systems, `read` checks the return value of `ReadFile(...)` by comparing with `1`. However, the [document of `ReadFile`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx) says that it returns nonzero, not `1`.
Is there a reason to use `ReadFile(...) == 1` instead of `ReadFile(...) != 0` or should it be fixed?