From 663299281ebbadbe78781cc369dafd63c3fa3219 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 8 Mar 2022 08:10:46 +1300 Subject: [PATCH] [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/ --- CHANGES.current | 9 +++++++++ Lib/tcl/tclwstrings.swg | 1 + 2 files changed, 10 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index e4697462d..d87daeec6 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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*. diff --git a/Lib/tcl/tclwstrings.swg b/Lib/tcl/tclwstrings.swg index b3b682e30..09374c54f 100644 --- a/Lib/tcl/tclwstrings.swg +++ b/Lib/tcl/tclwstrings.swg @@ -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;