[Tcl] Fix SWIG_AsWCharPtrAndSize() to assign result

Fix SWIG_AsWCharPtrAndSize() to actually assign to result variable.  It
looks like SWIG/Tcl wide character handling is currently fundamentally
broken except on systems which use wide characters as the system
encoding, but this should fix wrapping functions which take a wide
string as a parameter on Microsoft Windows.

Patch from Omar Medina.

Fixes https://sourceforge.net/p/swig/bugs/1290/
This commit is contained in:
Olly Betts 2022-03-08 08:10:46 +13:00
parent a4c82052ce
commit 663299281e
2 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,15 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress)
===========================
2022-03-07: Omar Medina
[Tcl] https://sourceforge.net/p/swig/bugs/1290/
Fix SWIG_AsWCharPtrAndSize() to actually assign to result
variable. It looks like SWIG/Tcl wide character handling is
currently fundamentally broken except on systems which use wide
characters as the system encoding, but this should fix wrapping
functions which take a wide string as a parameter on Microsoft
Windows.
2022-03-07: olly
[Javascript] #682 Fix handling of functions which take void*.

View File

@ -29,6 +29,7 @@ SWIG_AsWCharPtrAndSize(Tcl_Obj *obj, wchar_t** cptr, size_t* psize, int *alloc)
Tcl_UtfToExternal(0, encoding, src, srcLen, flags, statePtr, dst,
dstLen, &srcRead, &dstWrote, &dstChars);
*cptr = (wchar_t*)dst;
if (alloc) *alloc = SWIG_NEWOBJ;
}
if (psize) *psize = len + 1;