summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-11-25 15:21:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-11-25 15:21:47 (GMT)
commit73d8b7fc3cfcf42f8c2917b6e3f537a274e9e12a (patch)
tree3021d6b5cf822e9bf515dc0ef6296c75ecd960e0
parentc04ad633b6af78a14437fcb2dff51c95bdb35d72 (diff)
downloadtcl-73d8b7fc3cfcf42f8c2917b6e3f537a274e9e12a.zip
tcl-73d8b7fc3cfcf42f8c2917b6e3f537a274e9e12a.tar.gz
tcl-73d8b7fc3cfcf42f8c2917b6e3f537a274e9e12a.tar.bz2
Clean compile on OSX - except for usual warnings - and passes test suite.
-rw-r--r--generic/tclIO.c14
-rw-r--r--generic/tclIORChan.c2
-rw-r--r--tests/io.test9
3 files changed, 11 insertions, 14 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 7be3cb9..16fd741 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -9171,8 +9171,8 @@ CopyData(
Tcl_Channel inChan, outChan;
ChannelState *inStatePtr, *outStatePtr;
int result = TCL_OK;
- ssize_t size;
- size_t sizeb;
+ ssize_t size, sizeb;
+ size_t sizeout;
Tcl_WideInt total;
const char *buffer;
int inBinary, outBinary, sameEncoding;
@@ -9238,7 +9238,7 @@ CopyData(
|| (csPtr->toRead > (Tcl_WideInt) csPtr->bufSize)) {
sizeb = csPtr->bufSize;
} else {
- sizeb = (int) csPtr->toRead;
+ sizeb = (size_t) csPtr->toRead;
}
if (inBinary || sameEncoding) {
@@ -9302,15 +9302,15 @@ CopyData(
if (inBinary || sameEncoding) {
buffer = csPtr->buffer;
- sizeb = size;
+ sizeout = size;
} else {
- buffer = TclGetStringFromObj(bufObj, &sizeb);
+ buffer = TclGetStringFromObj(bufObj, &sizeout);
}
if (outBinary || sameEncoding) {
- sizeb = DoWrite(outStatePtr->topChanPtr, buffer, sizeb);
+ sizeb = DoWrite(outStatePtr->topChanPtr, buffer, sizeout);
} else {
- sizeb = DoWriteChars(outStatePtr->topChanPtr, buffer, sizeb);
+ sizeb = DoWriteChars(outStatePtr->topChanPtr, buffer, sizeout);
}
/*
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 02a91e2..e57b42b 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -1479,7 +1479,7 @@ ReflectOutput(
SetChannelErrorStr(rcPtr->chan, msg_write_nothing);
goto invalid;
}
- if (toWrite < written) {
+ if (written >= 0 && toWrite < written) {
/*
* The handler claims to have written more than it was given. That is
* bad. Note that the I/O core would crash if we were to return this
diff --git a/tests/io.test b/tests/io.test
index 0688c14..c8ef5a5 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -94,7 +94,7 @@ proc contents {file} {
close $f
return $a
}
-
+
test io-1.5 {Tcl_WriteChars: CheckChannelErrors} {emptyTest} {
# no test, need to cause an async error.
} {}
@@ -6875,7 +6875,7 @@ test io-53.5 {CopyData: error during fcopy} {socket fcopy} {
close $listen ;# This means the socket open never really succeeds
fcopy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
- if ![info exists fcopyTestDone] {
+ if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone] ;# The error occurs here in the b.g.
}
close $in
@@ -7555,8 +7555,6 @@ test io-70.0 {Cutting & Splicing channels} {testchannel} {
set res
} {0 1 0}
-
-
test io-70.1 {Transfer channel} {testchannel thread} {
set f [makeFile {... dummy ...} cutsplice]
set c [open $f r]
@@ -7774,7 +7772,6 @@ test io-73.1 {channel Tcl_Obj SetChannelFromAny} {} {
# Test for Bug 1847044 - don't spoil type unless we have a valid channel
catch {close [lreplace [list a] 0 end]}
} {1}
-
test io-73.2 {channel Tcl_Obj SetChannelFromAny, bug 2407783} -setup {
# Invalidate intrep of 'channel' Tcl_Obj when transiting between interpreters.
set f [open [info script] r]
@@ -7787,7 +7784,7 @@ test io-73.2 {channel Tcl_Obj SetChannelFromAny, bug 2407783} -setup {
} -cleanup {
close $f
} -result {1 {can not find channel named "@@"}}
-
+
# ### ### ### ######### ######### #########
# cleanup