diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-08 21:27:42 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-08 21:27:42 (GMT) |
| commit | 2b821c69deba46a4f4634dbbfa6b5b34b6036f9c (patch) | |
| tree | df9166fc1ba8f897b51f0ff1cc339bea9c75f8a6 /generic/tclMain.c | |
| parent | 2cba0bf57340c299b9b51681a44f37d95787a47d (diff) | |
| parent | eb0e31e945c4147ee2beef42af28636e9c3c9f59 (diff) | |
| download | tcl-2b821c69deba46a4f4634dbbfa6b5b34b6036f9c.zip tcl-2b821c69deba46a4f4634dbbfa6b5b34b6036f9c.tar.gz tcl-2b821c69deba46a4f4634dbbfa6b5b34b6036f9c.tar.bz2 | |
Make -DTCL_UTF_MAX=6-build work on win32. Add travis builds to prove it.
Diffstat (limited to 'generic/tclMain.c')
| -rw-r--r-- | generic/tclMain.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index 9380fb2..4b8fa8c 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -59,20 +59,27 @@ * encoding to UTF-8). */ -#ifdef UNICODE +#if defined(UNICODE) && (TCL_UTF_MAX <= 4) # define NewNativeObj Tcl_NewUnicodeObj -#else /* !UNICODE */ +#else /* !UNICODE || (TCL_UTF_MAX > 4) */ static inline Tcl_Obj * NewNativeObj( - char *string, + TCHAR *string, int length) { Tcl_DString ds; - Tcl_ExternalToUtfDString(NULL, string, length, &ds); +#ifdef UNICODE + if (length > 0) { + length *= sizeof(WCHAR); + } + Tcl_WinTCharToUtf(string, length, &ds); +#else + Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds); +#endif return TclDStringToObj(&ds); } -#endif /* !UNICODE */ +#endif /* !UNICODE || (TCL_UTF_MAX > 4) */ /* * Declarations for various library functions and variables (don't want to |
