diff options
Diffstat (limited to 'win/tclWinConsole.c')
-rw-r--r-- | win/tclWinConsole.c | 22 |
1 files changed, 10 insertions, 12 deletions
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; } |