Tk Source Code

Check-in [9fe4ab4e]
Login

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

Overview
Comment:Fix handling of -1 in tkMain.c, undo accidental change in tkUnixFont.c
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tip-548
Files: files | file ages | folders
SHA3-256: 9fe4ab4e993430c8feecf8bacb5a6f80669e0edacc5f9b7e47d41414e4199a0b
User & Date: jan.nijtmans 2019-06-11 12:34:16.195
Context
2019-06-11
12:52
Missing Tcl_DStringInit() call. check-in: 08f54084 user: jan.nijtmans tags: tip-548
12:34
Fix handling of -1 in tkMain.c, undo accidental change in tkUnixFont.c check-in: 9fe4ab4e user: jan.nijtmans tags: tip-548
11:39
More TCHAR -> WCHAR conversions check-in: 7550f481 user: jan.nijtmans tags: tip-548
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tkMain.c.
81
82
83
84
85
86
87



88
89
90
91
92
93
94
    TCHAR *string,
    int length)
{
    Tcl_Obj *obj;
    Tcl_DString ds;

#ifdef UNICODE



    Tcl_DStringInit(&ds);
    Tcl_UniCharToUtfDString(string, length, &ds);
#else
    Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds);
#endif
    obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
    Tcl_DStringFree(&ds);







>
>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    TCHAR *string,
    int length)
{
    Tcl_Obj *obj;
    Tcl_DString ds;

#ifdef UNICODE
    if (length < 0) {
	length = wcslen(string);
    }
    Tcl_DStringInit(&ds);
    Tcl_UniCharToUtfDString(string, length, &ds);
#else
    Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds);
#endif
    obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
    Tcl_DStringFree(&ds);
Changes to unix/tkUnixFont.c.
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
			    int *numNamesPtr);
static char **		ListFontOrAlias(Display *display, const char*faceName,
			    int *numNamesPtr);
static unsigned		RankAttributes(FontAttributes *wantPtr,
			    FontAttributes *gotPtr);
static void		ReleaseFont(UnixFont *fontPtr);
static void		ReleaseSubFont(Display *display, SubFont *subFontPtr);
static int		SeenName(const WCHAR *name, Tcl_DString *dsPtr);
#ifndef WORDS_BIGENDIAN
static int		Ucs2beToUtfProc(ClientData clientData, const char*src,
			    int srcLen, int flags, Tcl_EncodingState*statePtr,
			    char *dst, int dstLen, int *srcReadPtr,
			    int *dstWrotePtr, int *dstCharsPtr);
static int		UtfToUcs2beProc(ClientData clientData, const char*src,
			    int srcLen, int flags, Tcl_EncodingState*statePtr,







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
			    int *numNamesPtr);
static char **		ListFontOrAlias(Display *display, const char*faceName,
			    int *numNamesPtr);
static unsigned		RankAttributes(FontAttributes *wantPtr,
			    FontAttributes *gotPtr);
static void		ReleaseFont(UnixFont *fontPtr);
static void		ReleaseSubFont(Display *display, SubFont *subFontPtr);
static int		SeenName(const char *name, Tcl_DString *dsPtr);
#ifndef WORDS_BIGENDIAN
static int		Ucs2beToUtfProc(ClientData clientData, const char*src,
			    int srcLen, int flags, Tcl_EncodingState*statePtr,
			    char *dst, int dstLen, int *srcReadPtr,
			    int *dstWrotePtr, int *dstCharsPtr);
static int		UtfToUcs2beProc(ClientData clientData, const char*src,
			    int srcLen, int flags, Tcl_EncodingState*statePtr,