summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2019-11-22 17:09:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2019-11-22 17:09:18 (GMT)
commit6391ee591b496a5bd7640daa7669c1548f2f03a5 (patch)
tree197a84d805e3985f8b44ea3185cebbd943385a9b /unix
parent8e1942061fef5d51c075e2a8591c78ad1a372799 (diff)
parent0d9d82a93075017a8d03b884740a6b342d2a01a2 (diff)
downloadtk-6391ee591b496a5bd7640daa7669c1548f2f03a5.zip
tk-6391ee591b496a5bd7640daa7669c1548f2f03a5.tar.gz
tk-6391ee591b496a5bd7640daa7669c1548f2f03a5.tar.bz2
merge trunk
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixFont.c4
-rw-r--r--unix/tkUnixRFont.c15
-rw-r--r--unix/tkUnixWm.c9
3 files changed, 23 insertions, 5 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index d352c16..9a8d1f7 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -63,7 +63,7 @@ typedef struct FontFamily {
/* Two-level sparse table used to determine
* quickly if the specified character exists.
* As characters are encountered, more pages
- * in this table are dynamically alloced. The
+ * in this table are dynamically allocated. The
* contents of each page is a bitmask
* consisting of FONTMAP_BITSPERPAGE bits,
* representing whether this font can be used
@@ -520,7 +520,7 @@ Ucs2beToUtfProc(
* UCS-2BE. We know this is an LE->BE swap.
*/
- dst += TkUniCharToUtf(htons(*((short *)src)), dst);
+ dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst);
src += 2 /* sizeof(UCS-2) */;
}
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index bca193a..e69dab0 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -74,6 +74,15 @@ static Tcl_ThreadDataKey dataKey;
*-------------------------------------------------------------------------
*/
+
+static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes)
+{
+ if (numBytes >= 6) {
+ return TkUtfToUniChar(source, (int *)c);
+ }
+ return FcUtf8ToUcs4((const FcChar8 *)source, c, numBytes);
+}
+
void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
@@ -897,7 +906,7 @@ Tk_DrawChars(
XftFont *ftFont;
FcChar32 c;
- clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ clen = utf8ToUcs4(source, &c, numBytes);
if (clen <= 0) {
/*
* This should not happen, but it can.
@@ -1037,7 +1046,7 @@ TkDrawAngledChars(
XftFont *ftFont;
FcChar32 c;
- clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ clen = utf8ToUcs4(source, &c, numBytes);
if (clen <= 0) {
/*
* This should not happen, but it can.
@@ -1141,7 +1150,7 @@ TkDrawAngledChars(
XftFont *ftFont, *ft0Font;
FcChar32 c;
- clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ clen = utf8ToUcs4(source, &c, numBytes);
if (clen <= 0) {
/*
* This should not happen, but it can.
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index f9cf4e7..490a1ea 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -2444,6 +2444,10 @@ WmIconphotoCmd(
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
ckfree((char *) iconPropertyData);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "failed to create an iconphoto with image \"%s\"",
+ Tcl_GetString(objv[i])));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
return TCL_ERROR;
}
Tk_PhotoGetSize(photo, &width, &height);
@@ -3265,6 +3269,8 @@ WmStackorderCmd(
ckfree(windows);
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
+ } else {
+ return TCL_ERROR;
}
} else {
Tk_Window relWin;
@@ -6428,6 +6434,9 @@ TkWmStackorderToplevel(
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
+ if (windows == NULL) {
+ return NULL;
+ }
/*
* Special cases: If zero or one toplevels were mapped there is no need to