Tcl Source Code

Check-in [c1bdc62c2a]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Merge 8.7
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | utf-max
Files: files | file ages | folders
SHA3-256: c1bdc62c2a092c346184fda9c74522ce83b4009bc3accd3e3945f741417ac050
User & Date: jan.nijtmans 2019-04-03 19:52:38
Context
2019-05-10
07:46
merge 8.7 check-in: f3302db091 user: jan.nijtmans tags: utf-max
2019-04-03
19:52
Merge 8.7 check-in: c1bdc62c2a user: jan.nijtmans tags: utf-max
2019-04-02
18:23
merge-mark check-in: 5b3cc9e2a9 user: jan.nijtmans tags: core-8-branch
2019-03-28
22:49
Merge 8.7 check-in: eebb1e7ee1 user: jan.nijtmans tags: utf-max
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to doc/info.n.

   208    208   For a frame that corresponds to a level, (to be determined).
   209    209   .PP
   210    210   When a command can be traced to its literal definition in some script, e.g.
   211    211   procedures nested in statically defined procedures, and literal eval scripts in
   212    212   files or statically defined procedures, its type is \fBsource\fR and its
   213    213   location is the absolute line number in the script.  Otherwise, its type is
   214    214   \fBproc\fR and its location is its line number within the body of the
   215         -procedure. 
          215  +procedure.
   216    216   .PP
   217    217   In contrast, procedure definitions and \fBeval\fR within a dynamically
   218    218   \fBeval\fRuated environment count line numbers relative to the start of
   219    219   their script, even if they would be able to count relative to the
   220    220   start of the outer dynamic script. That type of number usually makes
   221    221   more sense.
   222    222   .PP
................................................................................
   296    296   \fBinfo object\fI subcommand object\fR ?\fIarg ...\fR
   297    297   .
   298    298   Returns information about the object named \fIobject\fR. \fIsubcommand\fR is
   299    299   described \fBOBJECT INTROSPECTION\fR below.
   300    300   .TP
   301    301   \fBinfo patchlevel\fR
   302    302   .
   303         -Returns the value of the global variable \fBtcl_patchLevel\fR, in which the 
          303  +Returns the value of the global variable \fBtcl_patchLevel\fR, in which the
   304    304   exact version of the Tcl library initially stored.
   305    305   .TP
   306    306   \fBinfo procs \fR?\fIpattern\fR?
   307    307   .
   308    308   Returns the names of all visible procedures. If \fIpattern\fR is given, returns
   309    309   only those names that match according to \fBstring match\fR.  Only the final
   310    310   component in \fIpattern\fR is actually considered a pattern.  Any qualifying

Changes to generic/tclCmdAH.c.

   928    928   int
   929    929   Tcl_ExitObjCmd(
   930    930       ClientData dummy,		/* Not used. */
   931    931       Tcl_Interp *interp,		/* Current interpreter. */
   932    932       int objc,			/* Number of arguments. */
   933    933       Tcl_Obj *const objv[])	/* Argument objects. */
   934    934   {
   935         -    int value;
          935  +    Tcl_WideInt value;
   936    936   
   937    937       if ((objc != 1) && (objc != 2)) {
   938    938   	Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
   939    939   	return TCL_ERROR;
   940    940       }
   941    941   
   942    942       if (objc == 1) {
   943    943   	value = 0;
   944         -    } else if (Tcl_GetIntFromObj(interp, objv[1], &value) != TCL_OK) {
          944  +    } else if (TclGetWideBitsFromObj(interp, objv[1], &value) != TCL_OK) {
   945    945   	return TCL_ERROR;
   946    946       }
   947         -    Tcl_Exit(value);
          947  +    Tcl_Exit((int)value);
   948    948       /*NOTREACHED*/
   949    949       return TCL_OK;		/* Better not ever reach this! */
   950    950   }
   951    951   
   952    952   /*
   953    953    *----------------------------------------------------------------------
   954    954    *

Changes to generic/tclCmdMZ.c.

  4368   4368   
  4369   4369   	middle -= start;		     /* execution time in microsecs */
  4370   4370   
  4371   4371       #ifdef TCL_WIDE_CLICKS
  4372   4372   	/* convert execution time in wide clicks to microsecs */
  4373   4373   	middle *= TclpWideClickInMicrosec();
  4374   4374       #endif
         4375  +
         4376  +	if (!count) { /* no iterations - avoid divide by zero */
         4377  +	    objs[0] = objs[2] = objs[4] = Tcl_NewWideIntObj(0);
         4378  +	    goto retRes;
         4379  +	}
  4375   4380   
  4376   4381   	/* if not calibrate */
  4377   4382   	if (!calibrate) {
  4378   4383   	    /* minimize influence of measurement overhead */
  4379   4384   	    if (overhead > 0) {
  4380   4385   		/* estimate the time of overhead (microsecs) */
  4381   4386   		Tcl_WideUInt curOverhead = overhead * count;
................................................................................
  4421   4426   	    } else {
  4422   4427   		objs[4] = Tcl_NewWideIntObj(val);
  4423   4428   	    }
  4424   4429   	} else {
  4425   4430   	    objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000);
  4426   4431   	}
  4427   4432   
         4433  +    retRes:
  4428   4434   	/* estimated net execution time (in millisecs) */
  4429   4435   	if (!calibrate) {
  4430         -	    objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000);
         4436  +	    if (middle >= 1) {
         4437  +		objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000);
         4438  +	    } else {
         4439  +		objs[6] = Tcl_NewWideIntObj(0);
         4440  +	    }
  4431   4441   	    TclNewLiteralStringObj(objs[7], "nett-ms");
  4432   4442   	}
  4433   4443   
  4434   4444   	/*
  4435   4445   	* Construct the result as a list because many programs have always parsed
  4436   4446   	* as such (extracting the first element, typically).
  4437   4447   	*/

