Tk Source Code

Check-in [d7b67f5b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use Tcl_UtfToChar16DString() in stead of Tcl_UtfToUniCharDString(), since the first is guaranteed to be 16-bit for any TCL_UTF_MAX value.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d7b67f5b6a46bad31cfe4e3293e5f6289548326268ad592de0474214825370db
User & Date: jan.nijtmans 2019-12-04 23:11:16
Context
2019-12-05
13:11
Merge 8.6 check-in: efcce960 user: jan.nijtmans tags: trunk
2019-12-04
23:11
Use Tcl_UtfToChar16DString() in stead of Tcl_UtfToUniCharDString(), since the first is guaranteed to be 16-bit for any TCL_UTF_MAX value. check-in: d7b67f5b user: jan.nijtmans tags: trunk
22:38
Merge 8.6. Introduce the new Unicode-handling functions here too: Tk 8.7 could be loaded in Tcl 8.6 .... Further improvements are still possible check-in: 2c72c39e user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkInt.h.

65
66
67
68
69
70
71


72
73
74
75
76
77
78
#	define TkSizeT int
#   endif
#endif

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7)
# define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString
# define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString


#endif

/*
 * Macros used to cast between pointers and integers (e.g. when storing an int
 * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
 * to/from pointer from/to integer of different size".
 */






>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#	define TkSizeT int
#   endif
#endif

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7)
# define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString
# define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString
# define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString
# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString
#endif

/*
 * Macros used to cast between pointers and integers (e.g. when storing an int
 * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
 * to/from pointer from/to integer of different size".
 */

Changes to macosx/tkMacOSXFont.c.

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
   const char *source,
   size_t numBytes)
{
    NSString *string;
    Tcl_DString ds;

    Tcl_DStringInit(&ds);
    Tcl_UtfToUniCharDString(source, numBytes, &ds);
    string = [[NSString alloc] initWithCharacters:(const unichar *)Tcl_DStringValue(&ds)
	    length:(Tcl_DStringLength(&ds)>>1)];
    Tcl_DStringFree(&ds);
    return string;
}
 
/*






|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
   const char *source,
   size_t numBytes)
{
    NSString *string;
    Tcl_DString ds;

    Tcl_DStringInit(&ds);
    Tcl_UtfToChar16DString(source, numBytes, &ds);
    string = [[NSString alloc] initWithCharacters:(const unichar *)Tcl_DStringValue(&ds)
	    length:(Tcl_DStringLength(&ds)>>1)];
    Tcl_DStringFree(&ds);
    return string;
}
 
/*