diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-16 07:41:01 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-16 07:41:01 (GMT) |
commit | b759c79faef78af4298e356f590b3d3a35b5ae01 (patch) | |
tree | 086c86b546650518426dcc5803be311f66cb3831 | |
parent | 79f10dcb586890630b25aa27250f270b39125713 (diff) | |
download | tk-b759c79faef78af4298e356f590b3d3a35b5ae01.zip tk-b759c79faef78af4298e356f590b3d3a35b5ae01.tar.gz tk-b759c79faef78af4298e356f590b3d3a35b5ae01.tar.bz2 |
Simplify NewNativeObj(), since its last parameter is always -1.
Change Tcl_StringMatch() calls to Tcl_StringCaseMatch()
A few end-of-line unnecessary spacings.
-rw-r--r-- | generic/tkBusy.c | 2 | ||||
-rw-r--r-- | generic/tkMain.c | 26 | ||||
-rw-r--r-- | generic/tkMenu.c | 2 | ||||
-rw-r--r-- | generic/tkWindow.c | 6 | ||||
-rw-r--r-- | library/tk.tcl | 4 | ||||
-rw-r--r-- | macosx/README | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXHLEvents.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 2 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 2 |
9 files changed, 22 insertions, 26 deletions
diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 7bd6262..7bd9a44 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -879,7 +879,7 @@ Tk_BusyObjCmd( hPtr = Tcl_NextHashEntry(&cursor)) { busyPtr = Tcl_GetHashValue(hPtr); if (pattern == NULL || - Tcl_StringMatch(Tk_PathName(busyPtr->tkRef), pattern)) { + Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) { Tcl_ListObjAppendElement(interp, objPtr, TkNewWindowObj(busyPtr->tkRef)); } diff --git a/generic/tkMain.c b/generic/tkMain.c index b80ce4d..f0b7b3e 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -86,19 +86,15 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; static inline Tcl_Obj * NewNativeObj( - TCHAR *string, - int length) + TCHAR *string) { Tcl_Obj *obj; Tcl_DString ds; #ifdef UNICODE - if (length > 0) { - length *= sizeof(WCHAR); - } - Tcl_WinTCharToUtf(string, length, &ds); + Tcl_WinTCharToUtf(string, -1, &ds); #else - Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds); + Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds); #endif obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); @@ -244,7 +240,7 @@ Tk_MainEx( is.gotPartial = 0; Tcl_Preserve(interp); -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) #if !defined(STATIC_BUILD) /* If compiled for Win32 but running on Cygwin, don't use console */ if (!tclStubsPtr->reserved9) @@ -278,19 +274,19 @@ Tk_MainEx( if ((argc > 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1])) && (TEXT('-') != argv[3][0])) { - Tcl_Obj *value = NewNativeObj(argv[2], -1); - Tcl_SetStartupScript(NewNativeObj(argv[3], -1), Tcl_GetString(value)); + Tcl_Obj *value = NewNativeObj(argv[2]); + Tcl_SetStartupScript(NewNativeObj(argv[3]), Tcl_GetString(value)); Tcl_DecrRefCount(value); argc -= 3; argv += 3; } else if ((argc > 1) && (TEXT('-') != argv[1][0])) { - Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); + Tcl_SetStartupScript(NewNativeObj(argv[1]), NULL); argc--; argv++; } else if ((argc > 2) && (length = _tcslen(argv[1])) && (length > 1) && (0 == _tcsncmp(TEXT("-file"), argv[1], length)) && (TEXT('-') != argv[2][0])) { - Tcl_SetStartupScript(NewNativeObj(argv[2], -1), NULL); + Tcl_SetStartupScript(NewNativeObj(argv[2]), NULL); argc -= 2; argv += 2; } @@ -298,7 +294,7 @@ Tk_MainEx( path = Tcl_GetStartupScript(&encodingName); if (path == NULL) { - appName = NewNativeObj(argv[0], -1); + appName = NewNativeObj(argv[0]); } else { appName = path; } @@ -310,7 +306,7 @@ Tk_MainEx( argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { - Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++, -1)); + Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++)); } Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY); @@ -440,7 +436,7 @@ StdinProc( count = Tcl_Gets(chan, &isPtr->line); - if (count < 0 && !isPtr->gotPartial) { + if (count == -1 && !isPtr->gotPartial) { if (isPtr->tty) { Tcl_Exit(0); } else { diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 5fd8b80..af77009 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -2164,7 +2164,7 @@ TkGetMenuIndex( Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr; const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr); - if ((label != NULL) && (Tcl_StringMatch(label, string))) { + if ((label != NULL) && (Tcl_StringCaseMatch(label, string, 0))) { *indexPtr = i; goto success; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 51cbaf3..0cae5c0 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -2855,10 +2855,10 @@ TkCygwinMainEx( /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ len = GetModuleFileNameW(Tk_GetHINSTANCE(), name, MAX_PATH); - name[len-2] = TEXT('.'); + name[len-2] = '.'; name[len-1] = name[len-5]; - _tcscpy(name+len, TEXT(".dll")); - memcpy(name+len-8, TEXT("libtk8"), 6 * sizeof(TCHAR)); + wcscpy(name+len, L".dll"); + memcpy(name+len-8, L"libtk8", 6 * sizeof(TCHAR)); tkcygwindll = LoadLibrary(name); if (!tkcygwindll) { diff --git a/library/tk.tcl b/library/tk.tcl index f4e8258..35433e8 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -463,7 +463,7 @@ switch -exact -- [tk windowingsystem] { # See http://support.apple.com/kb/HT1343 event add <<SelectAll>> <Command-Key-a> #Attach function keys not otherwise assigned to this event so they no-op - workaround for bug 0e6930dfe7 - event add <<SelectNone>> <Option-Command-Key-a> <Key-F5> <Key-F1> <Key-F5> <Key-F6> <Key-F7> <Key-F8> <Key-F9> <Key-F10> <Key-F11> <Key-F12> + event add <<SelectNone>> <Option-Command-Key-a> <Key-F5> <Key-F1> <Key-F5> <Key-F6> <Key-F7> <Key-F8> <Key-F9> <Key-F10> <Key-F11> <Key-F12> event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z> event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z> event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F> @@ -476,7 +476,7 @@ switch -exact -- [tk windowingsystem] { event add <<SelectPrevWord>> <Shift-Option-Left> event add <<LineStart>> <Home> <Command-Left> <Control-Key-a> <Control-Lock-Key-A> event add <<SelectLineStart>> <Shift-Home> <Shift-Command-Left> <Shift-Control-Key-A> <Shift-Control-Lock-Key-A> - event add <<LineEnd>> <End> <Command-Right> <Control-Key-e> <Control-Lock-Key-E> + event add <<LineEnd>> <End> <Command-Right> <Control-Key-e> <Control-Lock-Key-E> event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> <Shift-Control-Key-E> <Shift-Control-Lock-Key-E> event add <<PrevLine>> <Up> <Control-Key-p> <Control-Lock-Key-P> event add <<SelectPrevLine>> <Shift-Up> <Shift-Control-Key-P> <Shift-Control-Lock-Key-P> diff --git a/macosx/README b/macosx/README index 5ca9ee5..55306b3 100644 --- a/macosx/README +++ b/macosx/README @@ -172,7 +172,7 @@ to aqua or darkaqua then the window will be displayed with the corresponding appearance independent of any preferences settings. If it is set to "auto" the appearance will be determined by the preferences. This command can be used to opt out of Dark Mode on a per-window basis. It may be best to run the "update" command before setting the appearance property, to allow the event loop to run. - + - To determine the current appearance of a window in macOS 10.14 (Mojave) and higher, one can use the command: diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 7801fc3..42c15f4 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -328,7 +328,7 @@ static char* scriptTextProc = "::tk::mac::DoScriptText"; } } } - + - (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 144ba5b..ca19197 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -5911,7 +5911,7 @@ WmWinAppearance( #else NSString *appearance; #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - + const char *resultString = "unrecognized"; NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); if (win) { diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index f43e086..de1efd2 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -3000,7 +3000,7 @@ GetEncodingAlias( EncodingAlias *aliasPtr; for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) { - if (Tcl_StringMatch(name, aliasPtr->aliasPattern)) { + if (Tcl_StringCaseMatch(name, aliasPtr->aliasPattern, 0)) { return aliasPtr->realName; } aliasPtr++; |