diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-01 16:39:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-01 16:39:49 (GMT) |
commit | 226ae51f58137fc6d818f72dfe25a2d123f30f2c (patch) | |
tree | 6552f311fad9455ad216ba98b309f56534080b8e /unix | |
parent | 27aa537eef0dd848310938a5214909b070e92a1f (diff) | |
parent | 2156b8f27a1daba1ff6be50810e837283b9ec589 (diff) | |
download | tk-226ae51f58137fc6d818f72dfe25a2d123f30f2c.zip tk-226ae51f58137fc6d818f72dfe25a2d123f30f2c.tar.gz tk-226ae51f58137fc6d818f72dfe25a2d123f30f2c.tar.bz2 |
Merge 8.6. When compiling against Tcl 9.0 headers, don't allow Emoji escape sequences to be split into two surrugates any more.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixColor.c | 10 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 21 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 2 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 2 |
4 files changed, 19 insertions, 16 deletions
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index 512b20c..96e8937 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -136,17 +136,17 @@ TkpGetColor( if (*name != '#') { XColor screen; - if (((*name - 'A') & 0xdf) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { - if (!((name[0] - 'G') & 0xdf) && !((name[1] - 'R') & 0xdf) - && !((name[2] - 'A') & 0xdb) && !((name[3] - 'Y') & 0xdf) + if (((*name - 'A') & 0xDF) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { + if (!((name[0] - 'G') & 0xDF) && !((name[1] - 'R') & 0xDF) + && !((name[2] - 'A') & 0xDB) && !((name[3] - 'Y') & 0xDF) && !name[4]) { name = "#808080808080"; goto gotWebColor; } else { - const char *p = tkWebColors[((*name - 'A') & 0x1f)]; + const char *p = tkWebColors[((*name - 'A') & 0x1F)]; if (p) { const char *q = name; - while (!((*p - *(++q)) & 0xdf)) { + while (!((*p - *(++q)) & 0xDF)) { if (!*p++) { name = p; goto gotWebColor; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index a3dfa5f..f448da7 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -415,15 +415,15 @@ ControlUtfProc( dst += 2; } else if ((size_t)ch < 256) { dst[1] = 'x'; - dst[2] = hexChars[(ch >> 4) & 0xf]; - dst[3] = hexChars[ch & 0xf]; + dst[2] = hexChars[(ch >> 4) & 0xF]; + dst[3] = hexChars[ch & 0xF]; dst += 4; } else if ((size_t)ch < 0x10000) { dst[1] = 'u'; - dst[2] = hexChars[(ch >> 12) & 0xf]; - dst[3] = hexChars[(ch >> 8) & 0xf]; - dst[4] = hexChars[(ch >> 4) & 0xf]; - dst[5] = hexChars[ch & 0xf]; + dst[2] = hexChars[(ch >> 12) & 0xF]; + dst[3] = hexChars[(ch >> 8) & 0xF]; + dst[4] = hexChars[(ch >> 4) & 0xF]; + dst[5] = hexChars[ch & 0xF]; dst += 6; } else { /* TODO we can do better here */ @@ -610,13 +610,16 @@ UtfToUcs2beProc( break; } src += TkUtfToUniChar(src, &ch); + if (ch > 0xFFFF) { + ch = 0xFFFD; + } /* * Ensure big-endianness (store big bits first). */ - *dst++ = (char)(ch >> 8); - *dst++ = (char)ch; + *dst++ = (char)((ch >> 8) & 0xFF); + *dst++ = (char)(ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; @@ -1976,7 +1979,7 @@ FindSubFontForChar( Tcl_DString ds; if (ch < 0 || ch > 0x30000) { - ch = 0xfffd; + ch = 0xFFFD; } for (i = 0; i < fontPtr->numSubFonts; i++) { diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 0d3d255..6abb2fd 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -1110,7 +1110,7 @@ TkpComputeMenubarGeometry( maxWindowWidth = Tk_Width(menuPtr->tkwin); if (maxWindowWidth == 1) { - maxWindowWidth = 0x7ffffff; + maxWindowWidth = 0x7FFFFFF; } currentRowHeight = 0; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index e69dab0..37b2f95 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -836,7 +836,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */ fontPtr->colors[last].color.color.red = xcolor.red; fontPtr->colors[last].color.color.green = xcolor.green; fontPtr->colors[last].color.color.blue = xcolor.blue; - fontPtr->colors[last].color.color.alpha = 0xffff; + fontPtr->colors[last].color.color.alpha = 0xFFFF; fontPtr->colors[last].color.pixel = pixel; /* |