diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-10 21:03:59 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-10 21:03:59 (GMT) |
commit | bd2618f68e0532440f3e927439e16c62f3a54d09 (patch) | |
tree | 1633caca9c01f0f5582942d71d7435b014635f83 /win/tkWinClipboard.c | |
parent | 66faab2bdc539d97fbb7a3834e8271555a36759d (diff) | |
download | tk-bd2618f68e0532440f3e927439e16c62f3a54d09.zip tk-bd2618f68e0532440f3e927439e16c62f3a54d09.tar.gz tk-bd2618f68e0532440f3e927439e16c62f3a54d09.tar.bz2 |
Eliminate on Windows all usages of Tcl_WinUtfToTChar() and Tcl_WinTCharToUtf(). Proving the point of this TIP.
Diffstat (limited to 'win/tkWinClipboard.c')
-rw-r--r-- | win/tkWinClipboard.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 8c6a4a4..06bc362 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -79,7 +79,8 @@ TkSelGetSelection( goto error; } data = GlobalLock(handle); - Tcl_WinTCharToUtf((TCHAR *)data, -1, &ds); + Tcl_DStringInit(&ds) + Tcl_UniCharToUtfDString((TCHAR *)data, wcslen((TCHAR *)data), &ds); GlobalUnlock(handle); } else if (IsClipboardFormatAvailable(CF_TEXT)) { /* @@ -157,7 +158,8 @@ TkSelGetSelection( Tcl_DStringAppend(&ds, "\n", 1); } len = wcslen(fname); - Tcl_WinTCharToUtf(fname, len * sizeof(WCHAR), &dsTmp); + Tcl_DStringInit(&dsTmp); + Tcl_UniCharToUtfDString(fname, len, &dsTmp); Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsTmp), Tcl_DStringLength(&dsTmp)); Tcl_DStringFree(&dsTmp); @@ -334,7 +336,7 @@ TkWinClipboardRender( #ifdef UNICODE Tcl_DStringInit(&ds); - Tcl_WinUtfToTChar(rawText, -1, &ds); + Tcl_UtfToUniCharDString(rawText, -1, &ds); ckfree(rawText); handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, (unsigned) Tcl_DStringLength(&ds) + 2); |