From 977fd8496d174524a12ac1d1bda9ef02b2194503 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 13 Sep 2010 14:20:38 +0000 Subject: Various clean-ups, converting from tclWinProc->xxxProc directly to Xxx (no change in functionality) --- ChangeLog | 9 +++++++++ win/tclWinChan.c | 6 +++--- win/tclWinConsole.c | 22 ++++++++++------------ win/tclWinInit.c | 10 +++++----- win/tclWinLoad.c | 12 ++++++------ win/tclWinSerial.c | 8 ++++---- win/tclWinSock.c | 6 +++--- 7 files changed, 40 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81e5b33..21298f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-13 Jan Nijtmans + + * win/tclWinChan.c: Various clean-ups, converting from + * win/tclWinConsole.c: tclWinProc->xxxProc directly to Xxx + * win/tclWinInit.c: (no change in functionality) + * win/tclWinLoad.c: + * win/tclWinSerial.c: + * win/tclWinSock.c: + 2010-09-10 Jan Nijtmans * win/tclWin32Dll.c: Partly revert yesterday's change, to make it diff --git a/win/tclWinChan.c b/win/tclWinChan.c index cb39579..37e9011 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinChan.c,v 1.58 2010/09/08 21:02:41 dgp Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.59 2010/09/13 14:20:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -915,7 +915,7 @@ TclpOpenFileChannel( flags = FILE_ATTRIBUTE_READONLY; } } else { - flags = tclWinProcs->getFileAttributesProc(nativeName); + flags = GetFileAttributes(nativeName); if (flags == 0xFFFFFFFF) { flags = 0; } @@ -931,7 +931,7 @@ TclpOpenFileChannel( * Now we get to create the file. */ - handle = tclWinProcs->createFileProc(nativeName, accessMode, shareMode, + handle = CreateFile(nativeName, accessMode, shareMode, NULL, createMode, flags, (HANDLE) NULL); if (handle == INVALID_HANDLE_VALUE) { diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index eb24ef6..6ad92f1 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinConsole.c,v 1.24 2010/05/11 14:47:12 nijtmans Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.25 2010/09/13 14:20:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -197,9 +197,8 @@ readConsoleBytes( { DWORD ntchars; BOOL result; - int tcharsize; - tcharsize = tclWinProcs->useWide? 2 : 1; - result = tclWinProcs->readConsoleProc( + int tcharsize = sizeof(TCHAR); + result = ReadConsole( hConsole, lpBuffer, nbytes / tcharsize, &ntchars, NULL); if (nbytesread) *nbytesread = (ntchars*tcharsize); @@ -215,9 +214,8 @@ writeConsoleBytes( { DWORD ntchars; BOOL result; - int tcharsize; - tcharsize = tclWinProcs->useWide? 2 : 1; - result = tclWinProcs->writeConsoleProc( + int tcharsize = sizeof(TCHAR); + result = WriteConsole( hConsole, lpBuffer, nbytes / tcharsize, &ntchars, NULL); if (nbyteswritten) *nbyteswritten = (ntchars*tcharsize); @@ -1405,11 +1403,11 @@ TclWinOpenConsoleChannel( Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto"); Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}"); - if (tclWinProcs->useWide) - Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", "unicode"); - else - Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", encoding); - +#ifdef UNICODE + Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", "unicode"); +#else + Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", encoding); +#endif return infoPtr->channel; } diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 9115eaa..564ce7d 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.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: tclWinInit.c,v 1.85 2010/02/15 23:10:47 nijtmans Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.86 2010/09/13 14:20:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -478,7 +478,7 @@ TclpSetVariables( } sys; OSVERSIONINFOA osInfo; Tcl_DString ds; - WCHAR szUserName[UNLEN+1]; + TCHAR szUserName[UNLEN+1]; DWORD cchUserNameLen = UNLEN; Tcl_SetVar2Ex(interp, "tclDefaultLibrary", NULL, @@ -552,10 +552,10 @@ TclpSetVariables( Tcl_DStringInit(&ds); if (TclGetEnv("USERNAME", &ds) == NULL) { - if (tclWinProcs->getUserName((LPTSTR)szUserName, &cchUserNameLen) != 0) { + if (GetUserName(szUserName, &cchUserNameLen) != 0) { int cbUserNameLen = cchUserNameLen - 1; - if (tclWinProcs->useWide) cbUserNameLen *= sizeof(WCHAR); - tclWinProcs->tchar2utf((LPTSTR)szUserName, cbUserNameLen, &ds); + cbUserNameLen *= sizeof(TCHAR); + Tcl_WinTCharToUtf(szUserName, cbUserNameLen, &ds); } } Tcl_SetVar2(interp, "tcl_platform", "user", Tcl_DStringValue(&ds), diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 6fd44d1..cb46db9 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.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: tclWinLoad.c,v 1.31 2010/08/04 19:35:22 hobbs Exp $ + * RCS: @(#) $Id: tclWinLoad.c,v 1.32 2010/09/13 14:20:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -77,7 +77,7 @@ TclpDlopen( */ nativeName = Tcl_FSGetNativePath(pathPtr); - hInstance = tclWinProcs->loadLibraryExProc(nativeName, NULL, + hInstance = LoadLibraryEx(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hInstance == NULL) { /* @@ -89,8 +89,8 @@ TclpDlopen( Tcl_DString ds; const char *fileName = Tcl_GetString(pathPtr); - nativeName = tclWinProcs->utf2tchar(fileName, -1, &ds); - hInstance = tclWinProcs->loadLibraryExProc(nativeName, NULL, + nativeName = Tcl_WinUtfToTChar(fileName, -1, &ds); + hInstance = LoadLibraryEx(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); Tcl_DStringFree(&ds); } @@ -150,7 +150,7 @@ TclpDlopen( } return TCL_ERROR; } else { - handlePtr = + handlePtr = (Tcl_LoadHandle) ckalloc(sizeof(struct Tcl_LoadHandle_)); handlePtr->clientData = (ClientData) hInstance; handlePtr->findSymbolProcPtr = &FindSymbol; @@ -358,7 +358,7 @@ TclpTempFileNameForLibrary(Tcl_Interp* interp, /* Tcl interpreter */ Tcl_AppendToObj(fileName, "/", 1); Tcl_AppendObjToObj(fileName, tail); return fileName; - } + } } /* diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 34bbf9c..2f8cbd9 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.43 2010/05/11 14:47:12 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.44 2010/09/13 14:20:38 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1448,7 +1448,7 @@ TclWinSerialReopen( if (CloseHandle(handle) == FALSE) { return INVALID_HANDLE_VALUE; } - handle = tclWinProcs->createFileProc(name, access, 0, 0, OPEN_EXISTING, + handle = CreateFile(name, access, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); return handle; } @@ -1682,8 +1682,8 @@ SerialSetOptionProc( } return TCL_ERROR; } - native = tclWinProcs->utf2tchar(value, -1, &ds); - result = tclWinProcs->buildCommDCBProc(native, &dcb); + native = Tcl_WinUtfToTChar(value, -1, &ds); + result = BuildCommDCB(native, &dcb); Tcl_DStringFree(&ds); if (result == FALSE) { diff --git a/win/tclWinSock.c b/win/tclWinSock.c index b4ae07b..b4ef80b 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.73 2010/08/30 09:19:37 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.74 2010/09/13 14:20:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -2428,12 +2428,12 @@ InitializeHostName( DWORD length = MAX_COMPUTERNAME_LENGTH + 1; Tcl_DString ds; - if (tclWinProcs->getComputerNameProc(tbuf, &length) != 0) { + if (GetComputerName(tbuf, &length) != 0) { /* * Convert string from native to UTF then change to lowercase. */ - Tcl_UtfToLower((char *) tclWinProcs->tchar2utf(tbuf, -1, &ds)); + Tcl_UtfToLower(Tcl_WinTCharToUtf(tbuf, -1, &ds)); } else { Tcl_DStringInit(&ds); -- cgit v0.12