summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2004-09-10 01:52:17 (GMT)
committerdavygrvy <davygrvy@pobox.com>2004-09-10 01:52:17 (GMT)
commit3b09378118bfed68006ac0cb3e3dc2c5abbe04e4 (patch)
treed467a0f52f74ced277332a5f673fd2aa00ac1869
parent7387119ded3440e51b1dfe897052611bd8a7eb53 (diff)
downloadtcl-3b09378118bfed68006ac0cb3e3dc2c5abbe04e4.zip
tcl-3b09378118bfed68006ac0cb3e3dc2c5abbe04e4.tar.gz
tcl-3b09378118bfed68006ac0cb3e3dc2c5abbe04e4.tar.bz2
Calls to WriteFile and WriteConsoleA changed to WriteConsole.
-rw-r--r--ChangeLog5
-rw-r--r--win/tclWinConsole.c19
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f12310..f859f54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-09 David Gravereaux <davygrvy@pobox.com>
+
+ * win/tclWinConsole.c: Calls to WriteFile and WriteConsoleA
+ changed to WriteConsole for simplicity.
+
2004-09-09 Don Porter <dgp@users.sourceforge.net>
* generic/tclNamesp.c (Tcl_ForgetImport): Corrected faulty
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index 6d3709c..e2dedc4 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.11 2002/11/26 22:41:58 davygrvy Exp $
+ * RCS: @(#) $Id: tclWinConsole.c,v 1.12 2004/09/10 01:52:17 davygrvy Exp $
*/
#include "tclWinInt.h"
@@ -737,7 +737,7 @@ ConsoleOutputProc(
{
ConsoleInfo *infoPtr = (ConsoleInfo *) instanceData;
DWORD bytesWritten, timeout;
-
+
*errorCode = 0;
timeout = (infoPtr->flags & CONSOLE_ASYNC) ? 0 : INFINITE;
if (WaitForSingleObject(infoPtr->writable, timeout) == WAIT_TIMEOUT) {
@@ -749,7 +749,7 @@ ConsoleOutputProc(
errno = EAGAIN;
goto error;
}
-
+
/*
* Check for a background error on the last write.
*/
@@ -775,9 +775,9 @@ ConsoleOutputProc(
ckfree(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = ckalloc((unsigned int) toWrite);
+ infoPtr->writeBuf = ckalloc(toWrite);
}
- memcpy(infoPtr->writeBuf, buf, (size_t) toWrite);
+ memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
ResetEvent(infoPtr->writable);
SetEvent(infoPtr->startWriter);
@@ -788,18 +788,17 @@ ConsoleOutputProc(
* This avoids an unnecessary copy.
*/
- if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite,
- &bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
+ if (WriteConsole(infoPtr->handle, buf, toWrite, &bytesWritten,
+ NULL) == FALSE) {
TclWinConvertError(GetLastError());
goto error;
}
}
return bytesWritten;
- error:
+error:
*errorCode = errno;
return -1;
-
}
/*
@@ -1233,7 +1232,7 @@ ConsoleWriterThread(LPVOID arg)
*/
while (toWrite > 0) {
- if (WriteConsoleA(handle, buf, toWrite, &count, NULL) == FALSE) {
+ if (WriteConsole(handle, buf, toWrite, &count, NULL) == FALSE) {
infoPtr->writeError = GetLastError();
break;
} else {