RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2]

Roger Riggs rriggs at openjdk.org
Fri Jun 2 18:40:07 UTC 2023


On Fri, 2 Jun 2023 15:57:31 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> For Unix, copy the `jchar`s into an allocated `char` array.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8309216: Reformat malloc size calculation

test/jdk/java/io/File/libGetXSpace.c line 85:

> 83:         // use GetDiskSpaceInformationW
> 84:         DISK_SPACE_INFORMATION diskSpaceInfo;
> 85:         BOOL hres = pfnGetDiskSpaceInformation(path, &diskSpaceInfo);

The strchars/path could be released before checking the return; keeping the cleanup in the common flow.
Here and below after calling GetDiskFreeSpaceExW.
Your call.

test/jdk/java/io/File/libGetXSpace.c line 142:

> 140:     for (int i = 0; i < len; i++) {
> 141:         chars[i] = (char)strchars[i];
> 142:     }

Is this `memcpy(chars, strchars, len);`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214684070
PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214683954


More information about the core-libs-dev mailing list