diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-08-30 13:45:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-08-30 13:45:15 (GMT) |
commit | a941263ec7148380c0ebc01e14a6f8f99db6aa1d (patch) | |
tree | e81714d3404120338f4586833571dad9f358e210 /win | |
parent | f0449542a5811d05d5f94ed6ca7a67c1160525fa (diff) | |
parent | 4eb2a153b7c2e256c5ce2eab6f0a050214045cc5 (diff) | |
download | tcl-a941263ec7148380c0ebc01e14a6f8f99db6aa1d.zip tcl-a941263ec7148380c0ebc01e14a6f8f99db6aa1d.tar.gz tcl-a941263ec7148380c0ebc01e14a6f8f99db6aa1d.tar.bz2 |
Rebase to 9.0
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinPipe.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d9cee73..fd183cf 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -651,7 +651,7 @@ TclpCreateTempFile( const char *contents) /* String to write into temp file, or NULL. */ { WCHAR name[MAX_PATH]; - const char *native; + const char *native = NULL; Tcl_DString dstring; HANDLE handle; @@ -679,7 +679,10 @@ TclpCreateTempFile( * Convert the contents from UTF to native encoding */ - native = Tcl_UtfToExternalDString(NULL, contents, TCL_INDEX_NONE, &dstring); + if (Tcl_UtfToExternalDStringEx(NULL, TCLFSENCODING, contents, TCL_INDEX_NONE, 0, &dstring, NULL) != TCL_OK) { + goto error; + } + native = Tcl_DStringValue(&dstring); toCopy = Tcl_DStringLength(&dstring); for (p = native; toCopy > 0; p++, toCopy--) { @@ -719,7 +722,9 @@ TclpCreateTempFile( Tcl_DStringFree(&dstring); } - Tcl_WinConvertError(GetLastError()); + if (native != NULL) { + Tcl_WinConvertError(GetLastError()); + } CloseHandle(handle); DeleteFileW(name); return NULL; |