From d6e7246b215b507e14e2653aaeaa12804a31166b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Mar 2023 15:46:57 +0000 Subject: More -1 -> TCL_INDEX_NONE --- unix/tkUnixButton.c | 2 +- unix/tkUnixFont.c | 24 ++++++++-------- unix/tkUnixKey.c | 2 +- unix/tkUnixMenu.c | 2 +- unix/tkUnixRFont.c | 8 +++--- unix/tkUnixScale.c | 8 +++--- unix/tkUnixSelect.c | 17 ++++++----- unix/tkUnixSend.c | 26 ++++++++--------- unix/tkUnixSysNotify.c | 9 +++--- unix/tkUnixSysTray.c | 8 +++--- unix/tkUnixWm.c | 78 +++++++++++++++++++++++++------------------------- 11 files changed, 91 insertions(+), 93 deletions(-) diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 5f84e72..8222fca 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -384,7 +384,7 @@ TkpDrawCheckIndicator( } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); - code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); + code = Tcl_EvalEx(interp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index ffc0f16..c32518c 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -891,7 +891,7 @@ TkpGetFontFamilies( hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { - strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), -1); + strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } @@ -932,10 +932,10 @@ TkpGetSubFonts( fontPtr = (UnixFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; - objv[0] = Tcl_NewStringObj(familyPtr->faceName, -1); - objv[1] = Tcl_NewStringObj(familyPtr->foundry, -1); + objv[0] = Tcl_NewStringObj(familyPtr->faceName, TCL_INDEX_NONE); + objv[1] = Tcl_NewStringObj(familyPtr->foundry, TCL_INDEX_NONE); objv[2] = Tcl_NewStringObj( - Tcl_GetEncodingName(familyPtr->encoding), -1); + Tcl_GetEncodingName(familyPtr->encoding), TCL_INDEX_NONE); listPtr = Tcl_NewListObj(3, objv); Tcl_ListObjAppendElement(NULL, resultPtr, listPtr); } @@ -1065,8 +1065,8 @@ Tk_MeasureChars( thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; - (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, - p - source, TCL_ENCODING_NOCOMPLAIN, &runString); + Tcl_UtfToExternalDString(familyPtr->encoding, source, + p - source, &runString); if (familyPtr->isTwoByteFont) { curX += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), @@ -1083,8 +1083,8 @@ Tk_MeasureChars( p = next; } familyPtr = lastSubFontPtr->familyPtr; - (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, - TCL_ENCODING_NOCOMPLAIN, &runString); + Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, + &runString); if (familyPtr->isTwoByteFont) { curX += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), @@ -1332,8 +1332,8 @@ Tk_DrawChars( do_width = (needWidth || (p != end)) ? 1 : 0; familyPtr = lastSubFontPtr->familyPtr; - (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, - p - source, TCL_ENCODING_NOCOMPLAIN, &runString); + Tcl_UtfToExternalDString(familyPtr->encoding, source, + p - source, &runString); if (familyPtr->isTwoByteFont) { XDrawString16(display, drawable, gc, x, y, (XChar2b *) Tcl_DStringValue(&runString), @@ -2298,7 +2298,7 @@ FontMapLoadPage( int hi, lo; if (Tcl_UtfToExternal(NULL, encoding, src, TkUniCharToUtf(i, src), - TCL_ENCODING_STOPONERROR|TCL_ENCODING_STRICT, NULL, buf, sizeof(buf), NULL, + TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) { continue; } @@ -2572,7 +2572,7 @@ CanUseFallback( numEncodings++; } Tcl_UtfToExternal(NULL, encoding, src, srcLen, - TCL_ENCODING_STOPONERROR|TCL_ENCODING_STRICT, NULL, dst, sizeof(dst), &srcRead, + TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead, &dstWrote, NULL); if (dstWrote == 0) { goto crossout; diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index 109fa4f..f54a445 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -175,7 +175,7 @@ TkpGetString( len = 0; } Tcl_DStringSetLength(&buf, len); - (void)Tcl_ExternalToUtfDStringEx(NULL, Tcl_DStringValue(&buf), len, TCL_ENCODING_NOCOMPLAIN, dsPtr); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr); Tcl_DStringFree(&buf); #endif /* X_HAVE_UTF8_STRING */ } else diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 1b3d99e..f6442ad 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -964,7 +964,7 @@ TkpPostTearoffMenu( int vRootX, vRootY, vRootWidth, vRootHeight; int result; - TkActivateMenuEntry(menuPtr, -1); + TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 7282b91..6d826ea 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -612,7 +612,7 @@ TkpGetFontFamilies( if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr) == XftResultMatch) { - Tcl_Obj *strPtr = Tcl_NewStringObj(family, -1); + Tcl_Obj *strPtr = Tcl_NewStringObj(family, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } @@ -660,9 +660,9 @@ TkpGetSubFonts( XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr); XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr); XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr); - objv[0] = Tcl_NewStringObj(family, -1); - objv[1] = Tcl_NewStringObj(foundry, -1); - objv[2] = Tcl_NewStringObj(encoding, -1); + objv[0] = Tcl_NewStringObj(family, TCL_INDEX_NONE); + objv[1] = Tcl_NewStringObj(foundry, TCL_INDEX_NONE); + objv[2] = Tcl_NewStringObj(encoding, TCL_INDEX_NONE); listPtr = Tcl_NewListObj(3, objv); Tcl_ListObjAppendElement(NULL, resultPtr, listPtr); } diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index 2f55e05..8ccb998 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -572,10 +572,10 @@ TkpDisplayScale( string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, scalePtr->command, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, string, -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command executed by scale)"); diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index bd11a9f..89a4920 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -582,7 +582,7 @@ TkSelEventProc( } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( - "selection property too large", -1)); + "selection property too large", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE",NULL); retrPtr->result = TCL_ERROR; XFree(propInfo); @@ -621,13 +621,12 @@ TkSelEventProc( } else { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } - (void)Tcl_ExternalToUtfDStringEx(encoding, propInfo, numItems, TCL_ENCODING_NOCOMPLAIN, &ds); + char *str = Tcl_ExternalToUtfDString(encoding, propInfo, numItems, &ds); if (encoding) { Tcl_FreeEncoding(encoding); } - retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, - Tcl_DStringValue(&ds)); + retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, str); Tcl_DStringFree(&ds); Tcl_Release(interp); } else if (type == dispPtr->utf8Atom) { @@ -762,7 +761,7 @@ SelTimeoutProc( */ Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( - "selection owner didn't respond", -1)); + "selection owner didn't respond", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "IGNORED", NULL); retrPtr->result = TCL_ERROR; } else { @@ -997,10 +996,10 @@ ConvertSelection( } else { encoding = Tcl_GetEncoding(NULL, "iso2022"); } - (void)Tcl_UtfToExternalDStringEx(encoding, (char *) buffer, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + unsigned char *str = (unsigned char *)Tcl_UtfToExternalDString(encoding, + (char *) buffer, TCL_INDEX_NONE, &ds); XChangeProperty(reply.xsel.display, reply.xsel.requestor, - property, type, 8, PropModeReplace, - (unsigned char *) Tcl_DStringValue(&ds), + property, type, 8, PropModeReplace, str, Tcl_DStringLength(&ds)); if (encoding) { Tcl_FreeEncoding(encoding); @@ -1150,7 +1149,7 @@ SelRcvIncrProc( } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( - "selection property too large", -1)); + "selection property too large", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE", NULL); retrPtr->result = TCL_ERROR; goto done; diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 9ae0fe8..a3a61cc 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -870,7 +870,7 @@ Tk_SetAppName( if (i > 1) { if (i == 2) { Tcl_DStringInit(&dString); - Tcl_DStringAppend(&dString, name, -1); + Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE); Tcl_DStringAppend(&dString, " #", 2); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset+TCL_INTEGER_SPACE); @@ -1031,15 +1031,15 @@ Tk_SendObjCmd( localInterp = riPtr->interp; Tcl_Preserve(localInterp); if (firstArg == (objc-1)) { - result = Tcl_EvalEx(localInterp, Tcl_GetString(objv[firstArg]), -1, TCL_EVAL_GLOBAL); + result = Tcl_EvalEx(localInterp, Tcl_GetString(objv[firstArg]), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } else { Tcl_DStringInit(&request); - Tcl_DStringAppend(&request, Tcl_GetString(objv[firstArg]), -1); + Tcl_DStringAppend(&request, Tcl_GetString(objv[firstArg]), TCL_INDEX_NONE); for (i = firstArg+1; i < objc; i++) { Tcl_DStringAppend(&request, " ", 1); - Tcl_DStringAppend(&request, Tcl_GetString(objv[i]), -1); + Tcl_DStringAppend(&request, Tcl_GetString(objv[i]), TCL_INDEX_NONE); } - result = Tcl_EvalEx(localInterp, Tcl_DStringValue(&request), -1, TCL_EVAL_GLOBAL); + result = Tcl_EvalEx(localInterp, Tcl_DStringValue(&request), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&request); } if (interp != localInterp) { @@ -1281,7 +1281,7 @@ TkGetInterpNames( */ Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewStringObj(entryName, -1)); + Tcl_NewStringObj(entryName, TCL_INDEX_NONE)); } else { int count; @@ -1534,7 +1534,7 @@ SendEventProc( if (commWindow != None) { Tcl_DStringInit(&reply); Tcl_DStringAppend(&reply, "\0r\0-s ", 6); - Tcl_DStringAppend(&reply, serial, -1); + Tcl_DStringAppend(&reply, serial, TCL_INDEX_NONE); Tcl_DStringAppend(&reply, "\0-r ", 4); } @@ -1542,7 +1542,7 @@ SendEventProc( if (commWindow != None) { Tcl_DStringAppend(&reply, "X server insecure (must use xauth-style " - "authorization); command ignored", -1); + "authorization); command ignored", TCL_INDEX_NONE); } result = TCL_ERROR; goto returnResult; @@ -1556,8 +1556,8 @@ SendEventProc( if (riPtr == NULL) { if (commWindow != None) { Tcl_DStringAppend(&reply, - "receiver never heard of interpreter \"", -1); - Tcl_DStringAppend(&reply, interpName, -1); + "receiver never heard of interpreter \"", TCL_INDEX_NONE); + Tcl_DStringAppend(&reply, interpName, TCL_INDEX_NONE); Tcl_DStringAppend(&reply, "\"", 1); } result = TCL_ERROR; @@ -1577,7 +1577,7 @@ SendEventProc( remoteInterp = riPtr->interp; Tcl_Preserve(remoteInterp); - result = Tcl_EvalEx(remoteInterp, script, -1, TCL_EVAL_GLOBAL); + result = Tcl_EvalEx(remoteInterp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); /* * The call to Tcl_Release may have released the interpreter which @@ -1596,7 +1596,7 @@ SendEventProc( NULL, TCL_GLOBAL_ONLY); if (varValue != NULL) { Tcl_DStringAppend(&reply, "\0-i ", 4); - Tcl_DStringAppend(&reply, varValue, -1); + Tcl_DStringAppend(&reply, varValue, TCL_INDEX_NONE); } varValue = Tcl_GetVar2(remoteInterp, "errorCode", NULL, TCL_GLOBAL_ONLY); @@ -1623,7 +1623,7 @@ SendEventProc( snprintf(buffer, sizeof(buffer), "%d", result); Tcl_DStringAppend(&reply, "\0-c ", 4); - Tcl_DStringAppend(&reply, buffer, -1); + Tcl_DStringAppend(&reply, buffer, TCL_INDEX_NONE); } (void) AppendPropCarefully(dispPtr->display, commWindow, dispPtr->commProperty, Tcl_DStringValue(&reply), diff --git a/unix/tkUnixSysNotify.c b/unix/tkUnixSysNotify.c index 8f5a972..f4a6d12 100755 --- a/unix/tkUnixSysNotify.c +++ b/unix/tkUnixSysNotify.c @@ -145,11 +145,10 @@ SysNotifyCmd( Tcl_DStringInit(&dst); Tcl_DStringInit(&dsm); enc = Tcl_GetEncoding(NULL, "utf-8"); - (void)Tcl_UtfToExternalDStringEx(enc, title, -1, TCL_ENCODING_NOCOMPLAIN, &dst); - (void)Tcl_UtfToExternalDStringEx(enc, message, -1, TCL_ENCODING_NOCOMPLAIN, &dsm); + char *dstStr = Tcl_UtfToExternalDString(enc, title, TCL_INDEX_NONE, &dst); + char *dsmStr = Tcl_UtfToExternalDString(enc, message, TCL_INDEX_NONE, &dsm); notify_init(appname); - notif = notify_notification_new(Tcl_DStringValue(&dst), - Tcl_DStringValue(&dsm), icon, NULL); + notif = notify_notification_new(dstStr, dsmStr, icon, NULL); notify_notification_show(notif, NULL); Tcl_DStringFree(&dsm); Tcl_DStringFree(&dst); @@ -194,7 +193,7 @@ SysNotify_Init( while (lnlibs[i] != NULL) { Tcl_ResetResult(interp); - nameobj = Tcl_NewStringObj(lnlibs[i], -1); + nameobj = Tcl_NewStringObj(lnlibs[i], TCL_INDEX_NONE); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &ln_fns.lib) == TCL_OK) { diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c index faab097..cb1e736 100644 --- a/unix/tkUnixSysTray.c +++ b/unix/tkUnixSysTray.c @@ -349,17 +349,17 @@ TrayIconObjectCmd( case XWC_ORIENTATION: if (icon->myManager == None || icon->wrapper == None) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("none", TCL_INDEX_NONE)); } else { switch(QueryTrayOrientation(icon)) { case 0: - Tcl_SetObjResult(interp, Tcl_NewStringObj("horizontal", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("horizontal", TCL_INDEX_NONE)); break; case 1: - Tcl_SetObjResult(interp, Tcl_NewStringObj("vertical", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("vertical", TCL_INDEX_NONE)); break; default: - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", TCL_INDEX_NONE)); break; } } diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 46c507a..87847ee 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -713,7 +713,7 @@ TkWmMapWindow( UpdateCommand(winPtr); } if (wmPtr->clientMachine != NULL) { - (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->clientMachine, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, TCL_INDEX_NONE, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); @@ -985,8 +985,8 @@ TkWmSetClass( XClassHint *classPtr; Tcl_DString name, ds; - (void)Tcl_UtfToExternalDStringEx(NULL, winPtr->nameUid, -1, TCL_ENCODING_NOCOMPLAIN, &name); - (void)Tcl_UtfToExternalDStringEx(NULL, winPtr->classUid, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, winPtr->nameUid, TCL_INDEX_NONE, &name); + (void)Tcl_UtfToExternalDString(NULL, winPtr->classUid, TCL_INDEX_NONE, &ds); classPtr = XAllocClassHint(); classPtr->res_name = Tcl_DStringValue(&name); classPtr->res_class = Tcl_DStringValue(&ds); @@ -1224,7 +1224,7 @@ WmAspectCmd( if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "aspect number can't be <= 0", -1)); + "aspect number can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "ASPECT", NULL); return TCL_ERROR; } @@ -1401,7 +1401,7 @@ WmAttributesCmd( for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(WmAttributeNames[attribute], -1)); + Tcl_NewStringObj(WmAttributeNames[attribute], TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, result, WmGetAttribute(winPtr, (WmAttribute)attribute)); } @@ -1468,7 +1468,7 @@ WmClientCmd( if (objc == 3) { if (wmPtr->clientMachine != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(wmPtr->clientMachine, -1)); + Tcl_NewStringObj(wmPtr->clientMachine, TCL_INDEX_NONE)); } return TCL_OK; } @@ -1494,7 +1494,7 @@ WmClientCmd( XTextProperty textProp; Tcl_DString ds; - (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->clientMachine, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, TCL_INDEX_NONE, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); @@ -1576,7 +1576,7 @@ WmColormapwindowsCmd( Tcl_ObjPrintf("0x%lx", cmapList[i])); } else { Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewStringObj(winPtr2->pathName, -1)); + Tcl_NewStringObj(winPtr2->pathName, TCL_INDEX_NONE)); } } XFree((char *) cmapList); @@ -1658,7 +1658,7 @@ WmCommandCmd( if (wmPtr->cmdArgv != NULL) { char *arg = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); - Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, TCL_INDEX_NONE)); ckfree(arg); } return TCL_OK; @@ -1777,7 +1777,7 @@ WmFocusmodelCmd( } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - wmPtr->hints.input ? "passive" : "active", -1)); + wmPtr->hints.input ? "passive" : "active", TCL_INDEX_NONE)); return TCL_OK; } @@ -1885,7 +1885,7 @@ WmFrameCmd( window = Tk_WindowId((Tk_Window) winPtr); } snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)window); - Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); return TCL_OK; } @@ -2018,25 +2018,25 @@ WmGridCmd( } if (reqWidth < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "baseWidth can't be < 0", -1)); + "baseWidth can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (reqHeight < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "baseHeight can't be < 0", -1)); + "baseHeight can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (widthInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "widthInc can't be <= 0", -1)); + "widthInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (heightInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "heightInc can't be <= 0", -1)); + "heightInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } @@ -2084,7 +2084,7 @@ WmGroupCmd( } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE)); } return TCL_OK; } @@ -2159,7 +2159,7 @@ WmIconbadgeCmd( snprintf(cmd, sizeof(cmd), "::tk::icons::IconBadge {%s} {%s}", Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); - if (Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_DIRECT) != TCL_OK) { + if (Tcl_EvalEx(interp, cmd, TCL_INDEX_NONE, TCL_EVAL_DIRECT) != TCL_OK) { return TCL_ERROR; } return TCL_OK; @@ -2202,7 +2202,7 @@ WmIconbitmapCmd( if (wmPtr->hints.flags & IconPixmapHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj( Tk_NameOfBitmap(winPtr->display, - wmPtr->hints.icon_pixmap), -1)); + wmPtr->hints.icon_pixmap), TCL_INDEX_NONE)); } return TCL_OK; } @@ -2287,7 +2287,7 @@ WmIconifyCmd( } if (TkpWmSetState(winPtr, IconicState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't send iconify message to window manager", -1)); + "couldn't send iconify message to window manager", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } @@ -2387,7 +2387,7 @@ WmIconnameCmd( } if (objc == 3) { if (wmPtr->iconName != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, TCL_INDEX_NONE)); } return TCL_OK; } else { @@ -3005,7 +3005,7 @@ WmPositionfromCmd( } else if (wmPtr->sizeHintsFlags & PPosition) { sourceStr = "program"; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE)); return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { @@ -3088,7 +3088,7 @@ WmProtocolCmd( protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(protPtr->command, -1)); + Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE)); return TCL_OK; } } @@ -3101,7 +3101,7 @@ WmProtocolCmd( if (strcmp(Tcl_GetString(objv[3]), "_NET_WM_PING") == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "may not alter handling of that protocol", -1)); + "may not alter handling of that protocol", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "PROTOCOL", "RESERVED", NULL); return TCL_ERROR; } @@ -3241,7 +3241,7 @@ WmSizefromCmd( } else if (wmPtr->sizeHintsFlags & PSize) { sourceStr = "program"; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE)); return TCL_OK; } @@ -3310,7 +3310,7 @@ WmStackorderCmd( /* ASSERT: true [Bug 1789819]*/ for (window_ptr = windows; *window_ptr ; window_ptr++) { Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewStringObj((*window_ptr)->pathName, -1)); + Tcl_NewStringObj((*window_ptr)->pathName, TCL_INDEX_NONE)); } ckfree(windows); Tcl_SetObjResult(interp, resultObj); @@ -3358,7 +3358,7 @@ WmStackorderCmd( windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "TkWmStackorderToplevel failed", -1)); + "TkWmStackorderToplevel failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } @@ -3490,7 +3490,7 @@ WmStateCmd( } else { state = "iconic"; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(state, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(state, TCL_INDEX_NONE)); } return TCL_OK; } @@ -3529,9 +3529,9 @@ WmTitleCmd( } if (objc == 3) { if (wmPtr->title) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->title, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->title, TCL_INDEX_NONE)); } else { - Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, TCL_INDEX_NONE)); } } else { if (wmPtr->title != NULL) { @@ -3738,7 +3738,7 @@ WmWithdrawCmd( wmPtr->flags |= WM_WITHDRAWN; if (TkpWmSetState(winPtr, WithdrawnState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't send withdraw message to window manager", -1)); + "couldn't send withdraw message to window manager", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } @@ -4980,7 +4980,7 @@ UpdateTitle( */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; - (void)Tcl_UtfToExternalDStringEx(NULL, string, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, string, TCL_INDEX_NONE, &ds); XStoreName(winPtr->display, wmPtr->wrapperPtr->window, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); @@ -4993,7 +4993,7 @@ UpdateTitle( */ if (wmPtr->iconName != NULL) { - (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->iconName, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, wmPtr->iconName, TCL_INDEX_NONE, &ds); XSetIconName(winPtr->display, wmPtr->wrapperPtr->window, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); @@ -5513,7 +5513,7 @@ SetNetWmType( char *name = Tcl_GetStringFromObj(objv[n], &len); Tcl_UtfToUpper(name); - (void)Tcl_UtfToExternalDStringEx(NULL, name, len, TCL_ENCODING_NOCOMPLAIN, &dsName); + (void)Tcl_UtfToExternalDString(NULL, name, len, &dsName); Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "_NET_WM_WINDOW_TYPE_", 20); Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsName), @@ -5577,7 +5577,7 @@ GetNetWmType( const char *name = Tk_GetAtomName(tkwin, atoms[n]); if (strncmp("_NET_WM_WINDOW_TYPE_", name, 20) == 0) { - (void)Tcl_ExternalToUtfDStringEx(NULL, name+20, -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_ExternalToUtfDString(NULL, name+20, TCL_INDEX_NONE, &ds); Tcl_UtfToLower(Tcl_DStringValue(&ds)); Tcl_ListObjAppendElement(interp, typePtr, Tcl_NewStringObj(Tcl_DStringValue(&ds), @@ -6372,7 +6372,7 @@ TkWmProtocolEventProc( Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); - result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); + result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", @@ -6982,15 +6982,15 @@ TkpMakeMenuWindow( if (typeFlag == TK_MAKE_MENU_TEAROFF) { atts.override_redirect = False; atts.save_under = False; - typeObj = Tcl_NewStringObj("menu", -1); + typeObj = Tcl_NewStringObj("menu", TCL_INDEX_NONE); TkSetTransientFor(tkwin, NULL); } else { atts.override_redirect = True; atts.save_under = True; if (typeFlag == TK_MAKE_MENU_DROPDOWN) { - typeObj = Tcl_NewStringObj("dropdown_menu", -1); + typeObj = Tcl_NewStringObj("dropdown_menu", TCL_INDEX_NONE); } else { - typeObj = Tcl_NewStringObj("popup_menu", -1); + typeObj = Tcl_NewStringObj("popup_menu", TCL_INDEX_NONE); } } SetNetWmType((TkWindow *)tkwin, typeObj); @@ -7388,7 +7388,7 @@ UpdateCommand( offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { - (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->cmdArgv[i], -1, TCL_ENCODING_NOCOMPLAIN, &ds); + (void)Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], TCL_INDEX_NONE, &ds); offsets[i] = Tcl_DStringLength(&cmds); Tcl_DStringAppend(&cmds, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)+1); -- cgit v0.12