diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-18 10:29:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-18 10:29:41 (GMT) |
commit | b2a63152cbf72e7a23e9870d94bbf551373ef84b (patch) | |
tree | 7edbe522c18e704c6481c96aaa17f1163c688ca7 /generic/tclIO.c | |
parent | f1dbfbf21581370d5dad9cbeb4c8ac09f93fb30c (diff) | |
download | tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.zip tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.tar.gz tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.tar.bz2 |
Now that we have TCL_AUTO_LENGTH/TCL_IO_FAILURE macro's, use them to make code and documentation more readable.
Shifted to feature branch as a temporary measure since it doesn't build.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 621c728..4a32216 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -3986,8 +3986,8 @@ Tcl_ClearChannelHandlers( * No encoding conversions are applied to the bytes being read. * * Results: - * The number of bytes written or (size_t)-1 in case of error. If (size_t)-1, - * Tcl_GetErrno will return the error code. + * The number of bytes written or TCL_IO_FAILURE in case of error. If + * TCL_IO_FAILURE, Tcl_GetErrno will return the error code. * * Side effects: * May buffer up output and may cause output to be produced on the @@ -4040,8 +4040,8 @@ Tcl_Write( * No encoding conversions are applied to the bytes being read. * * Results: - * The number of bytes written or (size_t)-1 in case of error. If (size_t)-1, - * Tcl_GetErrno will return the error code. + * The number of bytes written or TCL_IO_FAILURE in case of error. If + * TCL_IO_FAILURE, Tcl_GetErrno will return the error code. * * Side effects: * May buffer up output and may cause output to be produced on the @@ -4054,7 +4054,7 @@ size_t Tcl_WriteRaw( Tcl_Channel chan, /* The channel to buffer output for. */ const char *src, /* Data to queue in output buffer. */ - size_t srcLen) /* Length of data in bytes, or (size_t)-1 for + size_t srcLen) /* Length of data in bytes, or -1 for * strlen(). */ { Channel *chanPtr = ((Channel *) chan); @@ -4064,10 +4064,10 @@ Tcl_WriteRaw( size_t written; if (CheckChannelErrors(statePtr, TCL_WRITABLE | CHANNEL_RAW_MODE) != 0) { - return (size_t)-1; + return TCL_IO_FAILURE; } - if (srcLen == (size_t)-1) { + if (srcLen == TCL_AUTO_LENGTH) { srcLen = strlen(src); } @@ -4077,7 +4077,7 @@ Tcl_WriteRaw( */ written = ChanWrite(chanPtr, src, srcLen, &errorCode); - if (written == (size_t)-1) { + if (written == TCL_IO_FAILURE) { Tcl_SetErrno(errorCode); } @@ -4097,8 +4097,8 @@ Tcl_WriteRaw( * specified channel to the topmost channel in a stack. * * Results: - * The number of bytes written or (size_t)-1 in case of error. If (size_t)-1, - * Tcl_GetErrno will return the error code. + * The number of bytes written or TCL_IO_FAILURE in case of error. If + * TCL_IO_FAILURE, Tcl_GetErrno will return the error code. * * Side effects: * May buffer up output and may cause output to be produced on the @@ -4112,7 +4112,7 @@ Tcl_WriteChars( Tcl_Channel chan, /* The channel to buffer output for. */ const char *src, /* UTF-8 characters to queue in output * buffer. */ - size_t len) /* Length of string in bytes, or (size_t)-1 for + size_t len) /* Length of string in bytes, or -1 for * strlen(). */ { Channel *chanPtr = (Channel *) chan; @@ -6614,7 +6614,7 @@ TranslateInputEOL( * channel, at either the head or tail of the queue. * * Results: - * The number of bytes stored in the channel, or (size_t)-1 on error. + * The number of bytes stored in the channel, or TCL_IO_FAILURE on error. * * Side effects: * Adds input to the input queue of a channel. @@ -6650,7 +6650,7 @@ Tcl_Ungets( flags = statePtr->flags; if (CheckChannelErrors(statePtr, TCL_READABLE) != 0) { - len = (size_t)-1; + len = TCL_IO_FAILURE; goto done; } statePtr->flags = flags; |