summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkImgBmap.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index f8a1d6e..03ebd1d 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -31,10 +31,10 @@ typedef struct BitmapMaster {
* deleted. */
int width, height; /* Dimensions of image. */
char *data; /* Data comprising bitmap (suitable for
- * input to XCreateBitmapFromData). May
+ * input to TkCreateBitmapFromData). May
* be NULL if no data. Malloc'ed. */
char *maskData; /* Data for bitmap's mask (suitable for
- * input to XCreateBitmapFromData).
+ * input to TkCreateBitmapFromData).
* Malloc'ed. */
Tk_Uid fgUid; /* Value of -foreground option (malloc'ed). */
Tk_Uid bgUid; /* Value of -background option (malloc'ed). */
@@ -375,7 +375,7 @@ ImgBmapConfigureInstance(instancePtr)
instancePtr->bitmap = None;
}
if (masterPtr->data != NULL) {
- instancePtr->bitmap = XCreateBitmapFromData(
+ instancePtr->bitmap = TkCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
masterPtr->data, (unsigned) masterPtr->width,
@@ -387,7 +387,7 @@ ImgBmapConfigureInstance(instancePtr)
instancePtr->mask = None;
}
if (masterPtr->maskData != NULL) {
- instancePtr->mask = XCreateBitmapFromData(
+ instancePtr->mask = TkCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
masterPtr->maskData, (unsigned) masterPtr->width,
@@ -462,7 +462,7 @@ ImgBmapConfigureInstance(instancePtr)
char *
TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
hotXPtr, hotYPtr)
- Tcl_Interp *interp; /* For reporting errors. */
+ Tcl_Interp *interp; /* For reporting errors, or NULL. */
char *string; /* String describing bitmap. May
* be NULL. */
char *fileName; /* Name of file containing bitmap
@@ -481,7 +481,7 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
pi.string = string;
if (string == NULL) {
- if (Tcl_IsSafe(interp)) {
+ if ((interp != NULL) && Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't get bitmap data from a file in a",
" safe interpreter", (char *) NULL);
return NULL;
@@ -493,9 +493,12 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
pi.chan = Tcl_OpenFileChannel(interp, expandedFileName, "r", 0);
Tcl_DStringFree(&buffer);
if (pi.chan == NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "couldn't read bitmap file \"",
- fileName, "\": ", Tcl_PosixError(interp), (char *) NULL);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "couldn't read bitmap file \"",
+ fileName, "\": ", Tcl_PosixError(interp),
+ (char *) NULL);
+ }
return NULL;
}
} else {
@@ -573,9 +576,11 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
}
}
} else if ((pi.word[0] == '{') && (pi.word[1] == 0)) {
- Tcl_AppendResult(interp, "format error in bitmap data; ",
- "looks like it's an obsolete X10 bitmap file",
- (char *) NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "format error in bitmap data; ",
+ "looks like it's an obsolete X10 bitmap file",
+ (char *) NULL);
+ }
goto errorCleanup;
}
}
@@ -615,7 +620,9 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
return data;
error:
- interp->result = "format error in bitmap data";
+ if (interp != NULL) {
+ interp->result = "format error in bitmap data";
+ }
errorCleanup:
if (data != NULL) {
ckfree(data);