From 12f45b93f54d74dcc7e81bd9b04f9734f832f72f Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 4 May 2010 11:05:34 +0000 Subject: TCHAR-related fixes, making those files compile fine when TCHAR != char Please see comments in [Freq 2965056] (2965056-1.patch). --- ChangeLog | 6 ++++++ win/tclWinNotify.c | 11 ++++++----- win/tclWinSock.c | 11 ++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a64eb7..f24c9e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-05-04 Jan Nijtmans + + * win/tclWinNotify.c TCHAR-related fixes, making those two + * win/tclWinSock.c files compile fine when TCHAR != char + Please see comments in [Freq 2965056] (2965056-1.patch). + 2010-05-03 Jan Nijtmans * generic/tclIORChan.c Use "tclIO.h" and "tclTomMathDecls.h" diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index 9e0db15..352379d 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinNotify.c,v 1.26 2009/11/18 21:59:49 nijtmans Exp $ + * RCS: @(#) $Id: tclWinNotify.c,v 1.27 2010/05/04 11:05:34 nijtmans Exp $ */ #include "tclInt.h" @@ -52,6 +52,7 @@ static Tcl_ThreadDataKey dataKey; */ static int notifierCount = 0; +static const TCHAR classname[] = TEXT("TclNotifier"); TCL_DECLARE_MUTEX(notifierMutex) /* @@ -99,12 +100,12 @@ Tcl_InitNotifier(void) class.hInstance = TclWinGetTclInstance(); class.hbrBackground = NULL; class.lpszMenuName = NULL; - class.lpszClassName = "TclNotifier"; + class.lpszClassName = classname; class.lpfnWndProc = NotifierProc; class.hIcon = NULL; class.hCursor = NULL; - if (!RegisterClassA(&class)) { + if (!RegisterClass(&class)) { Tcl_Panic("Unable to register TclNotifier window class"); } } @@ -187,7 +188,7 @@ Tcl_FinalizeNotifier( Tcl_MutexLock(¬ifierMutex); notifierCount--; if (notifierCount == 0) { - UnregisterClassA("TclNotifier", TclWinGetTclInstance()); + UnregisterClass(classname, TclWinGetTclInstance()); } Tcl_MutexUnlock(¬ifierMutex); } @@ -351,7 +352,7 @@ Tcl_ServiceModeHook( */ if (mode == TCL_SERVICE_ALL && !tsdPtr->hwnd) { - tsdPtr->hwnd = CreateWindowA("TclNotifier", "TclNotifier", + tsdPtr->hwnd = CreateWindow(classname, classname, WS_TILED, 0, 0, 0, 0, NULL, NULL, TclWinGetTclInstance(), NULL); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 27f7245..63f5f0c 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.70 2010/03/07 14:39:25 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.71 2010/05/04 11:05:34 nijtmans Exp $ */ #include "tclWinInt.h" @@ -41,6 +41,7 @@ */ static int initialized = 0; +static const TCHAR classname[] = TEXT("TclSocket"); TCL_DECLARE_MUTEX(socketMutex) /* @@ -247,12 +248,12 @@ InitSockets(void) windowClass.hInstance = TclWinGetTclInstance(); windowClass.hbrBackground = NULL; windowClass.lpszMenuName = NULL; - windowClass.lpszClassName = "TclSocket"; + windowClass.lpszClassName = classname; windowClass.lpfnWndProc = SocketProc; windowClass.hIcon = NULL; windowClass.hCursor = NULL; - if (!RegisterClassA(&windowClass)) { + if (!RegisterClass(&windowClass)) { TclWinConvertError(GetLastError()); goto initFailure; } @@ -394,7 +395,7 @@ SocketExitHandler( */ TclpFinalizeSockets(); - UnregisterClass("TclSocket", TclWinGetTclInstance()); + UnregisterClass(classname, TclWinGetTclInstance()); WSACleanup(); initialized = 0; Tcl_MutexUnlock(&socketMutex); @@ -2192,7 +2193,7 @@ SocketThread( * Create a dummy window receiving socket events. */ - tsdPtr->hwnd = CreateWindow("TclSocket", "TclSocket", + tsdPtr->hwnd = CreateWindow(classname, classname, WS_TILED, 0, 0, 0, 0, NULL, NULL, windowClass.hInstance, arg); /* -- cgit v0.12