diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
commit | b501910778714de837dc4367698256e996737e9b (patch) | |
tree | f2dc6d4861ea238a538f41c4306249dad1ac3ea5 /generic/tclIORTrans.c | |
parent | f7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff) | |
download | tcl-b501910778714de837dc4367698256e996737e9b.zip tcl-b501910778714de837dc4367698256e996737e9b.tar.gz tcl-b501910778714de837dc4367698256e996737e9b.tar.bz2 |
Code Audit results:
* use do { ... } while (0) in macros
* avoid shadowing one local variable with another
* use clearer 'foo.bar++;' instead of '++foo.bar;' where result not
required (i.e., semantically equivalent)
* follow Engineering Manual rules on spacing and declarations
Diffstat (limited to 'generic/tclIORTrans.c')
-rw-r--r-- | generic/tclIORTrans.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index a6e7ed5..dcad087 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIORTrans.c,v 1.12 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclIORTrans.c,v 1.13 2010/03/05 14:34:04 dkf Exp $ */ #include <tclInt.h> @@ -1058,7 +1058,7 @@ ReflectInput( int *errorCodePtr) { ReflectedTransform *rtPtr = clientData; - int gotBytes, copied, read; + int gotBytes, copied, readBytes; /* * The following check can be done before thread redirection, because we @@ -1124,8 +1124,8 @@ ReflectInput( return gotBytes; } - read = Tcl_ReadRaw(rtPtr->parent, buf, toRead); - if (read < 0) { + readBytes = Tcl_ReadRaw(rtPtr->parent, buf, toRead); + if (readBytes < 0) { /* * Report errors to caller. The state of the seek system is * unchanged! @@ -1144,7 +1144,7 @@ ReflectInput( return -1; } - if (read == 0) { + if (readBytes == 0) { /* * Check wether we hit on EOF in 'parent' or not. If not * differentiate between blocking and non-blocking modes. In @@ -1200,7 +1200,7 @@ ReflectInput( ((Channel *) rtPtr->parent)->state->flags &= ~CHANNEL_EOF; continue; /* at: while (toRead > 0) */ } - } /* read == 0 */ + } /* readBytes == 0 */ /* * Transform the read chunk, which was not empty. Anything we got back @@ -1208,7 +1208,7 @@ ReflectInput( * iteration will put it into the result. */ - if (!TransformRead(rtPtr, errorCodePtr, UCHARP(buf), read)) { + if (!TransformRead(rtPtr, errorCodePtr, UCHARP(buf), readBytes)) { return -1; } } /* while toRead > 0 */ @@ -2656,9 +2656,7 @@ ForwardProc( break; } - case ForwardedLimit: { - Tcl_Obj *resObj; - + case ForwardedLimit: if (InvokeTclMethod(rtPtr, "limit?", NULL, NULL, &resObj) != TCL_OK) { ForwardSetObjError(paramPtr, resObj); paramPtr->limit.max = -1; @@ -2670,7 +2668,6 @@ ForwardProc( Tcl_DecrRefCount(resObj); break; - } default: /* |