diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-17 07:39:46 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-17 07:39:46 (GMT) |
commit | e9f3439f70e36130011ece4455e8e9bbfc691afa (patch) | |
tree | 2f38263db68f35960214381b1a45982cd2bcf92e | |
parent | 75b1bfa6a69a03025753a0672213d914dad956ac (diff) | |
download | tk-e9f3439f70e36130011ece4455e8e9bbfc691afa.zip tk-e9f3439f70e36130011ece4455e8e9bbfc691afa.tar.gz tk-e9f3439f70e36130011ece4455e8e9bbfc691afa.tar.bz2 |
Don't compile in ucs-2be encoding when Tk is compiled with Tcl 9.0 headers, since it's only used when Tk 8.7 is dynamically loaded in Tcl 8.6.
Also make sure that the Tcl_UtfCharComplete() call in this encoding is always the pre-TIP #575 version
-rw-r--r-- | unix/tkUnixFont.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index e30c07a..ccb9b30 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -238,6 +238,7 @@ static unsigned RankAttributes(FontAttributes *wantPtr, static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); +#if TCL_MAJOR_VERSION < 9 static int Ucs2beToUtfProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, @@ -246,6 +247,7 @@ static int UtfToUcs2beProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); +#endif /* *------------------------------------------------------------------------- @@ -312,7 +314,9 @@ TkpFontPkgInit( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; +#if TCL_MAJOR_VERSION < 9 Tcl_Encoding ucs2; +#endif if (tsdPtr->controlFamily.encoding == NULL) { @@ -333,6 +337,7 @@ TkpFontPkgInit( * if it doesn't exist yet. It is used in iso10646 fonts. */ +#if TCL_MAJOR_VERSION < 9 ucs2 = Tcl_GetEncoding(NULL, "ucs-2be"); if (ucs2 == NULL) { Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; @@ -340,6 +345,7 @@ TkpFontPkgInit( } else { Tcl_FreeEncoding(ucs2); } +#endif Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL); } } @@ -458,6 +464,7 @@ ControlUtfProc( *------------------------------------------------------------------------- */ +#if TCL_MAJOR_VERSION < 9 static int Ucs2beToUtfProc( TCL_UNUSED(void *), /* Not used. */ @@ -554,6 +561,14 @@ Ucs2beToUtfProc( *------------------------------------------------------------------------- */ +#if defined(USE_TCL_STUBS) +/* Since the UCS-2BE encoding is only used when Tk 8.7 is dynamically loaded in Tcl 8.6, + * make sure that Tcl_UtfCharComplete is ALWAYS the pre-TIP #575 version, + * even though Tk 8.7 is being compiled with -DTCL_NO_DEPRECATED! */ +# undef Tcl_UtfCharComplete +# define Tcl_UtfCharComplete ((int (*)(const char *, int))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[326])) +#endif + static int UtfToUcs2beProc( TCL_UNUSED(void *), /* TableEncodingData that specifies @@ -627,6 +642,7 @@ UtfToUcs2beProc( *dstCharsPtr = numChars; return result; } +#endif /* *--------------------------------------------------------------------------- |