summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-10-05 18:22:21 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-10-05 18:22:21 (GMT)
commit501d0b1523e4a2b370c58cd262bbed99725a5ab1 (patch)
tree57b5f8cd5ff8ef866da62495bc435946f4655c50 /generic/tkImgPhoto.c
parent291d618cfb6ad5e935244599abbf1bdb93a284fc (diff)
downloadtk-501d0b1523e4a2b370c58cd262bbed99725a5ab1.zip
tk-501d0b1523e4a2b370c58cd262bbed99725a5ab1.tar.gz
tk-501d0b1523e4a2b370c58cd262bbed99725a5ab1.tar.bz2
Greatly clean up Tk's handling of the writability of the Tcl result object.
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 9644ecf..993ae46 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.81 2008/08/28 18:13:34 dgp Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.82 2008/10/05 18:22:21 dkf Exp $
*/
#include "tkImgPhoto.h"
@@ -512,6 +512,10 @@ ImgPhotoCmd(
if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
if (masterPtr->dataString) {
+ /*
+ * TODO: Modifying result is bad!
+ */
+
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
masterPtr->dataString);
} else {
@@ -522,6 +526,10 @@ ImgPhotoCmd(
!strncmp(arg, "-format", (unsigned) length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
if (masterPtr->format) {
+ /*
+ * TODO: Modifying result is bad!
+ */
+
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
masterPtr->format);
} else {
@@ -532,9 +540,10 @@ ImgPhotoCmd(
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
configSpecs, (char *) masterPtr, arg, 0);
}
+ } else {
+ return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
+ TK_CONFIG_ARGV_ONLY);
}
- return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
- TK_CONFIG_ARGV_ONLY);
case PHOTO_COPY:
/*
@@ -1146,7 +1155,7 @@ ImgPhotoCmd(
return TCL_ERROR;
}
if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ || (y < 0) || (y >= masterPtr->height)) {
Tcl_AppendResult(interp, Tcl_GetString(objv[0]),
" transparency get: coordinates out of range", NULL);
return TCL_ERROR;
@@ -1163,8 +1172,8 @@ ImgPhotoCmd(
TkClipBox(testRegion, &testBox);
TkDestroyRegion(testRegion);
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
- (testBox.width==0 && testBox.height==0));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
+ testBox.width==0 && testBox.height==0));
return TCL_OK;
}