diff options
author | dgp <dgp@users.sourceforge.net> | 2005-09-14 21:32:16 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-09-14 21:32:16 (GMT) |
commit | 62b5bf66c2c8dda87b14b78f81bc58a02cdfb172 (patch) | |
tree | 82a5606aa3a2ef7d0ea577afdb0814e7a2a96e48 /generic/tclIORChan.c | |
parent | dc74c2b374a963186c53482685a2c91773ade3da (diff) | |
download | tcl-62b5bf66c2c8dda87b14b78f81bc58a02cdfb172.zip tcl-62b5bf66c2c8dda87b14b78f81bc58a02cdfb172.tar.gz tcl-62b5bf66c2c8dda87b14b78f81bc58a02cdfb172.tar.bz2 |
* generic/tclStringObj.c: Bug fixes: ObjPrintfVA needed to
support "*" fields and needed to interpret precision limits on
%s conversions as a maximum number of bytes, not Tcl_UniChars, to
take from the (char *) argument.
* generic/tclBasic.c: Updated several callers to use
* generic/tclCkalloc.c: TclFormatToErrorInfo() and/or
* generic/tclCmdAH.c: TclObjPrintf().
* generic/tclCmdIL.c:
* generic/tclCmdMZ.c:
* generic/tclDictObj.c:
* generic/tclExecute.c:
* generic/tclIORChan.c:
* generic/tclIOUtil.c:
* generic/tclNamesp.c:
* generic/tclProc.c:
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r-- | generic/tclIORChan.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 26cc50c..13b8028 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.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: tclIORChan.c,v 1.3 2005/09/09 19:09:48 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.4 2005/09/14 21:32:17 dgp Exp $ */ #include <tclInt.h> @@ -1723,16 +1723,10 @@ RcGetOption (clientData, interp, optionName, dsPtr) if ((listc % 2) == 1) { /* Odd number of elements is wrong. */ - - char buf [20]; - - sprintf (buf, "%d", listc); - Tcl_ResetResult (interp); - Tcl_AppendResult (interp, - "Expected list with even number of elements, got ", - buf, (listc == 1 ? " element" : " elements"), - " instead", (char*) NULL); - + Tcl_ResetResult(interp); + TclObjPrintf(NULL, Tcl_GetObjResult(interp), + "Expected list with even number of elements, got %d element%s instead", + listc, (listc == 1 ? "" : "s")); Tcl_DecrRefCount (resObj); /* Remove reference we held from the invoke */ return TCL_ERROR; } @@ -1965,21 +1959,19 @@ RcNewHandle () #endif static unsigned long rcCounter = 0; - char channelName [50]; - Tcl_Obj* res = Tcl_NewStringObj ("rc", -1); + Tcl_Obj* res = Tcl_NewObj (); #ifdef TCL_THREADS Tcl_MutexLock (&rcCounterMutex); #endif - sprintf (channelName, "%lu", (unsigned long) rcCounter); + TclObjPrintf(NULL, res, "rc%lu", rcCounter); rcCounter ++; #ifdef TCL_THREADS Tcl_MutexUnlock (&rcCounterMutex); #endif - Tcl_AppendStringsToObj (res, channelName, (char*) NULL); return res; } |