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

Brian Burkhalter bpb at openjdk.org
Fri Jun 2 18:40:08 UTC 2023


On Fri, 2 Jun 2023 18:26:33 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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.

Good idea; will update.

> 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);`

I don't think so if `chars` is `char *` and `strchars` is `jchar*` as I think `char` is 8 bits and `jchar` is 16 bits.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214692423
PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214692051


More information about the core-libs-dev mailing list