summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXBitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXBitmap.c')
-rw-r--r--macosx/tkMacOSXBitmap.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index f503460..52768c6 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -55,7 +55,7 @@ typedef struct {
char *value;
} IconBitmap;
-static const char *iconBitmapOptionStrings[] = {
+static const char *const iconBitmapOptionStrings[] = {
"-file", "-fileType", "-osType", "-systemType", "-namedImage",
"-imageFile", NULL
};
@@ -97,8 +97,8 @@ TkpDefineNativeBitmaps(void)
name = Tk_GetUid(builtInPtr->name);
predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew);
if (isNew) {
- TkPredefBitmap *predefPtr = (TkPredefBitmap *)
- ckalloc(sizeof(TkPredefBitmap));
+ TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap));
+
predefPtr->source = UINT2PTR(builtInPtr->iconType);
predefPtr->width = builtInIconSize;
predefPtr->height = builtInIconSize;
@@ -166,7 +166,7 @@ GetBitmapForIcon(
Pixmap
TkpCreateNativeBitmap(
Display *display,
- const char *source) /* Info about the icon to build. */
+ const void *source) /* Info about the icon to build. */
{
Pixmap pixmap;
IconRef icon;
@@ -394,7 +394,8 @@ TkMacOSXIconBitmapObjCmd(
}
name = Tcl_GetStringFromObj(objv[i++], &len);
if (!len) {
- Tcl_AppendResult(interp, "empty bitmap name", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap name", -1));
+ Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "BAD", NULL);
goto end;
}
if (Tcl_GetIntFromObj(interp, objv[i++], &ib.width) != TCL_OK) {
@@ -403,25 +404,29 @@ TkMacOSXIconBitmapObjCmd(
if (Tcl_GetIntFromObj(interp, objv[i++], &ib.height) != TCL_OK) {
goto end;
}
- if (Tcl_GetIndexFromObj(interp, objv[i++], iconBitmapOptionStrings,
- "kind", TCL_EXACT, &ib.kind) != TCL_OK) {
+ if (Tcl_GetIndexFromObjStruct(interp, objv[i++], iconBitmapOptionStrings,
+ sizeof(char *), "kind", TCL_EXACT, &ib.kind) != TCL_OK) {
goto end;
}
value = Tcl_GetStringFromObj(objv[i++], &len);
if (!len) {
- Tcl_AppendResult(interp, "empty bitmap value", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap value", -1));
+ Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "EMPTY", NULL);
goto end;
}
#if 0
if ((kind == ICON_TYPE || kind == ICON_SYSTEM)) {
Tcl_DString ds;
Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
+
Tcl_UtfToExternalDString(encoding, value, -1, &ds);
len = Tcl_DStringLength(&ds);
Tcl_DStringFree(&ds);
Tcl_FreeEncoding(encoding);
if (len > 4) {
- Tcl_AppendResult(interp, "invalid bitmap value", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "invalid bitmap value", -1));
+ Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "INVALID", NULL);
goto end;
}
}
@@ -436,12 +441,12 @@ TkMacOSXIconBitmapObjCmd(
iconBitmap = Tcl_GetHashValue(hPtr);
ckfree(iconBitmap->value);
} else {
- iconBitmap = (IconBitmap *) ckalloc(sizeof(IconBitmap));
+ iconBitmap = ckalloc(sizeof(IconBitmap));
Tcl_SetHashValue(hPtr, iconBitmap);
}
*iconBitmap = ib;
result = TCL_OK;
-end:
+ end:
return result;
}