From 30fc8288f30a0b85762005fe52e18d254044d43b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 20 Jun 2019 12:39:45 +0000 Subject: Don't use wcslen() in combination with Tcl_WinTCharToUtf(): Using -1 has the same effect already (it even was wrong in tkWinTest.c's previous commit, forgot to multiply with sizeof(WCHAR)). --- win/tkWinInit.c | 2 +- win/tkWinTest.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tkWinInit.c b/win/tkWinInit.c index 780888a..e3c75de 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.c @@ -199,7 +199,7 @@ TkWin32ErrorObj( } #ifdef _UNICODE - Tcl_WinTCharToUtf(lpBuffer, wcslen(lpBuffer) * sizeof (WCHAR), &ds); + Tcl_WinTCharToUtf(lpBuffer, -1, &ds); errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); #else diff --git a/win/tkWinTest.c b/win/tkWinTest.c index e51b6a2..04ecb97 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -177,7 +177,7 @@ AppendSystemError( } else { char *msgPtr; - Tcl_WinTCharToUtf(wMsgPtr, wcslen(wMsgPtr), &ds); + Tcl_WinTCharToUtf(wMsgPtr, -1, &ds); LocalFree(wMsgPtr); msgPtr = Tcl_DStringValue(&ds); -- cgit v0.12