summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2003-03-06 09:47:48 (GMT)
committermdejong <mdejong>2003-03-06 09:47:48 (GMT)
commit07b4cc33fb2184b87a048a0a930f1396a70d9df5 (patch)
tree8a50de024a79defdc00631e494d09eafb394482e
parenta060bfc83abd3ede4e970cef1959af6d9f75946e (diff)
downloadtcl-07b4cc33fb2184b87a048a0a930f1396a70d9df5.zip
tcl-07b4cc33fb2184b87a048a0a930f1396a70d9df5.tar.gz
tcl-07b4cc33fb2184b87a048a0a930f1396a70d9df5.tar.bz2
* generic/tclIO.c (WriteBytes, WriteChars,
Tcl_GetsObj, ReadBytes): Rework calls to TranslateOutputEOL to make it clear that a boolean value is being returned. Add some comments in an effort to make the code more clear. This patch makes no functional changes.
-rw-r--r--ChangeLog10
-rw-r--r--generic/tclIO.c19
2 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index edcb79d..24f8e34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2003-03-06 Mo DeJong <mdejong@users.sourceforge.net>
+ * generic/tclIO.c (WriteBytes, WriteChars,
+ Tcl_GetsObj, ReadBytes): Rework calls to
+ TranslateOutputEOL to make it clear that
+ a boolean value is being returned.
+ Add some comments in an effort to make
+ the code more clear. This patch makes
+ no functional changes.
+
+2003-03-06 Mo DeJong <mdejong@users.sourceforge.net>
+
* generic/tclIO.c (Tcl_SetChannelOption):
Invoke the Tcl_SetChannelBufferSize method
as a result of changing the -buffersize
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 250fd2c..f972480 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.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: tclIO.c,v 1.62 2003/03/06 09:16:19 mdejong Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.63 2003/03/06 09:47:49 mdejong Exp $
*/
#include "tclInt.h"
@@ -3006,7 +3006,9 @@ WriteBytes(chanPtr, src, srcLen)
dstLen--;
sawLF++;
}
- sawLF += TranslateOutputEOL(statePtr, dst, src, &dstLen, &toWrite);
+ if (TranslateOutputEOL(statePtr, dst, src, &dstLen, &toWrite)) {
+ sawLF++;
+ }
dstLen += savedLF;
savedLF = 0;
@@ -3104,7 +3106,9 @@ WriteChars(chanPtr, src, srcLen)
stageLen--;
sawLF++;
}
- sawLF += TranslateOutputEOL(statePtr, stage, src, &stageLen, &toWrite);
+ if (TranslateOutputEOL(statePtr, stage, src, &stageLen, &toWrite)) {
+ sawLF++;
+ }
stage -= savedLF;
stageLen += savedLF;
@@ -3169,7 +3173,7 @@ WriteChars(chanPtr, src, srcLen)
/*
* The following code must be executed only when result is not 0.
*/
- if (result && ((stageRead + dstWrote) == 0)) {
+ if ((result != 0) && ((stageRead + dstWrote) == 0)) {
/*
* We have an incomplete UTF-8 character at the end of the
* staging buffer. It will get moved to the beginning of the
@@ -3602,6 +3606,13 @@ Tcl_GetsObj(chan, objPtr)
for (eol = dst; eol < dstEnd; eol++) {
if (*eol == '\r') {
eol++;
+
+ /*
+ * If a CR is at the end of the buffer,
+ * then check for a LF at the begining
+ * of the next buffer.
+ */
+
if (eol >= dstEnd) {
int offset;