summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-05-03 18:03:13 (GMT)
committerhobbs <hobbs>2004-05-03 18:03:13 (GMT)
commit29f9a26ab63583f320e15f62cf93033cd448cffb (patch)
tree8253356e3d0bc795fe1f4da9b726fcca1ea45577 /generic/tkImgPhoto.c
parent42f3bec566f510c6aa0dbc7d9391fce3dc96defa (diff)
downloadtk-29f9a26ab63583f320e15f62cf93033cd448cffb.zip
tk-29f9a26ab63583f320e15f62cf93033cd448cffb.tar.gz
tk-29f9a26ab63583f320e15f62cf93033cd448cffb.tar.bz2
* generic/tkImgPhoto.c (ImgPhotoConfigureMaster): force -data into
ByteArray and -format into String to correctly handle them if they have been shimmered or created as some other object type.
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index ee43846..2d7f7a0 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.46 2004/03/31 02:43:10 dgp Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.47 2004/05/03 18:03:13 hobbs Exp $
*/
#include "tkInt.h"
@@ -1986,9 +1986,12 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
masterPtr->fileString = NULL;
}
if (data) {
- if (data->length
- || (data->typePtr == Tcl_GetObjType("bytearray")
- && data->internalRep.otherValuePtr != NULL)) {
+ /*
+ * Force into ByteArray format, which most (all) image handlers
+ * will use anyway. Empty length means ignore the -data option.
+ */
+ (void) Tcl_GetByteArrayFromObj(data, &length);
+ if (length) {
Tcl_IncrRefCount(data);
} else {
data = NULL;
@@ -1999,7 +2002,12 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
masterPtr->dataString = data;
}
if (format) {
- if (format->length) {
+ /*
+ * Stringify to ignore -format "". It may come in as a list or
+ * other object.
+ */
+ (void) Tcl_GetStringFromObj(format, &length);
+ if (length) {
Tcl_IncrRefCount(format);
} else {
format = NULL;