Changes to generic/tclProcess.c.

   536    536   	result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs);
   537    537   	if (result != TCL_OK) {
   538    538   	    return result;
   539    539   	}
   540    540   	dict = Tcl_NewDictObj();
   541    541   	Tcl_MutexLock(&infoTablesMutex);
   542    542   	for (i = 0; i < numPids; i++) {
   543         -	    result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid);
          543  +	    result = Tcl_GetIntFromObj(interp, pidObjs[i], &pid);
   544    544   	    if (result != TCL_OK) {
   545    545   		Tcl_MutexUnlock(&infoTablesMutex);
   546    546   		Tcl_DecrRefCount(dict);
   547    547   		return result;
   548    548   	    }
   549    549   
   550    550   	    entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid));
................................................................................
   650    650   
   651    651   	result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs);
   652    652   	if (result != TCL_OK) {
   653    653   	    return result;
   654    654   	}
   655    655   	Tcl_MutexLock(&infoTablesMutex);
   656    656   	for (i = 0; i < numPids; i++) {
   657         -	    result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid);
          657  +	    result = Tcl_GetIntFromObj(interp, pidObjs[i], &pid);
   658    658   	    if (result != TCL_OK) {
   659    659   		Tcl_MutexUnlock(&infoTablesMutex);
   660    660   		return result;
   661    661   	    }
   662    662   
   663    663   	    entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid));
   664    664   	    if (!entry) {

Changes to generic/tclTest.c.

    48     48   /*
    49     49    * Dynamic string shared by TestdcallCmd and DelCallbackProc; used to collect
    50     50    * the results of the various deletion callbacks.
    51     51    */
    52     52   
    53     53   static Tcl_DString delString;
    54     54   static Tcl_Interp *delInterp;
           55  +static const Tcl_ObjType *properByteArrayType;
    55     56   
    56     57   /*
    57     58    * One of the following structures exists for each asynchronous handler
    58     59    * created by the "testasync" command".
    59     60    */
    60     61   
    61     62   typedef struct TestAsyncHandler {
................................................................................
   548    549    *----------------------------------------------------------------------
   549    550    */
   550    551   
   551    552   int
   552    553   Tcltest_Init(
   553    554       Tcl_Interp *interp)		/* Interpreter for application. */
   554    555   {
   555         -    Tcl_Obj *listPtr;
   556         -    Tcl_Obj **objv;
          556  +    Tcl_Obj **objv, *objPtr;
   557    557       int objc, index;
   558    558       static const char *const specialOptions[] = {
   559    559   	"-appinitprocerror", "-appinitprocdeleteinterp",
   560    560   	"-appinitprocclosestderr", "-appinitprocsetrcfile", NULL
   561    561       };
   562    562   
   563    563       if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) {
................................................................................
   570    570   	return TCL_ERROR;
   571    571       }
   572    572       /* TIP #268: Full patchlevel instead of just major.minor */
   573    573   
   574    574       if (Tcl_PkgProvideEx(interp, "Tcltest", TCL_PATCH_LEVEL, NULL) == TCL_ERROR) {
   575    575   	return TCL_ERROR;
   576    576       }
          577  +
          578  +    objPtr = Tcl_NewStringObj("abc", 3);
          579  +    (void)Tcl_GetByteArrayFromObj(objPtr, &index);
          580  +    properByteArrayType = objPtr->typePtr;
          581  +    Tcl_DecrRefCount(objPtr);
   577    582   
   578    583       /*
   579    584        * Create additional commands and math functions for testing Tcl.
   580    585        */
   581    586   
   582    587       Tcl_CreateObjCommand(interp, "gettimes", GetTimesObjCmd, NULL, NULL);
   583    588       Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL);
................................................................................
   736    741       }
   737    742   #endif
   738    743   
   739    744       /*
   740    745        * Check for special options used in ../tests/main.test
   741    746        */
   742    747   
   743         -    listPtr = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY);
   744         -    if (listPtr != NULL) {
   745         -	if (Tcl_ListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) {
          748  +    objPtr = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY);
          749  +    if (objPtr != NULL) {
          750  +	if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
   746    751   	    return TCL_ERROR;
   747    752   	}
   748    753   	if (objc && (Tcl_GetIndexFromObj(NULL, objv[0], specialOptions, NULL,
   749    754   		TCL_EXACT, &index) == TCL_OK)) {
   750    755   	    switch (index) {
   751    756   	    case 0:
   752    757   		return TCL_ERROR;
................................................................................
  5007   5012   static int
  5008   5013   TestbytestringObjCmd(
  5009   5014       void *unused,		/* Not used. */
  5010   5015       Tcl_Interp *interp,		/* Current interpreter. */
  5011   5016       int objc,			/* Number of arguments. */
  5012   5017       Tcl_Obj *const objv[])	/* The argument objects. */
  5013   5018   {
  5014         -    int n;
         5019  +    int n = 0;
  5015   5020       const char *p;
  5016   5021   
  5017   5022       if (objc != 2) {
  5018   5023   	Tcl_WrongNumArgs(interp, 1, objv, "bytearray");
  5019   5024   	return TCL_ERROR;
  5020   5025       }
  5021   5026       p = (const char *)Tcl_GetByteArrayFromObj(objv[1], &n);
         5027  +    if ((p == NULL) || !Tcl_FetchIntRep(objv[1], properByteArrayType)) {
         5028  +	Tcl_AppendResult(interp, "testbytestring expects bytes", NULL);
         5029  +	return TCL_ERROR;
         5030  +    }
  5022   5031       Tcl_SetObjResult(interp, Tcl_NewStringObj(p, n));
  5023   5032       return TCL_OK;
  5024   5033   }
  5025   5034   
  5026   5035   /*
  5027   5036    *----------------------------------------------------------------------
  5028   5037    *

Changes to generic/tclTestObj.c.

   381    381   	 * has ref count 1 (i.e. the object is unshared) we can modify that
   382    382   	 * object directly. Otherwise, if RC>1 (i.e. the object is shared),
   383    383   	 * we must create a new object to modify/set and decrement the old
   384    384   	 * formerly-shared object's ref count. This is "copy on write".
   385    385   	 */
   386    386   
   387    387   	if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) {
   388         -	    Tcl_SetBooleanObj(varPtr[varIndex], boolValue);
          388  +	    Tcl_SetWideIntObj(varPtr[varIndex], boolValue != 0);
   389    389   	} else {
   390         -	    SetVarToObj(varPtr, varIndex, Tcl_NewBooleanObj(boolValue));
          390  +	    SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(boolValue != 0));
   391    391   	}
   392    392   	Tcl_SetObjResult(interp, varPtr[varIndex]);
   393    393       } else if (strcmp(subCmd, "get") == 0) {
   394    394   	if (objc != 3) {
   395    395   	    goto wrongNumArgs;
   396    396   	}
   397    397   	if (CheckIfVarUnset(interp, varPtr,varIndex)) {
................................................................................
   406    406   	    return TCL_ERROR;
   407    407   	}
   408    408   	if (Tcl_GetBooleanFromObj(interp, varPtr[varIndex],
   409    409   				  &boolValue) != TCL_OK) {
   410    410   	    return TCL_ERROR;
   411    411   	}
   412    412   	if (!Tcl_IsShared(varPtr[varIndex])) {
   413         -	    Tcl_SetBooleanObj(varPtr[varIndex], !boolValue);
          413  +	    Tcl_SetWideIntObj(varPtr[varIndex], boolValue == 0);
   414    414   	} else {
   415         -	    SetVarToObj(varPtr, varIndex, Tcl_NewBooleanObj(!boolValue));
          415  +	    SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(boolValue == 0));
   416    416   	}
   417    417   	Tcl_SetObjResult(interp, varPtr[varIndex]);
   418    418       } else {
   419    419   	Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
   420    420   		"bad option \"", Tcl_GetString(objv[1]),
   421    421   		"\": must be set, get, or not", NULL);
   422    422   	return TCL_ERROR;
