diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-16 12:36:40 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-16 12:36:40 (GMT) |
commit | a96a4263f85fa276c74672a7e28251691f0c7680 (patch) | |
tree | 83188d92aa77a52a178e0ae85ba5439c402f4eca /generic/tkCanvWind.c | |
parent | da1c30ff0d8a05251ef3ab0e9f6a5c5bae6f7b14 (diff) | |
download | tk-a96a4263f85fa276c74672a7e28251691f0c7680.zip tk-a96a4263f85fa276c74672a7e28251691f0c7680.tar.gz tk-a96a4263f85fa276c74672a7e28251691f0c7680.tar.bz2 |
Working towards adding all the Tcl_SetErrorCode calls that should be there.
** WORK IN PROGRESS **
Diffstat (limited to 'generic/tkCanvWind.c')
-rw-r--r-- | generic/tkCanvWind.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index f2cce7d..0c54741 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -246,22 +246,19 @@ WinItemCoords( WindowItem *winItemPtr = (WindowItem *) itemPtr; if (objc == 0) { - Tcl_Obj *obj = Tcl_NewObj(); - Tcl_Obj *subobj = Tcl_NewDoubleObj(winItemPtr->x); - Tcl_ListObjAppendElement(interp, obj, subobj); - subobj = Tcl_NewDoubleObj(winItemPtr->y); - Tcl_ListObjAppendElement(interp, obj, subobj); - Tcl_SetObjResult(interp, obj); + Tcl_Obj *objs[2]; + + objs[0] = Tcl_NewDoubleObj(winItemPtr->x); + objs[1] = Tcl_NewDoubleObj(winItemPtr->y); + Tcl_SetObjResult(interp, Tcl_NewListObj(2, objs)); } else if (objc < 3) { if (objc==1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 2) { - char buf[64 + TCL_INTEGER_SPACE]; - - sprintf(buf, "wrong # coordinates: expected 2, got %d", objc); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "wrong # coordinates: expected 2, got %d", objc)); return TCL_ERROR; } } @@ -272,10 +269,8 @@ WinItemCoords( } ComputeWindowBbox(canvas, winItemPtr); } else { - char buf[64 + TCL_INTEGER_SPACE]; - - sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "wrong # coordinates: expected 0 or 2, got %d", objc)); return TCL_ERROR; } return TCL_OK; |