REDIVIVUS

Proposals / #1379

Recover the paired UTF-8 decoder's Mac identity and WCHAR pointer contract

checked · by eejitgames · submitted 2026-11-07

Mac 002b83b6 is the counterpart of Windows UTF8_ConvertToWideChar 00526320, with UTF8_DecodeNextChar inlined. Both use byte-identical 16-byte decoding rows, the same signed capacity-minus-one bound, continuation/minimum checks, WORD output and error-index behavior. Paired font initializers pass the same 'c'/'m' byte strings and capacity 2. The Mac destination is currently int and the result undefined; native exits preserve the original destination in EAX. Windows already returns a generic 16-bit pointer, explicitly restoring the destination on every exit. Recover the Mac name, WCHAR input/result, and refine the Windows result to its existing WCHAR destination type. Preserve chosen parameter names and each build's convention. This models the existing legacy decoder without claiming modern UTF-8 conformance.

Changes 3, applied together

  1. Set prototype mac 0x002b83b6

    signatureundefined FUN_002b83b6(int wszDest, char * szSrc, int nMaxChars)→WCHAR * FUN_002b83b6(WCHAR * wszDest, char * szSrc, int nMaxChars)
    convention__cdecl
  2. Rename function mac 0x002b83b6

    nameFUN_002b83b6→UTF8_ConvertToWideChar
  3. Set prototype win 0x00526320

    signatureundefined2 * UTF8_ConvertToWideChar(WCHAR * wszText, char * szText, int32_t nMaxWideChars)→WCHAR * UTF8_ConvertToWideChar(WCHAR * wszText, char * szText, int32_t nMaxWideChars)
    convention__fastcall