................................................................................
   654    654   TestintobjCmd(
   655    655       ClientData clientData,	/* Not used. */
   656    656       Tcl_Interp *interp,		/* Current interpreter. */
   657    657       int objc,			/* Number of arguments. */
   658    658       Tcl_Obj *const objv[])	/* Argument objects. */
   659    659   {
   660    660       int intValue, varIndex, i;
   661         -    long longValue;
          661  +    Tcl_WideInt wideValue;
   662    662       const char *index, *subCmd, *string;
   663    663       Tcl_Obj **varPtr;
   664    664   
   665    665       if (objc < 3) {
   666    666   	wrongNumArgs:
   667    667   	Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg ...?");
   668    668   	return TCL_ERROR;
................................................................................
   709    709   	}
   710    710   	intValue = i;
   711    711   	if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) {
   712    712   	    Tcl_SetIntObj(varPtr[varIndex], intValue);
   713    713   	} else {
   714    714   	    SetVarToObj(varPtr, varIndex, Tcl_NewIntObj(intValue));
   715    715   	}
   716         -    } else if (strcmp(subCmd, "setlong") == 0) {
          716  +    } else if (strcmp(subCmd, "setint") == 0) {
   717    717   	if (objc != 4) {
   718    718   	    goto wrongNumArgs;
   719    719   	}
   720    720   	string = Tcl_GetString(objv[3]);
   721    721   	if (Tcl_GetInt(interp, string, &i) != TCL_OK) {
   722    722   	    return TCL_ERROR;
   723    723   	}
................................................................................
   724    724   	intValue = i;
   725    725   	if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) {
   726    726   	    Tcl_SetWideIntObj(varPtr[varIndex], intValue);
   727    727   	} else {
   728    728   	    SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(intValue));
   729    729   	}
   730    730   	Tcl_SetObjResult(interp, varPtr[varIndex]);
   731         -    } else if (strcmp(subCmd, "setmaxlong") == 0) {
   732         -	long maxLong = LONG_MAX;
          731  +    } else if (strcmp(subCmd, "setmax") == 0) {
          732  +	Tcl_WideInt maxWide = WIDE_MAX;
   733    733   	if (objc != 3) {
   734    734   	    goto wrongNumArgs;
   735    735   	}
   736    736   	if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) {
   737         -	    Tcl_SetWideIntObj(varPtr[varIndex], maxLong);
          737  +	    Tcl_SetWideIntObj(varPtr[varIndex], maxWide);
   738    738   	} else {
   739         -	    SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(maxLong));
          739  +	    SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(maxWide));
   740    740   	}
   741         -    } else if (strcmp(subCmd, "ismaxlong") == 0) {
          741  +    } else if (strcmp(subCmd, "ismax") == 0) {
   742    742   	if (objc != 3) {
   743    743   	    goto wrongNumArgs;
   744    744   	}
   745    745   	if (CheckIfVarUnset(interp, varPtr,varIndex)) {
   746    746   	    return TCL_ERROR;
   747    747   	}
   748         -	if (Tcl_GetLongFromObj(interp, varPtr[varIndex], &longValue) != TCL_OK) {
          748  +	if (Tcl_GetWideIntFromObj(interp, varPtr[varIndex], &wideValue) != TCL_OK) {
   749    749   	    return TCL_ERROR;
   750    750   	}
   751    751   	Tcl_AppendToObj(Tcl_GetObjResult(interp),
   752         -		((longValue == LONG_MAX)? "1" : "0"), -1);
          752  +		((wideValue == WIDE_MAX)? "1" : "0"), -1);
   753    753       } else if (strcmp(subCmd, "get") == 0) {
   754    754   	if (objc != 3) {
   755    755   	    goto wrongNumArgs;
   756    756   	}
   757    757   	if (CheckIfVarUnset(interp, varPtr,varIndex)) {
   758    758   	    return TCL_ERROR;
   759    759   	}

Changes to generic/tclTestProcBodyObj.c.

   336    336   
   337    337       if (objc != 1) {
   338    338   	Tcl_WrongNumArgs(interp, 1, objv, "");
   339    339   	return TCL_ERROR;
   340    340       }
   341    341   
   342    342       version = Tcl_PkgPresent(interp, packageName, packageVersion, 1);
   343         -    Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
          343  +    Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
   344    344   	    strcmp(version, packageVersion) == 0));
   345    345       return TCL_OK;
   346    346   }
   347    347   
   348    348   /*
   349    349    * Local Variables:
   350    350    * mode: c
   351    351    * c-basic-offset: 4
   352    352    * fill-column: 78
   353    353    * End:
   354    354    */

