RFR: 8301302: Platform preferences API [v40]

Michael Strauß mstrauss at openjdk.org
Wed Dec 6 19:14:49 UTC 2023


On Wed, 6 Dec 2023 18:13:42 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Michael Strauß has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - null checking
>>  - rename GLASS_CHECK_EXCEPTIONALLY_RETURN
>
> modules/javafx.graphics/src/main/native-glass/win/RoActivationSupport.cpp line 208:
> 
>> 206:     int message_length = int(strlen(message));
>> 207:     int error_length = WideCharToMultiByte(CP_ACP, 0, error, -1, NULL, 0, NULL, FALSE);
>> 208:     if (message_length + error_length == 0) return;
> 
> Unless I'm missing something, this test should just be `if (error_length == 0)` -- note that a 0 value indicates an error (since the count includes the null terminator). The concern is that if `WideCharToMultiByte` returns a 0, then you will construct a string with no null terminator, since the subsequent call to `WideCharToMultiByte` would do nothing and you (intentionally) don't copy the null terminator from the message.

Yes, I think that's right. Changed it accordingly.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1417863223


More information about the openjfx-dev mailing list