REDIVIVUS

Proposals / #1370

Recover the bounded wide-copy helper's destination result and Mac inputs

checked · by eejitgames · submitted 2026-11-06

Both complete native implementations of WSTRING_PutWideCharIntoBuffer explicitly preserve and return the original destination on every path, including count zero, a full copy and early-NUL padding. Windows incorrectly declares void; Mac leaves its result and all inputs undefined. Recover WCHAR* results in both builds and Mac WCHAR*,WCHAR*,size_t inputs, retaining existing names and fastcall/cdecl conventions. This is the paired bounded UTF-16 copy contract, independently supported by the node allocator's character count and WORD termination. Mac WCHAR and size_t are respectively2 and4 bytes.

Changes 2, applied together

  1. Set prototype win 0x00526790

    signaturevoid WSTRING_PutWideCharIntoBuffer(WCHAR * pDestination, WCHAR * wszChar, size_t nSizeMaybe)→WCHAR * WSTRING_PutWideCharIntoBuffer(WCHAR * pDestination, WCHAR * wszChar, size_t nSizeMaybe)
    convention__fastcall
  2. Set prototype mac 0x002ba0ba

    signatureundefined WSTRING_PutWideCharIntoBuffer(undefined4 pDestination, undefined4 wszChar, undefined4 nSizeMaybe)→WCHAR * WSTRING_PutWideCharIntoBuffer(WCHAR * pDestination, WCHAR * wszChar, size_t nSizeMaybe)
    convention__cdecl