Changes to generic/tclUtil.c.

  3444   3444       ClientData clientData,	/* Not used. */
  3445   3445       Tcl_Interp *interp,		/* Interpreter containing variable. */
  3446   3446       const char *name1,		/* Name of variable. */
  3447   3447       const char *name2,		/* Second part of variable name. */
  3448   3448       int flags)			/* Information about what happened. */
  3449   3449   {
  3450   3450       Tcl_Obj *value;
  3451         -    int prec;
         3451  +    Tcl_WideInt prec;
  3452   3452       int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int));
  3453   3453   
  3454   3454       /*
  3455   3455        * If the variable is unset, then recreate the trace.
  3456   3456        */
  3457   3457   
  3458   3458       if (flags & TCL_TRACE_UNSETS) {
................................................................................
  3484   3484        */
  3485   3485   
  3486   3486       if (Tcl_IsSafe(interp)) {
  3487   3487   	return (char *) "can't modify precision from a safe interpreter";
  3488   3488       }
  3489   3489       value = Tcl_GetVar2Ex(interp, name1, name2, flags & TCL_GLOBAL_ONLY);
  3490   3490       if (value == NULL
  3491         -	    || Tcl_GetIntFromObj(NULL, value, &prec) != TCL_OK
         3491  +	    || Tcl_GetWideIntFromObj(NULL, value, &prec) != TCL_OK
  3492   3492   	    || prec < 0 || prec > TCL_MAX_PREC) {
  3493   3493   	return (char *) "improper value for precision";
  3494   3494       }
  3495         -    *precisionPtr = prec;
         3495  +    *precisionPtr = (int)prec;
  3496   3496       return NULL;
  3497   3497   }
  3498   3498   #endif /* !TCL_NO_DEPRECATED)*/
  3499   3499   
  3500   3500   /*
  3501   3501    *----------------------------------------------------------------------
  3502   3502    *

Changes to generic/tclZlib.c.

   418    418   				 * parsed. */
   419    419       GzipHeader *headerPtr,	/* Where to store the parsed-out values. */
   420    420       int *extraSizePtr)		/* Variable to add the length of header
   421    421   				 * strings (filename, comment) to. */
   422    422   {
   423    423       Tcl_Obj *value;
   424    424       int len, result = TCL_ERROR;
          425  +    Tcl_WideInt wideValue;
   425    426       const char *valueStr;
   426    427       Tcl_Encoding latin1enc;
   427    428       static const char *const types[] = {
   428    429   	"binary", "text"
   429    430       };
   430    431   
   431    432       /*
................................................................................
   481    482       /*
   482    483        * Ignore the 'size' field, since that is controlled by the size of the
   483    484        * input data.
   484    485        */
   485    486   
   486    487       if (GetValue(interp, dictObj, "time", &value) != TCL_OK) {
   487    488   	goto error;
   488         -    } else if (value != NULL && Tcl_GetLongFromObj(interp, value,
   489         -	    (long *) &headerPtr->header.time) != TCL_OK) {
          489  +    } else if (value != NULL && Tcl_GetWideIntFromObj(interp, value,
          490  +	    &wideValue) != TCL_OK) {
   490    491   	goto error;
   491    492       }
          493  +    headerPtr->header.time = wideValue;
   492    494   
   493    495       if (GetValue(interp, dictObj, "type", &value) != TCL_OK) {
   494    496   	goto error;
   495    497       } else if (value != NULL && Tcl_GetIndexFromObj(interp, value, types,
   496    498   	    "type", TCL_EXACT, &headerPtr->header.text) != TCL_OK) {
   497    499   	goto error;
   498    500       }

Changes to macosx/tclMacOSXFCmd.c.

   188    188   		OSSwapBigToHostInt32(finder->creator));
   189    189   	break;
   190    190       case MACOSX_TYPE_ATTRIBUTE:
   191    191   	*attributePtrPtr = NewOSTypeObj(
   192    192   		OSSwapBigToHostInt32(finder->type));
   193    193   	break;
   194    194       case MACOSX_HIDDEN_ATTRIBUTE:
   195         -	*attributePtrPtr = Tcl_NewBooleanObj(
          195  +	*attributePtrPtr = Tcl_NewWideIntObj(
   196    196   		(finder->fdFlags & kFinfoIsInvisible) != 0);
   197    197   	break;
   198    198       case MACOSX_RSRCLENGTH_ATTRIBUTE:
   199    199   	*attributePtrPtr = Tcl_NewWideIntObj(*rsrcForkSize);
   200    200   	break;
   201    201       }
   202    202       return TCL_OK;
