Jacek Caban (@jacek) commented about dlls/kernelbase/path.c:
{
utf8_buf[0] = ih;
utf8_len = get_utf8_len(ih);
for (i = 1; i < utf8_len; i++)
{
memcpy(buf + 2, src + 2, 2 * sizeof(WCHAR));
StrToIntExW(buf, STIF_SUPPORT_HEX, &ih);
/* Check if it is a valid continuation byte. */
if (*(src + 1) == '%' && (ih & 0xc0) == 0x80)
{
utf8_buf[i] = ih;
src += 3;
}
else
{
utf8_len = i;
You may just use `i` instead of `utf8_len` in `MultiByteToWideChar` and skip this assignment. It may simplify things a bit if you need to break out of the loop in more cases.