On Tue, 25 Jul 2023 11:17:23 GMT, Matthias Baesken <[email protected]> wrote:
> The function WideCharToMultiByte is used at a number of places of the JDK > codebase for conversion purposes. > Unfortunately, the function might fail because of various reasons, so the > return value must be checked to avoid undefined behavior or even crashes. > see > https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte > especially > https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#return-value > > At most places in the coding the return values are already checked, but some > are missing. Looks good, two minor suggestions. src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 3933: > 3931: JNU_ThrowByName(env, PRINTEREXCEPTION_STR, errStr); > 3932: } else { > 3933: JNU_ThrowByName(env, PRINTEREXCEPTION_STR, "Secondary error > while OS message extraction"); better: secondary error during OS message extraction src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.cpp line 46: > 44: delete[] lpUTF8Str; > 45: } > 46: return NULL; better move `return NULL` into else block? ------------- Marked as reviewed by clanger (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15015#pullrequestreview-1551609451 PR Review Comment: https://git.openjdk.org/jdk/pull/15015#discussion_r1277259513 PR Review Comment: https://git.openjdk.org/jdk/pull/15015#discussion_r1277260378
