From 0a6728c33d79445c6e4fc81ab9c78f2aa1f2cd82 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Sep 2019 21:01:44 +0000 Subject: Let's use GetWindowLongW/SetWindowLongW on Win32 directly. Missed them because they are not used in Win64. --- win/tclWinConsole.c | 10 ++++------ win/tclWinPipe.c | 2 +- win/tclWinSock.c | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 449bea9..173fe9e 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -208,7 +208,6 @@ ReadConsoleBytes( { DWORD ntchars; BOOL result; - int tcharsize = sizeof(WCHAR); /* * If user types a Ctrl-Break or Ctrl-C, ReadConsole will return @@ -221,11 +220,11 @@ ReadConsoleBytes( * will run and take whatever action it deems appropriate. */ do { - result = ReadConsoleW(hConsole, lpBuffer, nbytes / tcharsize, &ntchars, + result = ReadConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); } while (result && ntchars == 0 && GetLastError() == ERROR_OPERATION_ABORTED); if (nbytesread != NULL) { - *nbytesread = ntchars * tcharsize; + *nbytesread = ntchars * sizeof(WCHAR); } return result; } @@ -239,12 +238,11 @@ WriteConsoleBytes( { DWORD ntchars; BOOL result; - int tcharsize = sizeof(WCHAR); - result = WriteConsoleW(hConsole, lpBuffer, nbytes / tcharsize, &ntchars, + result = WriteConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); if (nbyteswritten != NULL) { - *nbyteswritten = ntchars * tcharsize; + *nbyteswritten = ntchars * sizeof(WCHAR); } return result; } diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 191545b..6120358 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1221,7 +1221,7 @@ HasConsole(void) { HANDLE handle; - handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, + handle = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle != INVALID_HANDLE_VALUE) { diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ed633ef..a397a30 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -3063,7 +3063,7 @@ SocketProc( #ifdef _WIN64 GetWindowLongPtrW(hwnd, GWLP_USERDATA); #else - GetWindowLong(hwnd, GWL_USERDATA); + GetWindowLongW(hwnd, GWL_USERDATA); #endif switch (message) { @@ -3081,7 +3081,7 @@ SocketProc( SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams); #else - SetWindowLong(hwnd, GWL_USERDATA, + SetWindowLongW(hwnd, GWL_USERDATA, (LONG) ((LPCREATESTRUCT)lParam)->lpCreateParams); #endif break; -- cgit v0.12