summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-05-03 17:59:21 (GMT)
committerhobbs <hobbs>2004-05-03 17:59:21 (GMT)
commit8d848e4fd32bdda554af3dd22918b3cfa66e8044 (patch)
tree47cb961ee8339a28f3d7b74587de0c03d00d672e
parente3ccc9a83efec3a4d83bb8f8d8576a6f87123b8b (diff)
downloadtk-8d848e4fd32bdda554af3dd22918b3cfa66e8044.zip
tk-8d848e4fd32bdda554af3dd22918b3cfa66e8044.tar.gz
tk-8d848e4fd32bdda554af3dd22918b3cfa66e8044.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. (ImgPhotoCmd): correctly init matched to 0.
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkImgPhoto.c19
2 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d1848cd..78e9efb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * 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.
+ (ImgPhotoCmd): correctly init matched to 0.
+
2004-04-20 Joe English <jenglish@users.sourceforge.net>
* unix/tkUnixWm.c: Backported fix for bug #915350
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index a969082..eea00ef 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.36.2.6 2004/03/26 22:01:26 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.7 2004/05/03 17:59:21 hobbs Exp $
*/
#include "tkInt.h"
@@ -947,6 +947,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
}
}
+ matched = 0;
if (stringWriteProc == NULL) {
oldformat = 1;
for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
@@ -1954,9 +1955,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;
@@ -1967,7 +1971,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;