diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-11-08 22:52:29 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-11-08 22:52:29 (GMT) |
commit | 6bb91a5313a57dceb34e2cd3764971af61368408 (patch) | |
tree | 307fda8121ab3396f4464ecccf7f5167defc07dd /generic/tkScale.c | |
parent | b2576f90de3e5a4860a8c5d13b864ee10225f5d6 (diff) | |
download | tk-6bb91a5313a57dceb34e2cd3764971af61368408.zip tk-6bb91a5313a57dceb34e2cd3764971af61368408.tar.gz tk-6bb91a5313a57dceb34e2cd3764971af61368408.tar.bz2 |
More small changes to use C89 better and manage the result more efficiently.
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r-- | generic/tkScale.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c index 374cc1e..542fc82 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.32 2008/10/30 23:18:59 nijtmans Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.33 2008/11/08 22:52:29 dkf Exp $ */ #include "default.h" @@ -303,7 +303,7 @@ Tk_ScaleObjCmd( return TCL_ERROR; } - Tcl_SetResult(interp, Tk_PathName(scalePtr->tkwin), TCL_STATIC); + Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin)); return TCL_OK; } @@ -357,9 +357,8 @@ ScaleWidgetObjCmd( scalePtr->optionTable, objv[2], scalePtr->tkwin); if (objPtr == NULL) { goto error; - } else { - Tcl_SetObjResult(interp, objPtr); } + Tcl_SetObjResult(interp, objPtr); break; case COMMAND_CONFIGURE: if (objc <= 3) { @@ -368,17 +367,15 @@ ScaleWidgetObjCmd( (objc == 3) ? objv[2] : NULL, scalePtr->tkwin); if (objPtr == NULL) { goto error; - } else { - Tcl_SetObjResult(interp, objPtr); } + Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureScale(interp, scalePtr, objc-2, objv+2); } break; case COMMAND_COORDS: { - int x, y ; + int x, y; double value; - char buf[TCL_INTEGER_SPACE * 2]; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?"); @@ -400,14 +397,12 @@ ScaleWidgetObjCmd( y = scalePtr->horizTroughY + scalePtr->width/2 + scalePtr->borderWidth; } - sprintf(buf, "%d %d", x, y); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d", x, y)); break; } case COMMAND_GET: { double value; int x, y; - char buf[TCL_DOUBLE_SPACE]; if ((objc != 2) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?"); @@ -422,8 +417,7 @@ ScaleWidgetObjCmd( } value = TkScalePixelToValue(scalePtr, x, y); } - sprintf(buf, scalePtr->format, value); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf(scalePtr->format, value)); break; } case COMMAND_IDENTIFY: { |