On Thu, 25 Aug 2022 08:02:00 GMT, Matthias Baesken <[email protected]> wrote:
> https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar > states about MultiByteToWideChar : "The function returns 0 if it does not > succeed" and lists a few failure cases. > However we miss checking the failure case in > Java_sun_awt_shell_Win32ShellFolder2_getLinkLocation , seems we assume the > function always works nicely (in most of the JDK coding the return value is > checked ). src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp line 724: > 722: // IShellFolder::ParseDisplayName requires the path name in > Unicode. > 723: ret = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strret.cStr, > -1, olePath, MAX_PATH); > 724: if (ret == 0) return 0; if (ret == 0) { return NULL; } Since (1) We always use parens, (2) the other cases return NULL .. unless you want to also change all those to return 0. ------------- PR: https://git.openjdk.org/jdk/pull/10015
