diff options
Diffstat (limited to 'generic/tkMain.c')
-rw-r--r-- | generic/tkMain.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/generic/tkMain.c b/generic/tkMain.c index 9127a7e..17031dc 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -78,20 +78,16 @@ 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 = wcslen(string); - } Tcl_DStringInit(&ds); - Tcl_WCharToUtfDString(string, length, &ds); + Tcl_WCharToUtfDString(string, wcslen(string), &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); @@ -271,19 +267,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; } @@ -291,7 +287,7 @@ Tk_MainEx( path = Tcl_GetStartupScript(&encodingName); if (path == NULL) { - appName = NewNativeObj(argv[0], -1); + appName = NewNativeObj(argv[0]); } else { appName = path; } @@ -303,7 +299,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); @@ -432,7 +428,7 @@ StdinProc( Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; - count = Tcl_Gets(chan, &isPtr->line); + count = (size_t)Tcl_Gets(chan, &isPtr->line); if (count == (size_t)-1 && !isPtr->gotPartial) { if (isPtr->tty) { |