On Fri, 3 Feb 2023 19:49:44 GMT, Justin King <jck...@openjdk.org> wrote:

> Avoid using `lseek` + `read` in favor of `pread`. For Windows, we can do the 
> same thing by using `OVERLAPPED`, as we are in synchronous mode we can use 
> `Offset` and `OffsetHigh` to achieve the same thing.
> 
> Additionally I updated open to use `O_CLOEXEC` when available, as that really 
> should be used.

src/java.base/share/native/libzip/zip_util.c line 227:

> 225:       number_of_bytes_to_read = (DWORD) (nbytes - total);
> 226:     }
> 227:     number_of_bytes_read = 0;

do we really need to set number_of_bytes_read = 0 in every iteration ? .  As 
per MSDN it looks like ReadFile will do it implicitly.

[out, optional] lpNumberOfBytesRead

A pointer to the variable that receives the number of bytes read when using a 
synchronous hFile parameter. ReadFile sets this value to zero before doing any 
work or error checking. Use NULL for this parameter if this is an asynchronous 
operation to avoid potentially erroneous results.

-------------

PR: https://git.openjdk.org/jdk/pull/12417

Reply via email to