................................................................................
   576    576       OSType *osTypePtr)		/* Place to store resulting OSType. */
   577    577   {
   578    578       int result = TCL_OK;
   579    579   
   580    580       if (!TclHasIntRep(objPtr, &tclOSTypeType)) {
   581    581   	result = SetOSTypeFromAny(interp, objPtr);
   582    582       }
   583         -    *osTypePtr = (OSType) objPtr->internalRep.longValue;
          583  +    *osTypePtr = (OSType) objPtr->internalRep.wideValue;
   584    584       return result;
   585    585   }
   586    586   
   587    587   /*
   588    588    *----------------------------------------------------------------------
   589    589    *
   590    590    * NewOSTypeObj --
................................................................................
   605    605       const OSType osType)	/* OSType used to initialize the new
   606    606   				 * object. */
   607    607   {
   608    608       Tcl_Obj *objPtr;
   609    609   
   610    610       TclNewObj(objPtr);
   611    611       TclInvalidateStringRep(objPtr);
   612         -    objPtr->internalRep.longValue = (long) osType;
          612  +    objPtr->internalRep.wideValue = (Tcl_WideInt) osType;
   613    613       objPtr->typePtr = &tclOSTypeType;
   614    614       return objPtr;
   615    615   }
   616    616   
   617    617   /*
   618    618    *----------------------------------------------------------------------
   619    619    *
................................................................................
   656    656   
   657    657   	memcpy(bytes, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
   658    658   	osType = (OSType) bytes[0] << 24 |
   659    659   		 (OSType) bytes[1] << 16 |
   660    660   		 (OSType) bytes[2] <<  8 |
   661    661   		 (OSType) bytes[3];
   662    662   	TclFreeIntRep(objPtr);
   663         -	objPtr->internalRep.longValue = (long) osType;
          663  +	objPtr->internalRep.wideValue = (Tcl_WideInt) osType;
   664    664   	objPtr->typePtr = &tclOSTypeType;
   665    665       }
   666    666       Tcl_DStringFree(&ds);
   667    667       Tcl_FreeEncoding(encoding);
   668    668       return result;
   669    669   }
   670    670   
................................................................................
   690    690   static void
   691    691   UpdateStringOfOSType(
   692    692       register Tcl_Obj *objPtr)	/* OSType object whose string rep to
   693    693   				 * update. */
   694    694   {
   695    695       const int size = TCL_UTF_MAX * 4;
   696    696       char *dst = Tcl_InitStringRep(objPtr, NULL, size);
   697         -    OSType osType = (OSType) objPtr->internalRep.longValue;
          697  +    OSType osType = (OSType) objPtr->internalRep.wideValue;
   698    698       int written = 0;
   699    699       Tcl_Encoding encoding;
   700    700       char src[5];
   701    701   
   702    702       TclOOM(dst, size);
   703    703   
   704    704       src[0] = (char) (osType >> 24);

Changes to tests/cmdMZ.test.

   356    356   } {1 {expected integer but got "b"}}
   357    357   test cmdMZ-6.3 {Tcl_TimeRateObjCmd: basic format of command} {
   358    358       list [catch {timerate -overhead b {} a b} msg] $msg
   359    359   } {1 {expected floating-point number but got "b"}}
   360    360   test cmdMZ-6.4 {Tcl_TimeRateObjCmd: compile of script happens even with negative iteration counts} {
   361    361       list [catch {timerate "foreach a {c d e} \{" -12456} msg] $msg
   362    362   } {1 {missing close-brace}}
   363         -test cmdMZ-6.5 {Tcl_TimeRateObjCmd: result format and one iteration} {
   364         -    regexp {^\d+.\d+ \ws/# 1 # \d+ #/sec \d+.\d+ nett-ms$} [timerate {} 0]
          363  +test cmdMZ-6.5a {Tcl_TimeRateObjCmd: result format and one iteration} {
          364  +    regexp {^\d+(?:\.\d+)? \ws/# 1 # \d+(?:\.\d+)? #/sec \d+(?:\.\d+)? nett-ms$} [timerate {} 0]
          365  +} 1
          366  +test cmdMZ-6.5b {Tcl_TimeRateObjCmd: result format without iterations} {
          367  +    regexp {^0 \ws/# 0 # 0 #/sec 0 nett-ms$} [timerate {} 0 0]
   365    368   } 1
   366    369   test cmdMZ-6.6 {Tcl_TimeRateObjCmd: slower commands take longer, but it remains almost the same time of measument} {
   367    370       set m1 [timerate {after 0} 20]
   368    371       set m2 [timerate {after 1} 20]
   369    372       list \
   370    373   	[expr {[lindex $m1 0] < [lindex $m2 0]}] \
   371    374   	[expr {[lindex $m1 0] < 100}] \

Changes to tests/obj.test.

   472    472   test obj-26.1 {UpdateStringOfInt} testobj {
   473    473       set result ""
   474    474       lappend result [testintobj set 1 512]
   475    475       lappend result [testintobj mult10 1]
   476    476       lappend result [testintobj get 1]       ;# must update string rep
   477    477   } {512 5120 5120}
   478    478   
   479         -test obj-27.1 {Tcl_NewLongObj} testobj {
          479  +test obj-27.1 {Tcl_NewWideObj} testobj {
   480    480       set result ""
   481    481       lappend result [testobj freeallvars]
   482         -    testintobj setmaxlong 1
   483         -    lappend result [testintobj ismaxlong 1]
          482  +    testintobj setmax 1
          483  +    lappend result [testintobj ismax 1]
   484    484       lappend result [testobj type 1]
   485    485       lappend result [testobj refcount 1]
   486    486   } {{} 1 int 1}
   487    487   
   488    488   test obj-28.1 {Tcl_SetLongObj, existing "empty string" object} testobj {
   489    489       set result ""
   490    490       lappend result [testobj freeallvars]
   491    491       lappend result [testobj newobj 1]
   492         -    lappend result [testintobj setlong 1 77]  ;# makes existing obj long int
          492  +    lappend result [testintobj setint 1 77]  ;# makes existing obj int
   493    493       lappend result [testobj type 1]
   494    494       lappend result [testobj refcount 1]
   495    495   } {{} {} 77 int 2}
   496    496   test obj-28.2 {Tcl_SetLongObj, existing non-"empty string" object} testobj {
   497    497       set result ""
   498    498       lappend result [testobj freeallvars]
   499    499       lappend result [testdoubleobj set 1 12.34]
   500         -    lappend result [testintobj setlong 1 77]  ;# makes existing obj long int
          500  +    lappend result [testintobj setint 1 77]  ;# makes existing obj int
   501    501       lappend result [testobj type 1]
   502    502       lappend result [testobj refcount 1]
   503    503   } {{} 12.34 77 int 2}
   504    504   
   505         -test obj-29.1 {Tcl_GetLongFromObj, existing long integer object} testobj {
          505  +test obj-29.1 {Tcl_GetWideIntFromObj, existing int object} testobj {
   506    506       set result ""
   507         -    lappend result [testintobj setlong 1 22]
   508         -    lappend result [testintobj mult10 1]   ;# gets existing long int rep
          507  +    lappend result [testintobj setint 1 22]
          508  +    lappend result [testintobj mult10 1]   ;# gets existingint rep
   509    509   } {22 220}
   510         -test obj-29.2 {Tcl_GetLongFromObj, convert to long} testobj {
          510  +test obj-29.2 {Tcl_GetWideIntFromObj, convert to int} testobj {
   511    511       set result ""
   512         -    lappend result [testintobj setlong 1 477]
          512  +    lappend result [testintobj setint 1 477]
   513    513       lappend result [testintobj div10 1]    ;# must convert to bool
   514    514       lappend result [testobj type 1]
   515    515   } {477 47 int}
   516         -test obj-29.3 {Tcl_GetLongFromObj, error converting to long integer} testobj {
          516  +test obj-29.3 {Tcl_GetWideIntFromObj, error converting to int} testobj {
   517    517       set result ""
   518    518       lappend result [teststringobj set 1 abc]
   519         -    lappend result [catch {testintobj ismaxlong 1} msg] ;# cvts to long int
          519  +    lappend result [catch {testintobj ismax 1} msg] ;# cvts to long int
   520    520       lappend result $msg
   521    521   } {abc 1 {expected integer but got "abc"}}
   522         -test obj-29.4 {Tcl_GetLongFromObj, error converting from "empty string"} testobj {
          522  +test obj-29.4 {Tcl_GetWideIntFromObj, error converting from "empty string"} testobj {
   523    523       set result ""
   524    524       lappend result [testobj newobj 1]
   525         -    lappend result [catch {testintobj ismaxlong 1} msg] ;# cvts to long int
          525  +    lappend result [catch {testintobj ismax 1} msg] ;# cvts to long int
   526    526       lappend result $msg
   527    527   } {{} 1 {expected integer but got ""}}
   528    528   
   529    529   test obj-30.1 {Ref counting and object deletion, simple types} testobj {
   530    530       set result ""
   531    531       lappend result [testobj freeallvars]
   532    532       lappend result [testintobj set 1 1024]

Changes to tests/utf.test.

   104    104   test utf-4.1 {Tcl_NumUtfChars: zero length} testnumutfchars {
   105    105       testnumutfchars ""
   106    106   } {0}
   107    107   test utf-4.2 {Tcl_NumUtfChars: length 1} {testnumutfchars testbytestring} {
   108    108       testnumutfchars [testbytestring "\xC2\xA2"]
   109    109   } {1}
   110    110   test utf-4.3 {Tcl_NumUtfChars: long string} {testnumutfchars testbytestring} {
   111         -    testnumutfchars [testbytestring "abc\xC2\xA2\xe4\xb9\x8e\uA2\u4e4e"]
          111  +    testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"]
   112    112   } {7}
   113    113   test utf-4.4 {Tcl_NumUtfChars: #u0000} {testnumutfchars testbytestring} {
   114    114       testnumutfchars [testbytestring "\xC0\x80"]
   115    115   } {1}
   116    116   test utf-4.5 {Tcl_NumUtfChars: zero length, calc len} testnumutfchars {
   117    117       testnumutfchars "" 0
   118    118   } {0}
   119    119   test utf-4.6 {Tcl_NumUtfChars: length 1, calc len} {testnumutfchars testbytestring} {
   120    120       testnumutfchars [testbytestring "\xC2\xA2"] 2
   121    121   } {1}
   122    122   test utf-4.7 {Tcl_NumUtfChars: long string, calc len} {testnumutfchars testbytestring} {
   123         -    testnumutfchars [testbytestring "abc\xC2\xA2\xe4\xb9\x8e\uA2\u4e4e"] 10
          123  +    testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"] 10
   124    124   } {7}
   125    125   test utf-4.8 {Tcl_NumUtfChars: #u0000, calc len} {testnumutfchars testbytestring} {
   126    126       testnumutfchars [testbytestring "\xC0\x80"] 2
   127    127   } {1}
   128    128   # Bug [2738427]: Tcl_NumUtfChars(...) no overflow check
   129    129   test utf-4.9 {Tcl_NumUtfChars: #u20AC, calc len, incomplete} {testnumutfchars testbytestring} {
   130    130       testnumutfchars [testbytestring "\xE2\x82\xAC"] 2

Changes to unix/tclUnixFCmd.c.

  1495   1495   static int
  1496   1496   SetGroupAttribute(
  1497   1497       Tcl_Interp *interp,		/* The interp for error reporting. */
  1498   1498       int objIndex,		/* The index of the attribute. */
  1499   1499       Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
  1500   1500       Tcl_Obj *attributePtr)	/* New group for file. */
  1501   1501   {
  1502         -    long gid;
         1502  +    Tcl_WideInt gid;
  1503   1503       int result;
  1504   1504       const char *native;
  1505   1505   
  1506         -    if (Tcl_GetLongFromObj(NULL, attributePtr, &gid) != TCL_OK) {
         1506  +    if (Tcl_GetWideIntFromObj(NULL, attributePtr, &gid) != TCL_OK) {
  1507   1507   	Tcl_DString ds;
  1508   1508   	struct group *groupPtr = NULL;
  1509   1509   	const char *string;
  1510   1510   
  1511   1511   	string = TclGetString(attributePtr);
  1512   1512   
  1513   1513   	native = Tcl_UtfToExternalDString(NULL, string, attributePtr->length, &ds);
................................................................................
  1561   1561   static int
  1562   1562   SetOwnerAttribute(
  1563   1563       Tcl_Interp *interp,		/* The interp for error reporting. */
  1564   1564       int objIndex,		/* The index of the attribute. */
  1565   1565       Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
  1566   1566       Tcl_Obj *attributePtr)	/* New owner for file. */
  1567   1567   {
  1568         -    long uid;
         1568  +    Tcl_WideInt uid;
  1569   1569       int result;
  1570   1570       const char *native;
  1571   1571   
  1572         -    if (Tcl_GetLongFromObj(NULL, attributePtr, &uid) != TCL_OK) {
         1572  +    if (Tcl_GetWideIntFromObj(NULL, attributePtr, &uid) != TCL_OK) {
  1573   1573   	Tcl_DString ds;
  1574   1574   	struct passwd *pwPtr = NULL;
  1575   1575   	const char *string;
  1576   1576   
  1577   1577   	string = TclGetString(attributePtr);
  1578   1578   
  1579   1579   	native = Tcl_UtfToExternalDString(NULL, string, attributePtr->length, &ds);
................................................................................
  1627   1627   static int
  1628   1628   SetPermissionsAttribute(
  1629   1629       Tcl_Interp *interp,		/* The interp we are using for errors. */
  1630   1630       int objIndex,		/* The index of the attribute. */
  1631   1631       Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
  1632   1632       Tcl_Obj *attributePtr)	/* The attribute to set. */
  1633   1633   {
  1634         -    long mode;
         1634  +    Tcl_WideInt mode;
  1635   1635       mode_t newMode;
  1636   1636       int result = TCL_ERROR;
  1637   1637       const char *native;
  1638   1638       const char *modeStringPtr = TclGetString(attributePtr);
  1639   1639       int scanned = TclParseAllWhiteSpace(modeStringPtr, -1);
  1640   1640   
  1641   1641       /*
................................................................................
  1646   1646   	    && (modeStringPtr[scanned+1] >= '0')
  1647   1647   	    && (modeStringPtr[scanned+1] <= '7')) {
  1648   1648   	/* Leading zero - attempt octal interpretation */
  1649   1649   	Tcl_Obj *modeObj;
  1650   1650   
  1651   1651   	TclNewLiteralStringObj(modeObj, "0o");
  1652   1652   	Tcl_AppendToObj(modeObj, modeStringPtr+scanned+1, -1);
  1653         -	result = Tcl_GetLongFromObj(NULL, modeObj, &mode);
         1653  +	result = Tcl_GetWideIntFromObj(NULL, modeObj, &mode);
  1654   1654   	Tcl_DecrRefCount(modeObj);
  1655   1655       }
  1656   1656       if (result == TCL_OK
  1657         -	    || Tcl_GetLongFromObj(NULL, attributePtr, &mode) == TCL_OK) {
         1657  +	    || Tcl_GetWideIntFromObj(NULL, attributePtr, &mode) == TCL_OK) {
  1658   1658   	newMode = (mode_t) (mode & 0x00007FFF);
  1659   1659       } else {
  1660   1660   	Tcl_StatBuf buf;
  1661   1661   
  1662   1662   	/*
  1663   1663   	 * Try the forms "rwxrwxrwx" and "ugo=rwx"
  1664   1664   	 *
................................................................................
  2336   2336       ckfree(winPath);
  2337   2337   
  2338   2338       if (fileAttributes == -1) {
  2339   2339   	StatError(interp, fileName);
  2340   2340   	return TCL_ERROR;
  2341   2341       }
  2342   2342   
  2343         -    *attributePtrPtr = Tcl_NewBooleanObj(
  2344         -	    fileAttributes & attributeArray[objIndex]);
         2343  +    *attributePtrPtr = Tcl_NewWideIntObj(
         2344  +	    (fileAttributes & attributeArray[objIndex]) != 0);
  2345   2345       return TCL_OK;
  2346   2346   }
  2347   2347   
  2348   2348   /*
  2349   2349    *---------------------------------------------------------------------------
  2350   2350    *
  2351   2351    * SetUnixFileAttributes
................................................................................
  2436   2436   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2437   2437   		    "could not read \"%s\": %s",
  2438   2438   		    TclGetString(fileName), Tcl_PosixError(interp)));
  2439   2439   	}
  2440   2440   	return TCL_ERROR;
  2441   2441       }
  2442   2442   
  2443         -    *attributePtrPtr = Tcl_NewBooleanObj(statBuf.st_flags & UF_IMMUTABLE);
         2443  +    *attributePtrPtr = Tcl_NewWideIntObj((statBuf.st_flags & UF_IMMUTABLE) != 0);
  2444   2444       return TCL_OK;
  2445   2445   }
  2446   2446   
  2447   2447   /*
  2448   2448    *---------------------------------------------------------------------------
  2449   2449    *
  2450   2450    * SetUnixFileAttributes

Changes to win/tclWinFCmd.c.

  1545   1545   		 */
  1546   1546   
  1547   1547   		attr = 0;
  1548   1548   	    }
  1549   1549   	}
  1550   1550       }
  1551   1551   
  1552         -    *attributePtrPtr = Tcl_NewBooleanObj(attr);
         1552  +    *attributePtrPtr = Tcl_NewWideIntObj(attr != 0);
  1553   1553       return TCL_OK;
  1554   1554   }
  1555   1555   
  1556   1556   /*
  1557   1557    *----------------------------------------------------------------------
  1558   1558    *
  1559   1559    * ConvertFileNameFormat --