Tcl Source Code

Check-in [76fa1ad734]
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 trunk through 2019-02-01
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-refactor
Files: files | file ages | folders
SHA3-256: 76fa1ad734df55f9614c7d3f7a9aad83c054d8d5c74dafcacc3d21e3fddae3f7
User & Date: dgp 2019-02-13 21:24:42
Context
2019-02-13
21:38
Merge trunk through 2019-02-05 check-in: 3bbdf1f4ba user: dgp tags: dgp-refactor
21:24
Merge trunk through 2019-02-01 check-in: 76fa1ad734 user: dgp tags: dgp-refactor
21:14
Merge trunk through 2019-01-26 check-in: 8b66d9f360 user: dgp tags: dgp-refactor
2019-02-01
20:36
Another (big) round of int -> size_t enhancements. So Tcl can handle string >2GiB in more places. check-in: 8534448b44 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Deleted compat/unistd.h.

     1         -/*
     2         - * unistd.h --
     3         - *
     4         - *      Macros, constants and prototypes for Posix conformance.
     5         - *
     6         - * Copyright 1989 Regents of the University of California Permission to use,
     7         - * copy, modify, and distribute this software and its documentation for any
     8         - * purpose and without fee is hereby granted, provided that the above
     9         - * copyright notice appear in all copies. The University of California makes
    10         - * no representations about the suitability of this software for any purpose.
    11         - * It is provided "as is" without express or implied warranty.
    12         - */
    13         -
    14         -#ifndef _UNISTD
    15         -#define _UNISTD
    16         -
    17         -#include <sys/types.h>
    18         -
    19         -#ifndef NULL
    20         -#define NULL    0
    21         -#endif
    22         -
    23         -/*
    24         - * Strict POSIX stuff goes here. Extensions go down below, in the ifndef
    25         - * _POSIX_SOURCE section.
    26         - */
    27         -
    28         -extern void		_exit(int status);
    29         -extern int		access(const char *path, int mode);
    30         -extern int		chdir(const char *path);
    31         -extern int		chown(const char *path, uid_t owner, gid_t group);
    32         -extern int		close(int fd);
    33         -extern int		dup(int oldfd);
    34         -extern int		dup2(int oldfd, int newfd);
    35         -extern int		execl(const char *path, ...);
    36         -extern int		execle(const char *path, ...);
    37         -extern int		execlp(const char *file, ...);
    38         -extern int		execv(const char *path, char **argv);
    39         -extern int		execve(const char *path, char **argv, char **envp);
    40         -extern int		execvpw(const char *file, char **argv);
    41         -extern pid_t		fork(void);
    42         -extern char *		getcwd(char *buf, size_t size);
    43         -extern gid_t		getegid(void);
    44         -extern uid_t		geteuid(void);
    45         -extern gid_t		getgid(void);
    46         -extern int		getgroups(int bufSize, int *buffer);
    47         -extern pid_t		getpid(void);
    48         -extern uid_t		getuid(void);
    49         -extern int		isatty(int fd);
    50         -extern long		lseek(int fd, long offset, int whence);
    51         -extern int		pipe(int *fildes);
    52         -extern int		read(int fd, char *buf, size_t size);
    53         -extern int		setgid(gid_t group);
    54         -extern int		setuid(uid_t user);
    55         -extern unsigned		sleep(unsigned seconds);
    56         -extern char *		ttyname(int fd);
    57         -extern int		unlink(const char *path);
    58         -extern int		write(int fd, const char *buf, size_t size);
    59         -
    60         -#ifndef	_POSIX_SOURCE
    61         -extern char *		crypt(const char *, const char *);
    62         -extern int		fchown(int fd, uid_t owner, gid_t group);
    63         -extern int		flock(int fd, int operation);
    64         -extern int		ftruncate(int fd, unsigned long length);
    65         -extern int		ioctl(int fd, int request, ...);
    66         -extern int		readlink(const char *path, char *buf, int bufsize);
    67         -extern int		setegid(gid_t group);
    68         -extern int		seteuidw(uid_t user);
    69         -extern int		setreuid(int ruid, int euid);
    70         -extern int		symlink(const char *, const char *);
    71         -extern int		ttyslot(void);
    72         -extern int		truncate(const char *path, unsigned long length);
    73         -extern int		vfork(void);
    74         -#endif /* _POSIX_SOURCE */
    75         -
    76         -#endif /* _UNISTD */

Changes to doc/ParseArgs.3.

    99     99   As noted above, the \fItype\fR field is used to describe the interpretation of
   100    100   the argument's value. The following values are acceptable values for
   101    101   \fItype\fR:
   102    102   .TP
   103    103   \fBTCL_ARGV_CONSTANT\fR
   104    104   .
   105    105   The argument does not take any following value argument. If this argument is
   106         -present, the int pointed to by the \fIsrcPtr\fR field is copied to the
   107         -\fIdstPtr\fR field. The \fIclientData\fR field is ignored.
          106  +present, the \fIsrcPtr\fR field (casted to \fIint\fR) is copied to the variable
          107  +pointed to by the \fIdstPtr\fR field. The \fIclientData\fR field is ignored.
   108    108   .TP
   109    109   \fBTCL_ARGV_END\fR
   110    110   .
   111    111   This value marks the end of all option descriptors in the table. All other
   112    112   fields are ignored.
   113    113   .TP
   114    114   \fBTCL_ARGV_FLOAT\fR

Changes to generic/tclBasic.c.

  1052   1052        * Register Tcl's version number.
  1053   1053        * TIP #268: Full patchlevel instead of just major.minor
  1054   1054        */
  1055   1055   
  1056   1056       Tcl_PkgProvideEx(interp, "Tcl", TCL_PATCH_LEVEL, &tclStubs);
  1057   1057   
  1058   1058       if (TclTommath_Init(interp) != TCL_OK) {
  1059         -	Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
         1059  +	Tcl_Panic("%s", Tcl_GetStringResult(interp));
  1060   1060       }
  1061   1061   
  1062   1062       if (TclOOInit(interp) != TCL_OK) {
  1063         -	Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
         1063  +	Tcl_Panic("%s", Tcl_GetStringResult(interp));
  1064   1064       }
  1065   1065   
  1066   1066       /*
  1067   1067        * Only build in zlib support if we've successfully detected a library to
  1068   1068        * compile and link against.
  1069   1069        */
  1070   1070   
  1071   1071   #ifdef HAVE_ZLIB
  1072   1072       if (TclZlibInit(interp) != TCL_OK) {
  1073         -	Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
         1073  +	Tcl_Panic("%s", Tcl_GetStringResult(interp));
  1074   1074       }
  1075   1075       if (TclZipfs_Init(interp) != TCL_OK) {
  1076         -	Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
         1076  +	Tcl_Panic("%s", Tcl_GetStringResult(interp));
  1077   1077       }
  1078   1078   #endif
  1079   1079   
  1080   1080       TOP_CB(iPtr) = NULL;
  1081   1081       return interp;
  1082   1082   }
  1083   1083   
................................................................................
  1201   1201   
  1202   1202               if (TclRenameCommand(interp, TclGetString(cmdName),
  1203   1203                           "___tmp") != TCL_OK
  1204   1204                       || Tcl_HideCommand(interp, "___tmp",
  1205   1205                               TclGetString(hideName)) != TCL_OK) {
  1206   1206                   Tcl_Panic("problem making '%s %s' safe: %s",
  1207   1207                           unsafePtr->ensembleNsName, unsafePtr->commandName,
  1208         -                        Tcl_GetString(Tcl_GetObjResult(interp)));
         1208  +                        Tcl_GetStringResult(interp));
  1209   1209               }
  1210   1210               Tcl_CreateObjCommand(interp, TclGetString(cmdName),
  1211   1211                       BadEnsembleSubcommand, (ClientData) unsafePtr, NULL);
  1212   1212               TclDecrRefCount(cmdName);
  1213   1213               TclDecrRefCount(hideName);
  1214   1214           } else {
  1215   1215               /*
................................................................................
  1216   1216                * Hide an ensemble main command (for compatibility).
  1217   1217                */
  1218   1218   
  1219   1219               if (Tcl_HideCommand(interp, unsafePtr->ensembleNsName,
  1220   1220                       unsafePtr->ensembleNsName) != TCL_OK) {
  1221   1221                   Tcl_Panic("problem making '%s' safe: %s",
  1222   1222                           unsafePtr->ensembleNsName,
  1223         -                        Tcl_GetString(Tcl_GetObjResult(interp)));
         1223  +                        Tcl_GetStringResult(interp));
  1224   1224               }
  1225   1225           }
  1226   1226       }
  1227   1227   
  1228   1228       return TCL_OK;
  1229   1229   }
  1230   1230   
................................................................................
  6683   6683       if (objc != 2) {
  6684   6684   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  6685   6685   	return TCL_ERROR;
  6686   6686       }
  6687   6687       code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
  6688   6688   #ifdef ACCEPT_NAN
  6689   6689       if (code != TCL_OK) {
  6690         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6690  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6691   6691   
  6692   6692   	if (irPtr) {
  6693   6693   	    Tcl_SetObjResult(interp, objv[1]);
  6694   6694   	    return TCL_OK;
  6695   6695   	}
  6696   6696       }
  6697   6697   #endif
................................................................................
  6723   6723       if (objc != 2) {
  6724   6724   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  6725   6725   	return TCL_ERROR;
  6726   6726       }
  6727   6727       code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
  6728   6728   #ifdef ACCEPT_NAN
  6729   6729       if (code != TCL_OK) {
  6730         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6730  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6731   6731   
  6732   6732   	if (irPtr) {
  6733   6733   	    Tcl_SetObjResult(interp, objv[1]);
  6734   6734   	    return TCL_OK;
  6735   6735   	}
  6736   6736       }
  6737   6737   #endif
................................................................................
  6863   6863       if (objc != 2) {
  6864   6864   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  6865   6865   	return TCL_ERROR;
  6866   6866       }
  6867   6867       code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
  6868   6868   #ifdef ACCEPT_NAN
  6869   6869       if (code != TCL_OK) {
  6870         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6870  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6871   6871   
  6872   6872   	if (irPtr) {
  6873   6873   	    Tcl_SetObjResult(interp, objv[1]);
  6874   6874   	    return TCL_OK;
  6875   6875   	}
  6876   6876       }
  6877   6877   #endif
................................................................................
  6910   6910       if (objc != 2) {
  6911   6911   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  6912   6912   	return TCL_ERROR;
  6913   6913       }
  6914   6914       code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
  6915   6915   #ifdef ACCEPT_NAN
  6916   6916       if (code != TCL_OK) {
  6917         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6917  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6918   6918   
  6919   6919   	if (irPtr) {
  6920   6920   	    d = irPtr->doubleValue;
  6921   6921   	    Tcl_ResetResult(interp);
  6922   6922   	    code = TCL_OK;
  6923   6923   	}
  6924   6924       }
................................................................................
  6974   6974       if (objc != 3) {
  6975   6975   	MathFuncWrongNumArgs(interp, 3, objc, objv);
  6976   6976   	return TCL_ERROR;
  6977   6977       }
  6978   6978       code = Tcl_GetDoubleFromObj(interp, objv[1], &d1);
  6979   6979   #ifdef ACCEPT_NAN
  6980   6980       if (code != TCL_OK) {
  6981         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6981  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6982   6982   
  6983   6983   	if (irPtr) {
  6984   6984   	    d1 = irPtr->doubleValue;
  6985   6985   	    Tcl_ResetResult(interp);
  6986   6986   	    code = TCL_OK;
  6987   6987   	}
  6988   6988       }
................................................................................
  6989   6989   #endif
  6990   6990       if (code != TCL_OK) {
  6991   6991   	return TCL_ERROR;
  6992   6992       }
  6993   6993       code = Tcl_GetDoubleFromObj(interp, objv[2], &d2);
  6994   6994   #ifdef ACCEPT_NAN
  6995   6995       if (code != TCL_OK) {
  6996         -	const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType);
         6996  +	const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType);
  6997   6997   
  6998   6998   	if (irPtr) {
  6999   6999   	    d2 = irPtr->doubleValue;
  7000   7000   	    Tcl_ResetResult(interp);
  7001   7001   	    code = TCL_OK;
  7002   7002   	}
  7003   7003       }
................................................................................
  7137   7137   
  7138   7138       if (objc != 2) {
  7139   7139   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  7140   7140   	return TCL_ERROR;
  7141   7141       }
  7142   7142       if (Tcl_GetDoubleFromObj(interp, objv[1], &dResult) != TCL_OK) {
  7143   7143   #ifdef ACCEPT_NAN
  7144         -	if (Tcl_FetchIntRep(objv[1], &tclDoubleType)) {
         7144  +	if (objv[1]->typePtr == &tclDoubleType) {
  7145   7145   	    Tcl_SetObjResult(interp, objv[1]);
  7146   7146   	    return TCL_OK;
  7147   7147   	}
  7148   7148   #endif
  7149   7149   	return TCL_ERROR;
  7150   7150       }
  7151   7151       Tcl_SetObjResult(interp, Tcl_NewDoubleObj(dResult));

Changes to generic/tclBinary.c.

    18     18   #include <assert.h>
    19     19   
    20     20   /*
    21     21    * The following constants are used by GetFormatSpec to indicate various
    22     22    * special conditions in the parsing of a format specifier.
    23     23    */
    24     24   
    25         -#define BINARY_ALL -1		/* Use all elements in the argument. */
    26         -#define BINARY_NOCOUNT -2	/* No count was specified in format. */
           25  +#define BINARY_ALL ((size_t)-1)		/* Use all elements in the argument. */
           26  +#define BINARY_NOCOUNT ((size_t)-2)	/* No count was specified in format. */
    27     27   
    28     28   /*
    29     29    * The following flags may be ORed together and returned by GetFormatSpec
    30     30    */
    31     31   
    32     32   #define BINARY_SIGNED 0		/* Field to be read as signed data */
    33     33   #define BINARY_UNSIGNED 1	/* Field to be read as unsigned data */
................................................................................
    53     53   
    54     54   /*
    55     55    * Prototypes for local procedures defined in this file:
    56     56    */
    57     57   
    58     58   static void		DupByteArrayInternalRep(Tcl_Obj *srcPtr,
    59     59   			    Tcl_Obj *copyPtr);
    60         -static void		DupProperByteArrayInternalRep(Tcl_Obj *srcPtr,
    61         -			    Tcl_Obj *copyPtr);
    62     60   static int		FormatNumber(Tcl_Interp *interp, int type,
    63     61   			    Tcl_Obj *src, unsigned char **cursorPtr);
    64     62   static void		FreeByteArrayInternalRep(Tcl_Obj *objPtr);
    65         -static void		FreeProperByteArrayInternalRep(Tcl_Obj *objPtr);
    66     63   static int		GetFormatSpec(const char **formatPtr, char *cmdPtr,
    67         -			    int *countPtr, int *flagsPtr);
           64  +			    size_t *countPtr, int *flagsPtr);
    68     65   static Tcl_Obj *	ScanNumber(unsigned char *buffer, int type,
    69     66   			    int flags, Tcl_HashTable **numberCachePtr);
    70     67   static int		SetByteArrayFromAny(Tcl_Interp *interp,
    71     68   			    Tcl_Obj *objPtr);
    72     69   static void		UpdateStringOfByteArray(Tcl_Obj *listPtr);
    73     70   static void		DeleteScanNumberCache(Tcl_HashTable *numberCachePtr);
    74     71   static int		NeedReversing(int format);
    75     72   static void		CopyNumber(const void *from, void *to,
    76         -			    unsigned length, int type);
           73  +			    size_t length, int type);
    77     74   /* Binary ensemble commands */
    78     75   static int		BinaryFormatCmd(ClientData clientData,
    79     76   			    Tcl_Interp *interp,
    80     77   			    int objc, Tcl_Obj *const objv[]);
    81     78   static int		BinaryScanCmd(ClientData clientData,
    82     79   			    Tcl_Interp *interp,
    83     80   			    int objc, Tcl_Obj *const objv[]);
................................................................................
   218    215    * been retrofitted with the required "purity testing".  The set of values
   219    216    * able to pass the purity test can be increased via the introduction of
   220    217    * a "canonical" flag marker, but the only way the broken interface itself
   221    218    * can be discarded is to start over and define the Tcl_ObjType properly.
   222    219    * Bytearrays should simply be usable as bytearrays without a kabuki
   223    220    * dance of testing.
   224    221    *
   225         - * The Tcl_ObjType "properByteArrayType" is (nearly) a correct
          222  + * The "Pure" ByteArray type is (nearly) a correct
   226    223    * implementation of bytearrays.  Any Tcl value with the type
   227    224    * properByteArrayType can have its bytearray value fetched and
   228    225    * used with confidence that acting on that value is equivalent to
   229    226    * acting on the true Tcl string value.  This still implies a side
   230    227    * testing burden -- past mistakes will not let us avoid that
   231    228    * immediately, but it is at least a conventional test of type, and
   232    229    * can be implemented entirely by examining the objPtr fields, with
................................................................................
   244    241    * so that Tcl 9 will no longer have any trace of it.  Prescribing a
   245    242    * migration path will be the key element of that work.  The internal
   246    243    * changes now in place are the limit of what can be done short of
   247    244    * interface repair.  They provide a great expansion of the histories
   248    245    * over which bytearray values can be useful in the meanwhile.
   249    246    */
   250    247   
   251         -static const Tcl_ObjType properByteArrayType = {
          248  +const Tcl_ObjType tclPureByteArrayType = {
   252    249       "bytearray",
   253         -    FreeProperByteArrayInternalRep,
   254         -    DupProperByteArrayInternalRep,
          250  +    FreeByteArrayInternalRep,
          251  +    DupByteArrayInternalRep,
   255    252       UpdateStringOfByteArray,
   256    253       NULL
   257    254   };
   258    255   
   259    256   const Tcl_ObjType tclByteArrayType = {
   260    257       "bytearray",
   261    258       FreeByteArrayInternalRep,
................................................................................
   281    278   				 * above. */
   282    279   } ByteArray;
   283    280   
   284    281   #define BYTEARRAY_SIZE(len) \
   285    282   		((TclOffset(ByteArray, bytes) + (len)))
   286    283   #define GET_BYTEARRAY(irPtr) ((ByteArray *) (irPtr)->twoPtrValue.ptr1)
   287    284   #define SET_BYTEARRAY(irPtr, baPtr) \
   288         -		(irPtr)->twoPtrValue.ptr1 = (void *) (baPtr)
   289         -
   290         -int
   291         -TclIsPureByteArray(
   292         -    Tcl_Obj * objPtr)
   293         -{
   294         -    return (NULL != Tcl_FetchIntRep(objPtr, &properByteArrayType));
   295         -}
          285  +		(irPtr)->twoPtrValue.ptr1 = (baPtr)
   296    286   
   297    287   /*
   298    288    *----------------------------------------------------------------------
   299    289    *
   300    290    * Tcl_NewByteArrayObj --
   301    291    *
   302    292    *	This procedure is creates a new ByteArray object and initializes it
................................................................................
   416    406       byteArrayPtr->allocated = length;
   417    407   
   418    408       if ((bytes != NULL) && (length > 0)) {
   419    409   	memcpy(byteArrayPtr->bytes, bytes, length);
   420    410       }
   421    411       SET_BYTEARRAY(&ir, byteArrayPtr);
   422    412   
   423         -    Tcl_StoreIntRep(objPtr, &properByteArrayType, &ir);
          413  +    Tcl_StoreIntRep(objPtr, &tclPureByteArrayType, &ir);
   424    414   }
   425    415   
   426    416   /*
   427    417    *----------------------------------------------------------------------
   428    418    *
   429    419    * Tcl_GetByteArrayFromObj --
   430    420    *
................................................................................
   444    434   unsigned char *
   445    435   Tcl_GetByteArrayFromObj(
   446    436       Tcl_Obj *objPtr,		/* The ByteArray object. */
   447    437       int *lengthPtr)		/* If non-NULL, filled with length of the
   448    438   				 * array of bytes in the ByteArray object. */
   449    439   {
   450    440       ByteArray *baPtr;
   451         -    const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          441  +    const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   452    442   
   453    443       if (irPtr == NULL) {
   454         -	irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          444  +	irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   455    445   	if (irPtr == NULL) {
   456    446   	    SetByteArrayFromAny(NULL, objPtr);
   457         -	    irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          447  +	    irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   458    448   	    if (irPtr == NULL) {
   459         -		irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          449  +		irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   460    450   	    }
   461    451   	}
   462    452       }
   463    453       baPtr = GET_BYTEARRAY(irPtr);
   464    454   
   465    455       if (lengthPtr != NULL) {
   466    456   	*lengthPtr = baPtr->used;
................................................................................
   498    488       ByteArray *byteArrayPtr;
   499    489       Tcl_ObjIntRep *irPtr;
   500    490   
   501    491       if (Tcl_IsShared(objPtr)) {
   502    492   	Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength");
   503    493       }
   504    494   
   505         -    irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          495  +    irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   506    496       if (irPtr == NULL) {
   507         -	irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          497  +	irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   508    498   	if (irPtr == NULL) {
   509    499   	    SetByteArrayFromAny(NULL, objPtr);
   510         -	    irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          500  +	    irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   511    501   	    if (irPtr == NULL) {
   512         -		irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          502  +		irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   513    503   	    }
   514    504   	}
   515    505       }
   516    506   
   517    507       byteArrayPtr = GET_BYTEARRAY(irPtr);
   518    508       if (length > byteArrayPtr->allocated) {
   519    509   	byteArrayPtr = Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(length));
................................................................................
   549    539       size_t length;
   550    540       int improper = 0;
   551    541       const char *src, *srcEnd;
   552    542       unsigned char *dst;
   553    543       ByteArray *byteArrayPtr;
   554    544       Tcl_ObjIntRep ir;
   555    545   
   556         -    if (Tcl_FetchIntRep(objPtr, &properByteArrayType)) {
   557         -	return TCL_OK;
   558         -    }
   559         -    if (Tcl_FetchIntRep(objPtr, &tclByteArrayType)) {
          546  +    if ((objPtr->typePtr == &tclPureByteArrayType)
          547  +	    || (objPtr->typePtr == &tclByteArrayType)) {
   560    548   	return TCL_OK;
   561    549       }
   562    550   
   563    551       src = TclGetString(objPtr);
   564    552       length = objPtr->length;
   565    553       srcEnd = src + length;
   566    554   
................................................................................
   573    561       }
   574    562   
   575    563       byteArrayPtr->used = dst - byteArrayPtr->bytes;
   576    564       byteArrayPtr->allocated = length;
   577    565   
   578    566       SET_BYTEARRAY(&ir, byteArrayPtr);
   579    567       Tcl_StoreIntRep(objPtr,
   580         -	    improper ? &tclByteArrayType : &properByteArrayType, &ir);
          568  +	    improper ? &tclByteArrayType : &tclPureByteArrayType, &ir);
   581    569       return TCL_OK;
   582    570   }
   583    571   
   584    572   /*
   585    573    *----------------------------------------------------------------------
   586    574    *
   587    575    * FreeByteArrayInternalRep --
................................................................................
   598    586    *----------------------------------------------------------------------
   599    587    */
   600    588   
   601    589   static void
   602    590   FreeByteArrayInternalRep(
   603    591       Tcl_Obj *objPtr)		/* Object with internal rep to free. */
   604    592   {
   605         -    Tcl_Free(GET_BYTEARRAY(Tcl_FetchIntRep(objPtr, &tclByteArrayType)));
   606         -}
   607         -
   608         -static void
   609         -FreeProperByteArrayInternalRep(
   610         -    Tcl_Obj *objPtr)		/* Object with internal rep to free. */
   611         -{
   612         -    Tcl_Free(GET_BYTEARRAY(Tcl_FetchIntRep(objPtr, &properByteArrayType)));
          593  +    Tcl_Free(GET_BYTEARRAY(&(objPtr->internalRep)));
   613    594   }
   614    595   
   615    596   /*
   616    597    *----------------------------------------------------------------------
   617    598    *
   618    599    * DupByteArrayInternalRep --
   619    600    *
................................................................................
   634    615       Tcl_Obj *srcPtr,		/* Object with internal rep to copy. */
   635    616       Tcl_Obj *copyPtr)		/* Object with internal rep to set. */
   636    617   {
   637    618       size_t length;
   638    619       ByteArray *srcArrayPtr, *copyArrayPtr;
   639    620       Tcl_ObjIntRep ir;
   640    621   
   641         -    srcArrayPtr = GET_BYTEARRAY(Tcl_FetchIntRep(srcPtr, &tclByteArrayType));
          622  +    srcArrayPtr = GET_BYTEARRAY(&(srcPtr->internalRep));
   642    623       length = srcArrayPtr->used;
   643    624   
   644    625       copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
   645    626       copyArrayPtr->used = length;
   646    627       copyArrayPtr->allocated = length;
   647    628       memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
   648    629   
   649    630       SET_BYTEARRAY(&ir, copyArrayPtr);
   650         -    Tcl_StoreIntRep(copyPtr, &tclByteArrayType, &ir);
   651         -}
   652         -
   653         -static void
   654         -DupProperByteArrayInternalRep(
   655         -    Tcl_Obj *srcPtr,		/* Object with internal rep to copy. */
   656         -    Tcl_Obj *copyPtr)		/* Object with internal rep to set. */
   657         -{
   658         -    size_t length;
   659         -    ByteArray *srcArrayPtr, *copyArrayPtr;
   660         -    Tcl_ObjIntRep ir;
   661         -
   662         -    srcArrayPtr = GET_BYTEARRAY(Tcl_FetchIntRep(srcPtr, &properByteArrayType));
   663         -    length = srcArrayPtr->used;
   664         -
   665         -    copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
   666         -    copyArrayPtr->used = length;
   667         -    copyArrayPtr->allocated = length;
   668         -    memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
   669         -
   670         -    SET_BYTEARRAY(&ir, copyArrayPtr);
   671         -    Tcl_StoreIntRep(copyPtr, &properByteArrayType, &ir);
          631  +    Tcl_StoreIntRep(copyPtr, srcPtr->typePtr, &ir);
   672    632   }
   673    633   
   674    634   /*
   675    635    *----------------------------------------------------------------------
   676    636    *
   677    637    * UpdateStringOfByteArray --
   678    638    *
................................................................................
   689    649    */
   690    650   
   691    651   static void
   692    652   UpdateStringOfByteArray(
   693    653       Tcl_Obj *objPtr)		/* ByteArray object whose string rep to
   694    654   				 * update. */
   695    655   {
   696         -    const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          656  +    const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   697    657       ByteArray *byteArrayPtr = GET_BYTEARRAY(irPtr);
   698    658       unsigned char *src = byteArrayPtr->bytes;
   699    659       size_t i, length = byteArrayPtr->used;
   700    660       size_t size = length;
   701    661   
   702    662       /*
   703    663        * How much space will string rep need?
................................................................................
   759    719   		"TclAppendBytesToByteArray");
   760    720       }
   761    721       if (len == 0) {
   762    722   	/* Append zero bytes is a no-op. */
   763    723   	return;
   764    724       }
   765    725   
   766         -    irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          726  +    irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   767    727       if (irPtr == NULL) {
   768         -	irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          728  +	irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   769    729   	if (irPtr == NULL) {
   770    730   	    SetByteArrayFromAny(NULL, objPtr);
   771         -	    irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType);
          731  +	    irPtr = TclFetchIntRep(objPtr, &tclPureByteArrayType);
   772    732   	    if (irPtr == NULL) {
   773         -		irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType);
          733  +		irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
   774    734   	    }
   775    735   	}
   776    736       }
   777    737       byteArrayPtr = GET_BYTEARRAY(irPtr);
   778    738   
   779    739       if (len > UINT_MAX - byteArrayPtr->used) {
   780    740   	Tcl_Panic("max size for a Tcl value (%u bytes) exceeded", UINT_MAX);
................................................................................
   872    832       int objc,			/* Number of arguments. */
   873    833       Tcl_Obj *const objv[])	/* Argument objects. */
   874    834   {
   875    835       int arg;			/* Index of next argument to consume. */
   876    836       int value = 0;		/* Current integer value to be packed.
   877    837   				 * Initialized to avoid compiler warning. */
   878    838       char cmd;			/* Current format character. */
   879         -    int count;			/* Count associated with current format
          839  +    size_t count;			/* Count associated with current format
   880    840   				 * character. */
   881    841       int flags;			/* Format field flags */
   882    842       const char *format;	/* Pointer to current position in format
   883    843   				 * string. */
   884    844       Tcl_Obj *resultPtr = NULL;	/* Object holding result buffer. */
   885    845       unsigned char *buffer;	/* Start of result buffer. */
   886    846       unsigned char *cursor;	/* Current position within result buffer. */
   887    847       unsigned char *maxPos;	/* Greatest position within result buffer that
   888    848   				 * cursor has visited.*/
   889    849       const char *errorString;
   890    850       const char *errorValue, *str;
   891         -    int offset, size, length;
          851  +    int offset, size;
          852  +    size_t length;
   892    853   
   893    854       if (objc < 2) {
   894    855   	Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?");
   895    856   	return TCL_ERROR;
   896    857       }
   897    858   
   898    859       /*
................................................................................
   923    884   	     * of bytes in a single argument.
   924    885   	     */
   925    886   
   926    887   	    if (arg >= objc) {
   927    888   		goto badIndex;
   928    889   	    }
   929    890   	    if (count == BINARY_ALL) {
   930         -		TclGetByteArrayFromObj(objv[arg], &count);
          891  +		(void)TclGetByteArrayFromObj(objv[arg], &count);
   931    892   	    } else if (count == BINARY_NOCOUNT) {
   932    893   		count = 1;
   933    894   	    }
   934    895   	    arg++;
   935    896   	    if (cmd == 'a' || cmd == 'A') {
   936    897   		offset += count;
   937    898   	    } else if (cmd == 'b' || cmd == 'B') {
................................................................................
   995    956   			&listv) != TCL_OK) {
   996    957   		    return TCL_ERROR;
   997    958   		}
   998    959   		arg++;
   999    960   
  1000    961   		if (count == BINARY_ALL) {
  1001    962   		    count = listc;
  1002         -		} else if (count > listc) {
          963  +		} else if (count > (size_t)listc) {
  1003    964   		    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1004    965   			    "number of elements in list does not match count",
  1005    966   			    -1));
  1006    967   		    return TCL_ERROR;
  1007    968   		}
  1008    969   	    }
  1009    970   	    offset += count*size;
................................................................................
  1019    980   	    }
  1020    981   	    offset += count;
  1021    982   	    break;
  1022    983   	case 'X':
  1023    984   	    if (count == BINARY_NOCOUNT) {
  1024    985   		count = 1;
  1025    986   	    }
  1026         -	    if ((count > offset) || (count == BINARY_ALL)) {
          987  +	    if ((count > (size_t)offset) || (count == BINARY_ALL)) {
  1027    988   		count = offset;
  1028    989   	    }
  1029         -	    if (offset > length) {
          990  +	    if (offset > (int)length) {
  1030    991   		length = offset;
  1031    992   	    }
  1032    993   	    offset -= count;
  1033    994   	    break;
  1034    995   	case '@':
  1035         -	    if (offset > length) {
          996  +	    if (offset > (int)length) {
  1036    997   		length = offset;
  1037    998   	    }
  1038    999   	    if (count == BINARY_ALL) {
  1039   1000   		offset = length;
  1040   1001   	    } else if (count == BINARY_NOCOUNT) {
  1041   1002   		goto badCount;
  1042   1003   	    } else {
................................................................................
  1044   1005   	    }
  1045   1006   	    break;
  1046   1007   	default:
  1047   1008   	    errorString = str;
  1048   1009   	    goto badField;
  1049   1010   	}
  1050   1011       }
  1051         -    if (offset > length) {
         1012  +    if (offset > (int)length) {
  1052   1013   	length = offset;
  1053   1014       }
  1054   1015       if (length == 0) {
  1055   1016   	return TCL_OK;
  1056   1017       }
  1057   1018   
  1058   1019       /*
  1059   1020        * Prepare the result object by preallocating the caclulated number of
  1060   1021        * bytes and filling with nulls.
  1061   1022        */
  1062   1023   
  1063   1024       resultPtr = Tcl_NewObj();
  1064   1025       buffer = Tcl_SetByteArrayLength(resultPtr, length);
  1065         -    memset(buffer, 0, (size_t) length);
         1026  +    memset(buffer, 0, length);
  1066   1027   
  1067   1028       /*
  1068   1029        * Pack the data into the result object. Note that we can skip the
  1069   1030        * error checking during this pass, since we have already parsed the
  1070   1031        * string once.
  1071   1032        */
  1072   1033   
................................................................................
  1095   1056   	    arg++;
  1096   1057   	    if (count == BINARY_ALL) {
  1097   1058   		count = length;
  1098   1059   	    } else if (count == BINARY_NOCOUNT) {
  1099   1060   		count = 1;
  1100   1061   	    }
  1101   1062   	    if (length >= count) {
  1102         -		memcpy(cursor, bytes, (size_t) count);
         1063  +		memcpy(cursor, bytes, count);
  1103   1064   	    } else {
  1104         -		memcpy(cursor, bytes, (size_t) length);
  1105         -		memset(cursor + length, pad, (size_t) (count - length));
         1065  +		memcpy(cursor, bytes, length);
         1066  +		memset(cursor + length, pad, count - length);
  1106   1067   	    }
  1107   1068   	    cursor += count;
  1108   1069   	    break;
  1109   1070   	}
  1110   1071   	case 'b':
  1111   1072   	case 'B': {
  1112   1073   	    unsigned char *last;
  1113   1074   
  1114         -	    str = Tcl_GetStringFromObj(objv[arg], &length);
         1075  +	    str = TclGetStringFromObj(objv[arg], &length);
  1115   1076   	    arg++;
  1116   1077   	    if (count == BINARY_ALL) {
  1117   1078   		count = length;
  1118   1079   	    } else if (count == BINARY_NOCOUNT) {
  1119   1080   		count = 1;
  1120   1081   	    }
  1121   1082   	    last = cursor + ((count + 7) / 8);
  1122   1083   	    if (count > length) {
  1123   1084   		count = length;
  1124   1085   	    }
  1125   1086   	    value = 0;
  1126   1087   	    errorString = "binary";
  1127   1088   	    if (cmd == 'B') {
  1128         -		for (offset = 0; offset < count; offset++) {
         1089  +		for (offset = 0; (size_t)offset < count; offset++) {
  1129   1090   		    value <<= 1;
  1130   1091   		    if (str[offset] == '1') {
  1131   1092   			value |= 1;
  1132   1093   		    } else if (str[offset] != '0') {
  1133   1094   			errorValue = str;
  1134   1095   			Tcl_DecrRefCount(resultPtr);
  1135   1096   			goto badValue;
................................................................................
  1136   1097   		    }
  1137   1098   		    if (((offset + 1) % 8) == 0) {
  1138   1099   			*cursor++ = UCHAR(value);
  1139   1100   			value = 0;
  1140   1101   		    }
  1141   1102   		}
  1142   1103   	    } else {
  1143         -		for (offset = 0; offset < count; offset++) {
         1104  +		for (offset = 0; (size_t)offset < count; offset++) {
  1144   1105   		    value >>= 1;
  1145   1106   		    if (str[offset] == '1') {
  1146   1107   			value |= 128;
  1147   1108   		    } else if (str[offset] != '0') {
  1148   1109   			errorValue = str;
  1149   1110   			Tcl_DecrRefCount(resultPtr);
  1150   1111   			goto badValue;
................................................................................
  1169   1130   	    break;
  1170   1131   	}
  1171   1132   	case 'h':
  1172   1133   	case 'H': {
  1173   1134   	    unsigned char *last;
  1174   1135   	    int c;
  1175   1136   
  1176         -	    str = Tcl_GetStringFromObj(objv[arg], &length);
         1137  +	    str = TclGetStringFromObj(objv[arg], &length);
  1177   1138   	    arg++;
  1178   1139   	    if (count == BINARY_ALL) {
  1179   1140   		count = length;
  1180   1141   	    } else if (count == BINARY_NOCOUNT) {
  1181   1142   		count = 1;
  1182   1143   	    }
  1183   1144   	    last = cursor + ((count + 1) / 2);
  1184   1145   	    if (count > length) {
  1185   1146   		count = length;
  1186   1147   	    }
  1187   1148   	    value = 0;
  1188   1149   	    errorString = "hexadecimal";
  1189   1150   	    if (cmd == 'H') {
  1190         -		for (offset = 0; offset < count; offset++) {
         1151  +		for (offset = 0; (size_t)offset < count; offset++) {
  1191   1152   		    value <<= 4;
  1192   1153   		    if (!isxdigit(UCHAR(str[offset]))) {     /* INTL: digit */
  1193   1154   			errorValue = str;
  1194   1155   			Tcl_DecrRefCount(resultPtr);
  1195   1156   			goto badValue;
  1196   1157   		    }
  1197   1158   		    c = str[offset] - '0';
................................................................................
  1204   1165   		    value |= (c & 0xf);
  1205   1166   		    if (offset % 2) {
  1206   1167   			*cursor++ = (char) value;
  1207   1168   			value = 0;
  1208   1169   		    }
  1209   1170   		}
  1210   1171   	    } else {
  1211         -		for (offset = 0; offset < count; offset++) {
         1172  +		for (offset = 0; (size_t)offset < count; offset++) {
  1212   1173   		    value >>= 4;
  1213   1174   
  1214   1175   		    if (!isxdigit(UCHAR(str[offset]))) {     /* INTL: digit */
  1215   1176   			errorValue = str;
  1216   1177   			Tcl_DecrRefCount(resultPtr);
  1217   1178   			goto badValue;
  1218   1179   		    }
................................................................................
  1275   1236   	    } else {
  1276   1237   		TclListObjGetElements(interp, objv[arg], &listc, &listv);
  1277   1238   		if (count == BINARY_ALL) {
  1278   1239   		    count = listc;
  1279   1240   		}
  1280   1241   	    }
  1281   1242   	    arg++;
  1282         -	    for (i = 0; i < count; i++) {
         1243  +	    for (i = 0; (size_t)i < count; i++) {
  1283   1244   		if (FormatNumber(interp, cmd, listv[i], &cursor)!=TCL_OK) {
  1284   1245   		    Tcl_DecrRefCount(resultPtr);
  1285   1246   		    return TCL_ERROR;
  1286   1247   		}
  1287   1248   	    }
  1288   1249   	    break;
  1289   1250   	}
  1290   1251   	case 'x':
  1291   1252   	    if (count == BINARY_NOCOUNT) {
  1292   1253   		count = 1;
  1293   1254   	    }
  1294         -	    memset(cursor, 0, (size_t) count);
         1255  +	    memset(cursor, 0, count);
  1295   1256   	    cursor += count;
  1296   1257   	    break;
  1297   1258   	case 'X':
  1298   1259   	    if (cursor > maxPos) {
  1299   1260   		maxPos = cursor;
  1300   1261   	    }
  1301   1262   	    if (count == BINARY_NOCOUNT) {
  1302   1263   		count = 1;
  1303   1264   	    }
  1304         -	    if ((count == BINARY_ALL) || (count > (cursor - buffer))) {
         1265  +	    if ((count == BINARY_ALL) || (count > (size_t)(cursor - buffer))) {
  1305   1266   		cursor = buffer;
  1306   1267   	    } else {
  1307   1268   		cursor -= count;
  1308   1269   	    }
  1309   1270   	    break;
  1310   1271   	case '@':
  1311   1272   	    if (cursor > maxPos) {
................................................................................
  1377   1338       int objc,			/* Number of arguments. */
  1378   1339       Tcl_Obj *const objv[])	/* Argument objects. */
  1379   1340   {
  1380   1341       int arg;			/* Index of next argument to consume. */
  1381   1342       int value = 0;		/* Current integer value to be packed.
  1382   1343   				 * Initialized to avoid compiler warning. */
  1383   1344       char cmd;			/* Current format character. */
  1384         -    int count;			/* Count associated with current format
         1345  +    size_t count;			/* Count associated with current format
  1385   1346   				 * character. */
  1386   1347       int flags;			/* Format field flags */
  1387   1348       const char *format;	/* Pointer to current position in format
  1388   1349   				 * string. */
  1389   1350       Tcl_Obj *resultPtr = NULL;	/* Object holding result buffer. */
  1390   1351       unsigned char *buffer;	/* Start of result buffer. */
  1391   1352       const char *errorString;
  1392   1353       const char *str;
  1393         -    int offset, size, length;
         1354  +    int offset, size;
         1355  +    size_t length;
  1394   1356   
  1395   1357       int i;
  1396   1358       Tcl_Obj *valuePtr, *elementPtr;
  1397   1359       Tcl_HashTable numberCacheHash;
  1398   1360       Tcl_HashTable *numberCachePtr;
  1399   1361   
  1400   1362       if (objc < 3) {
................................................................................
  1425   1387   	    }
  1426   1388   	    if (count == BINARY_ALL) {
  1427   1389   		count = length - offset;
  1428   1390   	    } else {
  1429   1391   		if (count == BINARY_NOCOUNT) {
  1430   1392   		    count = 1;
  1431   1393   		}
  1432         -		if (count > (length - offset)) {
         1394  +		if (count > length - offset) {
  1433   1395   		    goto done;
  1434   1396   		}
  1435   1397   	    }
  1436   1398   
  1437   1399   	    src = buffer + offset;
  1438   1400   	    size = count;
  1439   1401   
................................................................................
  1484   1446   	    }
  1485   1447   	    if (count == BINARY_ALL) {
  1486   1448   		count = (length - offset) * 8;
  1487   1449   	    } else {
  1488   1450   		if (count == BINARY_NOCOUNT) {
  1489   1451   		    count = 1;
  1490   1452   		}
  1491         -		if (count > (length - offset) * 8) {
         1453  +		if (count > (size_t)(length - offset) * 8) {
  1492   1454   		    goto done;
  1493   1455   		}
  1494   1456   	    }
  1495   1457   	    src = buffer + offset;
  1496   1458   	    valuePtr = Tcl_NewObj();
  1497   1459   	    Tcl_SetObjLength(valuePtr, count);
  1498   1460   	    dest = TclGetString(valuePtr);
  1499   1461   
  1500   1462   	    if (cmd == 'b') {
  1501         -		for (i = 0; i < count; i++) {
         1463  +		for (i = 0; (size_t)i < count; i++) {
  1502   1464   		    if (i % 8) {
  1503   1465   			value >>= 1;
  1504   1466   		    } else {
  1505   1467   			value = *src++;
  1506   1468   		    }
  1507   1469   		    *dest++ = (char) ((value & 1) ? '1' : '0');
  1508   1470   		}
  1509   1471   	    } else {
  1510         -		for (i = 0; i < count; i++) {
         1472  +		for (i = 0; (size_t)i < count; i++) {
  1511   1473   		    if (i % 8) {
  1512   1474   			value <<= 1;
  1513   1475   		    } else {
  1514   1476   			value = *src++;
  1515   1477   		    }
  1516   1478   		    *dest++ = (char) ((value & 0x80) ? '1' : '0');
  1517   1479   		}
................................................................................
  1549   1511   	    }
  1550   1512   	    src = buffer + offset;
  1551   1513   	    valuePtr = Tcl_NewObj();
  1552   1514   	    Tcl_SetObjLength(valuePtr, count);
  1553   1515   	    dest = TclGetString(valuePtr);
  1554   1516   
  1555   1517   	    if (cmd == 'h') {
  1556         -		for (i = 0; i < count; i++) {
         1518  +		for (i = 0; (size_t)i < count; i++) {
  1557   1519   		    if (i % 2) {
  1558   1520   			value >>= 4;
  1559   1521   		    } else {
  1560   1522   			value = *src++;
  1561   1523   		    }
  1562   1524   		    *dest++ = hexdigit[value & 0xf];
  1563   1525   		}
  1564   1526   	    } else {
  1565         -		for (i = 0; i < count; i++) {
         1527  +		for (i = 0; (size_t)i < count; i++) {
  1566   1528   		    if (i % 2) {
  1567   1529   			value <<= 4;
  1568   1530   		    } else {
  1569   1531   			value = *src++;
  1570   1532   		    }
  1571   1533   		    *dest++ = hexdigit[(value >> 4) & 0xf];
  1572   1534   		}
................................................................................
  1615   1577   
  1616   1578   	scanNumber:
  1617   1579   	    if (arg >= objc) {
  1618   1580   		DeleteScanNumberCache(numberCachePtr);
  1619   1581   		goto badIndex;
  1620   1582   	    }
  1621   1583   	    if (count == BINARY_NOCOUNT) {
  1622         -		if ((length - offset) < size) {
         1584  +		if ((length - offset) < (size_t)size) {
  1623   1585   		    goto done;
  1624   1586   		}
  1625   1587   		valuePtr = ScanNumber(buffer+offset, cmd, flags,
  1626   1588   			&numberCachePtr);
  1627   1589   		offset += size;
  1628   1590   	    } else {
  1629   1591   		if (count == BINARY_ALL) {
................................................................................
  1630   1592   		    count = (length - offset) / size;
  1631   1593   		}
  1632   1594   		if ((length - offset) < (count * size)) {
  1633   1595   		    goto done;
  1634   1596   		}
  1635   1597   		valuePtr = Tcl_NewObj();
  1636   1598   		src = buffer + offset;
  1637         -		for (i = 0; i < count; i++) {
         1599  +		for (i = 0; (size_t)i < count; i++) {
  1638   1600   		    elementPtr = ScanNumber(src, cmd, flags, &numberCachePtr);
  1639   1601   		    src += size;
  1640   1602   		    Tcl_ListObjAppendElement(NULL, valuePtr, elementPtr);
  1641   1603   		}
  1642   1604   		offset += count * size;
  1643   1605   	    }
  1644   1606   
................................................................................
  1651   1613   	    }
  1652   1614   	    break;
  1653   1615   	}
  1654   1616   	case 'x':
  1655   1617   	    if (count == BINARY_NOCOUNT) {
  1656   1618   		count = 1;
  1657   1619   	    }
  1658         -	    if ((count == BINARY_ALL) || (count > (length - offset))) {
         1620  +	    if ((count == BINARY_ALL) || (count > length - offset)) {
  1659   1621   		offset = length;
  1660   1622   	    } else {
  1661   1623   		offset += count;
  1662   1624   	    }
  1663   1625   	    break;
  1664   1626   	case 'X':
  1665   1627   	    if (count == BINARY_NOCOUNT) {
  1666   1628   		count = 1;
  1667   1629   	    }
  1668         -	    if ((count == BINARY_ALL) || (count > offset)) {
         1630  +	    if ((count == BINARY_ALL) || (count > (size_t)offset)) {
  1669   1631   		offset = 0;
  1670   1632   	    } else {
  1671   1633   		offset -= count;
  1672   1634   	    }
  1673   1635   	    break;
  1674   1636   	case '@':
  1675   1637   	    if (count == BINARY_NOCOUNT) {
................................................................................
  1745   1707    *----------------------------------------------------------------------
  1746   1708    */
  1747   1709   
  1748   1710   static int
  1749   1711   GetFormatSpec(
  1750   1712       const char **formatPtr,	/* Pointer to format string. */
  1751   1713       char *cmdPtr,		/* Pointer to location of command char. */
  1752         -    int *countPtr,		/* Pointer to repeat count value. */
         1714  +    size_t *countPtr,		/* Pointer to repeat count value. */
  1753   1715       int *flagsPtr)		/* Pointer to field flags */
  1754   1716   {
  1755   1717       /*
  1756   1718        * Skip any leading blanks.
  1757   1719        */
  1758   1720   
  1759   1721       while (**formatPtr == ' ') {
................................................................................
  1911   1873    *----------------------------------------------------------------------
  1912   1874    */
  1913   1875   
  1914   1876   static void
  1915   1877   CopyNumber(
  1916   1878       const void *from,		/* source */
  1917   1879       void *to,			/* destination */
  1918         -    unsigned length,		/* Number of bytes to copy */
         1880  +    size_t length,		/* Number of bytes to copy */
  1919   1881       int type)			/* What type of thing are we copying? */
  1920   1882   {
  1921   1883       switch (NeedReversing(type)) {
  1922   1884       case 0:
  1923   1885   	memcpy(to, from, length);
  1924   1886   	break;
  1925   1887       case 1: {
................................................................................
  2013   1975   	/*
  2014   1976   	 * Double-precision floating point values. Tcl_GetDoubleFromObj
  2015   1977   	 * returns TCL_ERROR for NaN, but we can check by comparing the
  2016   1978   	 * object's type pointer.
  2017   1979   	 */
  2018   1980   
  2019   1981   	if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
  2020         -	    const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(src, &tclDoubleType);
         1982  +	    const Tcl_ObjIntRep *irPtr = TclFetchIntRep(src, &tclDoubleType);
  2021   1983   	    if (irPtr == NULL) {
  2022   1984   		return TCL_ERROR;
  2023   1985   	    }
  2024   1986   	    dvalue = irPtr->doubleValue;
  2025   1987   	}
  2026   1988   	CopyNumber(&dvalue, *cursorPtr, sizeof(double), type);
  2027   1989   	*cursorPtr += sizeof(double);
................................................................................
  2033   1995   	/*
  2034   1996   	 * Single-precision floating point values. Tcl_GetDoubleFromObj
  2035   1997   	 * returns TCL_ERROR for NaN, but we can check by comparing the
  2036   1998   	 * object's type pointer.
  2037   1999   	 */
  2038   2000   
  2039   2001   	if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
  2040         -	    const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(src, &tclDoubleType);
         2002  +	    const Tcl_ObjIntRep *irPtr = TclFetchIntRep(src, &tclDoubleType);
  2041   2003   	    if (irPtr == NULL) {
  2042   2004   		return TCL_ERROR;
  2043   2005   	    }
  2044   2006   	    dvalue = irPtr->doubleValue;
  2045   2007   	}
  2046   2008   
  2047   2009   	/*
................................................................................
  2441   2403       Tcl_Interp *interp,
  2442   2404       int objc,
  2443   2405       Tcl_Obj *const objv[])
  2444   2406   {
  2445   2407       Tcl_Obj *resultObj = NULL;
  2446   2408       unsigned char *data = NULL;
  2447   2409       unsigned char *cursor = NULL;
  2448         -    int offset = 0, count = 0;
         2410  +    size_t offset = 0, count = 0;
  2449   2411   
  2450   2412       if (objc != 2) {
  2451   2413   	Tcl_WrongNumArgs(interp, 1, objv, "data");
  2452   2414   	return TCL_ERROR;
  2453   2415       }
  2454   2416   
  2455   2417       TclNewObj(resultObj);
................................................................................
  2607   2569       Tcl_Obj *const objv[])
  2608   2570   {
  2609   2571       Tcl_Obj *resultObj;
  2610   2572       unsigned char *data, *cursor, *limit;
  2611   2573       int maxlen = 0;
  2612   2574       const char *wrapchar = "\n";
  2613   2575       size_t wrapcharlen = 1;
  2614         -    int offset, i, index, size, outindex = 0, count = 0;
         2576  +    int i, index, size, outindex = 0;
         2577  +    size_t offset, count = 0;
  2615   2578       enum {OPT_MAXLEN, OPT_WRAPCHAR };
  2616   2579       static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
  2617   2580   
  2618   2581       if (objc < 2 || objc%2 != 0) {
  2619   2582   	Tcl_WrongNumArgs(interp, 1, objv,
  2620   2583   		"?-maxlen len? ?-wrapchar char? data");
  2621   2584   	return TCL_ERROR;
................................................................................
  2710   2673       ClientData clientData,
  2711   2674       Tcl_Interp *interp,
  2712   2675       int objc,
  2713   2676       Tcl_Obj *const objv[])
  2714   2677   {
  2715   2678       Tcl_Obj *resultObj;
  2716   2679       unsigned char *data, *start, *cursor;
  2717         -    int offset, count, rawLength, n, i, j, bits, index;
         2680  +    int rawLength, n, i, bits, index;
  2718   2681       int lineLength = 61;
  2719   2682       const unsigned char SingleNewline[] = { (unsigned char) '\n' };
  2720   2683       const unsigned char *wrapchar = SingleNewline;
  2721         -    int wrapcharlen = sizeof(SingleNewline);
         2684  +    size_t j, offset, count, wrapcharlen = sizeof(SingleNewline);
  2722   2685       enum { OPT_MAXLEN, OPT_WRAPCHAR };
  2723   2686       static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
  2724   2687   
  2725   2688       if (objc < 2 || objc%2 != 0) {
  2726   2689   	Tcl_WrongNumArgs(interp, 1, objv,
  2727   2690   		"?-maxlen len? ?-wrapchar char? data");
  2728   2691   	return TCL_ERROR;

Changes to generic/tclClock.c.

   448    448       }
   449    449   
   450    450       /*
   451    451        * fields.seconds could be an unsigned number that overflowed. Make sure
   452    452        * that it isn't.
   453    453        */
   454    454   
   455         -    if (Tcl_FetchIntRep(objv[1], &tclBignumType)) {
          455  +    if (objv[1]->typePtr == &tclBignumType) {
   456    456   	Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]);
   457    457   	return TCL_ERROR;
   458    458       }
   459    459   
   460    460       /*
   461    461        * Convert UTC time to local.
   462    462        */
................................................................................
  1918   1918       formatObj = litPtr[LIT__DEFAULT_FORMAT];
  1919   1919       localeObj = litPtr[LIT_C];
  1920   1920       timezoneObj = litPtr[LIT__NIL];
  1921   1921       for (i = 2; i < objc; i+=2) {
  1922   1922   	if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
  1923   1923   		&optionIndex) != TCL_OK) {
  1924   1924   	    Tcl_SetErrorCode(interp, "CLOCK", "badOption",
  1925         -		    Tcl_GetString(objv[i]), NULL);
         1925  +		    TclGetString(objv[i]), NULL);
  1926   1926   	    return TCL_ERROR;
  1927   1927   	}
  1928   1928   	switch (optionIndex) {
  1929   1929   	case CLOCK_FORMAT_FORMAT:
  1930   1930   	    formatObj = objv[i+1];
  1931   1931   	    break;
  1932   1932   	case CLOCK_FORMAT_GMT:

Changes to generic/tclCmdAH.c.

  1706   1706   	Tcl_WrongNumArgs(interp, 1, objv, "name");
  1707   1707   	return TCL_ERROR;
  1708   1708       }
  1709   1709       fsInfo = Tcl_FSFileSystemInfo(objv[1]);
  1710   1710       if (fsInfo == NULL) {
  1711   1711   	Tcl_SetObjResult(interp, Tcl_NewStringObj("unrecognised path", -1));
  1712   1712   	Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
  1713         -		Tcl_GetString(objv[1]), NULL);
         1713  +		TclGetString(objv[1]), NULL);
  1714   1714   	return TCL_ERROR;
  1715   1715       }
  1716   1716       Tcl_SetObjResult(interp, fsInfo);
  1717   1717       return TCL_OK;
  1718   1718   }
  1719   1719   
  1720   1720   /*
................................................................................
  1958   1958       } else {
  1959   1959   	Tcl_Obj *separatorObj = Tcl_FSPathSeparator(objv[1]);
  1960   1960   
  1961   1961   	if (separatorObj == NULL) {
  1962   1962   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1963   1963   		    "unrecognised path", -1));
  1964   1964   	    Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
  1965         -		    Tcl_GetString(objv[1]), NULL);
         1965  +		    TclGetString(objv[1]), NULL);
  1966   1966   	    return TCL_ERROR;
  1967   1967   	}
  1968   1968   	Tcl_SetObjResult(interp, separatorObj);
  1969   1969       }
  1970   1970       return TCL_OK;
  1971   1971   }
  1972   1972   

Changes to generic/tclCmdIL.c.

  1043   1043       if ((objc != 1) && (objc != 2)) {
  1044   1044   	Tcl_WrongNumArgs(interp, 1, objv, "?interp?");
  1045   1045   	return TCL_ERROR;
  1046   1046       }
  1047   1047   
  1048   1048       target = interp;
  1049   1049       if (objc == 2) {
  1050         -	target = Tcl_GetSlave(interp, Tcl_GetString(objv[1]));
         1050  +	target = Tcl_GetSlave(interp, TclGetString(objv[1]));
  1051   1051   	if (target == NULL) {
  1052   1052   	    return TCL_ERROR;
  1053   1053   	}
  1054   1054       }
  1055   1055   
  1056   1056       iPtr = (Interp *) target;
  1057   1057       Tcl_SetObjResult(interp, iPtr->errorStack);
................................................................................
  2151   2151   {
  2152   2152       Tcl_Command command;
  2153   2153   
  2154   2154       if (objc != 2) {
  2155   2155   	Tcl_WrongNumArgs(interp, 1, objv, "commandName");
  2156   2156   	return TCL_ERROR;
  2157   2157       }
  2158         -    command = Tcl_FindCommand(interp, Tcl_GetString(objv[1]), NULL,
         2158  +    command = Tcl_FindCommand(interp, TclGetString(objv[1]), NULL,
  2159   2159   	    TCL_LEAVE_ERR_MSG);
  2160   2160       if (command == NULL) {
  2161   2161   	return TCL_ERROR;
  2162   2162       }
  2163   2163   
  2164   2164       /*
  2165   2165        * There's one special case: safe slave interpreters can't see aliases as
................................................................................
  3244   3244   		if (TclIndexEncode(interp, indices[j], TCL_INDEX_NONE,
  3245   3245   			TCL_INDEX_NONE, &encoded) != TCL_OK) {
  3246   3246   		    result = TCL_ERROR;
  3247   3247   		}
  3248   3248   		if (encoded == TCL_INDEX_NONE) {
  3249   3249   		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3250   3250   			    "index \"%s\" cannot select an element "
  3251         -			    "from any list", Tcl_GetString(indices[j])));
         3251  +			    "from any list", TclGetString(indices[j])));
  3252   3252   		    Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
  3253   3253   			    "OUTOFRANGE", NULL);
  3254   3254   		    result = TCL_ERROR;
  3255   3255   		}
  3256   3256   		if (result == TCL_ERROR) {
  3257   3257   		    Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
  3258   3258   			    "\n    (-index option item number %d)", j));
................................................................................
  3961   3961   		int encoded = 0;
  3962   3962   		int result = TclIndexEncode(interp, indexv[j],
  3963   3963   			TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
  3964   3964   
  3965   3965   		if ((result == TCL_OK) && (encoded == TCL_INDEX_NONE)) {
  3966   3966   		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3967   3967   			    "index \"%s\" cannot select an element "
  3968         -			    "from any list", Tcl_GetString(indexv[j])));
         3968  +			    "from any list", TclGetString(indexv[j])));
  3969   3969   		    Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
  3970   3970   			    "OUTOFRANGE", NULL);
  3971   3971   		    result = TCL_ERROR;
  3972   3972   		}
  3973   3973   		if (result == TCL_ERROR) {
  3974   3974   		    Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
  3975   3975   			    "\n    (-index option item number %d)", j));

Changes to generic/tclCmdMZ.c.

  1647   1647   	}
  1648   1648   	break;
  1649   1649       }
  1650   1650       case STR_IS_DIGIT:
  1651   1651   	chcomp = Tcl_UniCharIsDigit;
  1652   1652   	break;
  1653   1653       case STR_IS_DOUBLE: {
  1654         -	if (Tcl_FetchIntRep(objPtr, &tclDoubleType) ||
  1655         -		Tcl_FetchIntRep(objPtr, &tclIntType) ||
  1656         -		Tcl_FetchIntRep(objPtr, &tclBignumType)) {
         1654  +	if ((objPtr->typePtr == &tclDoubleType) ||
         1655  +		(objPtr->typePtr == &tclIntType) ||
         1656  +		(objPtr->typePtr == &tclBignumType)) {
  1657   1657   	    break;
  1658   1658   	}
  1659   1659   	string1 = TclGetStringFromObj(objPtr, &length1);
  1660   1660   	if (length1 == 0) {
  1661   1661   	    if (strict) {
  1662   1662   		result = 0;
  1663   1663   	    }
................................................................................
  1678   1678   	break;
  1679   1679       }
  1680   1680       case STR_IS_GRAPH:
  1681   1681   	chcomp = Tcl_UniCharIsGraph;
  1682   1682   	break;
  1683   1683       case STR_IS_INT:
  1684   1684       case STR_IS_ENTIER:
  1685         -	if (Tcl_FetchIntRep(objPtr, &tclIntType) ||
  1686         -		Tcl_FetchIntRep(objPtr, &tclBignumType)) {
         1685  +	if ((objPtr->typePtr == &tclIntType) ||
         1686  +		(objPtr->typePtr == &tclBignumType)) {
  1687   1687   	    break;
  1688   1688   	}
  1689   1689   	string1 = TclGetStringFromObj(objPtr, &length1);
  1690   1690   	if (length1 == 0) {
  1691   1691   	    if (strict) {
  1692   1692   		result = 0;
  1693   1693   	    }
................................................................................
  1960   1960   
  1961   1961       /*
  1962   1962        * This test is tricky, but has to be that way or you get other strange
  1963   1963        * inconsistencies (see test string-10.20.1 for illustration why!)
  1964   1964        */
  1965   1965   
  1966   1966       if (!TclHasStringRep(objv[objc-2])
  1967         -	    && Tcl_FetchIntRep(objv[objc-2], &tclDictType)){
         1967  +	    && (objv[objc-2]->typePtr == &tclDictType)){
  1968   1968   	int i, done;
  1969   1969   	Tcl_DictSearch search;
  1970   1970   
  1971   1971   	/*
  1972   1972   	 * We know the type exactly, so all dict operations will succeed for
  1973   1973   	 * sure. This shortens this code quite a bit.
  1974   1974   	 */
................................................................................
  4068   4068   #endif
  4069   4069   
  4070   4070       if (count <= 1) {
  4071   4071   	/*
  4072   4072   	 * Use int obj since we know time is not fractional. [Bug 1202178]
  4073   4073   	 */
  4074   4074   
  4075         -	objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt) totalMicroSec);
         4075  +	objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
  4076   4076       } else {
  4077   4077   	objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
  4078   4078       }
  4079   4079   
  4080   4080       /*
  4081   4081        * Construct the result as a list because many programs have always parsed
  4082   4082        * as such (extracting the first element, typically).
................................................................................
  4207   4207   			"ARGUMENT", NULL);
  4208   4208   		return TCL_ERROR;
  4209   4209   	    }
  4210   4210   	    code = 1;
  4211   4211   	    if (Tcl_ListObjLength(NULL, objv[i+1], &dummy) != TCL_OK) {
  4212   4212   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  4213   4213   			"bad prefix '%s': must be a list",
  4214         -			Tcl_GetString(objv[i+1])));
         4214  +			TclGetString(objv[i+1])));
  4215   4215   		Tcl_DecrRefCount(handlersObj);
  4216   4216   		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP",
  4217   4217   			"EXNFORMAT", NULL);
  4218   4218   		return TCL_ERROR;
  4219   4219   	    }
  4220   4220   	    info[2] = objv[i+1];
  4221   4221   
................................................................................
  4746   4746   				 * contain n elements. */
  4747   4747       int line,			/* Line the list as a whole starts on. */
  4748   4748       int n,			/* #elements in lines */
  4749   4749       int *lines,			/* Array of line numbers, to fill. */
  4750   4750       Tcl_Obj *const *elems)      /* The list elems as Tcl_Obj*, in need of
  4751   4751   				 * derived continuation data */
  4752   4752   {
  4753         -    const char *listStr = Tcl_GetString(listObj);
         4753  +    const char *listStr = TclGetString(listObj);
  4754   4754       const char *listHead = listStr;
  4755   4755       int i, length = strlen(listStr);
  4756   4756       const char *element = NULL, *next = NULL;
  4757   4757       ContLineLoc *clLocPtr = TclContinuationsGet(listObj);
  4758   4758       int *clNext = (clLocPtr ? &clLocPtr->loc[0] : NULL);
  4759   4759   
  4760   4760       for (i = 0; i < n; i++) {

Changes to generic/tclCompCmds.c.

  3181   3181       }
  3182   3182   
  3183   3183       /*
  3184   3184        * Everything is a literal, so the result is constant too (or an error if
  3185   3185        * the format is broken). Do the format now.
  3186   3186        */
  3187   3187   
  3188         -    tmpObj = Tcl_Format(interp, Tcl_GetString(formatObj),
         3188  +    tmpObj = Tcl_Format(interp, TclGetString(formatObj),
  3189   3189   	    parsePtr->numWords-2, objv);
  3190   3190       for (; --i>=0 ;) {
  3191   3191   	Tcl_DecrRefCount(objv[i]);
  3192   3192       }
  3193   3193       Tcl_Free(objv);
  3194   3194       Tcl_DecrRefCount(formatObj);
  3195   3195       if (tmpObj == NULL) {
................................................................................
  3225   3225       tokenPtr = TokenAfter(tokenPtr);
  3226   3226       i = 0;
  3227   3227   
  3228   3228       /*
  3229   3229        * Now scan through and check for non-%s and non-%% substitutions.
  3230   3230        */
  3231   3231   
  3232         -    for (bytes = Tcl_GetString(formatObj) ; *bytes ; bytes++) {
         3232  +    for (bytes = TclGetString(formatObj) ; *bytes ; bytes++) {
  3233   3233   	if (*bytes == '%') {
  3234   3234   	    bytes++;
  3235   3235   	    if (*bytes == 's') {
  3236   3236   		i++;
  3237   3237   		continue;
  3238   3238   	    } else if (*bytes == '%') {
  3239   3239   		continue;
................................................................................
  3258   3258        * we'd have the case in the first half of this function) which we will
  3259   3259        * concatenate.
  3260   3260        */
  3261   3261   
  3262   3262       i = 0;			/* The count of things to concat. */
  3263   3263       j = 2;			/* The index into the argument tokens, for
  3264   3264   				 * TIP#280 handling. */
  3265         -    start = Tcl_GetString(formatObj);
         3265  +    start = TclGetString(formatObj);
  3266   3266   				/* The start of the currently-scanned literal
  3267   3267   				 * in the format string. */
  3268   3268       tmpObj = Tcl_NewObj();	/* The buffer used to accumulate the literal
  3269   3269   				 * being built. */
  3270   3270       for (bytes = start ; *bytes ; bytes++) {
  3271   3271   	if (*bytes == '%') {
  3272   3272   	    Tcl_AppendToObj(tmpObj, start, bytes - start);
................................................................................
  3408   3408       Tcl_Token *varTokenPtr,	/* Points to a variable token. */
  3409   3409       CompileEnv *envPtr,		/* Holds resulting instructions. */
  3410   3410       int flags,			/* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */
  3411   3411       int *localIndexPtr,		/* Must not be NULL. */
  3412   3412       int *isScalarPtr)		/* Must not be NULL. */
  3413   3413   {
  3414   3414       register const char *p;
  3415         -    const char *name, *elName;
  3416         -    register size_t i, n;
         3415  +    const char *last, *name, *elName;
         3416  +    register size_t n;
  3417   3417       Tcl_Token *elemTokenPtr = NULL;
  3418         -    size_t nameChars, elNameChars;
         3418  +	size_t nameLen, elNameLen;
  3419   3419       int simpleVarName, localIndex;
  3420   3420       int elemTokenCount = 0, allocedTokens = 0, removedParen = 0;
  3421   3421   
  3422   3422       /*
  3423   3423        * Decide if we can use a frame slot for the var/array name or if we need
  3424   3424        * to emit code to compute and push the name at runtime. We use a frame
  3425   3425        * slot (entry in the array of local vars) if we are compiling a procedure
  3426   3426        * body and if the name is simple text that does not include namespace
  3427   3427        * qualifiers.
  3428   3428        */
  3429   3429   
  3430   3430       simpleVarName = 0;
  3431   3431       name = elName = NULL;
  3432         -    nameChars = elNameChars = 0;
         3432  +    nameLen = elNameLen = 0;
  3433   3433       localIndex = -1;
  3434   3434   
  3435   3435       if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
  3436   3436   	/*
  3437   3437   	 * A simple variable name. Divide it up into "name" and "elName"
  3438   3438   	 * strings. If it is not a local variable, look it up at runtime.
  3439   3439   	 */
  3440   3440   
  3441   3441   	simpleVarName = 1;
  3442   3442   
  3443   3443   	name = varTokenPtr[1].start;
  3444         -	nameChars = varTokenPtr[1].size;
  3445         -	if (name[nameChars-1] == ')') {
         3444  +	nameLen = varTokenPtr[1].size;
         3445  +	if (name[nameLen-1] == ')') {
  3446   3446   	    /*
  3447   3447   	     * last char is ')' => potential array reference.
  3448   3448   	     */
         3449  +	    last = Tcl_UtfPrev(name + nameLen, name);
  3449   3450   
  3450         -	    for (i=0,p=name ; i<nameChars ; i++,p++) {
  3451         -		if (*p == '(') {
  3452         -		    elName = p + 1;
  3453         -		    elNameChars = nameChars - i - 2;
  3454         -		    nameChars = i;
  3455         -		    break;
         3451  +	    if (*last == ')') {
         3452  +		for (p = name;  p < last;  p = Tcl_UtfNext(p)) {
         3453  +		    if (*p == '(') {
         3454  +			elName = p + 1;
         3455  +			elNameLen = last - elName;
         3456  +			nameLen = p - name;
         3457  +			break;
         3458  +		    }
  3456   3459   		}
  3457   3460   	    }
  3458   3461   
  3459         -	    if (!(flags & TCL_NO_ELEMENT) && (elName != NULL) && elNameChars) {
         3462  +	    if (!(flags & TCL_NO_ELEMENT) && elNameLen) {
  3460   3463   		/*
  3461   3464   		 * An array element, the element name is a simple string:
  3462   3465   		 * assemble the corresponding token.
  3463   3466   		 */
  3464   3467   
  3465   3468   		elemTokenPtr = TclStackAlloc(interp, sizeof(Tcl_Token));
  3466   3469   		allocedTokens = 1;
  3467   3470   		elemTokenPtr->type = TCL_TOKEN_TEXT;
  3468   3471   		elemTokenPtr->start = elName;
  3469         -		elemTokenPtr->size = elNameChars;
         3472  +		elemTokenPtr->size = elNameLen;
  3470   3473   		elemTokenPtr->numComponents = 0;
  3471   3474   		elemTokenCount = 1;
  3472   3475   	    }
  3473   3476   	}
  3474   3477       } else if (interp && ((n = varTokenPtr->numComponents) > 1)
  3475   3478   	    && (varTokenPtr[1].type == TCL_TOKEN_TEXT)
  3476   3479   	    && (varTokenPtr[n].type == TCL_TOKEN_TEXT)
  3477         -	    && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) {
         3480  +	    && (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')')
         3481  +	    && (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) {
  3478   3482   	/*
  3479   3483   	 * Check for parentheses inside first token.
  3480   3484   	 */
  3481   3485   
  3482   3486   	simpleVarName = 0;
  3483         -	for (i = 0, p = varTokenPtr[1].start;
  3484         -		i < varTokenPtr[1].size; i++, p++) {
         3487  +	for (p = varTokenPtr[1].start,
         3488  +	     last = p + varTokenPtr[1].size;  p < last;  p = Tcl_UtfNext(p)) {
  3485   3489   	    if (*p == '(') {
  3486   3490   		simpleVarName = 1;
  3487   3491   		break;
  3488   3492   	    }
  3489   3493   	}
  3490   3494   	if (simpleVarName) {
  3491         -	    size_t remainingChars;
         3495  +	    size_t remainingLen;
  3492   3496   
  3493   3497   	    /*
  3494   3498   	     * Check the last token: if it is just ')', do not count it.
  3495   3499   	     * Otherwise, remove the ')' and flag so that it is restored at
  3496   3500   	     * the end.
  3497   3501   	     */
  3498   3502   
................................................................................
  3500   3504   		n--;
  3501   3505   	    } else {
  3502   3506   		varTokenPtr[n].size--;
  3503   3507   		removedParen = n;
  3504   3508   	    }
  3505   3509   
  3506   3510   	    name = varTokenPtr[1].start;
  3507         -	    nameChars = p - varTokenPtr[1].start;
         3511  +	    nameLen = p - varTokenPtr[1].start;
  3508   3512   	    elName = p + 1;
  3509         -	    remainingChars = (varTokenPtr[2].start - p) - 1;
  3510         -	    elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
         3513  +	    remainingLen = (varTokenPtr[2].start - p) - 1;
         3514  +	    elNameLen = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
  3511   3515   
  3512   3516   	    if (!(flags & TCL_NO_ELEMENT)) {
  3513         -	      if (remainingChars) {
         3517  +	      if (remainingLen) {
  3514   3518   		/*
  3515   3519   		 * Make a first token with the extra characters in the first
  3516   3520   		 * token.
  3517   3521   		 */
  3518   3522   
  3519   3523   		elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token));
  3520   3524   		allocedTokens = 1;
  3521   3525   		elemTokenPtr->type = TCL_TOKEN_TEXT;
  3522   3526   		elemTokenPtr->start = elName;
  3523         -		elemTokenPtr->size = remainingChars;
         3527  +		elemTokenPtr->size = remainingLen;
  3524   3528   		elemTokenPtr->numComponents = 0;
  3525   3529   		elemTokenCount = n;
  3526   3530   
  3527   3531   		/*
  3528   3532   		 * Copy the remaining tokens.
  3529   3533   		 */
  3530   3534   
................................................................................
  3545   3549       if (simpleVarName) {
  3546   3550   	/*
  3547   3551   	 * See whether name has any namespace separators (::'s).
  3548   3552   	 */
  3549   3553   
  3550   3554   	int hasNsQualifiers = 0;
  3551   3555   
  3552         -	for (i = 0, p = name;  i < nameChars;  i++, p++) {
  3553         -	    if ((*p == ':') && ((i+1) < nameChars) && (*(p+1) == ':')) {
         3556  +	for (p = name, last = p + nameLen-1;  p < last;  p = Tcl_UtfNext(p)) {
         3557  +	    if ((*p == ':') && (*(p+1) == ':')) {
  3554   3558   		hasNsQualifiers = 1;
  3555   3559   		break;
  3556   3560   	    }
  3557   3561   	}
  3558   3562   
  3559   3563   	/*
  3560   3564   	 * Look up the var name's index in the array of local vars in the proc
  3561   3565   	 * frame. If retrieving the var's value and it doesn't already exist,
  3562   3566   	 * push its name and look it up at runtime.
  3563   3567   	 */
  3564   3568   
  3565   3569   	if (!hasNsQualifiers) {
  3566         -	    localIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr);
         3570  +	    localIndex = TclFindCompiledLocal(name, nameLen, 1, envPtr);
  3567   3571   	    if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) {
  3568   3572   		/*
  3569   3573   		 * We'll push the name.
  3570   3574   		 */
  3571   3575   
  3572   3576   		localIndex = -1;
  3573   3577   	    }
  3574   3578   	}
  3575   3579   	if (interp && localIndex < 0) {
  3576         -	    PushLiteral(envPtr, name, nameChars);
         3580  +	    PushLiteral(envPtr, name, nameLen);
  3577   3581   	}
  3578   3582   
  3579   3583   	/*
  3580   3584   	 * Compile the element script, if any, and only if not inhibited. [Bug
  3581   3585   	 * 3600328]
  3582   3586   	 */
  3583   3587   
  3584   3588   	if (elName != NULL && !(flags & TCL_NO_ELEMENT)) {
  3585         -	    if (elNameChars) {
         3589  +	    if (elNameLen) {
  3586   3590   		TclCompileTokens(interp, elemTokenPtr, elemTokenCount,
  3587   3591   			envPtr);
  3588   3592   	    } else {
  3589   3593   		PushStringLiteral(envPtr, "");
  3590   3594   	    }
  3591   3595   	}
  3592   3596       } else if (interp) {

Changes to generic/tclCompCmdsGR.c.

   595    595       }
   596    596       tokenPtr = TokenAfter(parsePtr->tokenPtr);
   597    597       objPtr = Tcl_NewObj();
   598    598       Tcl_IncrRefCount(objPtr);
   599    599       if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) {
   600    600   	goto notCompilable;
   601    601       }
   602         -    bytes = Tcl_GetString(objPtr);
          602  +    bytes = TclGetString(objPtr);
   603    603   
   604    604       /*
   605    605        * We require that the argument start with "::" and not have any of "*\[?"
   606    606        * in it. (Theoretically, we should look in only the final component, but
   607    607        * the difference is so slight given current naming practices.)
   608    608        */
   609    609   
................................................................................
  2286   2286   
  2287   2287       Tcl_DStringInit(&pattern);
  2288   2288       tokenPtr = TokenAfter(tokenPtr);
  2289   2289       patternObj = Tcl_NewObj();
  2290   2290       if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) {
  2291   2291   	goto done;
  2292   2292       }
  2293         -    if (Tcl_GetString(patternObj)[0] == '-') {
  2294         -	if (strcmp(Tcl_GetString(patternObj), "--") != 0
         2293  +    if (TclGetString(patternObj)[0] == '-') {
         2294  +	if (strcmp(TclGetString(patternObj), "--") != 0
  2295   2295   		|| parsePtr->numWords == 5) {
  2296   2296   	    goto done;
  2297   2297   	}
  2298   2298   	tokenPtr = TokenAfter(tokenPtr);
  2299   2299   	Tcl_DecrRefCount(patternObj);
  2300   2300   	patternObj = Tcl_NewObj();
  2301   2301   	if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) {
................................................................................
  2352   2352   	    }
  2353   2353   	case '\0': case '?': case '[': case '\\':
  2354   2354   	    goto done;
  2355   2355   	}
  2356   2356   	bytes++;
  2357   2357       }
  2358   2358     isSimpleGlob:
  2359         -    for (bytes = Tcl_GetString(replacementObj); *bytes; bytes++) {
         2359  +    for (bytes = TclGetString(replacementObj); *bytes; bytes++) {
  2360   2360   	switch (*bytes) {
  2361   2361   	case '\\': case '&':
  2362   2362   	    goto done;
  2363   2363   	}
  2364   2364       }
  2365   2365   
  2366   2366       /*

Changes to generic/tclCompile.h.

   495    495       } while (0)
   496    496   
   497    497   
   498    498   
   499    499   #define ByteCodeGetIntRep(objPtr, typePtr, codePtr)			\
   500    500       do {								\
   501    501   	const Tcl_ObjIntRep *irPtr;					\
   502         -	irPtr = Tcl_FetchIntRep((objPtr), (typePtr));			\
          502  +	irPtr = TclFetchIntRep((objPtr), (typePtr));			\
   503    503   	(codePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   504    504       } while (0)
   505    505   
   506    506   /*
   507    507    * Opcodes for the Tcl bytecode instructions. These must correspond to the
   508    508    * entries in the table of instruction descriptions, tclInstructionTable, in
   509    509    * tclCompile.c. Also, the order and number of the expression opcodes (e.g.,

Changes to generic/tclConfig.c.

   198    198       Tcl_Interp *interp,
   199    199       int objc,
   200    200       struct Tcl_Obj *const *objv)
   201    201   {
   202    202       QCCD *cdPtr = clientData;
   203    203       Tcl_Obj *pkgName = cdPtr->pkg;
   204    204       Tcl_Obj *pDB, *pkgDict, *val, *listPtr;
   205         -    int n, index;
          205  +    size_t n;
          206  +    int index, m;
   206    207       static const char *const subcmdStrings[] = {
   207    208   	"get", "list", NULL
   208    209       };
   209    210       enum subcmds {
   210    211   	CFG_GET, CFG_LIST
   211    212       };
   212    213       Tcl_DString conv;
................................................................................
   270    271   
   271    272       case CFG_LIST:
   272    273   	if (objc != 2) {
   273    274   	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
   274    275   	    return TCL_ERROR;
   275    276   	}
   276    277   
   277         -	Tcl_DictObjSize(interp, pkgDict, &n);
   278         -	listPtr = Tcl_NewListObj(n, NULL);
          278  +	Tcl_DictObjSize(interp, pkgDict, &m);
          279  +	listPtr = Tcl_NewListObj(m, NULL);
   279    280   
   280    281   	if (!listPtr) {
   281    282   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
   282    283   		    "insufficient memory to create list", -1));
   283    284   	    Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
   284    285   	    return TCL_ERROR;
   285    286   	}
   286    287   
   287         -	if (n) {
          288  +	if (m) {
   288    289   	    Tcl_DictSearch s;
   289    290   	    Tcl_Obj *key;
   290    291   	    int done;
   291    292   
   292    293   	    for (Tcl_DictObjFirst(interp, pkgDict, &s, &key, NULL, &done);
   293    294   		    !done; Tcl_DictObjNext(&s, &key, NULL, &done)) {
   294    295   		Tcl_ListObjAppendElement(NULL, listPtr, key);

Changes to generic/tclDate.c.

  2757   2757   
  2758   2758       if (objc != 5) {
  2759   2759   	Tcl_WrongNumArgs(interp, 1, objv,
  2760   2760   		"stringToParse baseYear baseMonth baseDay" );
  2761   2761   	return TCL_ERROR;
  2762   2762       }
  2763   2763   
  2764         -    yyInput = Tcl_GetString( objv[1] );
         2764  +    yyInput = TclGetString(objv[1]);
  2765   2765       dateInfo.dateStart = yyInput;
  2766   2766   
  2767   2767       yyHaveDate = 0;
  2768   2768       if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK
  2769   2769   	    || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK
  2770   2770   	    || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) {
  2771   2771   	return TCL_ERROR;

Changes to generic/tclDictObj.c.

   169    169           ir.twoPtrValue.ptr2 = NULL;                                     \
   170    170           Tcl_StoreIntRep((objPtr), &tclDictType, &ir);                   \
   171    171       } while (0)
   172    172   
   173    173   #define DictGetIntRep(objPtr, dictRepPtr)				\
   174    174       do {                                                                \
   175    175           const Tcl_ObjIntRep *irPtr;                                     \
   176         -        irPtr = Tcl_FetchIntRep((objPtr), &tclDictType);                \
          176  +        irPtr = TclFetchIntRep((objPtr), &tclDictType);                \
   177    177           (dictRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;          \
   178    178       } while (0)
   179    179   
   180    180   /*
   181    181    * The type of the specially adapted version of the Tcl_Obj*-containing hash
   182    182    * table defined in the tclObj.c code. This version differs in that it
   183    183    * allocates a bit more space in each hash entry in order to hold the pointers
................................................................................
   613    613   
   614    614       /*
   615    615        * Since lists and dictionaries have very closely-related string
   616    616        * representations (i.e. the same parsing code) we can safely special-case
   617    617        * the conversion from lists to dictionaries.
   618    618        */
   619    619   
   620         -    if (Tcl_FetchIntRep(objPtr, &tclListType)) {
          620  +    if (objPtr->typePtr == &tclListType) {
   621    621   	int objc, i;
   622    622   	Tcl_Obj **objv;
   623    623   
   624    624   	/* Cannot fail, we already know the Tcl_ObjType is "list". */
   625    625   	TclListObjGetElements(NULL, objPtr, &objc, &objv);
   626    626   	if (objc & 1) {
   627    627   	    goto missingValue;
................................................................................
   636    636   
   637    637   		/*
   638    638   		 * Not really a well-formed dictionary as there are duplicate
   639    639   		 * keys, so better get the string rep here so that we can
   640    640   		 * convert back.
   641    641   		 */
   642    642   
   643         -		(void) Tcl_GetString(objPtr);
          643  +		(void) TclGetString(objPtr);
   644    644   
   645    645   		TclDecrRefCount(discardedValue);
   646    646   	    }
   647    647   	    Tcl_SetHashValue(hPtr, objv[i+1]);
   648    648   	    Tcl_IncrRefCount(objv[i+1]); /* Since hash now holds ref to it */
   649    649   	}
   650    650       } else {
................................................................................
  3232   3232       for (i=2 ; i+2<objc ; i+=2) {
  3233   3233   	if (Tcl_DictObjGet(interp, dictPtr, objv[i], &objPtr) != TCL_OK) {
  3234   3234   	    TclDecrRefCount(dictPtr);
  3235   3235   	    return TCL_ERROR;
  3236   3236   	}
  3237   3237   	if (objPtr == NULL) {
  3238   3238   	    /* ??? */
  3239         -	    Tcl_UnsetVar(interp, Tcl_GetString(objv[i+1]), 0);
         3239  +	    Tcl_UnsetVar(interp, TclGetString(objv[i+1]), 0);
  3240   3240   	} else if (Tcl_ObjSetVar2(interp, objv[i+1], NULL, objPtr,
  3241   3241   		TCL_LEAVE_ERR_MSG) == NULL) {
  3242   3242   	    TclDecrRefCount(dictPtr);
  3243   3243   	    return TCL_ERROR;
  3244   3244   	}
  3245   3245       }
  3246   3246       TclDecrRefCount(dictPtr);

Changes to generic/tclDisassemble.c.

    52     52   	ir.wideValue = (inst);					\
    53     53   	Tcl_StoreIntRep((objPtr), &instNameType, &ir);		\
    54     54       } while (0)
    55     55   
    56     56   #define InstNameGetIntRep(objPtr, inst)				\
    57     57       do {							\
    58     58   	const Tcl_ObjIntRep *irPtr;				\
    59         -	irPtr = Tcl_FetchIntRep((objPtr), &instNameType);	\
           59  +	irPtr = TclFetchIntRep((objPtr), &instNameType);	\
    60     60   	assert(irPtr != NULL);					\
    61     61   	(inst) = (size_t)irPtr->wideValue;			\
    62     62       } while (0)
    63     63   
    64     64   
    65     65   /*
    66     66    *----------------------------------------------------------------------
................................................................................
   284    284   	    codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
   285    285       Tcl_AppendToObj(bufferObj, "  Source ", -1);
   286    286       PrintSourceToObj(bufferObj, codePtr->source,
   287    287   	    TclMin(codePtr->numSrcBytes, 55));
   288    288       GetLocationInformation(codePtr->procPtr, &fileObj, &line);
   289    289       if (line > -1 && fileObj != NULL) {
   290    290   	Tcl_AppendPrintfToObj(bufferObj, "\n  File \"%s\" Line %d",
   291         -		Tcl_GetString(fileObj), line);
          291  +		TclGetString(fileObj), line);
   292    292       }
   293    293       Tcl_AppendPrintfToObj(bufferObj,
   294    294   	    "\n  Cmds %d, src %d, inst %d, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
   295    295   	    numCmds, codePtr->numSrcBytes, codePtr->numCodeBytes,
   296    296   	    codePtr->numLitObjects, (int) BA_AuxData_Size(codePtr->auxData),
   297    297   	    codePtr->maxStackDepth,
   298    298   #ifdef TCL_COMPILE_STATS
................................................................................
  1385   1385   	 */
  1386   1386   
  1387   1387   	if (objc != 3) {
  1388   1388   	    Tcl_WrongNumArgs(interp, 2, objv, "script");
  1389   1389   	    return TCL_ERROR;
  1390   1390   	}
  1391   1391   
  1392         -	if ((NULL == Tcl_FetchIntRep(objv[2], &tclByteCodeType)) && (TCL_OK
         1392  +	if ((objv[2]->typePtr != &tclByteCodeType) && (TCL_OK
  1393   1393   		!= TclSetByteCodeFromAny(interp, objv[2], NULL, NULL))) {
  1394   1394   	    return TCL_ERROR;
  1395   1395   	}
  1396   1396   	codeObjPtr = objv[2];
  1397   1397   	break;
  1398   1398   
  1399   1399       case DISAS_CLASS_CONSTRUCTOR:
................................................................................
  1586   1586   	if (procPtr == NULL) {
  1587   1587   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1588   1588   		    "body not available for this kind of method", -1));
  1589   1589   	    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
  1590   1590   		    "METHODTYPE", NULL);
  1591   1591   	    return TCL_ERROR;
  1592   1592   	}
  1593         -	if (NULL == Tcl_FetchIntRep(procPtr->bodyPtr, &tclByteCodeType)) {
         1593  +	if (procPtr->bodyPtr->typePtr != &tclByteCodeType) {
  1594   1594   	    Command cmd;
  1595   1595   
  1596   1596   	    /*
  1597   1597   	     * Yes, this is ugly, but we need to pass the namespace in to the
  1598   1598   	     * compiler in two places.
  1599   1599   	     */
  1600   1600   

Changes to generic/tclEncoding.c.

   286    286   	ir.twoPtrValue.ptr2 = NULL;					\
   287    287   	Tcl_StoreIntRep((objPtr), &encodingType, &ir);			\
   288    288       } while (0)
   289    289   
   290    290   #define EncodingGetIntRep(objPtr, encoding)				\
   291    291       do {								\
   292    292   	const Tcl_ObjIntRep *irPtr;					\
   293         -	irPtr = Tcl_FetchIntRep ((objPtr), &encodingType);		\
          293  +	irPtr = TclFetchIntRep ((objPtr), &encodingType);		\
   294    294   	(encoding) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   295    295       } while (0)
   296    296   
   297    297   
   298    298   /*
   299    299    *----------------------------------------------------------------------
   300    300    *

Changes to generic/tclEnsemble.c.

    91     91   	ir.twoPtrValue.ptr2 = NULL;					\
    92     92   	Tcl_StoreIntRep((objPtr), &ensembleCmdType, &ir);		\
    93     93       } while (0)
    94     94   
    95     95   #define ECRGetIntRep(objPtr, ecRepPtr)					\
    96     96       do {								\
    97     97   	const Tcl_ObjIntRep *irPtr;					\
    98         -	irPtr = Tcl_FetchIntRep((objPtr), &ensembleCmdType);		\
           98  +	irPtr = TclFetchIntRep((objPtr), &ensembleCmdType);		\
    99     99   	(ecRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   100    100       } while (0)
   101    101   
   102    102   /*
   103    103    * The internal rep for caching ensemble subcommand lookups and spelling
   104    104    * corrections.
   105    105    */
................................................................................
  1620   1620   		if (map[i].unsafe && Tcl_IsSafe(interp)) {
  1621   1621   		    cmdPtr = (Command *)
  1622   1622   			    Tcl_NRCreateCommand(interp, "___tmp", map[i].proc,
  1623   1623   			    map[i].nreProc, map[i].clientData, NULL);
  1624   1624   		    Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
  1625   1625   		    if (Tcl_HideCommand(interp, "___tmp",
  1626   1626   			    Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
  1627         -			Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
         1627  +			Tcl_Panic("%s", Tcl_GetStringResult(interp));
  1628   1628   		    }
  1629   1629   		} else {
  1630   1630   		    /*
  1631   1631   		     * Not hidden, so just create it. Yay!
  1632   1632   		     */
  1633   1633   
  1634   1634   		    cmdPtr = (Command *)

Changes to generic/tclEvent.c.

  1399   1399       int done, foundEvent;
  1400   1400       const char *nameString;
  1401   1401   
  1402   1402       if (objc != 2) {
  1403   1403   	Tcl_WrongNumArgs(interp, 1, objv, "name");
  1404   1404   	return TCL_ERROR;
  1405   1405       }
  1406         -    nameString = Tcl_GetString(objv[1]);
         1406  +    nameString = TclGetString(objv[1]);
  1407   1407       if (Tcl_TraceVar2(interp, nameString, NULL,
  1408   1408   	    TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
  1409   1409   	    VwaitVarProc, &done) != TCL_OK) {
  1410   1410   	return TCL_ERROR;
  1411   1411       };
  1412   1412       done = 0;
  1413   1413       foundEvent = 1;

Changes to generic/tclExecute.c.

   688    688   ReleaseDictIterator(
   689    689       Tcl_Obj *objPtr)
   690    690   {
   691    691       Tcl_DictSearch *searchPtr;
   692    692       Tcl_Obj *dictPtr;
   693    693       const Tcl_ObjIntRep *irPtr;
   694    694   
   695         -    irPtr = Tcl_FetchIntRep(objPtr, &dictIteratorType);
          695  +    irPtr = TclFetchIntRep(objPtr, &dictIteratorType);
   696    696       assert(irPtr != NULL);
   697    697   
   698    698       /*
   699    699        * First kill the search, and then release the reference to the dictionary
   700    700        * that we were holding.
   701    701        */
   702    702   
................................................................................
  3558   3558   	varPtr = LOCAL(opnd);
  3559   3559   	while (TclIsVarLink(varPtr)) {
  3560   3560   	    varPtr = varPtr->value.linkPtr;
  3561   3561   	}
  3562   3562   	arrayPtr = NULL;
  3563   3563   	part1Ptr = part2Ptr = NULL;
  3564   3564   	cleanup = 0;
  3565         -	TRACE(("%u %s => ", opnd, Tcl_GetString(incrPtr)));
         3565  +	TRACE(("%u %s => ", opnd, TclGetString(incrPtr)));
  3566   3566   
  3567   3567       doIncrVar:
  3568   3568   	if (TclIsVarDirectModifyable2(varPtr, arrayPtr)) {
  3569   3569   	    objPtr = varPtr->value.objPtr;
  3570   3570   	    if (Tcl_IsShared(objPtr)) {
  3571   3571   		objPtr->refCount--;	/* We know it's shared */
  3572   3572   		objResultPtr = Tcl_DuplicateObj(objPtr);
................................................................................
  4520   4520        *     End of TclOO support instructions.
  4521   4521        * -----------------------------------------------------------------
  4522   4522        *	   Start of INST_LIST and related instructions.
  4523   4523        */
  4524   4524   
  4525   4525       {
  4526   4526   	int index, numIndices, fromIdx, toIdx;
  4527         -	int nocase, match, length2, cflags, s1len, s2len;
  4528         -	size_t slength;
         4527  +	int nocase, match, cflags, s1len, s2len;
         4528  +	size_t slength, length2;
  4529   4529   	const char *s1, *s2;
  4530   4530   
  4531   4531       case INST_LIST:
  4532   4532   	/*
  4533   4533   	 * Pop the opnd (objc) top stack elements into a new list obj and then
  4534   4534   	 * decrement their ref counts.
  4535   4535   	 */
................................................................................
  4555   4555   	TRACE(("\"%.30s\" \"%.30s\" => ", O2S(valuePtr), O2S(value2Ptr)));
  4556   4556   
  4557   4557   	/*
  4558   4558   	 * Extract the desired list element.
  4559   4559   	 */
  4560   4560   
  4561   4561   	if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK)
  4562         -		&& (NULL == Tcl_FetchIntRep(value2Ptr, &tclListType))
         4562  +		&& (value2Ptr->typePtr != &tclListType)
  4563   4563   		&& (TclGetIntForIndexM(NULL, value2Ptr, objc-1,
  4564   4564   			&index) == TCL_OK)) {
  4565   4565   	    TclDecrRefCount(value2Ptr);
  4566   4566   	    tosPtr--;
  4567   4567   	    pcAdjustment = 1;
  4568   4568   	    goto lindexFastPath;
  4569   4569   	}
................................................................................
  5110   5110   	    TclNewObj(objResultPtr);
  5111   5111   	}
  5112   5112   	TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
  5113   5113   	NEXT_INST_F(9, 1, 1);
  5114   5114   
  5115   5115       {
  5116   5116   	Tcl_UniChar *ustring1, *ustring2, *ustring3, *end, *p;
  5117         -	int length3;
         5117  +	size_t length3;
  5118   5118   	Tcl_Obj *value3Ptr;
  5119   5119   
  5120   5120       case INST_STR_REPLACE:
  5121   5121   	value3Ptr = POP_OBJECT();
  5122   5122   	valuePtr = OBJ_AT_DEPTH(2);
  5123   5123   	slength = Tcl_GetCharLength(valuePtr) - 1;
  5124   5124   	TRACE(("\"%.20s\" %s %s \"%.20s\" => ", O2S(valuePtr),
................................................................................
  5186   5186   	}
  5187   5187   	ustring1 = TclGetUnicodeFromObj(valuePtr, &slength);
  5188   5188   	if (slength == 0) {
  5189   5189   	    objResultPtr = valuePtr;
  5190   5190   	    goto doneStringMap;
  5191   5191   	}
  5192   5192   	ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2);
  5193         -	if (length2 > (int)slength || length2 == 0) {
         5193  +	if (length2 > slength || length2 == 0) {
  5194   5194   	    objResultPtr = valuePtr;
  5195   5195   	    goto doneStringMap;
  5196         -	} else if (length2 == (int)slength) {
         5196  +	} else if (length2 == slength) {
  5197   5197   	    if (memcmp(ustring1, ustring2, sizeof(Tcl_UniChar) * slength)) {
  5198   5198   		objResultPtr = valuePtr;
  5199   5199   	    } else {
  5200   5200   		objResultPtr = value3Ptr;
  5201   5201   	    }
  5202   5202   	    goto doneStringMap;
  5203   5203   	}
................................................................................
  6734   6734   	    TclNewObj(statePtr);
  6735   6735   	    ir.twoPtrValue.ptr1 = searchPtr;
  6736   6736   	    ir.twoPtrValue.ptr2 = dictPtr;
  6737   6737   	    Tcl_StoreIntRep(statePtr, &dictIteratorType, &ir);
  6738   6738   	}
  6739   6739   	varPtr = LOCAL(opnd);
  6740   6740   	if (varPtr->value.objPtr) {
  6741         -	    if (Tcl_FetchIntRep(varPtr->value.objPtr, &dictIteratorType)) {
         6741  +	    if (varPtr->value.objPtr->typePtr == &dictIteratorType) {
  6742   6742   		Tcl_Panic("mis-issued dictFirst!");
  6743   6743   	    }
  6744   6744   	    TclDecrRefCount(varPtr->value.objPtr);
  6745   6745   	}
  6746   6746   	varPtr->value.objPtr = statePtr;
  6747   6747   	Tcl_IncrRefCount(statePtr);
  6748   6748   	goto pushDictIteratorResult;
................................................................................
  6751   6751   	opnd = TclGetUInt4AtPtr(pc+1);
  6752   6752   	TRACE(("%u => ", opnd));
  6753   6753   	statePtr = (*LOCAL(opnd)).value.objPtr;
  6754   6754   	{
  6755   6755   	    const Tcl_ObjIntRep *irPtr;
  6756   6756   
  6757   6757   	    if (statePtr &&
  6758         -		    (irPtr = Tcl_FetchIntRep(statePtr, &dictIteratorType))) {
         6758  +		    (irPtr = TclFetchIntRep(statePtr, &dictIteratorType))) {
  6759   6759   		searchPtr = irPtr->twoPtrValue.ptr1;
  6760   6760   		Tcl_DictObjNext(searchPtr, &keyPtr, &valuePtr, &done);
  6761   6761   	    } else {
  6762   6762   		Tcl_Panic("mis-issued dictNext!");
  6763   6763   	    }
  6764   6764   	}
  6765   6765       pushDictIteratorResult:
................................................................................
  8635   8635       } else {
  8636   8636   	/* TODO: No caller needs this. Eliminate? */
  8637   8637   	description = "(big) integer";
  8638   8638       }
  8639   8639   
  8640   8640       Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  8641   8641   	    "can't use %s \"%s\" as operand of \"%s\"", description,
  8642         -	    Tcl_GetString(opndPtr), operator));
         8642  +	    TclGetString(opndPtr), operator));
  8643   8643       Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL);
  8644   8644   }
  8645   8645   
  8646   8646   /*
  8647   8647    *----------------------------------------------------------------------
  8648   8648    *
  8649   8649    * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSourceFromFrame --
................................................................................
  9239   9239       objBytesIfUnshared = 0.0;
  9240   9240       strBytesIfUnshared = 0.0;
  9241   9241       strBytesSharedMultX = 0.0;
  9242   9242       strBytesSharedOnce = 0.0;
  9243   9243       for (i = 0;  i < globalTablePtr->numBuckets;  i++) {
  9244   9244   	for (entryPtr = globalTablePtr->buckets[i];  entryPtr != NULL;
  9245   9245   		entryPtr = entryPtr->nextPtr) {
  9246         -	    if (NULL != Tcl_FetchIntRep(entryPtr->objPtr, &tclByteCodeType)) {
         9246  +	    if (entryPtr->objPtr->typePtr == &tclByteCodeType) {
  9247   9247   		numByteCodeLits++;
  9248   9248   	    }
  9249   9249   	    (void) TclGetStringFromObj(entryPtr->objPtr, &length);
  9250   9250   	    refCountSum += entryPtr->refCount;
  9251   9251   	    objBytesIfUnshared += (entryPtr->refCount * sizeof(Tcl_Obj));
  9252   9252   	    strBytesIfUnshared += (entryPtr->refCount * (length+1));
  9253   9253   	    if (entryPtr->refCount > 1) {

Changes to generic/tclFileName.c.

   382    382   TclpGetNativePathType(
   383    383       Tcl_Obj *pathPtr,		/* Native path of interest */
   384    384       int *driveNameLengthPtr,	/* Returns length of drive, if non-NULL and
   385    385   				 * path was absolute */
   386    386       Tcl_Obj **driveNameRef)
   387    387   {
   388    388       Tcl_PathType type = TCL_PATH_ABSOLUTE;
   389         -    int pathLen;
   390         -    const char *path = TclGetStringFromObj(pathPtr, &pathLen);
          389  +    const char *path = TclGetString(pathPtr);
   391    390   
   392    391       if (path[0] == '~') {
   393    392   	/*
   394    393   	 * This case is common to all platforms. Paths that begin with ~ are
   395    394   	 * absolute.
   396    395   	 */
   397    396   
................................................................................
   500    499   
   501    500       /*
   502    501        * Perform platform specific splitting.
   503    502        */
   504    503   
   505    504       switch (tclPlatform) {
   506    505       case TCL_PLATFORM_UNIX:
   507         -	resultPtr = SplitUnixPath(Tcl_GetString(pathPtr));
          506  +	resultPtr = SplitUnixPath(TclGetString(pathPtr));
   508    507   	break;
   509    508   
   510    509       case TCL_PLATFORM_WINDOWS:
   511         -	resultPtr = SplitWinPath(Tcl_GetString(pathPtr));
          510  +	resultPtr = SplitWinPath(TclGetString(pathPtr));
   512    511   	break;
   513    512       }
   514    513   
   515    514       /*
   516    515        * Compute the number of elements in the result.
   517    516        */
   518    517   
................................................................................
   553    552       int *argcPtr,		/* Pointer to location to fill in with the
   554    553   				 * number of elements in the path. */
   555    554       const char ***argvPtr)	/* Pointer to place to store pointer to array
   556    555   				 * of pointers to path elements. */
   557    556   {
   558    557       Tcl_Obj *resultPtr = NULL;	/* Needed only to prevent gcc warnings. */
   559    558       Tcl_Obj *tmpPtr, *eltPtr;
   560         -    int i, size, len;
          559  +    int i;
          560  +    size_t size, len;
   561    561       char *p;
   562    562       const char *str;
   563    563   
   564    564       /*
   565    565        * Perform the splitting, using objectified, vfs-aware code.
   566    566        */
   567    567   
................................................................................
   892    892   
   893    893   	/*
   894    894   	 * Append the element, eliminating duplicate and trailing slashes.
   895    895   	 */
   896    896   
   897    897   	Tcl_SetObjLength(prefix, length + (int) strlen(p));
   898    898   
   899         -	dest = Tcl_GetString(prefix) + length;
          899  +	dest = TclGetString(prefix) + length;
   900    900   	for (; *p != '\0'; p++) {
   901    901   	    if (*p == '/') {
   902    902   		while (p[1] == '/') {
   903    903   		    p++;
   904    904   		}
   905    905   		if (p[1] != '\0' && needsSep) {
   906    906   		    *dest++ = '/';
   907    907   		}
   908    908   	    } else {
   909    909   		*dest++ = *p;
   910    910   		needsSep = 1;
   911    911   	    }
   912    912   	}
   913         -	length = dest - Tcl_GetString(prefix);
          913  +	length = dest - TclGetString(prefix);
   914    914   	Tcl_SetObjLength(prefix, length);
   915    915   	break;
   916    916   
   917    917       case TCL_PLATFORM_WINDOWS:
   918    918   	/*
   919    919   	 * Check to see if we need to append a separator.
   920    920   	 */
................................................................................
   927    927   	needsSep = 0;
   928    928   
   929    929   	/*
   930    930   	 * Append the element, eliminating duplicate and trailing slashes.
   931    931   	 */
   932    932   
   933    933   	Tcl_SetObjLength(prefix, length + (int) strlen(p));
   934         -	dest = Tcl_GetString(prefix) + length;
          934  +	dest = TclGetString(prefix) + length;
   935    935   	for (; *p != '\0'; p++) {
   936    936   	    if ((*p == '/') || (*p == '\\')) {
   937    937   		while ((p[1] == '/') || (p[1] == '\\')) {
   938    938   		    p++;
   939    939   		}
   940    940   		if ((p[1] != '\0') && needsSep) {
   941    941   		    *dest++ = '/';
   942    942   		}
   943    943   	    } else {
   944    944   		*dest++ = *p;
   945    945   		needsSep = 1;
   946    946   	    }
   947    947   	}
   948         -	length = dest - Tcl_GetString(prefix);
          948  +	length = dest - TclGetString(prefix);
   949    949   	Tcl_SetObjLength(prefix, length);
   950    950   	break;
   951    951       }
   952    952       return;
   953    953   }
   954    954   
   955    955   /*
................................................................................
   973    973   
   974    974   char *
   975    975   Tcl_JoinPath(
   976    976       int argc,
   977    977       const char *const *argv,
   978    978       Tcl_DString *resultPtr)	/* Pointer to previously initialized DString */
   979    979   {
   980         -    int i, len;
          980  +    int i;
          981  +    size_t len;
   981    982       Tcl_Obj *listObj = Tcl_NewObj();
   982    983       Tcl_Obj *resultObj;
   983    984       const char *resultStr;
   984    985   
   985    986       /*
   986    987        * Build the list of paths.
   987    988        */
................................................................................
  1246   1247       globFlags = 0;
  1247   1248       join = 0;
  1248   1249       dir = PATH_NONE;
  1249   1250       typePtr = NULL;
  1250   1251       for (i = 1; i < objc; i++) {
  1251   1252   	if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
  1252   1253   		&index) != TCL_OK) {
  1253         -	    string = TclGetStringFromObj(objv[i], &length);
         1254  +	    string = TclGetString(objv[i]);
  1254   1255   	    if (string[0] == '-') {
  1255   1256   		/*
  1256   1257   		 * It looks like the command contains an option so signal an
  1257   1258   		 * error.
  1258   1259   		 */
  1259   1260   
  1260   1261   		return TCL_ERROR;
................................................................................
  1352   1353   	break;
  1353   1354       case TCL_PLATFORM_WINDOWS:
  1354   1355   	separators = "/\\:";
  1355   1356   	break;
  1356   1357       }
  1357   1358   
  1358   1359       if (dir == PATH_GENERAL) {
  1359         -	int pathlength;
         1360  +	size_t pathlength;
  1360   1361   	const char *last;
  1361   1362   	const char *first = TclGetStringFromObj(pathOrDir,&pathlength);
  1362   1363   
  1363   1364   	/*
  1364   1365   	 * Find the last path separator in the path
  1365   1366   	 */
  1366   1367   
................................................................................
  1404   1405   		/*
  1405   1406   		 * We must ensure that we haven't cut off too much, and turned
  1406   1407   		 * a valid path like '/' or 'C:/' into an incorrect path like
  1407   1408   		 * '' or 'C:'. The way we do this is to add a separator if
  1408   1409   		 * there are none presently in the prefix.
  1409   1410   		 */
  1410   1411   
  1411         -		if (strpbrk(Tcl_GetString(pathOrDir), "\\/") == NULL) {
         1412  +		if (strpbrk(TclGetString(pathOrDir), "\\/") == NULL) {
  1412   1413   		    Tcl_AppendToObj(pathOrDir, last-1, 1);
  1413   1414   		}
  1414   1415   	    }
  1415   1416   
  1416   1417   	    /*
  1417   1418   	     * Need to quote 'prefix'.
  1418   1419   	     */
................................................................................
  1516   1517   	    } else {
  1517   1518   		Tcl_Obj *item;
  1518   1519   		int llen;
  1519   1520   
  1520   1521   		if ((Tcl_ListObjLength(NULL, look, &llen) == TCL_OK)
  1521   1522   			&& (llen == 3)) {
  1522   1523   		    Tcl_ListObjIndex(interp, look, 0, &item);
  1523         -		    if (!strcmp("macintosh", Tcl_GetString(item))) {
         1524  +		    if (!strcmp("macintosh", TclGetString(item))) {
  1524   1525   			Tcl_ListObjIndex(interp, look, 1, &item);
  1525         -			if (!strcmp("type", Tcl_GetString(item))) {
         1526  +			if (!strcmp("type", TclGetString(item))) {
  1526   1527   			    Tcl_ListObjIndex(interp, look, 2, &item);
  1527   1528   			    if (globTypes->macType != NULL) {
  1528   1529   				goto badMacTypesArg;
  1529   1530   			    }
  1530   1531   			    globTypes->macType = item;
  1531   1532   			    Tcl_IncrRefCount(item);
  1532   1533   			    continue;
  1533         -			} else if (!strcmp("creator", Tcl_GetString(item))) {
         1534  +			} else if (!strcmp("creator", TclGetString(item))) {
  1534   1535   			    Tcl_ListObjIndex(interp, look, 2, &item);
  1535   1536   			    if (globTypes->macCreator != NULL) {
  1536   1537   				goto badMacTypesArg;
  1537   1538   			    }
  1538   1539   			    globTypes->macCreator = item;
  1539   1540   			    Tcl_IncrRefCount(item);
  1540   1541   			    continue;
................................................................................
  1546   1547   		 * Error cases. We reset the 'join' flag to zero, since we
  1547   1548   		 * haven't yet made use of it.
  1548   1549   		 */
  1549   1550   
  1550   1551   	    badTypesArg:
  1551   1552   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1552   1553   			"bad argument to \"-types\": %s",
  1553         -			Tcl_GetString(look)));
         1554  +			TclGetString(look)));
  1554   1555   		Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "BAD", NULL);
  1555   1556   		result = TCL_ERROR;
  1556   1557   		join = 0;
  1557   1558   		goto endOfGlob;
  1558   1559   
  1559   1560   	    badMacTypesArg:
  1560   1561   		Tcl_SetObjResult(interp, Tcl_NewStringObj(
................................................................................
  1610   1611   		Tcl_DStringFree(&str);
  1611   1612   		goto endOfGlob;
  1612   1613   	    }
  1613   1614   	}
  1614   1615   	Tcl_DStringFree(&str);
  1615   1616       } else {
  1616   1617   	for (i = 0; i < objc; i++) {
  1617         -	    string = Tcl_GetString(objv[i]);
         1618  +	    string = TclGetString(objv[i]);
  1618   1619   	    if (TclGlob(interp, string, pathOrDir, globFlags,
  1619   1620   		    globTypes) != TCL_OK) {
  1620   1621   		result = TCL_ERROR;
  1621   1622   		goto endOfGlob;
  1622   1623   	    }
  1623   1624   	}
  1624   1625       }
................................................................................
  1642   1643   	    if (join) {
  1643   1644   		Tcl_AppendToObj(errorMsg, Tcl_DStringValue(&prefix), -1);
  1644   1645   	    } else {
  1645   1646   		const char *sep = "";
  1646   1647   
  1647   1648   		for (i = 0; i < objc; i++) {
  1648   1649   		    Tcl_AppendPrintfToObj(errorMsg, "%s%s",
  1649         -			    sep, Tcl_GetString(objv[i]));
         1650  +			    sep, TclGetString(objv[i]));
  1650   1651   		    sep = " ";
  1651   1652   		}
  1652   1653   	    }
  1653   1654   	    Tcl_AppendToObj(errorMsg, "\"", -1);
  1654   1655   	    Tcl_SetObjResult(interp, errorMsg);
  1655   1656   	    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "NOMATCH",
  1656   1657   		    NULL);
................................................................................
  1845   1846   
  1846   1847   		Tcl_Obj *cwd = Tcl_FSGetCwd(interp);
  1847   1848   
  1848   1849   		if (cwd == NULL) {
  1849   1850   		    Tcl_DecrRefCount(temp);
  1850   1851   		    return TCL_ERROR;
  1851   1852   		}
  1852         -		pathPrefix = Tcl_NewStringObj(Tcl_GetString(cwd), 3);
         1853  +		pathPrefix = Tcl_NewStringObj(TclGetString(cwd), 3);
  1853   1854   		Tcl_DecrRefCount(cwd);
  1854   1855   		if (tail[0] == '/') {
  1855   1856   		    tail++;
  1856   1857   		} else {
  1857   1858   		    tail += 2;
  1858   1859   		}
  1859   1860   		Tcl_IncrRefCount(pathPrefix);
................................................................................
  1979   1980        *
  1980   1981        * We do it by rewriting the result list in-place.
  1981   1982        */
  1982   1983   
  1983   1984       if (globFlags & TCL_GLOBMODE_TAILS) {
  1984   1985   	int objc, i;
  1985   1986   	Tcl_Obj **objv;
  1986         -	int prefixLen;
         1987  +	size_t prefixLen;
  1987   1988   	const char *pre;
  1988   1989   
  1989   1990   	/*
  1990   1991   	 * If this length has never been set, set it here.
  1991   1992   	 */
  1992   1993   
  1993   1994   	if (pathPrefix == NULL) {
................................................................................
  2007   2008   		    || (pre[1] != ':')) {
  2008   2009   		prefixLen++;
  2009   2010   	    }
  2010   2011   	}
  2011   2012   
  2012   2013   	Tcl_ListObjGetElements(NULL, filenamesObj, &objc, &objv);
  2013   2014   	for (i = 0; i< objc; i++) {
  2014         -	    int len;
         2015  +	    size_t len;
  2015   2016   	    const char *oldStr = TclGetStringFromObj(objv[i], &len);
  2016   2017   	    Tcl_Obj *elem;
  2017   2018   
  2018   2019   	    if (len == prefixLen) {
  2019   2020   		if ((pattern[0] == '\0')
  2020   2021   			|| (strchr(separators, pattern[0]) == NULL)) {
  2021   2022   		    TclNewLiteralStringObj(elem, ".");
................................................................................
  2339   2340   	    Tcl_Obj **subdirv;
  2340   2341   
  2341   2342   	    result = Tcl_ListObjGetElements(interp, subdirsPtr,
  2342   2343   		    &subdirc, &subdirv);
  2343   2344   	    for (i=0; result==TCL_OK && i<subdirc; i++) {
  2344   2345   		Tcl_Obj *copy = NULL;
  2345   2346   
  2346         -		if (pathPtr == NULL && Tcl_GetString(subdirv[i])[0] == '~') {
         2347  +		if (pathPtr == NULL && TclGetString(subdirv[i])[0] == '~') {
  2347   2348   		    Tcl_ListObjLength(NULL, matchesObj, &repair);
  2348   2349   		    copy = subdirv[i];
  2349   2350   		    subdirv[i] = Tcl_NewStringObj("./", 2);
  2350   2351   		    Tcl_AppendObjToObj(subdirv[i], copy);
  2351   2352   		    Tcl_IncrRefCount(subdirv[i]);
  2352   2353   		}
  2353   2354   		result = DoGlob(interp, matchesObj, separators, subdirv[i],
................................................................................
  2356   2357   		    int end;
  2357   2358   
  2358   2359   		    Tcl_DecrRefCount(subdirv[i]);
  2359   2360   		    subdirv[i] = copy;
  2360   2361   		    Tcl_ListObjLength(NULL, matchesObj, &end);
  2361   2362   		    while (repair < end) {
  2362   2363   			const char *bytes;
  2363         -			int numBytes;
         2364  +			size_t numBytes;
  2364   2365   			Tcl_Obj *fixme, *newObj;
  2365   2366   
  2366   2367   			Tcl_ListObjIndex(NULL, matchesObj, repair, &fixme);
  2367   2368   			bytes = TclGetStringFromObj(fixme, &numBytes);
  2368   2369   			newObj = Tcl_NewStringObj(bytes+2, numBytes-2);
  2369   2370   			Tcl_ListObjReplace(NULL, matchesObj, repair, 1,
  2370   2371   				1, &newObj);
................................................................................
  2443   2444   	} else {
  2444   2445   	    joinedPtr = Tcl_DuplicateObj(pathPtr);
  2445   2446   	    if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
  2446   2447   		/*
  2447   2448   		 * The current prefix must end in a separator.
  2448   2449   		 */
  2449   2450   
  2450         -		int len;
         2451  +		size_t len;
  2451   2452   		const char *joined = TclGetStringFromObj(joinedPtr,&len);
  2452   2453   
  2453   2454   		if (strchr(separators, joined[len-1]) == NULL) {
  2454   2455   		    Tcl_AppendToObj(joinedPtr, "/", 1);
  2455   2456   		}
  2456   2457   	    }
  2457   2458   	    Tcl_AppendToObj(joinedPtr, Tcl_DStringValue(&append),
................................................................................
  2480   2481   	     * The current prefix must end in a separator, unless this is a
  2481   2482   	     * volume-relative path. In particular globbing in Windows shares,
  2482   2483   	     * when not using -dir or -path, e.g. 'glob [file join
  2483   2484   	     * //machine/share/subdir *]' requires adding a separator here.
  2484   2485   	     * This behaviour is not currently tested for in the test suite.
  2485   2486   	     */
  2486   2487   
  2487         -	    int len;
         2488  +	    size_t len;
  2488   2489   	    const char *joined = TclGetStringFromObj(joinedPtr,&len);
  2489   2490   
  2490   2491   	    if (strchr(separators, joined[len-1]) == NULL) {
  2491   2492   		if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
  2492   2493   		    Tcl_AppendToObj(joinedPtr, "/", 1);
  2493   2494   		}
  2494   2495   	    }

Changes to generic/tclIO.c.

   345    345   	ir.twoPtrValue.ptr2 = NULL;					\
   346    346   	Tcl_StoreIntRep((objPtr), &chanObjType, &ir);			\
   347    347       } while (0)
   348    348   
   349    349   #define ChanGetIntRep(objPtr, resPtr)					\
   350    350       do {								\
   351    351   	const Tcl_ObjIntRep *irPtr;					\
   352         -	irPtr = Tcl_FetchIntRep((objPtr), &chanObjType);		\
          352  +	irPtr = TclFetchIntRep((objPtr), &chanObjType);		\
   353    353   	(resPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   354    354       } while (0)
   355    355   
   356    356   #define BUSY_STATE(st, fl) \
   357    357        ((((st)->csPtrR) && ((fl) & TCL_READABLE)) || \
   358    358         (((st)->csPtrW) && ((fl) & TCL_WRITABLE)))
   359    359   
................................................................................
  4520   4520   				 * object as UTF-8 characters. */
  4521   4521   {
  4522   4522       GetsState gs;
  4523   4523       Channel *chanPtr = (Channel *) chan;
  4524   4524       ChannelState *statePtr = chanPtr->state;
  4525   4525   				/* State info for channel */
  4526   4526       ChannelBuffer *bufPtr;
  4527         -    int inEofChar, skip, copiedTotal, oldLength, oldFlags, oldRemoved;
         4527  +    int inEofChar, skip, copiedTotal, oldFlags, oldRemoved;
         4528  +    size_t oldLength;
  4528   4529       Tcl_Encoding encoding;
  4529   4530       char *dst, *dstEnd, *eol, *eof;
  4530   4531       Tcl_EncodingState oldState;
  4531   4532   
  4532   4533       if (CheckChannelErrors(statePtr, TCL_READABLE) != 0) {
  4533   4534   	return TCL_IO_FAILURE;
  4534   4535       }
................................................................................
  6081   6082       Tcl_Encoding encoding = statePtr->encoding? statePtr->encoding
  6082   6083   	    : GetBinaryEncoding();
  6083   6084       Tcl_EncodingState savedState = statePtr->inputEncodingState;
  6084   6085       ChannelBuffer *bufPtr = statePtr->inQueueHead;
  6085   6086       int savedIEFlags = statePtr->inputEncodingFlags;
  6086   6087       int savedFlags = statePtr->flags;
  6087   6088       char *dst, *src = RemovePoint(bufPtr);
  6088         -    int numBytes, srcLen = BytesLeft(bufPtr);
         6089  +    size_t numBytes;
         6090  +    int srcLen = BytesLeft(bufPtr);
  6089   6091   
  6090   6092       /*
  6091   6093        * One src byte can yield at most one character.  So when the number of
  6092   6094        * src bytes we plan to read is less than the limit on character count to
  6093   6095        * be read, clearly we will remain within that limit, and we can use the
  6094   6096        * value of "srcLen" as a tighter limit for sizing receiving buffers.
  6095   6097        */
................................................................................
  9422   9424       CopyState *csPtr,		/* State of copy operation. */
  9423   9425       int mask)			/* Current channel event flags. */
  9424   9426   {
  9425   9427       Tcl_Interp *interp;
  9426   9428       Tcl_Obj *cmdPtr, *errObj = NULL, *bufObj = NULL, *msg = NULL;
  9427   9429       Tcl_Channel inChan, outChan;
  9428   9430       ChannelState *inStatePtr, *outStatePtr;
  9429         -    int result = TCL_OK, size, sizeb;
         9431  +    int result = TCL_OK, size;
         9432  +    size_t sizeb;
  9430   9433       Tcl_WideInt total;
  9431   9434       const char *buffer;
  9432   9435       int inBinary, outBinary, sameEncoding;
  9433   9436   				/* Encoding control */
  9434   9437       int underflow;		/* Input underflow */
  9435   9438   
  9436   9439       inChan	= (Tcl_Channel) csPtr->readPtr;
................................................................................
  9488   9491   	     * Read up to bufSize bytes.
  9489   9492   	     */
  9490   9493   
  9491   9494   	    if ((csPtr->toRead == (Tcl_WideInt) -1)
  9492   9495                       || (csPtr->toRead > (Tcl_WideInt) csPtr->bufSize)) {
  9493   9496   		sizeb = csPtr->bufSize;
  9494   9497   	    } else {
  9495         -		sizeb = (int) csPtr->toRead;
         9498  +		sizeb = csPtr->toRead;
  9496   9499   	    }
  9497   9500   
  9498   9501   	    if (inBinary || sameEncoding) {
  9499   9502   		size = DoRead(inStatePtr->topChanPtr, csPtr->buffer, sizeb,
  9500   9503                                 !GotFlag(inStatePtr, CHANNEL_NONBLOCKING));
  9501   9504   	    } else {
  9502   9505   		size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb,
  9503   9506   			0 /* No append */);
  9504   9507   	    }
  9505         -	    underflow = (size >= 0) && (size < sizeb);	/* Input underflow */
         9508  +	    underflow = (size >= 0) && ((size_t)size < sizeb);	/* Input underflow */
  9506   9509   	}
  9507   9510   
  9508   9511   	if (size < 0) {
  9509   9512   	readError:
  9510   9513   	    if (interp) {
  9511   9514   		TclNewObj(errObj);
  9512   9515   		Tcl_AppendStringsToObj(errObj, "error reading \"",
................................................................................
  9582   9585   	 * bytes or characters, and both EOL translation and encoding
  9583   9586   	 * conversion may have changed this number unpredictably in relation
  9584   9587   	 * to 'size' (It can be smaller or larger, in the latter case able to
  9585   9588   	 * drive toRead below -1, causing infinite looping). Completely
  9586   9589   	 * unsuitable for updating totals and toRead.
  9587   9590   	 */
  9588   9591   
  9589         -	if (sizeb < 0) {
         9592  +	if (sizeb == TCL_AUTO_LENGTH) {
  9590   9593   	writeError:
  9591   9594   	    if (interp) {
  9592   9595   		TclNewObj(errObj);
  9593   9596   		Tcl_AppendStringsToObj(errObj, "error writing \"",
  9594   9597   			Tcl_GetChannelName(outChan), "\": ", NULL);
  9595   9598   		if (msg != NULL) {
  9596   9599   		    Tcl_AppendObjToObj(errObj, msg);

Changes to generic/tclIOCmd.c.

   704    704   	 * messages produced by drivers during the closing of a channel,
   705    705   	 * because the Tcl convention is that such error messages do not have
   706    706   	 * a terminating newline.
   707    707   	 */
   708    708   
   709    709   	Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);
   710    710   	const char *string;
   711         -	int len;
          711  +	size_t len;
   712    712   
   713    713   	if (Tcl_IsShared(resultPtr)) {
   714    714   	    resultPtr = Tcl_DuplicateObj(resultPtr);
   715    715   	    Tcl_SetObjResult(interp, resultPtr);
   716    716   	}
   717    717   	string = TclGetStringFromObj(resultPtr, &len);
   718    718   	if ((len > 0) && (string[len - 1] == '\n')) {
................................................................................
   866    866       Tcl_Obj *const objv[])	/* Argument objects. */
   867    867   {
   868    868       Tcl_Obj *resultPtr;
   869    869       const char **argv;		/* An array for the string arguments. Stored
   870    870   				 * on the _Tcl_ stack. */
   871    871       const char *string;
   872    872       Tcl_Channel chan;
   873         -    int argc, background, i, index, keepNewline, result, skip, length;
   874         -    int ignoreStderr;
          873  +    int argc, background, i, index, keepNewline, result, skip, ignoreStderr;
          874  +    size_t length;
   875    875       static const char *const options[] = {
   876    876   	"-ignorestderr", "-keepnewline", "--", NULL
   877    877       };
   878    878       enum options {
   879    879   	EXEC_IGNORESTDERR, EXEC_KEEPNEWLINE, EXEC_LAST
   880    880       };
   881    881   
................................................................................
  1472   1472       Tcl_Channel chan;
  1473   1473   
  1474   1474       if (TclpHasSockets(interp) != TCL_OK) {
  1475   1475   	return TCL_ERROR;
  1476   1476       }
  1477   1477   
  1478   1478       for (a = 1; a < objc; a++) {
  1479         -	const char *arg = Tcl_GetString(objv[a]);
         1479  +	const char *arg = TclGetString(objv[a]);
  1480   1480   
  1481   1481   	if (arg[0] != '-') {
  1482   1482   	    break;
  1483   1483   	}
  1484   1484   	if (Tcl_GetIndexFromObj(interp, objv[a], socketOptions, "option",
  1485   1485   		TCL_EXACT, &optionIndex) != TCL_OK) {
  1486   1486   	    return TCL_ERROR;

Changes to generic/tclIORChan.c.

  1953   1953   	Tcl_ResetResult(interp);
  1954   1954   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1955   1955   		"Expected list with even number of "
  1956   1956   		"elements, got %d element%s instead", listc,
  1957   1957   		(listc == 1 ? "" : "s")));
  1958   1958           goto error;
  1959   1959       } else {
  1960         -	int len;
         1960  +	size_t len;
  1961   1961   	const char *str = TclGetStringFromObj(resObj, &len);
  1962   1962   
  1963   1963   	if (len) {
  1964   1964   	    TclDStringAppendLiteral(dsPtr, " ");
  1965   1965   	    Tcl_DStringAppend(dsPtr, str, len);
  1966   1966   	}
  1967   1967           goto ok;
................................................................................
  2326   2326   	     * the full state of the result, including additional options.
  2327   2327   	     *
  2328   2328   	     * This is complex and ugly, and would be completely unnecessary
  2329   2329   	     * if we only added support for a TCL_FORBID_EXCEPTIONS flag.
  2330   2330   	     */
  2331   2331   
  2332   2332   	    if (result != TCL_ERROR) {
  2333         -		int cmdLen;
         2333  +		size_t cmdLen;
  2334   2334   		const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
  2335   2335   
  2336   2336   		Tcl_IncrRefCount(cmd);
  2337   2337   		Tcl_ResetResult(rcPtr->interp);
  2338   2338   		Tcl_SetObjResult(rcPtr->interp, Tcl_ObjPrintf(
  2339   2339   			"chan handler returned bad code: %d", result));
  2340   2340   		Tcl_LogCommandInfo(rcPtr->interp, cmdString, cmdString,
................................................................................
  3190   3190   		char *buf = Tcl_Alloc(200);
  3191   3191   		sprintf(buf,
  3192   3192   			"{Expected list with even number of elements, got %d %s instead}",
  3193   3193   			listc, (listc == 1 ? "element" : "elements"));
  3194   3194   
  3195   3195   		ForwardSetDynamicError(paramPtr, buf);
  3196   3196   	    } else {
  3197         -		int len;
         3197  +		size_t len;
  3198   3198   		const char *str = TclGetStringFromObj(resObj, &len);
  3199   3199   
  3200   3200   		if (len) {
  3201   3201   		    TclDStringAppendLiteral(paramPtr->getOpt.value, " ");
  3202   3202   		    Tcl_DStringAppend(paramPtr->getOpt.value, str, len);
  3203   3203   		}
  3204   3204   	    }

Changes to generic/tclIORTrans.c.

    85     85   /*
    86     86    * Structure of the buffer to hold transform results to be consumed by higher
    87     87    * layers upon reading from the channel, plus the functions to manage such.
    88     88    */
    89     89   
    90     90   typedef struct {
    91     91       unsigned char *buf;		/* Reference to the buffer area. */
    92         -    int allocated;		/* Allocated size of the buffer area. */
    93         -    int used;			/* Number of bytes in the buffer,
           92  +    size_t allocated;		/* Allocated size of the buffer area. */
           93  +    size_t used;			/* Number of bytes in the buffer,
    94     94   				 * <= allocated. */
    95     95   } ResultBuffer;
    96     96   
    97     97   #define ResultLength(r) ((r)->used)
    98     98   /* static int		ResultLength(ResultBuffer *r); */
    99     99   
   100    100   static void		ResultClear(ResultBuffer *r);
................................................................................
   266    266    * has no "subtype" and just uses ForwardParamBase, as listed above.)
   267    267    */
   268    268   
   269    269   struct ForwardParamTransform {
   270    270       ForwardParamBase base;	/* "Supertype". MUST COME FIRST. */
   271    271       char *buf;			/* I: Bytes to transform,
   272    272   				 * O: Bytes in transform result */
   273         -    int size;			/* I: #bytes to transform,
          273  +    size_t size;		/* I: #bytes to transform,
   274    274   				 * O: #bytes in the transform result */
   275    275   };
   276    276   struct ForwardParamLimit {
   277    277       ForwardParamBase base;	/* "Supertype". MUST COME FIRST. */
   278    278       int max;			/* O: Character read limit */
   279    279   };
   280    280   
................................................................................
   616    616       methods = 0;
   617    617       while (listc > 0) {
   618    618   	if (Tcl_GetIndexFromObj(interp, listv[listc-1], methodNames,
   619    619   		"method", TCL_EXACT, &methIndex) != TCL_OK) {
   620    620   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   621    621   		    "chan handler \"%s initialize\" returned %s",
   622    622   		    TclGetString(cmdObj),
   623         -		    Tcl_GetString(Tcl_GetObjResult(interp))));
          623  +		    Tcl_GetStringResult(interp)));
   624    624   	    Tcl_DecrRefCount(resObj);
   625    625   	    goto error;
   626    626   	}
   627    627   
   628    628   	methods |= FLAG(methIndex);
   629    629   	listc--;
   630    630       }
................................................................................
  1010   1010        *
  1011   1011        * NOTE: The channel may have been removed from the map already via
  1012   1012        * the per-interp DeleteReflectedTransformMap exit-handler.
  1013   1013        */
  1014   1014   
  1015   1015       if (!rtPtr->dead) {
  1016   1016   	rtmPtr = GetReflectedTransformMap(rtPtr->interp);
  1017         -	hPtr = Tcl_FindHashEntry(&rtmPtr->map, Tcl_GetString(rtPtr->handle));
         1017  +	hPtr = Tcl_FindHashEntry(&rtmPtr->map, TclGetString(rtPtr->handle));
  1018   1018   	if (hPtr) {
  1019   1019   	    Tcl_DeleteHashEntry(hPtr);
  1020   1020   	}
  1021   1021   
  1022   1022   	/*
  1023   1023   	 * In a threaded interpreter we manage a per-thread map as well,
  1024   1024   	 * to allow us to survive if the script level pulls the rug out
................................................................................
  2037   2037   	     * the full state of the result, including additional options.
  2038   2038   	     *
  2039   2039   	     * This is complex and ugly, and would be completely unnecessary
  2040   2040   	     * if we only added support for a TCL_FORBID_EXCEPTIONS flag.
  2041   2041   	     */
  2042   2042   	    if (result != TCL_ERROR) {
  2043   2043   		Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv);
  2044         -		int cmdLen;
         2044  +		size_t cmdLen;
  2045   2045   		const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
  2046   2046   
  2047   2047   		Tcl_IncrRefCount(cmd);
  2048   2048   		Tcl_ResetResult(rtPtr->interp);
  2049   2049   		Tcl_SetObjResult(rtPtr->interp, Tcl_ObjPrintf(
  2050   2050   			"chan handler returned bad code: %d", result));
  2051   2051   		Tcl_LogCommandInfo(rtPtr->interp, cmdString, cmdString, cmdLen);
................................................................................
  2586   2586       case ForwardedInput: {
  2587   2587   	Tcl_Obj *bufObj = Tcl_NewByteArrayObj((unsigned char *)
  2588   2588   		paramPtr->transform.buf, paramPtr->transform.size);
  2589   2589   	Tcl_IncrRefCount(bufObj);
  2590   2590   
  2591   2591   	if (InvokeTclMethod(rtPtr, "read", bufObj, NULL, &resObj) != TCL_OK) {
  2592   2592   	    ForwardSetObjError(paramPtr, resObj);
  2593         -	    paramPtr->transform.size = -1;
         2593  +	    paramPtr->transform.size = TCL_AUTO_LENGTH;
  2594   2594   	} else {
  2595   2595   	    /*
  2596   2596   	     * Process a regular return. Contains the transformation result.
  2597   2597   	     * Sent it back to the request originator.
  2598   2598   	     */
  2599   2599   
  2600   2600   	    size_t bytec;		/* Number of returned bytes */
................................................................................
  2620   2620       case ForwardedOutput: {
  2621   2621   	Tcl_Obj *bufObj = Tcl_NewByteArrayObj((unsigned char *)
  2622   2622   		paramPtr->transform.buf, paramPtr->transform.size);
  2623   2623   	Tcl_IncrRefCount(bufObj);
  2624   2624   
  2625   2625   	if (InvokeTclMethod(rtPtr, "write", bufObj, NULL, &resObj) != TCL_OK) {
  2626   2626   	    ForwardSetObjError(paramPtr, resObj);
  2627         -	    paramPtr->transform.size = -1;
         2627  +	    paramPtr->transform.size = TCL_AUTO_LENGTH;
  2628   2628   	} else {
  2629   2629   	    /*
  2630   2630   	     * Process a regular return. Contains the transformation result.
  2631   2631   	     * Sent it back to the request originator.
  2632   2632   	     */
  2633   2633   
  2634   2634   	    size_t bytec;		/* Number of returned bytes */
................................................................................
  2650   2650   	Tcl_DecrRefCount(bufObj);
  2651   2651   	break;
  2652   2652       }
  2653   2653   
  2654   2654       case ForwardedDrain:
  2655   2655   	if (InvokeTclMethod(rtPtr, "drain", NULL, NULL, &resObj) != TCL_OK) {
  2656   2656   	    ForwardSetObjError(paramPtr, resObj);
  2657         -	    paramPtr->transform.size = -1;
         2657  +	    paramPtr->transform.size = TCL_AUTO_LENGTH;
  2658   2658   	} else {
  2659   2659   	    /*
  2660   2660   	     * Process a regular return. Contains the transformation result.
  2661   2661   	     * Sent it back to the request originator.
  2662   2662   	     */
  2663   2663   
  2664   2664   	    size_t bytec;		/* Number of returned bytes */
................................................................................
  2676   2676   	    }
  2677   2677   	}
  2678   2678   	break;
  2679   2679   
  2680   2680       case ForwardedFlush:
  2681   2681   	if (InvokeTclMethod(rtPtr, "flush", NULL, NULL, &resObj) != TCL_OK) {
  2682   2682   	    ForwardSetObjError(paramPtr, resObj);
  2683         -	    paramPtr->transform.size = -1;
         2683  +	    paramPtr->transform.size = TCL_AUTO_LENGTH;
  2684   2684   	} else {
  2685   2685   	    /*
  2686   2686   	     * Process a regular return. Contains the transformation result.
  2687   2687   	     * Sent it back to the request originator.
  2688   2688   	     */
  2689   2689   
  2690   2690   	    size_t bytec;		/* Number of returned bytes */
................................................................................
  3033   3033   
  3034   3034       if (rPtr->used == 0) {
  3035   3035   	/*
  3036   3036   	 * Nothing to copy in the case of an empty buffer.
  3037   3037   	 */
  3038   3038   
  3039   3039   	copied = 0;
  3040         -    } else if (rPtr->used == toRead) {
         3040  +    } else if (rPtr->used == (size_t)toRead) {
  3041   3041   	/*
  3042   3042   	 * We have just enough. Copy everything to the caller.
  3043   3043   	 */
  3044   3044   
  3045   3045   	memcpy(buf, rPtr->buf, toRead);
  3046   3046   	rPtr->used = 0;
  3047   3047   	copied = toRead;
  3048         -    } else if (rPtr->used > toRead) {
         3048  +    } else if (rPtr->used > (size_t)toRead) {
  3049   3049   	/*
  3050   3050   	 * The internal buffer contains more than requested. Copy the
  3051   3051   	 * requested subset to the caller, and shift the remaining bytes down.
  3052   3052   	 */
  3053   3053   
  3054   3054   	memcpy(buf, rPtr->buf, toRead);
  3055   3055   	memmove(rPtr->buf, rPtr->buf + toRead, rPtr->used - toRead);

Changes to generic/tclIOUtil.c.

   535    535       if (pathPtrPtr == NULL) {
   536    536   	return (tsdPtr->cwdPathPtr == NULL);
   537    537       }
   538    538   
   539    539       if (tsdPtr->cwdPathPtr == *pathPtrPtr) {
   540    540   	return 1;
   541    541       } else {
   542         -	int len1, len2;
          542  +	size_t len1, len2;
   543    543   	const char *str1, *str2;
   544    544   
   545    545   	str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1);
   546    546   	str2 = TclGetStringFromObj(*pathPtrPtr, &len2);
   547    547   	if ((len1 == len2) && !memcmp(str1, str2, len1)) {
   548    548   	    /*
   549    549   	     * They are equal, but different objects. Update so they will be
................................................................................
   677    677    */
   678    678   
   679    679   static void
   680    680   FsUpdateCwd(
   681    681       Tcl_Obj *cwdObj,
   682    682       ClientData clientData)
   683    683   {
   684         -    int len = 0;
          684  +    size_t len = 0;
   685    685       const char *str = NULL;
   686    686       ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
   687    687   
   688    688       if (cwdObj != NULL) {
   689    689   	str = TclGetStringFromObj(cwdObj, &len);
   690    690       }
   691    691   
................................................................................
  1199   1199   		    gLength--;
  1200   1200   		}
  1201   1201   		break;		/* Break out of for loop. */
  1202   1202   	    }
  1203   1203   	}
  1204   1204   	if (!found && dir) {
  1205   1205   	    Tcl_Obj *norm;
  1206         -	    int len, mlen;
         1206  +	    size_t len, mlen;
  1207   1207   
  1208   1208   	    /*
  1209   1209   	     * We know mElt is absolute normalized and lies inside pathPtr, so
  1210   1210   	     * now we must add to the result the right representation of mElt,
  1211   1211   	     * i.e. the representation which is relative to pathPtr.
  1212   1212   	     */
  1213   1213   
................................................................................
  1386   1386   TclFSNormalizeToUniquePath(
  1387   1387       Tcl_Interp *interp,		/* Used for error messages. */
  1388   1388       Tcl_Obj *pathPtr,		/* The path to normalize in place. */
  1389   1389       int startAt)		/* Start at this char-offset. */
  1390   1390   {
  1391   1391       FilesystemRecord *fsRecPtr, *firstFsRecPtr;
  1392   1392   
  1393         -    int i;
         1393  +    size_t i;
  1394   1394       int isVfsPath = 0;
  1395   1395       char *path;
  1396   1396   
  1397   1397       /*
  1398   1398        * Paths starting with a UNC prefix whose final character is a colon
  1399   1399        * are reserved for VFS use.  These names can not conflict with real
  1400   1400        * UNC paths per https://msdn.microsoft.com/en-us/library/gg465305.aspx
  1401   1401        * and rfc3986's definition of reg-name.
  1402   1402        *
  1403   1403        * We check these first to avoid useless calls to the native filesystem's
  1404   1404        * normalizePathProc.
  1405   1405        */
  1406         -    path = Tcl_GetStringFromObj(pathPtr, &i);
         1406  +    path = TclGetStringFromObj(pathPtr, &i);
  1407   1407   
  1408   1408       if ( (i >= 3) && ( (path[0] == '/' && path[1] == '/')
  1409   1409   		    || (path[0] == '\\' && path[1] == '\\') ) ) {
  1410   1410   	for ( i = 2; ; i++) {
  1411   1411   	    if (path[i] == '\0') break;
  1412   1412   	    if (path[i] == path[0]) break;
  1413   1413   	}
................................................................................
  1764   1764   	return result;
  1765   1765       }
  1766   1766   
  1767   1767       if (Tcl_FSStat(pathPtr, &statBuf) == -1) {
  1768   1768   	Tcl_SetErrno(errno);
  1769   1769   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1770   1770   		"couldn't read file \"%s\": %s",
  1771         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1771  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1772   1772   	return result;
  1773   1773       }
  1774   1774       chan = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0644);
  1775   1775       if (chan == NULL) {
  1776   1776   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1777   1777   		"couldn't read file \"%s\": %s",
  1778         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1778  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1779   1779   	return result;
  1780   1780       }
  1781   1781   
  1782   1782       /*
  1783   1783        * The eofchar is \32 (^Z). This is the usual on Windows, but we effect
  1784   1784        * this cross-platform to allow for scripted documents. [Bug: 2040]
  1785   1785        */
................................................................................
  1807   1807        * be handled especially.
  1808   1808        */
  1809   1809   
  1810   1810       if (Tcl_ReadChars(chan, objPtr, 1, 0) == TCL_IO_FAILURE) {
  1811   1811   	Tcl_Close(interp, chan);
  1812   1812   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1813   1813   		"couldn't read file \"%s\": %s",
  1814         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1814  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1815   1815   	goto end;
  1816   1816       }
  1817         -    string = Tcl_GetString(objPtr);
         1817  +    string = TclGetString(objPtr);
  1818   1818   
  1819   1819       /*
  1820   1820        * If first character is not a BOM, append the remaining characters,
  1821   1821        * otherwise replace them. [Bug 3466099]
  1822   1822        */
  1823   1823   
  1824   1824       if (Tcl_ReadChars(chan, objPtr, -1,
  1825   1825   	    memcmp(string, "\xef\xbb\xbf", 3)) == TCL_IO_FAILURE) {
  1826   1826   	Tcl_Close(interp, chan);
  1827   1827   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1828   1828   		"couldn't read file \"%s\": %s",
  1829         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1829  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1830   1830   	goto end;
  1831   1831       }
  1832   1832   
  1833   1833       if (Tcl_Close(interp, chan) != TCL_OK) {
  1834   1834   	goto end;
  1835   1835       }
  1836   1836   
................................................................................
  1898   1898   	return TCL_ERROR;
  1899   1899       }
  1900   1900   
  1901   1901       if (Tcl_FSStat(pathPtr, &statBuf) == -1) {
  1902   1902   	Tcl_SetErrno(errno);
  1903   1903   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1904   1904   		"couldn't read file \"%s\": %s",
  1905         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1905  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1906   1906   	return TCL_ERROR;
  1907   1907       }
  1908   1908       chan = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0644);
  1909   1909       if (chan == NULL) {
  1910   1910   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1911   1911   		"couldn't read file \"%s\": %s",
  1912         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1912  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1913   1913   	return TCL_ERROR;
  1914   1914       }
  1915         -    TclPkgFileSeen(interp, Tcl_GetString(pathPtr));
         1915  +    TclPkgFileSeen(interp, TclGetString(pathPtr));
  1916   1916   
  1917   1917       /*
  1918   1918        * The eofchar is \32 (^Z). This is the usual on Windows, but we effect
  1919   1919        * this cross-platform to allow for scripted documents. [Bug: 2040]
  1920   1920        */
  1921   1921   
  1922   1922       Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
................................................................................
  1942   1942        * be handled especially.
  1943   1943        */
  1944   1944   
  1945   1945       if (Tcl_ReadChars(chan, objPtr, 1, 0) == TCL_IO_FAILURE) {
  1946   1946   	Tcl_Close(interp, chan);
  1947   1947   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1948   1948   		"couldn't read file \"%s\": %s",
  1949         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1949  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1950   1950   	Tcl_DecrRefCount(objPtr);
  1951   1951   	return TCL_ERROR;
  1952   1952       }
  1953         -    string = Tcl_GetString(objPtr);
         1953  +    string = TclGetString(objPtr);
  1954   1954   
  1955   1955       /*
  1956   1956        * If first character is not a BOM, append the remaining characters,
  1957   1957        * otherwise replace them. [Bug 3466099]
  1958   1958        */
  1959   1959   
  1960   1960       if (Tcl_ReadChars(chan, objPtr, -1,
  1961   1961   	    memcmp(string, "\xef\xbb\xbf", 3)) == TCL_IO_FAILURE) {
  1962   1962   	Tcl_Close(interp, chan);
  1963   1963   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1964   1964   		"couldn't read file \"%s\": %s",
  1965         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         1965  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  1966   1966   	Tcl_DecrRefCount(objPtr);
  1967   1967   	return TCL_ERROR;
  1968   1968       }
  1969   1969   
  1970   1970       if (Tcl_Close(interp, chan) != TCL_OK) {
  1971   1971   	Tcl_DecrRefCount(objPtr);
  1972   1972   	return TCL_ERROR;
................................................................................
  2012   2012       if (result == TCL_RETURN) {
  2013   2013   	result = TclUpdateReturnInfo(iPtr);
  2014   2014       } else if (result == TCL_ERROR) {
  2015   2015   	/*
  2016   2016   	 * Record information telling where the error occurred.
  2017   2017   	 */
  2018   2018   
  2019         -	int length;
         2019  +	size_t length;
  2020   2020   	const char *pathString = TclGetStringFromObj(pathPtr, &length);
  2021         -	const int limit = 150;
         2021  +	const unsigned int limit = 150;
  2022   2022   	int overflow = (length > limit);
  2023   2023   
  2024   2024   	Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
  2025   2025   		"\n    (file \"%.*s%s\" line %d)",
  2026         -		(overflow ? limit : length), pathString,
         2026  +		(overflow ? limit : (unsigned int)length), pathString,
  2027   2027   		(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
  2028   2028       }
  2029   2029   
  2030   2030       Tcl_DecrRefCount(objPtr);
  2031   2031       return result;
  2032   2032   }
  2033   2033   
................................................................................
  2296   2296   	 */
  2297   2297   
  2298   2298   	if (seekFlag && Tcl_Seek(retVal, (Tcl_WideInt) 0, SEEK_END)
  2299   2299   		< (Tcl_WideInt) 0) {
  2300   2300   	    if (interp != NULL) {
  2301   2301   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2302   2302   			"could not seek to end of file while opening \"%s\": %s",
  2303         -			Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         2303  +			TclGetString(pathPtr), Tcl_PosixError(interp)));
  2304   2304   	    }
  2305   2305   	    Tcl_Close(NULL, retVal);
  2306   2306   	    return NULL;
  2307   2307   	}
  2308   2308   	if (binary) {
  2309   2309   	    Tcl_SetChannelOption(interp, retVal, "-translation", "binary");
  2310   2310   	}
................................................................................
  2315   2315        * File doesn't belong to any filesystem that can open it.
  2316   2316        */
  2317   2317   
  2318   2318       Tcl_SetErrno(ENOENT);
  2319   2319       if (interp != NULL) {
  2320   2320   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2321   2321   		"couldn't open \"%s\": %s",
  2322         -		Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         2322  +		TclGetString(pathPtr), Tcl_PosixError(interp)));
  2323   2323       }
  2324   2324       return NULL;
  2325   2325   }
  2326   2326   
  2327   2327   /*
  2328   2328    *----------------------------------------------------------------------
  2329   2329    *
................................................................................
  2863   2863   	    /*
  2864   2864   	     * Note that both 'norm' and 'tsdPtr->cwdPathPtr' are normalized
  2865   2865   	     * paths. Therefore we can be more efficient than calling
  2866   2866   	     * 'Tcl_FSEqualPaths', and in addition avoid a nasty infinite loop
  2867   2867   	     * bug when trying to normalize tsdPtr->cwdPathPtr.
  2868   2868   	     */
  2869   2869   
  2870         -	    int len1, len2;
         2870  +	    size_t len1, len2;
  2871   2871   	    const char *str1, *str2;
  2872   2872   
  2873   2873   	    str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1);
  2874   2874   	    str2 = TclGetStringFromObj(norm, &len2);
  2875   2875   	    if ((len1 == len2) && (strcmp(str1, str2) == 0)) {
  2876   2876   		/*
  2877   2877   		 * If the paths were equal, we can be more efficient and
................................................................................
  3223   3223   	 *     http://mooon.googlecode.com/svn/trunk/linux_include/linux/aufs_type.h
  3224   3224   	 *     http://aufs.sourceforge.net/
  3225   3225   	 * Better reference will be gladly taken.
  3226   3226   	 */
  3227   3227   #ifndef AUFS_SUPER_MAGIC
  3228   3228   #define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
  3229   3229   #endif /* AUFS_SUPER_MAGIC */
  3230         -	if ((statfs(Tcl_GetString(shlibFile), &fs) == 0)
         3230  +	if ((statfs(TclGetString(shlibFile), &fs) == 0)
  3231   3231   		&& (fs.f_type == AUFS_SUPER_MAGIC)) {
  3232   3232   	    return 1;
  3233   3233   	}
  3234   3234       }
  3235   3235   #endif /* ... NO_FSTATFS */
  3236   3236   #endif /* ... TCL_TEMPLOAD_NO_UNLINK */
  3237   3237   
................................................................................
  3299   3299        * First check if it is readable -- and exists!
  3300   3300        */
  3301   3301   
  3302   3302       if (Tcl_FSAccess(pathPtr, R_OK) != 0) {
  3303   3303   	if (interp) {
  3304   3304   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3305   3305   		    "couldn't load library \"%s\": %s",
  3306         -		    Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
         3306  +		    TclGetString(pathPtr), Tcl_PosixError(interp)));
  3307   3307   	}
  3308   3308   	return TCL_ERROR;
  3309   3309       }
  3310   3310   
  3311   3311   #ifdef TCL_LOAD_FROM_MEMORY
  3312   3312       /*
  3313   3313        * The platform supports loading code from memory, so ask for a buffer of
................................................................................
  4029   4029        */
  4030   4030   
  4031   4031       if (fsPtr->filesystemSeparatorProc != NULL) {
  4032   4032   	Tcl_Obj *sep = fsPtr->filesystemSeparatorProc(pathPtr);
  4033   4033   
  4034   4034   	if (sep != NULL) {
  4035   4035   	    Tcl_IncrRefCount(sep);
  4036         -	    separator = Tcl_GetString(sep)[0];
         4036  +	    separator = TclGetString(sep)[0];
  4037   4037   	    Tcl_DecrRefCount(sep);
  4038   4038   	}
  4039   4039       }
  4040   4040   
  4041   4041       /*
  4042   4042        * Place the drive name as first element of the result list. The drive
  4043   4043        * name may contain strange characters, like colons and multiple forward
  4044   4044        * slashes (for example 'ftp://' is a valid vfs drive name)
  4045   4045        */
  4046   4046   
  4047   4047       result = Tcl_NewObj();
  4048         -    p = Tcl_GetString(pathPtr);
         4048  +    p = TclGetString(pathPtr);
  4049   4049       Tcl_ListObjAppendElement(NULL, result,
  4050   4050   	    Tcl_NewStringObj(p, driveNameLength));
  4051   4051       p += driveNameLength;
  4052   4052   
  4053   4053       /*
  4054   4054        * Add the remaining path elements to the list.
  4055   4055        */
................................................................................
  4118   4118   				 * driveName. */
  4119   4119       Tcl_Obj **driveNameRef)	/* If the path is absolute, and this is
  4120   4120   				 * non-NULL, then set to the name of the
  4121   4121   				 * drive, network-volume which contains the
  4122   4122   				 * path, already with a refCount for the
  4123   4123   				 * caller. */
  4124   4124   {
  4125         -    int pathLen;
         4125  +    size_t pathLen;
  4126   4126       const char *path = TclGetStringFromObj(pathPtr, &pathLen);
  4127   4127       Tcl_PathType type;
  4128   4128   
  4129   4129       type = TclFSNonnativePathType(path, pathLen, filesystemPtrPtr,
  4130   4130   	    driveNameLengthPtr, driveNameRef);
  4131   4131   
  4132   4132       if (type != TCL_PATH_ABSOLUTE) {
................................................................................
  4226   4226   		     * (but Tcl_Panic seems a bit excessive).
  4227   4227   		     */
  4228   4228   
  4229   4229   		    numVolumes = -1;
  4230   4230   		}
  4231   4231   		while (numVolumes > 0) {
  4232   4232   		    Tcl_Obj *vol;
  4233         -		    int len;
         4233  +		    size_t len;
  4234   4234   		    const char *strVol;
  4235   4235   
  4236   4236   		    numVolumes--;
  4237   4237   		    Tcl_ListObjIndex(NULL, thisFsVolumes, numVolumes, &vol);
  4238   4238   		    strVol = TclGetStringFromObj(vol,&len);
  4239         -		    if (pathLen < len) {
         4239  +		    if ((size_t) pathLen < len) {
  4240   4240   			continue;
  4241   4241   		    }
  4242         -		    if (strncmp(strVol, path, (size_t) len) == 0) {
         4242  +		    if (strncmp(strVol, path, len) == 0) {
  4243   4243   			type = TCL_PATH_ABSOLUTE;
  4244   4244   			if (filesystemPtrPtr != NULL) {
  4245   4245   			    *filesystemPtrPtr = fsRecPtr->fsPtr;
  4246   4246   			}
  4247   4247   			if (driveNameLengthPtr != NULL) {
  4248   4248   			    *driveNameLengthPtr = len;
  4249   4249   			}
................................................................................
  4574   4574        */
  4575   4575   
  4576   4576       if (recursive) {
  4577   4577   	Tcl_Obj *cwdPtr = Tcl_FSGetCwd(NULL);
  4578   4578   
  4579   4579   	if (cwdPtr != NULL) {
  4580   4580   	    const char *cwdStr, *normPathStr;
  4581         -	    int cwdLen, normLen;
         4581  +	    size_t cwdLen, normLen;
  4582   4582   	    Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4583   4583   
  4584   4584   	    if (normPath != NULL) {
  4585   4585   		normPathStr = TclGetStringFromObj(normPath, &normLen);
  4586   4586   		cwdStr = TclGetStringFromObj(cwdPtr, &cwdLen);
  4587   4587   		if ((cwdLen >= normLen) && (strncmp(normPathStr, cwdStr,
  4588         -			(size_t) normLen) == 0)) {
         4588  +			normLen) == 0)) {
  4589   4589   		    /*
  4590   4590   		     * The cwd is inside the directory, so we perform a 'cd
  4591   4591   		     * [file dirname $path]'.
  4592   4592   		     */
  4593   4593   
  4594   4594   		    Tcl_Obj *dirPtr = TclPathPart(NULL, pathPtr,
  4595   4595   			    TCL_PATH_DIRNAME);

Changes to generic/tclIndexObj.c.

   139    139   	     */
   140    140   
   141    141   	    Tcl_Free(tablePtr);
   142    142   	    *indexPtr = t;
   143    143   	    return TCL_OK;
   144    144   	}
   145    145   
   146         -	tablePtr[t] = Tcl_GetString(objv[t]);
          146  +	tablePtr[t] = TclGetString(objv[t]);
   147    147       }
   148    148       tablePtr[objc] = NULL;
   149    149   
   150    150       result = Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr,
   151    151   	    sizeof(char *), msg, flags | INDEX_TEMP_TABLE, indexPtr);
   152    152   
   153    153       Tcl_Free(tablePtr);
................................................................................
   209    209   	offset = sizeof(char *);
   210    210       }
   211    211       /*
   212    212        * See if there is a valid cached result from a previous lookup.
   213    213        */
   214    214   
   215    215       if (!(flags & INDEX_TEMP_TABLE)) {
   216         -    irPtr = Tcl_FetchIntRep(objPtr, &indexType);
          216  +    irPtr = TclFetchIntRep(objPtr, &indexType);
   217    217       if (irPtr) {
   218    218   	indexRep = irPtr->twoPtrValue.ptr1;
   219    219   	if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) {
   220    220   	    *indexPtr = indexRep->index;
   221    221   	    return TCL_OK;
   222    222   	}
   223    223       }
................................................................................
   273    273       /*
   274    274        * Cache the found representation. Note that we want to avoid allocating a
   275    275        * new internal-rep if at all possible since that is potentially a slow
   276    276        * operation.
   277    277        */
   278    278   
   279    279       if (!(flags & INDEX_TEMP_TABLE)) {
   280         -    irPtr = Tcl_FetchIntRep(objPtr, &indexType);
          280  +    irPtr = TclFetchIntRep(objPtr, &indexType);
   281    281       if (irPtr) {
   282    282   	indexRep = irPtr->twoPtrValue.ptr1;
   283    283       } else {
   284    284   	Tcl_ObjIntRep ir;
   285    285   
   286    286   	indexRep = Tcl_Alloc(sizeof(IndexRep));
   287    287   	ir.twoPtrValue.ptr1 = indexRep;
................................................................................
   384    384    *----------------------------------------------------------------------
   385    385    */
   386    386   
   387    387   static void
   388    388   UpdateStringOfIndex(
   389    389       Tcl_Obj *objPtr)
   390    390   {
   391         -    IndexRep *indexRep = Tcl_FetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1;
          391  +    IndexRep *indexRep = TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1;
   392    392       register const char *indexStr = EXPAND_OF(indexRep);
   393    393   
   394    394       Tcl_InitStringRep(objPtr, indexStr, strlen(indexStr));
   395    395   }
   396    396   
   397    397   /*
   398    398    *----------------------------------------------------------------------
................................................................................
   416    416   DupIndex(
   417    417       Tcl_Obj *srcPtr,
   418    418       Tcl_Obj *dupPtr)
   419    419   {
   420    420       Tcl_ObjIntRep ir;
   421    421       IndexRep *dupIndexRep = Tcl_Alloc(sizeof(IndexRep));
   422    422   
   423         -    memcpy(dupIndexRep, Tcl_FetchIntRep(srcPtr, &indexType)->twoPtrValue.ptr1,
          423  +    memcpy(dupIndexRep, TclFetchIntRep(srcPtr, &indexType)->twoPtrValue.ptr1,
   424    424   	    sizeof(IndexRep));
   425    425   
   426    426       ir.twoPtrValue.ptr1 = dupIndexRep;
   427    427       Tcl_StoreIntRep(dupPtr, &indexType, &ir);
   428    428   }
   429    429   
   430    430   /*
................................................................................
   444    444    *----------------------------------------------------------------------
   445    445    */
   446    446   
   447    447   static void
   448    448   FreeIndex(
   449    449       Tcl_Obj *objPtr)
   450    450   {
   451         -    Tcl_Free(Tcl_FetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1);
          451  +    Tcl_Free(TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1);
   452    452       objPtr->typePtr = NULL;
   453    453   }
   454    454   
   455    455   /*
   456    456    *----------------------------------------------------------------------
   457    457    *
   458    458    * TclInitPrefixCmd --
................................................................................
   540    540   	    if (i > objc-4) {
   541    541   		Tcl_SetObjResult(interp, Tcl_NewStringObj(
   542    542   			"missing value for -message", -1));
   543    543   		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
   544    544   		return TCL_ERROR;
   545    545   	    }
   546    546   	    i++;
   547         -	    message = Tcl_GetString(objv[i]);
          547  +	    message = TclGetString(objv[i]);
   548    548   	    break;
   549    549   	case PRFMATCH_ERROR:
   550    550   	    if (i > objc-4) {
   551    551   		Tcl_SetObjResult(interp, Tcl_NewStringObj(
   552    552   			"missing value for -error", -1));
   553    553   		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
   554    554   		return TCL_ERROR;
................................................................................
   630    630   static int
   631    631   PrefixAllObjCmd(
   632    632       ClientData clientData,	/* Not used. */
   633    633       Tcl_Interp *interp,		/* Current interpreter. */
   634    634       int objc,			/* Number of arguments. */
   635    635       Tcl_Obj *const objv[])	/* Argument objects. */
   636    636   {
   637         -    int tableObjc, result, t, length, elemLength;
          637  +    int tableObjc, result, t;
          638  +    size_t length, elemLength;
   638    639       const char *string, *elemString;
   639    640       Tcl_Obj **tableObjv, *resultPtr;
   640    641   
   641    642       if (objc != 3) {
   642    643   	Tcl_WrongNumArgs(interp, 1, objv, "table string");
   643    644   	return TCL_ERROR;
   644    645       }
................................................................................
   687    688   static int
   688    689   PrefixLongestObjCmd(
   689    690       ClientData clientData,	/* Not used. */
   690    691       Tcl_Interp *interp,		/* Current interpreter. */
   691    692       int objc,			/* Number of arguments. */
   692    693       Tcl_Obj *const objv[])	/* Argument objects. */
   693    694   {
   694         -    int tableObjc, result, i, t, length, elemLength, resultLength;
          695  +    int tableObjc, result, t;
          696  +    size_t i, length, elemLength, resultLength;
   695    697       const char *string, *elemString, *resultString;
   696    698       Tcl_Obj **tableObjv;
   697    699   
   698    700       if (objc != 3) {
   699    701   	Tcl_WrongNumArgs(interp, 1, objv, "table string");
   700    702   	return TCL_ERROR;
   701    703       }
................................................................................
   871    873   
   872    874   	for (i=0 ; i<toPrint ; i++) {
   873    875   	    /*
   874    876   	     * Add the element, quoting it if necessary.
   875    877   	     */
   876    878   	    const Tcl_ObjIntRep *irPtr;
   877    879   
   878         -	    if ((irPtr = Tcl_FetchIntRep(origObjv[i], &indexType))) {
          880  +	    if ((irPtr = TclFetchIntRep(origObjv[i], &indexType))) {
   879    881   		register IndexRep *indexRep = irPtr->twoPtrValue.ptr1;
   880    882   
   881    883   		elementStr = EXPAND_OF(indexRep);
   882    884   		elemLen = strlen(elementStr);
   883    885   	    } else {
   884    886   		elementStr = TclGetStringFromObj(origObjv[i], &elemLen);
   885    887   	    }
................................................................................
   918    920   	/*
   919    921   	 * If the object is an index type use the index table which allows for
   920    922   	 * the correct error message even if the subcommand was abbreviated.
   921    923   	 * Otherwise, just use the string rep.
   922    924   	 */
   923    925   	const Tcl_ObjIntRep *irPtr;
   924    926   
   925         -	if ((irPtr = Tcl_FetchIntRep(objv[i], &indexType))) {
          927  +	if ((irPtr = TclFetchIntRep(objv[i], &indexType))) {
   926    928   	    register IndexRep *indexRep = irPtr->twoPtrValue.ptr1;
   927    929   
   928    930   	    Tcl_AppendStringsToObj(objPtr, EXPAND_OF(indexRep), NULL);
   929    931   	} else {
   930    932   	    /*
   931    933   	     * Quote the argument if it contains spaces (Bug 942757).
   932    934   	     */
................................................................................
  1120   1122   	    if (objc == 0) {
  1121   1123   		goto missingArg;
  1122   1124   	    }
  1123   1125   	    if (Tcl_GetIntFromObj(interp, objv[srcIndex],
  1124   1126   		    (int *) infoPtr->dstPtr) == TCL_ERROR) {
  1125   1127   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1126   1128   			"expected integer argument for \"%s\" but got \"%s\"",
  1127         -			infoPtr->keyStr, Tcl_GetString(objv[srcIndex])));
         1129  +			infoPtr->keyStr, TclGetString(objv[srcIndex])));
  1128   1130   		goto error;
  1129   1131   	    }
  1130   1132   	    srcIndex++;
  1131   1133   	    objc--;
  1132   1134   	    break;
  1133   1135   	case TCL_ARGV_STRING:
  1134   1136   	    if (objc == 0) {
  1135   1137   		goto missingArg;
  1136   1138   	    }
  1137   1139   	    *((const char **) infoPtr->dstPtr) =
  1138         -		    Tcl_GetString(objv[srcIndex]);
         1140  +		    TclGetString(objv[srcIndex]);
  1139   1141   	    srcIndex++;
  1140   1142   	    objc--;
  1141   1143   	    break;
  1142   1144   	case TCL_ARGV_REST:
  1143   1145   	    /*
  1144   1146   	     * Only store the point where we got to if it's not to be written
  1145   1147   	     * to NULL, so that TCL_ARGV_AUTO_REST works.
................................................................................
  1153   1155   	    if (objc == 0) {
  1154   1156   		goto missingArg;
  1155   1157   	    }
  1156   1158   	    if (Tcl_GetDoubleFromObj(interp, objv[srcIndex],
  1157   1159   		    (double *) infoPtr->dstPtr) == TCL_ERROR) {
  1158   1160   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1159   1161   			"expected floating-point argument for \"%s\" but got \"%s\"",
  1160         -			infoPtr->keyStr, Tcl_GetString(objv[srcIndex])));
         1162  +			infoPtr->keyStr, TclGetString(objv[srcIndex])));
  1161   1163   		goto error;
  1162   1164   	    }
  1163   1165   	    srcIndex++;
  1164   1166   	    objc--;
  1165   1167   	    break;
  1166   1168   	case TCL_ARGV_FUNC: {
  1167   1169   	    Tcl_ArgvFuncProc *handlerProc = (Tcl_ArgvFuncProc *)

Changes to generic/tclInt.h.

   919    919    */
   920    920   
   921    921   typedef struct CompiledLocal {
   922    922       struct CompiledLocal *nextPtr;
   923    923   				/* Next compiler-recognized local variable for
   924    924   				 * this procedure, or NULL if this is the last
   925    925   				 * local. */
   926         -    int nameLength;		/* The number of characters in local
   927         -				 * variable's name. Used to speed up variable
   928         -				 * lookups. */
          926  +    int nameLength;		/* The number of bytes in local variable's name.
          927  +				 * Among others used to speed up var lookups. */
   929    928       int frameIndex;		/* Index in the array of compiler-assigned
   930    929   				 * variables in the procedure call frame. */
   931    930       int flags;			/* Flag bits for the local variable. Same as
   932    931   				 * the flags for the Var structure above,
   933    932   				 * although only VAR_ARGUMENT, VAR_TEMPORARY,
   934    933   				 * and VAR_RESOLVED make sense. */
   935    934       Tcl_Obj *defValuePtr;	/* Pointer to the default value of an
................................................................................
  2718   2717   /*
  2719   2718    * Variables denoting the Tcl object types defined in the core.
  2720   2719    */
  2721   2720   
  2722   2721   MODULE_SCOPE const Tcl_ObjType tclBignumType;
  2723   2722   MODULE_SCOPE const Tcl_ObjType tclBooleanType;
  2724   2723   MODULE_SCOPE const Tcl_ObjType tclByteArrayType;
         2724  +MODULE_SCOPE const Tcl_ObjType tclPureByteArrayType;
  2725   2725   MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
  2726   2726   MODULE_SCOPE const Tcl_ObjType tclDoubleType;
  2727   2727   MODULE_SCOPE const Tcl_ObjType tclIntType;
  2728   2728   MODULE_SCOPE const Tcl_ObjType tclListType;
  2729   2729   MODULE_SCOPE const Tcl_ObjType tclDictType;
  2730   2730   MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
  2731   2731   MODULE_SCOPE const Tcl_ObjType tclStringType;
................................................................................
  4497   4497   #define TclGetUnicodeFromObj(objPtr, lenPtr) \
  4498   4498       (Tcl_GetUnicodeFromObj(objPtr, NULL), \
  4499   4499   	    *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \
  4500   4500   	    Tcl_GetUnicodeFromObj(objPtr, NULL))
  4501   4501   #define TclGetByteArrayFromObj(objPtr, lenPtr) \
  4502   4502       (Tcl_GetByteArrayFromObj(objPtr, NULL), \
  4503   4503   	    *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \
  4504         -	    Tcl_GetByteArrayFromObj(objPtr, NULL))
         4504  +		(unsigned char *)(((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1) + 2))
  4505   4505   #endif
  4506   4506   
  4507   4507   /*
  4508   4508    *----------------------------------------------------------------
  4509   4509    * Macro used by the Tcl core to clean out an object's internal
  4510   4510    * representation. Does not actually reset the rep's bytes. The ANSI C
  4511   4511    * "prototype" for this macro is:
................................................................................
  4595   4595   	    if (oldPtr == (staticPtr)) {				\
  4596   4596   		oldPtr = NULL;						\
  4597   4597   	    }								\
  4598   4598   	    if (allocated > TCL_MAX_TOKENS) {				\
  4599   4599   		allocated = TCL_MAX_TOKENS;				\
  4600   4600   	    }								\
  4601   4601   	    newPtr = (Tcl_Token *) Tcl_AttemptRealloc((char *) oldPtr,	\
  4602         -		    (unsigned int) (allocated * sizeof(Tcl_Token)));	\
         4602  +		    (allocated * sizeof(Tcl_Token)));	\
  4603   4603   	    if (newPtr == NULL) {					\
  4604   4604   		allocated = _needed + (append) + TCL_MIN_TOKEN_GROWTH;	\
  4605   4605   		if (allocated > TCL_MAX_TOKENS) {			\
  4606   4606   		    allocated = TCL_MAX_TOKENS;				\
  4607   4607   		}							\
  4608   4608   		newPtr = (Tcl_Token *) Tcl_Realloc((char *) oldPtr,	\
  4609         -			(unsigned int) (allocated * sizeof(Tcl_Token))); \
         4609  +			(allocated * sizeof(Tcl_Token))); \
  4610   4610   	    }								\
  4611   4611   	    (available) = allocated;					\
  4612   4612   	    if (oldPtr == NULL) {					\
  4613   4613   		memcpy(newPtr, staticPtr,				\
  4614         -			(size_t) ((used) * sizeof(Tcl_Token)));		\
         4614  +			((used) * sizeof(Tcl_Token)));		\
  4615   4615   	    }								\
  4616   4616   	    (tokenPtr) = newPtr;					\
  4617   4617   	}								\
  4618   4618       } while (0)
  4619   4619   
  4620   4620   #define TclGrowParseTokenArray(parsePtr, append)			\
  4621   4621       TclGrowTokenArray((parsePtr)->tokenPtr, (parsePtr)->numTokens,	\
................................................................................
  4674   4674    * but we don't do that at the moment since this is purely about efficiency.
  4675   4675    * The ANSI C "prototype" for this macro is:
  4676   4676    *
  4677   4677    * MODULE_SCOPE int	TclIsPureByteArray(Tcl_Obj *objPtr);
  4678   4678    *----------------------------------------------------------------
  4679   4679    */
  4680   4680   
  4681         -MODULE_SCOPE int	TclIsPureByteArray(Tcl_Obj *objPtr);
         4681  +#define TclIsPureByteArray(objPtr) \
         4682  +	((objPtr)->typePtr==&tclPureByteArrayType)
  4682   4683   #define TclIsPureDict(objPtr) \
  4683   4684   	(((objPtr)->bytes==NULL) && ((objPtr)->typePtr==&tclDictType))
         4685  +#define TclFetchIntRep(objPtr, type) \
         4686  +	(((objPtr)->typePtr == type) ? &((objPtr)->internalRep) : NULL)
  4684   4687   
  4685   4688   
  4686   4689   /*
  4687   4690    *----------------------------------------------------------------
  4688   4691    * Macro used by the Tcl core to compare Unicode strings. On big-endian
  4689   4692    * systems we can use the more efficient memcmp, but this would not be
  4690   4693    * lexically correct on little-endian systems. The ANSI C "prototype" for

Changes to generic/tclIntDecls.h.

    11     11    * See the file "license.terms" for information on usage and redistribution
    12     12    * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    13     13    */
    14     14   
    15     15   #ifndef _TCLINTDECLS
    16     16   #define _TCLINTDECLS
    17     17   
    18         -#include "tclPort.h"
    19     18   
    20     19   #undef TCL_STORAGE_CLASS
    21     20   #ifdef BUILD_tcl
    22     21   #   define TCL_STORAGE_CLASS DLLEXPORT
    23     22   #else
    24     23   #   ifdef USE_TCL_STUBS
    25     24   #      define TCL_STORAGE_CLASS

Changes to generic/tclInterp.c.

   782    782   	/*
   783    783   	 * Weird historical rules: "-safe" is accepted at the end, too.
   784    784   	 */
   785    785   
   786    786   	slavePtr = NULL;
   787    787   	last = 0;
   788    788   	for (i = 2; i < objc; i++) {
   789         -	    if ((last == 0) && (Tcl_GetString(objv[i])[0] == '-')) {
          789  +	    if ((last == 0) && (TclGetString(objv[i])[0] == '-')) {
   790    790   		if (Tcl_GetIndexFromObj(interp, objv[i], createOptions,
   791    791   			"option", 0, &index) != TCL_OK) {
   792    792   		    return TCL_ERROR;
   793    793   		}
   794    794   		if (index == OPT_SAFE) {
   795    795   		    safe = 1;
   796    796   		    continue;
................................................................................
  1096   1096   	aliasName = TclGetString(objv[3]);
  1097   1097   
  1098   1098   	iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
  1099   1099   	hPtr = Tcl_FindHashEntry(&iiPtr->slave.aliasTable, aliasName);
  1100   1100   	if (hPtr == NULL) {
  1101   1101   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1102   1102   		    "alias \"%s\" in path \"%s\" not found",
  1103         -		    aliasName, Tcl_GetString(objv[2])));
         1103  +		    aliasName, TclGetString(objv[2])));
  1104   1104   	    Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ALIAS", aliasName,
  1105   1105   		    NULL);
  1106   1106   	    return TCL_ERROR;
  1107   1107   	}
  1108   1108   	aliasPtr = Tcl_GetHashValue(hPtr);
  1109   1109   	if (Tcl_GetInterpPath(interp, aliasPtr->targetInterp) != TCL_OK) {
  1110   1110   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1111   1111   		    "target interpreter for alias \"%s\" in path \"%s\" is "
  1112         -		    "not my descendant", aliasName, Tcl_GetString(objv[2])));
         1112  +		    "not my descendant", aliasName, TclGetString(objv[2])));
  1113   1113   	    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
  1114   1114   		    "TARGETSHROUDED", NULL);
  1115   1115   	    return TCL_ERROR;
  1116   1116   	}
  1117   1117   	return TCL_OK;
  1118   1118       }
  1119   1119       }
................................................................................
  1723   1723       /*
  1724   1724        * If the alias has been renamed in the slave, the master can still use
  1725   1725        * the original name (with which it was created) to find the alias to
  1726   1726        * describe it.
  1727   1727        */
  1728   1728   
  1729   1729       slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
  1730         -    hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, Tcl_GetString(namePtr));
         1730  +    hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, TclGetString(namePtr));
  1731   1731       if (hPtr == NULL) {
  1732   1732   	return TCL_OK;
  1733   1733       }
  1734   1734       aliasPtr = Tcl_GetHashValue(hPtr);
  1735   1735       prefixPtr = Tcl_NewListObj(aliasPtr->objc, &aliasPtr->objPtr);
  1736   1736       Tcl_SetObjResult(interp, prefixPtr);
  1737   1737       return TCL_OK;

Changes to generic/tclLink.c.

   289    289       if (flags & TCL_TRACE_UNSETS) {
   290    290   	if (Tcl_InterpDeleted(interp)) {
   291    291   	    Tcl_DecrRefCount(linkPtr->varName);
   292    292   	    Tcl_Free(linkPtr);
   293    293   	} else if (flags & TCL_TRACE_DESTROYED) {
   294    294   	    Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr),
   295    295   		    TCL_GLOBAL_ONLY);
   296         -	    Tcl_TraceVar2(interp, Tcl_GetString(linkPtr->varName), NULL,
          296  +	    Tcl_TraceVar2(interp, TclGetString(linkPtr->varName), NULL,
   297    297   		    TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES
   298    298   		    |TCL_TRACE_UNSETS, LinkTraceProc, linkPtr);
   299    299   	}
   300    300   	return NULL;
   301    301       }
   302    302   
   303    303       /*
................................................................................
   412    412   	}
   413    413   	LinkedVar(Tcl_WideInt) = linkPtr->lastValue.w;
   414    414   	break;
   415    415   
   416    416       case TCL_LINK_DOUBLE:
   417    417   	if (Tcl_GetDoubleFromObj(NULL, valueObj, &linkPtr->lastValue.d) != TCL_OK) {
   418    418   #ifdef ACCEPT_NAN
   419         -	    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(valueObj, &tclDoubleType);
          419  +	    Tcl_ObjIntRep *irPtr = TclFetchIntRep(valueObj, &tclDoubleType);
   420    420   	    if (irPtr == NULL) {
   421    421   #endif
   422    422   		if (GetInvalidDoubleFromObj(valueObj, &linkPtr->lastValue.d) != TCL_OK) {
   423    423   		    Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr),
   424    424   			TCL_GLOBAL_ONLY);
   425    425   		    return (char *) "variable must have real value";
   426    426   		}

Changes to generic/tclListObj.c.

    57     57   	(listRepPtr)->refCount++;					\
    58     58   	Tcl_StoreIntRep((objPtr), &tclListType, &ir);			\
    59     59       } while (0)
    60     60   
    61     61   #define ListGetIntRep(objPtr, listRepPtr)				\
    62     62       do {								\
    63     63   	const Tcl_ObjIntRep *irPtr;					\
    64         -	irPtr = Tcl_FetchIntRep((objPtr), &tclListType);		\
           64  +	irPtr = TclFetchIntRep((objPtr), &tclListType);		\
    65     65   	(listRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
    66     66       } while (0)
    67     67   
    68     68   #define ListResetIntRep(objPtr, listRepPtr) \
    69         -    Tcl_FetchIntRep((objPtr), &tclListType)->twoPtrValue.ptr1 = (listRepPtr)
           69  +    TclFetchIntRep((objPtr), &tclListType)->twoPtrValue.ptr1 = (listRepPtr)
    70     70   
    71     71   #ifndef TCL_MIN_ELEMENT_GROWTH
    72     72   #define TCL_MIN_ELEMENT_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Obj *)
    73     73   #endif
    74     74   
    75     75   /*
    76     76    *----------------------------------------------------------------------
................................................................................
   532    532   				 * pointers to the list's objects. */
   533    533   {
   534    534       register List *listRepPtr;
   535    535   
   536    536       ListGetIntRep(listPtr, listRepPtr);
   537    537   
   538    538       if (listRepPtr == NULL) {
   539         -	int result, length;
          539  +	int result;
          540  +	size_t length;
   540    541   
   541         -	(void) Tcl_GetStringFromObj(listPtr, &length);
          542  +	(void) TclGetStringFromObj(listPtr, &length);
   542    543   	if (length == 0) {
   543    544   	    *objcPtr = 0;
   544    545   	    *objvPtr = NULL;
   545    546   	    return TCL_OK;
   546    547   	}
   547    548   	result = SetListFromAny(interp, listPtr);
   548    549   	if (result != TCL_OK) {
................................................................................
   655    656   
   656    657       if (Tcl_IsShared(listPtr)) {
   657    658   	Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendElement");
   658    659       }
   659    660   
   660    661       ListGetIntRep(listPtr, listRepPtr);
   661    662       if (listRepPtr == NULL) {
   662         -	int result, length;
          663  +	int result;
          664  +	size_t length;
   663    665   
   664         -	(void) Tcl_GetStringFromObj(listPtr, &length);
          666  +	(void) TclGetStringFromObj(listPtr, &length);
   665    667   	if (length == 0) {
   666    668   	    Tcl_SetListObj(listPtr, 1, &objPtr);
   667    669   	    return TCL_OK;
   668    670   	}
   669    671   	result = SetListFromAny(interp, listPtr);
   670    672   	if (result != TCL_OK) {
   671    673   	    return result;
................................................................................
   829    831       register int index,		/* Index of element to return. */
   830    832       Tcl_Obj **objPtrPtr)	/* The resulting Tcl_Obj* is stored here. */
   831    833   {
   832    834       register List *listRepPtr;
   833    835   
   834    836       ListGetIntRep(listPtr, listRepPtr);
   835    837       if (listRepPtr == NULL) {
   836         -	int result, length;
          838  +	int result;
          839  +	size_t length;
   837    840   
   838         -	(void) Tcl_GetStringFromObj(listPtr, &length);
          841  +	(void) TclGetStringFromObj(listPtr, &length);
   839    842   	if (length == 0) {
   840    843   	    *objPtrPtr = NULL;
   841    844   	    return TCL_OK;
   842    845   	}
   843    846   	result = SetListFromAny(interp, listPtr);
   844    847   	if (result != TCL_OK) {
   845    848   	    return result;
................................................................................
   885    888       register Tcl_Obj *listPtr,	/* List object whose #elements to return. */
   886    889       register int *intPtr)	/* The resulting int is stored here. */
   887    890   {
   888    891       register List *listRepPtr;
   889    892   
   890    893       ListGetIntRep(listPtr, listRepPtr);
   891    894       if (listRepPtr == NULL) {
   892         -	int result, length;
          895  +	int result;
          896  +	size_t length;
   893    897   
   894         -	(void) Tcl_GetStringFromObj(listPtr, &length);
          898  +	(void) TclGetStringFromObj(listPtr, &length);
   895    899   	if (length == 0) {
   896    900   	    *intPtr = 0;
   897    901   	    return TCL_OK;
   898    902   	}
   899    903   	result = SetListFromAny(interp, listPtr);
   900    904   	if (result != TCL_OK) {
   901    905   	    return result;
................................................................................
  1630   1634   	     * variable.  Later on, when we set valuePtr in its proper place,
  1631   1635   	     * then all containing lists will have their values changed, and
  1632   1636   	     * will need their string reps spoiled.  We maintain a list of all
  1633   1637   	     * those Tcl_Obj's (via a little intrep surgery) so we can spoil
  1634   1638   	     * them at that time.
  1635   1639   	     */
  1636   1640   
  1637         -	    irPtr = Tcl_FetchIntRep(parentList, &tclListType);
         1641  +	    irPtr = TclFetchIntRep(parentList, &tclListType);
  1638   1642   	    irPtr->twoPtrValue.ptr2 = chainPtr;
  1639   1643   	    chainPtr = parentList;
  1640   1644   	}
  1641   1645       } while (indexCount > 0);
  1642   1646   
  1643   1647       /*
  1644   1648        * Either we've detected and error condition, and exited the loop with
................................................................................
  1651   1655   	Tcl_Obj *objPtr = chainPtr;
  1652   1656   	List *listRepPtr;
  1653   1657   
  1654   1658   	/*
  1655   1659   	 * Clear away our intrep surgery mess.
  1656   1660   	 */
  1657   1661   
  1658         -	irPtr = Tcl_FetchIntRep(objPtr, &tclListType);
         1662  +	irPtr = TclFetchIntRep(objPtr, &tclListType);
  1659   1663   	listRepPtr = irPtr->twoPtrValue.ptr1;
  1660   1664   	chainPtr = irPtr->twoPtrValue.ptr2;
  1661   1665   
  1662   1666   	if (result == TCL_OK) {
  1663   1667   
  1664   1668   	    /*
  1665   1669   	     * We're going to store valuePtr, so spoil string reps of all
................................................................................
  1771   1775   
  1772   1776       if (Tcl_IsShared(listPtr)) {
  1773   1777   	Tcl_Panic("%s called with shared object", "TclListObjSetElement");
  1774   1778       }
  1775   1779   
  1776   1780       ListGetIntRep(listPtr, listRepPtr);
  1777   1781       if (listRepPtr == NULL) {
  1778         -	int result, length;
         1782  +	int result;
         1783  +	size_t length;
  1779   1784   
  1780         -	(void) Tcl_GetStringFromObj(listPtr, &length);
         1785  +	(void) TclGetStringFromObj(listPtr, &length);
  1781   1786   	if (length == 0) {
  1782   1787   	    if (interp != NULL) {
  1783   1788   		Tcl_SetObjResult(interp,
  1784   1789   			Tcl_NewStringObj("list index out of range", -1));
  1785   1790   		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET",
  1786   1791   			"BADINDEX", NULL);
  1787   1792   	    }
................................................................................
  1972   1977        * Dictionaries are a special case; they have a string representation such
  1973   1978        * that *all* valid dictionaries are valid lists. Hence we can convert
  1974   1979        * more directly. Only do this when there's no existing string rep; if
  1975   1980        * there is, it is the string rep that's authoritative (because it could
  1976   1981        * describe duplicate keys).
  1977   1982        */
  1978   1983   
  1979         -    if (!TclHasStringRep(objPtr) && Tcl_FetchIntRep(objPtr, &tclDictType)) {
         1984  +    if (!TclHasStringRep(objPtr) && (objPtr->typePtr == &tclDictType)) {
  1980   1985   	Tcl_Obj *keyPtr, *valuePtr;
  1981   1986   	Tcl_DictSearch search;
  1982   1987   	int done, size;
  1983   1988   
  1984   1989   	/*
  1985   1990   	 * Create the new list representation. Note that we do not need to do
  1986   1991   	 * anything with the string representation as the transformation (and
................................................................................
  2007   2012   	    *elemPtrs++ = keyPtr;
  2008   2013   	    *elemPtrs++ = valuePtr;
  2009   2014   	    Tcl_IncrRefCount(keyPtr);
  2010   2015   	    Tcl_IncrRefCount(valuePtr);
  2011   2016   	    Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done);
  2012   2017   	}
  2013   2018       } else {
  2014         -	int estCount, length;
         2019  +	int estCount;
         2020  +	size_t length;
  2015   2021   	const char *limit, *nextElem = TclGetStringFromObj(objPtr, &length);
  2016   2022   
  2017   2023   	/*
  2018   2024   	 * Allocate enough space to hold a (Tcl_Obj *) for each
  2019   2025   	 * (possible) list element.
  2020   2026   	 */
  2021   2027   

Changes to generic/tclLoad.c.

   161    161       if ((objc < 2) || (objc > 4)) {
   162    162   	Tcl_WrongNumArgs(interp, 1, savedobjv, "?-global? ?-lazy? ?--? fileName ?packageName? ?interp?");
   163    163   	return TCL_ERROR;
   164    164       }
   165    165       if (Tcl_FSConvertToPathType(interp, objv[1]) != TCL_OK) {
   166    166   	return TCL_ERROR;
   167    167       }
   168         -    fullFileName = Tcl_GetString(objv[1]);
          168  +    fullFileName = TclGetString(objv[1]);
   169    169   
   170    170       Tcl_DStringInit(&pkgName);
   171    171       Tcl_DStringInit(&initName);
   172    172       Tcl_DStringInit(&safeInitName);
   173    173       Tcl_DStringInit(&unloadName);
   174    174       Tcl_DStringInit(&safeUnloadName);
   175    175       Tcl_DStringInit(&tmp);
   176    176   
   177    177       packageName = NULL;
   178    178       if (objc >= 3) {
   179         -	packageName = Tcl_GetString(objv[2]);
          179  +	packageName = TclGetString(objv[2]);
   180    180   	if (packageName[0] == '\0') {
   181    181   	    packageName = NULL;
   182    182   	}
   183    183       }
   184    184       if ((fullFileName[0] == 0) && (packageName == NULL)) {
   185    185   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
   186    186   		"must specify either file name or package name", -1));
................................................................................
   192    192   
   193    193       /*
   194    194        * Figure out which interpreter we're going to load the package into.
   195    195        */
   196    196   
   197    197       target = interp;
   198    198       if (objc == 4) {
   199         -	const char *slaveIntName = Tcl_GetString(objv[3]);
          199  +	const char *slaveIntName = TclGetString(objv[3]);
   200    200   
   201    201   	target = Tcl_GetSlave(interp, slaveIntName);
   202    202   	if (target == NULL) {
   203    203   	    code = TCL_ERROR;
   204    204   	    goto done;
   205    205   	}
   206    206       }
................................................................................
   320    320   		 * name, stripping off any leading "lib", and then using all
   321    321   		 * of the alphabetic and underline characters that follow
   322    322   		 * that.
   323    323   		 */
   324    324   
   325    325   		splitPtr = Tcl_FSSplitPath(objv[1], &pElements);
   326    326   		Tcl_ListObjIndex(NULL, splitPtr, pElements -1, &pkgGuessPtr);
   327         -		pkgGuess = Tcl_GetString(pkgGuessPtr);
          327  +		pkgGuess = TclGetString(pkgGuessPtr);
   328    328   		if ((pkgGuess[0] == 'l') && (pkgGuess[1] == 'i')
   329    329   			&& (pkgGuess[2] == 'b')) {
   330    330   		    pkgGuess += 3;
   331    331   		}
   332    332   #ifdef __CYGWIN__
   333    333   		if ((pkgGuess[0] == 'c') && (pkgGuess[1] == 'y')
   334    334   			&& (pkgGuess[2] == 'g')) {
................................................................................
   560    560       enum options {
   561    561   	UNLOAD_NOCOMPLAIN, UNLOAD_KEEPLIB, UNLOAD_LAST
   562    562       };
   563    563   
   564    564       for (i = 1; i < objc; i++) {
   565    565   	if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
   566    566   		&index) != TCL_OK) {
   567         -	    fullFileName = Tcl_GetString(objv[i]);
          567  +	    fullFileName = TclGetString(objv[i]);
   568    568   	    if (fullFileName[0] == '-') {
   569    569   		/*
   570    570   		 * It looks like the command contains an option so signal an
   571    571   		 * error
   572    572   		 */
   573    573   
   574    574   		return TCL_ERROR;
................................................................................
   600    600   		"?-switch ...? fileName ?packageName? ?interp?");
   601    601   	return TCL_ERROR;
   602    602       }
   603    603       if (Tcl_FSConvertToPathType(interp, objv[i]) != TCL_OK) {
   604    604   	return TCL_ERROR;
   605    605       }
   606    606   
   607         -    fullFileName = Tcl_GetString(objv[i]);
          607  +    fullFileName = TclGetString(objv[i]);
   608    608       Tcl_DStringInit(&pkgName);
   609    609       Tcl_DStringInit(&tmp);
   610    610   
   611    611       packageName = NULL;
   612    612       if (objc - i >= 2) {
   613         -	packageName = Tcl_GetString(objv[i+1]);
          613  +	packageName = TclGetString(objv[i+1]);
   614    614   	if (packageName[0] == '\0') {
   615    615   	    packageName = NULL;
   616    616   	}
   617    617       }
   618    618       if ((fullFileName[0] == 0) && (packageName == NULL)) {
   619    619   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
   620    620   		"must specify either file name or package name", -1));
................................................................................
   626    626   
   627    627       /*
   628    628        * Figure out which interpreter we're going to load the package into.
   629    629        */
   630    630   
   631    631       target = interp;
   632    632       if (objc - i == 3) {
   633         -	const char *slaveIntName = Tcl_GetString(objv[i + 2]);
          633  +	const char *slaveIntName = TclGetString(objv[i + 2]);
   634    634   
   635    635   	target = Tcl_GetSlave(interp, slaveIntName);
   636    636   	if (target == NULL) {
   637    637   	    return TCL_ERROR;
   638    638   	}
   639    639       }
   640    640   

Changes to generic/tclMain.c.

   211    211   {
   212    212       ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
   213    213   
   214    214       if (encodingPtr != NULL) {
   215    215   	if (tsdPtr->encoding == NULL) {
   216    216   	    *encodingPtr = NULL;
   217    217   	} else {
   218         -	    *encodingPtr = Tcl_GetString(tsdPtr->encoding);
          218  +	    *encodingPtr = TclGetString(tsdPtr->encoding);
   219    219   	}
   220    220       }
   221    221       return tsdPtr->path;
   222    222   }
   223    223   
   224    224   /*----------------------------------------------------------------------
   225    225    *
................................................................................
   339    339   	 *  FILENAME
   340    340   	 */
   341    341   
   342    342   	if ((argc > 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1]))
   343    343   		&& ('-' != argv[3][0])) {
   344    344   	    Tcl_Obj *value = NewNativeObj(argv[2], -1);
   345    345   	    Tcl_SetStartupScript(NewNativeObj(argv[3], -1),
   346         -		    Tcl_GetString(value));
          346  +		    TclGetString(value));
   347    347   	    Tcl_DecrRefCount(value);
   348    348   	    argc -= 3;
   349    349   	    argv += 3;
   350    350   	} else if ((argc > 1) && ('-' != argv[1][0])) {
   351    351   	    Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL);
   352    352   	    argc--;
   353    353   	    argv++;
................................................................................
   484    484   	    }
   485    485   	    if (Tcl_IsShared(is.commandPtr)) {
   486    486   		Tcl_DecrRefCount(is.commandPtr);
   487    487   		is.commandPtr = Tcl_DuplicateObj(is.commandPtr);
   488    488   		Tcl_IncrRefCount(is.commandPtr);
   489    489   	    }
   490    490   	    length = Tcl_GetsObj(is.input, is.commandPtr);
   491         -	    if (length == (size_t)-1) {
          491  +	    if (length == TCL_AUTO_LENGTH) {
   492    492   		if (Tcl_InputBlocked(is.input)) {
   493    493   		    /*
   494    494   		     * This can only happen if stdin has been set to
   495    495   		     * non-blocking. In that case cycle back and try again.
   496    496   		     * This sets up a tight polling loop (since we have no
   497    497   		     * event loop running). If this causes bad CPU hogging, we
   498    498   		     * might try toggling the blocking on stdin instead.
................................................................................
   762    762   
   763    763       if (Tcl_IsShared(commandPtr)) {
   764    764   	Tcl_DecrRefCount(commandPtr);
   765    765   	commandPtr = Tcl_DuplicateObj(commandPtr);
   766    766   	Tcl_IncrRefCount(commandPtr);
   767    767       }
   768    768       length = Tcl_GetsObj(chan, commandPtr);
   769         -    if (length == (size_t)-1) {
          769  +    if (length == TCL_AUTO_LENGTH) {
   770    770   	if (Tcl_InputBlocked(chan)) {
   771    771   	    return;
   772    772   	}
   773    773   	if (isPtr->tty) {
   774    774   	    /*
   775    775   	     * Would be better to find a way to exit the mainLoop? Or perhaps
   776    776   	     * evaluate [exit]? Leaving as is for now due to compatibility

Changes to generic/tclNamesp.c.

   161    161   	ir.twoPtrValue.ptr2 = NULL;					\
   162    162   	Tcl_StoreIntRep((objPtr), &nsNameType, &ir);			\
   163    163       } while (0)
   164    164   
   165    165   #define NsNameGetIntRep(objPtr, nnPtr)					\
   166    166       do {								\
   167    167   	const Tcl_ObjIntRep *irPtr;					\
   168         -	irPtr = Tcl_FetchIntRep((objPtr), &nsNameType);			\
          168  +	irPtr = TclFetchIntRep((objPtr), &nsNameType);			\
   169    169   	(nnPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   170    170       } while (0)
   171    171   
   172    172   /*
   173    173    * Array of values describing how to implement each standard subcommand of the
   174    174    * "namespace" command.
   175    175    */
................................................................................
  3616   3616       }
  3617   3617   
  3618   3618       /*
  3619   3619        * Process the optional "-clear" argument.
  3620   3620        */
  3621   3621   
  3622   3622       firstArg = 1;
  3623         -    if (strcmp("-clear", Tcl_GetString(objv[firstArg])) == 0) {
         3623  +    if (strcmp("-clear", TclGetString(objv[firstArg])) == 0) {
  3624   3624   	if (nsPtr->exportPatternList) {
  3625   3625   	    Tcl_DecrRefCount(nsPtr->exportPatternList);
  3626   3626   	    nsPtr->exportPatternList = NULL;
  3627   3627   	    changed = 1;
  3628   3628   	}
  3629   3629   	firstArg++;
  3630   3630       }

Changes to generic/tclOOBasic.c.

   740    740   
   741    741       if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
   742    742   	Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
   743    743   		"varName");
   744    744   	return TCL_ERROR;
   745    745       }
   746    746       argPtr = objv[objc-1];
   747         -    arg = Tcl_GetString(argPtr);
          747  +    arg = TclGetString(argPtr);
   748    748   
   749    749       /*
   750    750        * Convert the variable name to fully-qualified form if it wasn't already.
   751    751        * This has to be done prior to lookup because we can run into problems
   752    752        * with resolvers otherwise. [Bug 3603695]
   753    753        *
   754    754        * We still need to do the lookup; the variable could be linked to another
................................................................................
   777    777   	    Method *mPtr = callerContext->callPtr->chain[
   778    778   		    callerContext->index].mPtr;
   779    779   	    PrivateVariableMapping *pvPtr;
   780    780   	    int i;
   781    781   
   782    782   	    if (mPtr->declaringObjectPtr == oPtr) {
   783    783   		FOREACH_STRUCT(pvPtr, oPtr->privateVariables) {
   784         -		    if (!strcmp(Tcl_GetString(pvPtr->variableObj),
   785         -			    Tcl_GetString(argPtr))) {
          784  +		    if (!strcmp(TclGetString(pvPtr->variableObj),
          785  +			    TclGetString(argPtr))) {
   786    786   			argPtr = pvPtr->fullNameObj;
   787    787   			break;
   788    788   		    }
   789    789   		}
   790    790   	    } else if (mPtr->declaringClassPtr &&
   791    791   		    mPtr->declaringClassPtr->privateVariables.num) {
   792    792   		Class *clsPtr = mPtr->declaringClassPtr;
................................................................................
   799    799   			    isInstance = 1;
   800    800   			    break;
   801    801   			}
   802    802   		    }
   803    803   		}
   804    804   		if (isInstance) {
   805    805   		    FOREACH_STRUCT(pvPtr, clsPtr->privateVariables) {
   806         -			if (!strcmp(Tcl_GetString(pvPtr->variableObj),
   807         -				Tcl_GetString(argPtr))) {
          806  +			if (!strcmp(TclGetString(pvPtr->variableObj),
          807  +				TclGetString(argPtr))) {
   808    808   			    argPtr = pvPtr->fullNameObj;
   809    809   			    break;
   810    810   			}
   811    811   		    }
   812    812   		}
   813    813   	    }
   814    814   	}

Changes to generic/tclOOCall.c.

   276    276   
   277    277   static void
   278    278   DupMethodNameRep(
   279    279       Tcl_Obj *srcPtr,
   280    280       Tcl_Obj *dstPtr)
   281    281   {
   282    282       StashCallChain(dstPtr,
   283         -	    Tcl_FetchIntRep(srcPtr, &methodNameType)->twoPtrValue.ptr1);
          283  +	    TclFetchIntRep(srcPtr, &methodNameType)->twoPtrValue.ptr1);
   284    284   }
   285    285   
   286    286   static void
   287    287   FreeMethodNameRep(
   288    288       Tcl_Obj *objPtr)
   289    289   {
   290    290       TclOODeleteChain(
   291         -	    Tcl_FetchIntRep(objPtr, &methodNameType)->twoPtrValue.ptr1);
          291  +	    TclFetchIntRep(objPtr, &methodNameType)->twoPtrValue.ptr1);
   292    292   }
   293    293   
   294    294   /*
   295    295    * ----------------------------------------------------------------------
   296    296    *
   297    297    * TclOOInvokeContext --
   298    298    *
................................................................................
  1185   1185   	 * there are multiple different layers of cache (in the Tcl_Obj, in
  1186   1186   	 * the object, and in the class).
  1187   1187   	 */
  1188   1188   
  1189   1189   	const Tcl_ObjIntRep *irPtr;
  1190   1190   	const int reuseMask = (WANT_PUBLIC(flags) ? ~0 : ~PUBLIC_METHOD);
  1191   1191   
  1192         -	if ((irPtr = Tcl_FetchIntRep(cacheInThisObj, &methodNameType))) {
         1192  +	if ((irPtr = TclFetchIntRep(cacheInThisObj, &methodNameType))) {
  1193   1193   	    callPtr = irPtr->twoPtrValue.ptr1;
  1194   1194   	    if (IsStillValid(callPtr, oPtr, flags, reuseMask)) {
  1195   1195   		callPtr->refCount++;
  1196   1196   		goto returnContext;
  1197   1197   	    }
  1198   1198   	    Tcl_StoreIntRep(cacheInThisObj, &methodNameType, NULL);
  1199   1199   	}

Changes to generic/tclOODefineCmds.c.

   552    552   	for (i=n=0 ; i<varc ; i++) {
   553    553   	    Tcl_CreateHashEntry(&uniqueTable, varv[i], &created);
   554    554   	    if (created) {
   555    555   		privatePtr = &(pvlPtr->list[n++]);
   556    556   		privatePtr->variableObj = varv[i];
   557    557   		privatePtr->fullNameObj = Tcl_ObjPrintf(
   558    558   			PRIVATE_VARIABLE_PATTERN,
   559         -			creationEpoch, Tcl_GetString(varv[i]));
          559  +			creationEpoch, TclGetString(varv[i]));
   560    560   		Tcl_IncrRefCount(privatePtr->fullNameObj);
   561    561   	    } else {
   562    562   		Tcl_DecrRefCount(varv[i]);
   563    563   	    }
   564    564   	}
   565    565   	pvlPtr->num = n;
   566    566   
................................................................................
  1616   1616   	Tcl_WrongNumArgs(interp, 1, objv, "?kind? namespace");
  1617   1617   	return TCL_ERROR;
  1618   1618       }
  1619   1619       if (objc == 3 && Tcl_GetIndexFromObj(interp, objv[1], kindList, "kind", 0,
  1620   1620   	    &kind) != TCL_OK) {
  1621   1621   	return TCL_ERROR;
  1622   1622       }
  1623         -    if (!Tcl_GetString(objv[objc - 1])[0]) {
         1623  +    if (!TclGetString(objv[objc - 1])[0]) {
  1624   1624   	nsNamePtr = NULL;
  1625   1625       } else {
  1626   1626   	nsPtr = GetNamespaceInOuterContext(interp, objv[objc - 1]);
  1627   1627   	if (nsPtr == NULL) {
  1628   1628   	    return TCL_ERROR;
  1629   1629   	}
  1630   1630   	nsNamePtr = Tcl_NewStringObj(nsPtr->fullName, -1);

Changes to generic/tclOOInfo.c.

   812    812       int i, private = 0;
   813    813   
   814    814       if (objc != 2 && objc != 3) {
   815    815   	Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?");
   816    816   	return TCL_ERROR;
   817    817       }
   818    818       if (objc == 3) {
   819         -	if (strcmp("-private", Tcl_GetString(objv[2])) != 0) {
          819  +	if (strcmp("-private", TclGetString(objv[2])) != 0) {
   820    820   	    return TCL_ERROR;
   821    821   	}
   822    822   	private = 1;
   823    823       }
   824    824       oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[1]);
   825    825       if (oPtr == NULL) {
   826    826   	return TCL_ERROR;
................................................................................
  1591   1591       int i, private = 0;
  1592   1592   
  1593   1593       if (objc != 2 && objc != 3) {
  1594   1594   	Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?");
  1595   1595   	return TCL_ERROR;
  1596   1596       }
  1597   1597       if (objc == 3) {
  1598         -	if (strcmp("-private", Tcl_GetString(objv[2])) != 0) {
         1598  +	if (strcmp("-private", TclGetString(objv[2])) != 0) {
  1599   1599   	    return TCL_ERROR;
  1600   1600   	}
  1601   1601   	private = 1;
  1602   1602       }
  1603   1603       clsPtr = GetClassFromObj(interp, objv[1]);
  1604   1604       if (clsPtr == NULL) {
  1605   1605   	return TCL_ERROR;

Changes to generic/tclOOMethod.c.

  1116   1116       Tcl_Obj *variableObj = Tcl_NewStringObj(varName, length);
  1117   1117   
  1118   1118       /*
  1119   1119        * Do not create resolvers for cases that contain namespace separators or
  1120   1120        * which look like array accesses. Both will lead us astray.
  1121   1121        */
  1122   1122   
  1123         -    if (strstr(Tcl_GetString(variableObj), "::") != NULL ||
  1124         -	    Tcl_StringMatch(Tcl_GetString(variableObj), "*(*)")) {
         1123  +    if (strstr(TclGetString(variableObj), "::") != NULL ||
         1124  +	    Tcl_StringMatch(TclGetString(variableObj), "*(*)")) {
  1125   1125   	Tcl_DecrRefCount(variableObj);
  1126   1126   	return TCL_CONTINUE;
  1127   1127       }
  1128   1128   
  1129   1129       infoPtr = Tcl_Alloc(sizeof(OOResVarInfo));
  1130   1130       infoPtr->info.fetchProc = ProcedureMethodCompiledVarConnect;
  1131   1131       infoPtr->info.deleteProc = ProcedureMethodCompiledVarDelete;
................................................................................
  1334   1334   
  1335   1335       /*
  1336   1336        * Must strip the internal representation in order to ensure that any
  1337   1337        * bound references to instance variables are removed. [Bug 3609693]
  1338   1338        */
  1339   1339   
  1340   1340       bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr);
  1341         -    Tcl_GetString(bodyObj);
         1341  +    TclGetString(bodyObj);
  1342   1342       Tcl_StoreIntRep(pmPtr->procPtr->bodyPtr, &tclByteCodeType, NULL);
  1343   1343   
  1344   1344       /*
  1345   1345        * Create the actual copy of the method record, manufacturing a new proc
  1346   1346        * record.
  1347   1347        */
  1348   1348   

Changes to generic/tclObj.c.

  1876   1876    */
  1877   1877   
  1878   1878   Tcl_ObjIntRep *
  1879   1879   Tcl_FetchIntRep(
  1880   1880       Tcl_Obj *objPtr,		/* Object to fetch from. */
  1881   1881       const Tcl_ObjType *typePtr)	/* Requested type */
  1882   1882   {
  1883         -    /* If objPtr type doesn't match request, nothing can be fetched */
  1884         -    if (objPtr->typePtr != typePtr) {
  1885         -	return NULL;
  1886         -    }
  1887         -
  1888         -    /* Type match! objPtr IntRep is the one sought. */
  1889         -    return &(objPtr->internalRep);
         1883  +    return TclFetchIntRep(objPtr, typePtr);
  1890   1884   }
  1891   1885   
  1892   1886   /*
  1893   1887    *----------------------------------------------------------------------
  1894   1888    *
  1895   1889    * Tcl_FreeIntRep --
  1896   1890    *

Changes to generic/tclPathObj.c.

    97     97   #define TCLPATH_NEEDNORM 4
    98     98   
    99     99   /*
   100    100    * Define some macros to give us convenient access to path-object specific
   101    101    * fields.
   102    102    */
   103    103   
   104         -#define PATHOBJ(pathPtr) ((FsPath *) (Tcl_FetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1))
          104  +#define PATHOBJ(pathPtr) ((FsPath *) (TclFetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1))
   105    105   #define SETPATHOBJ(pathPtr,fsPathPtr) \
   106    106   	do {							\
   107    107   		Tcl_ObjIntRep ir;				\
   108    108   		ir.twoPtrValue.ptr1 = (void *) (fsPathPtr);	\
   109    109   		ir.twoPtrValue.ptr2 = NULL;			\
   110    110   		Tcl_StoreIntRep((pathPtr), &fsPathType, &ir);	\
   111    111   	} while (0)
................................................................................
   556    556   
   557    557   Tcl_Obj *
   558    558   TclPathPart(
   559    559       Tcl_Interp *interp,		/* Used for error reporting */
   560    560       Tcl_Obj *pathPtr,		/* Path to take dirname of */
   561    561       Tcl_PathPart portion)	/* Requested portion of name */
   562    562   {
   563         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
          563  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
   564    564   
   565    565       if (irPtr) {
   566    566   	FsPath *fsPathPtr = PATHOBJ(pathPtr);
   567    567   
   568    568   	if (PATHFLAGS(pathPtr) != 0) {
   569    569   	    switch (portion) {
   570    570   	    case TCL_PATH_DIRNAME: {
................................................................................
   856    856   	return Tcl_NewObj();
   857    857       }
   858    858   
   859    859       assert ( elements > 0 );
   860    860   
   861    861       if (elements == 2) {
   862    862   	Tcl_Obj *elt = objv[0];
   863         -	Tcl_ObjIntRep *eltIr = Tcl_FetchIntRep(elt, &fsPathType);
          863  +	Tcl_ObjIntRep *eltIr = TclFetchIntRep(elt, &fsPathType);
   864    864   
   865    865   	/*
   866    866   	 * This is a special case where we can be much more efficient, where
   867    867   	 * we are joining a single relative path onto an object that is
   868    868   	 * already of path type. The 'TclNewFSPathObj' call below creates an
   869    869   	 * object which can be normalized more efficiently. Currently we only
   870    870   	 * use the special case when we have exactly two elements, but we
................................................................................
   912    912   		    /*
   913    913   		     * Finally, on Windows, 'file join' is defined to convert
   914    914   		     * all backslashes to forward slashes, so the base part
   915    915   		     * cannot have backslashes either.
   916    916   		     */
   917    917   
   918    918   		    if ((tclPlatform != TCL_PLATFORM_WINDOWS)
   919         -			    || (strchr(Tcl_GetString(elt), '\\') == NULL)) {
          919  +			    || (strchr(TclGetString(elt), '\\') == NULL)) {
   920    920   
   921    921   			if (PATHFLAGS(elt)) {
   922    922   			    return TclNewFSPathObj(elt, str, len);
   923    923   			}
   924    924   			if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
   925    925   			    return TclNewFSPathObj(elt, str, len);
   926    926   			}
................................................................................
   948    948   	    }
   949    949   	}
   950    950       }
   951    951   
   952    952       assert ( res == NULL );
   953    953   
   954    954       for (i = 0; i < elements; i++) {
   955         -	int driveNameLength, strEltLen, length;
          955  +	int driveNameLength;
          956  +	size_t strEltLen, length;
   956    957   	Tcl_PathType type;
   957    958   	char *strElt, *ptr;
   958    959   	Tcl_Obj *driveName = NULL;
   959    960   	Tcl_Obj *elt = objv[i];
   960    961   
   961    962   	strElt = TclGetStringFromObj(elt, &strEltLen);
   962    963   	driveNameLength = 0;
................................................................................
  1152   1153   int
  1153   1154   Tcl_FSConvertToPathType(
  1154   1155       Tcl_Interp *interp,		/* Interpreter in which to store error message
  1155   1156   				 * (if necessary). */
  1156   1157       Tcl_Obj *pathPtr)		/* Object to convert to a valid, current path
  1157   1158   				 * type. */
  1158   1159   {
  1159         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         1160  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  1160   1161   
  1161   1162       /*
  1162   1163        * While it is bad practice to examine an object's type directly, this is
  1163   1164        * actually the best thing to do here. The reason is that if we are
  1164   1165        * converting this object to FsPath type for the first time, we don't need
  1165   1166        * to worry whether the 'cwd' has changed. On the other hand, if this
  1166   1167        * object is already of FsPath type, and is a relative path, we do have to
................................................................................
  1403   1404   
  1404   1405   Tcl_Obj *
  1405   1406   TclFSMakePathRelative(
  1406   1407       Tcl_Interp *interp,		/* Used for error reporting if not NULL. */
  1407   1408       Tcl_Obj *pathPtr,		/* The path we have. */
  1408   1409       Tcl_Obj *cwdPtr)		/* Make it relative to this. */
  1409   1410   {
  1410         -    int cwdLen, len;
         1411  +    size_t cwdLen, len;
  1411   1412       const char *tempStr;
  1412         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         1413  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  1413   1414   
  1414   1415       if (irPtr) {
  1415   1416   	FsPath *fsPathPtr = PATHOBJ(pathPtr);
  1416   1417   
  1417   1418   	if (PATHFLAGS(pathPtr) != 0 && fsPathPtr->cwdPtr == cwdPtr) {
  1418   1419   	    return fsPathPtr->normPathPtr;
  1419   1420   	}
................................................................................
  1474   1475   
  1475   1476   static int
  1476   1477   MakePathFromNormalized(
  1477   1478       Tcl_Interp *interp,		/* Used for error reporting if not NULL. */
  1478   1479       Tcl_Obj *pathPtr)		/* The object to convert. */
  1479   1480   {
  1480   1481       FsPath *fsPathPtr;
  1481         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         1482  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  1482   1483   
  1483   1484       if (irPtr) {
  1484   1485   	return TCL_OK;
  1485   1486       }
  1486   1487   
  1487   1488       fsPathPtr = Tcl_Alloc(sizeof(FsPath));
  1488   1489   
................................................................................
  1615   1616   	    if (translatedCwdPtr == NULL) {
  1616   1617   		return NULL;
  1617   1618   	    }
  1618   1619   
  1619   1620   	    retObj = Tcl_FSJoinToPath(translatedCwdPtr, 1,
  1620   1621   		    &srcFsPathPtr->normPathPtr);
  1621   1622   	    Tcl_IncrRefCount(srcFsPathPtr->translatedPathPtr = retObj);
  1622         -	    translatedCwdIrPtr = Tcl_FetchIntRep(translatedCwdPtr, &fsPathType);
         1623  +	    translatedCwdIrPtr = TclFetchIntRep(translatedCwdPtr, &fsPathType);
  1623   1624   	    if (translatedCwdIrPtr) {
  1624   1625   		srcFsPathPtr->filesystemEpoch
  1625   1626   			= PATHOBJ(translatedCwdPtr)->filesystemEpoch;
  1626   1627   	    } else {
  1627   1628   		srcFsPathPtr->filesystemEpoch = 0;
  1628   1629   	    }
  1629   1630   	    Tcl_DecrRefCount(translatedCwdPtr);
................................................................................
  1673   1674   Tcl_FSGetTranslatedStringPath(
  1674   1675       Tcl_Interp *interp,
  1675   1676       Tcl_Obj *pathPtr)
  1676   1677   {
  1677   1678       Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(interp, pathPtr);
  1678   1679   
  1679   1680       if (transPtr != NULL) {
  1680         -	int len;
         1681  +	size_t len;
  1681   1682   	const char *orig = TclGetStringFromObj(transPtr, &len);
  1682   1683   	char *result = Tcl_Alloc(len+1);
  1683   1684   
  1684         -	memcpy(result, orig, (size_t) len+1);
         1685  +	memcpy(result, orig, len+1);
  1685   1686   	TclDecrRefCount(transPtr);
  1686   1687   	return result;
  1687   1688       }
  1688   1689   
  1689   1690       return NULL;
  1690   1691   }
  1691   1692   
................................................................................
  1723   1724       if (PATHFLAGS(pathPtr) != 0) {
  1724   1725   	/*
  1725   1726   	 * This is a special path object which is the result of something like
  1726   1727   	 * 'file join'
  1727   1728   	 */
  1728   1729   
  1729   1730   	Tcl_Obj *dir, *copy;
  1730         -	int tailLen, cwdLen, pathType;
         1731  +	size_t tailLen, cwdLen;
         1732  +	int pathType;
  1731   1733   
  1732   1734   	pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
  1733   1735   	dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr);
  1734   1736   	if (dir == NULL) {
  1735   1737   	    return NULL;
  1736   1738   	}
  1737   1739   	/* TODO: Figure out why this is needed. */
................................................................................
  1839   1841   	} else if (fsPathPtr->normPathPtr == NULL) {
  1840   1842   	    size_t cwdLen;
  1841   1843   	    Tcl_Obj *copy;
  1842   1844   
  1843   1845   	    copy = AppendPath(fsPathPtr->cwdPtr, pathPtr);
  1844   1846   
  1845   1847   	    (void) TclGetStringFromObj(fsPathPtr->cwdPtr, &cwdLen);
  1846         -	    cwdLen += (Tcl_GetString(copy)[cwdLen] == '/');
         1848  +	    cwdLen += (TclGetString(copy)[cwdLen] == '/');
  1847   1849   
  1848   1850   	    /*
  1849   1851   	     * Normalize the combined string, but only starting after the end
  1850   1852   	     * of the previously normalized 'dir'. This should be much faster!
  1851   1853   	     */
  1852   1854   
  1853   1855   	    TclFSNormalizeToUniquePath(interp, copy, cwdLen-1);
................................................................................
  2080   2082   
  2081   2083   int
  2082   2084   TclFSEnsureEpochOk(
  2083   2085       Tcl_Obj *pathPtr,
  2084   2086       const Tcl_Filesystem **fsPtrPtr)
  2085   2087   {
  2086   2088       FsPath *srcFsPathPtr;
  2087         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         2089  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  2088   2090   
  2089   2091       if (irPtr == NULL) {
  2090   2092   	return TCL_OK;
  2091   2093       }
  2092   2094   
  2093   2095       srcFsPathPtr = PATHOBJ(pathPtr);
  2094   2096   
................................................................................
  2139   2141   void
  2140   2142   TclFSSetPathDetails(
  2141   2143       Tcl_Obj *pathPtr,
  2142   2144       const Tcl_Filesystem *fsPtr,
  2143   2145       ClientData clientData)
  2144   2146   {
  2145   2147       FsPath *srcFsPathPtr;
  2146         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);;
         2148  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);;
  2147   2149   
  2148   2150       /*
  2149   2151        * Make sure pathPtr is of the correct type.
  2150   2152        */
  2151   2153   
  2152   2154       if (irPtr == NULL) {
  2153   2155   	if (SetFsPathFromAny(NULL, pathPtr) != TCL_OK) {
................................................................................
  2244   2246       Tcl_Interp *interp,		/* Used for error reporting if not NULL. */
  2245   2247       Tcl_Obj *pathPtr)		/* The object to convert. */
  2246   2248   {
  2247   2249       size_t len;
  2248   2250       FsPath *fsPathPtr;
  2249   2251       Tcl_Obj *transPtr;
  2250   2252       char *name;
  2251         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         2253  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  2252   2254   
  2253   2255       if (irPtr) {
  2254   2256   	return TCL_OK;
  2255   2257       }
  2256   2258   
  2257   2259       /*
  2258   2260        * First step is to translate the filename. This is similar to
................................................................................
  2360   2362   
  2361   2363   		/*
  2362   2364   		 * Skip '~'. It's replaced by its expansion.
  2363   2365   		 */
  2364   2366   
  2365   2367   		objc--; objv++;
  2366   2368   		while (objc--) {
  2367         -		    TclpNativeJoinPath(transPtr, Tcl_GetString(*objv++));
         2369  +		    TclpNativeJoinPath(transPtr, TclGetString(*objv));
         2370  +		    objv++;
  2368   2371   		}
  2369   2372   		TclDecrRefCount(parts);
  2370   2373   	    } else {
  2371   2374   		Tcl_Obj *pair[2];
  2372   2375   
  2373   2376   		pair[0] = transPtr;
  2374   2377   		pair[1] = Tcl_NewStringObj(name+split+1, -1);
................................................................................
  2552   2555    */
  2553   2556   
  2554   2557   int
  2555   2558   TclNativePathInFilesystem(
  2556   2559       Tcl_Obj *pathPtr,
  2557   2560       ClientData *clientDataPtr)
  2558   2561   {
  2559         -    Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);
         2562  +    Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
  2560   2563   
  2561   2564       /*
  2562   2565        * A special case is required to handle the empty path "". This is a valid
  2563   2566        * path (i.e. the user should be able to do 'file exists ""' without
  2564   2567        * throwing an error), but equally the path doesn't exist. Those are the
  2565   2568        * semantics of Tcl (at present anyway), so we have to abide by them here.
  2566   2569        */

Changes to generic/tclPkg.c.

  1003   1003   
  1004   1004   	if (objc != 3) {
  1005   1005   	    Tcl_WrongNumArgs(interp, 2, objv, "package");
  1006   1006   	    return TCL_ERROR;
  1007   1007   	}
  1008   1008   	pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
  1009   1009   	if (pkgFiles) {
  1010         -	    Tcl_HashEntry *entry = Tcl_FindHashEntry(&pkgFiles->table, Tcl_GetString(objv[2]));
         1010  +	    Tcl_HashEntry *entry = Tcl_FindHashEntry(&pkgFiles->table, TclGetString(objv[2]));
  1011   1011   	    if (entry) {
  1012   1012   		Tcl_SetObjResult(interp, (Tcl_Obj *)Tcl_GetHashValue(entry));
  1013   1013   	    }
  1014   1014   	}
  1015   1015   	break;
  1016   1016       }
  1017   1017       case PKG_FORGET: {

Changes to generic/tclProc.c.

    76     76   	ir.twoPtrValue.ptr2 = NULL;					\
    77     77   	Tcl_StoreIntRep((objPtr), &tclProcBodyType, &ir);		\
    78     78       } while (0)
    79     79   
    80     80   #define ProcGetIntRep(objPtr, procPtr)					\
    81     81       do {								\
    82     82   	const Tcl_ObjIntRep *irPtr;					\
    83         -	irPtr = Tcl_FetchIntRep((objPtr), &tclProcBodyType);		\
           83  +	irPtr = TclFetchIntRep((objPtr), &tclProcBodyType);		\
    84     84   	(procPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
    85     85       } while (0)
    86     86   
    87     87   /*
    88     88    * The [upvar]/[uplevel] level reference type. Uses the longValue field
    89     89    * to remember the integer value of a parsed #<integer> format.
    90     90    *
................................................................................
   122    122   	Tcl_IncrRefCount((nsObjPtr));					\
   123    123   	Tcl_StoreIntRep((objPtr), &lambdaType, &ir);			\
   124    124       } while (0)
   125    125   
   126    126   #define LambdaGetIntRep(objPtr, procPtr, nsObjPtr)			\
   127    127       do {								\
   128    128   	const Tcl_ObjIntRep *irPtr;					\
   129         -	irPtr = Tcl_FetchIntRep((objPtr), &lambdaType);			\
          129  +	irPtr = TclFetchIntRep((objPtr), &lambdaType);			\
   130    130   	(procPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   131    131   	(nsObjPtr) = irPtr ? irPtr->twoPtrValue.ptr2 : NULL;		\
   132    132       } while (0)
   133    133   
   134    134   
   135    135   /*
   136    136    *----------------------------------------------------------------------
................................................................................
   325    325        *	   seem to make a lot of sense to verify the number of arguments we
   326    326        *	   are about to ignore ...
   327    327        *	 - could be enhanced to handle also non-empty bodies that contain only
   328    328        *	   comments; however, parsing the body will slow down the compilation
   329    329        *	   of all procs whose argument list is just _args_
   330    330        */
   331    331   
   332         -    if (Tcl_FetchIntRep(objv[3], &tclProcBodyType)) {
          332  +    if (objv[3]->typePtr == &tclProcBodyType) {
   333    333   	goto done;
   334    334       }
   335    335   
   336    336       procArgs = TclGetString(objv[2]);
   337    337   
   338    338       while (*procArgs == ' ') {
   339    339   	procArgs++;
................................................................................
   404    404       Tcl_Obj *bodyPtr,		/* Command body. */
   405    405       Proc **procPtrPtr)		/* Returns: pointer to proc data. */
   406    406   {
   407    407       Interp *iPtr = (Interp *) interp;
   408    408   
   409    409       register Proc *procPtr = NULL;
   410    410       int i, result, numArgs;
   411         -    size_t plen;
   412         -    const char *bytes, *argname, *argnamei;
   413         -    char argnamelast;
   414    411       register CompiledLocal *localPtr = NULL;
   415         -    Tcl_Obj *defPtr, *errorObj, **argArray;
          412  +    Tcl_Obj **argArray;
   416    413       int precompiled = 0;
   417    414   
   418    415       ProcGetIntRep(bodyPtr, procPtr);
   419    416       if (procPtr != NULL) {
   420    417   	/*
   421    418   	 * Because the body is a TclProProcBody, the actual body is already
   422    419   	 * compiled, and it is not shared with anyone else, so it's OK not to
................................................................................
   445    442   	 * means that the same code can not be shared by two procedures that
   446    443   	 * have a different number of arguments, even if their bodies are
   447    444   	 * identical. Note that we don't use Tcl_DuplicateObj since we would
   448    445   	 * not want any bytecode internal representation.
   449    446   	 */
   450    447   
   451    448   	if (Tcl_IsShared(bodyPtr)) {
          449  +	    const char *bytes;
   452    450   	    size_t length;
   453    451   	    Tcl_Obj *sharedBodyPtr = bodyPtr;
   454    452   
   455    453   	    bytes = TclGetStringFromObj(bodyPtr, &length);
   456    454   	    bodyPtr = Tcl_NewStringObj(bytes, length);
   457    455   
   458    456   	    /*
................................................................................
   507    505   	localPtr = procPtr->firstLocalPtr;
   508    506       } else {
   509    507   	procPtr->numArgs = numArgs;
   510    508   	procPtr->numCompiledLocals = numArgs;
   511    509       }
   512    510   
   513    511       for (i = 0; i < numArgs; i++) {
          512  +	const char *argname, *argnamei, *argnamelast;
   514    513   	int fieldCount, nameLength;
   515         -	size_t valueLength;
   516    514   	Tcl_Obj **fieldValues;
   517    515   
   518    516   	/*
   519    517   	 * Now divide the specifier up into name and default.
   520    518   	 */
   521    519   
   522    520   	result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount,
   523    521   		&fieldValues);
   524    522   	if (result != TCL_OK) {
   525    523   	    goto procError;
   526    524   	}
   527    525   	if (fieldCount > 2) {
   528         -	    errorObj = Tcl_NewStringObj(
          526  +	    Tcl_Obj *errorObj = Tcl_NewStringObj(
   529    527   		"too many fields in argument specifier \"", -1);
   530    528   	    Tcl_AppendObjToObj(errorObj, argArray[i]);
   531    529   	    Tcl_AppendToObj(errorObj, "\"", -1);
   532    530   	    Tcl_SetObjResult(interp, errorObj);
   533    531   	    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
   534    532   		    "FORMALARGUMENTFORMAT", NULL);
   535    533   	    goto procError;
................................................................................
   538    536   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
   539    537   		    "argument with no name", -1));
   540    538   	    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
   541    539   		    "FORMALARGUMENTFORMAT", NULL);
   542    540   	    goto procError;
   543    541   	}
   544    542   
   545         -	argname = TclGetStringFromObj(fieldValues[0], &plen);
   546         -	nameLength = Tcl_NumUtfChars(argname, plen);
   547         -	if (fieldCount == 2) {
   548         -	    const char * value = TclGetString(fieldValues[1]);
   549         -	    valueLength = Tcl_NumUtfChars(value, fieldValues[1]->length);
   550         -	} else {
   551         -	    valueLength = 0;
   552         -	}
          543  +	argname = TclGetStringFromObj(fieldValues[0], &nameLength);
   553    544   
   554    545   	/*
   555    546   	 * Check that the formal parameter name is a scalar.
   556    547   	 */
   557    548   
   558    549   	argnamei = argname;
   559         -	argnamelast = argname[plen-1];
   560         -	while (plen--) {
   561         -	    if (argnamei[0] == '(') {
   562         -		if (argnamelast == ')') {	/* We have an array element. */
          550  +	argnamelast = Tcl_UtfPrev(argname + nameLength, argname);
          551  +	while (argnamei < argnamelast) {
          552  +	    if (*argnamei == '(') {
          553  +		if (*argnamelast == ')') { /* We have an array element. */
   563    554   		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   564    555   			    "formal parameter \"%s\" is an array element",
   565         -			    Tcl_GetString(fieldValues[0])));
          556  +			    TclGetString(fieldValues[0])));
   566    557   		    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
   567    558   			    "FORMALARGUMENTFORMAT", NULL);
   568    559   		    goto procError;
   569    560   		}
   570         -	    } else if ((argnamei[0] == ':') && (argnamei[1] == ':')) {
   571         -		errorObj = Tcl_NewStringObj("formal parameter \"", -1);
          561  +	    } else if (*argnamei == ':' && *(argnamei+1) == ':') {
          562  +		Tcl_Obj *errorObj = Tcl_NewStringObj(
          563  +		    "formal parameter \"", -1);
   572    564   		Tcl_AppendObjToObj(errorObj, fieldValues[0]);
   573    565   		Tcl_AppendToObj(errorObj, "\" is not a simple name", -1);
   574    566   		Tcl_SetObjResult(interp, errorObj);
   575    567   		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
   576    568   			"FORMALARGUMENTFORMAT", NULL);
   577    569   		goto procError;
   578    570   	    }
................................................................................
   588    580   	     *
   589    581   	     * The only other flag vlaue that is important to retrieve from
   590    582   	     * precompiled procs is VAR_TEMPORARY (also unchanged). It is
   591    583   	     * needed later when retrieving the variable names.
   592    584   	     */
   593    585   
   594    586   	    if ((localPtr->nameLength != nameLength)
   595         -		    || (Tcl_UtfNcmp(localPtr->name, argname, nameLength))
          587  +		    || (memcmp(localPtr->name, argname, nameLength) != 0)
   596    588   		    || (localPtr->frameIndex != i)
   597    589   		    || !(localPtr->flags & VAR_ARGUMENT)
   598    590   		    || (localPtr->defValuePtr == NULL && fieldCount == 2)
   599    591   		    || (localPtr->defValuePtr != NULL && fieldCount != 2)) {
   600    592   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   601    593   			"procedure \"%s\": formal parameter %d is "
   602    594   			"inconsistent with precompiled body", procName, i));
................................................................................
   608    600   	    /*
   609    601   	     * Compare the default value if any.
   610    602   	     */
   611    603   
   612    604   	    if (localPtr->defValuePtr != NULL) {
   613    605   		const char *tmpPtr = TclGetString(localPtr->defValuePtr);
   614    606   		size_t tmpLength = localPtr->defValuePtr->length;
          607  +		const char *value = TclGetString(fieldValues[1]);
          608  +		size_t valueLength = fieldValues[1]->length;
   615    609   
   616         -		if ((valueLength != tmpLength) ||
   617         -			Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) {
   618         -		    errorObj = Tcl_ObjPrintf(
   619         -			    "procedure \"%s\": formal parameter \"" ,procName);
          610  +		if ((valueLength != tmpLength)
          611  +		     || memcmp(value, tmpPtr, tmpLength) != 0
          612  +		) {
          613  +		    Tcl_Obj *errorObj = Tcl_ObjPrintf(
          614  +			    "procedure \"%s\": formal parameter \"", procName);
   620    615   		    Tcl_AppendObjToObj(errorObj, fieldValues[0]);
   621    616   		    Tcl_AppendToObj(errorObj, "\" has "
   622    617   			"default value inconsistent with precompiled body", -1);
   623    618   		    Tcl_SetObjResult(interp, errorObj);
   624    619   		    Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
   625    620   			    "BYTECODELIES", NULL);
   626    621   		    goto procError;
................................................................................
   659    654   	    } else {
   660    655   		localPtr->defValuePtr = NULL;
   661    656   	    }
   662    657   	    memcpy(localPtr->name, argname, fieldValues[0]->length + 1);
   663    658   	    if ((i == numArgs - 1)
   664    659   		    && (localPtr->nameLength == 4)
   665    660   		    && (localPtr->name[0] == 'a')
   666         -		    && (strcmp(localPtr->name, "args") == 0)) {
          661  +		    && (memcmp(localPtr->name, "args", 4) == 0)) {
   667    662   		localPtr->flags |= VAR_IS_ARGS;
   668    663   	    }
   669    664   	}
   670    665       }
   671    666   
   672    667       *procPtrPtr = procPtr;
   673    668       return TCL_OK;
................................................................................
   677    672   	procPtr->refCount--;
   678    673       } else {
   679    674   	Tcl_DecrRefCount(bodyPtr);
   680    675   	while (procPtr->firstLocalPtr != NULL) {
   681    676   	    localPtr = procPtr->firstLocalPtr;
   682    677   	    procPtr->firstLocalPtr = localPtr->nextPtr;
   683    678   
   684         -	    defPtr = localPtr->defValuePtr;
   685         -	    if (defPtr != NULL) {
   686         -		Tcl_DecrRefCount(defPtr);
          679  +	    if (localPtr->defValuePtr != NULL) {
          680  +		Tcl_DecrRefCount(localPtr->defValuePtr);
   687    681   	    }
   688    682   
   689    683   	    Tcl_Free(localPtr);
   690    684   	}
   691    685   	Tcl_Free(procPtr);
   692    686       }
   693    687       return TCL_ERROR;
................................................................................
   792    786   	Tcl_GetWideIntFromObj(NULL, objPtr, &w);
   793    787   	if (w < 0 || w > INT_MAX || curLevel > w + INT_MAX) {
   794    788   	    result = -1;
   795    789   	} else {
   796    790   	    level = curLevel - level;
   797    791   	    result = 1;
   798    792   	}
   799         -    } else if ((irPtr = Tcl_FetchIntRep(objPtr, &levelReferenceType))) {
          793  +    } else if ((irPtr = TclFetchIntRep(objPtr, &levelReferenceType))) {
   800    794   	level = irPtr->wideValue;
   801    795   	result = 1;
   802    796       } else {
   803    797   	name = TclGetString(objPtr);
   804    798   	if (name[0] == '#') {
   805    799   	    if (TCL_OK == Tcl_GetInt(NULL, name+1, &level)) {
   806    800   		if (level < 0 || (level > 0 && name[1] == '-')) {
................................................................................
  2423   2417        * length is not 2, then it cannot be converted to lambdaType.
  2424   2418        */
  2425   2419   
  2426   2420       result = TclListObjGetElements(NULL, objPtr, &objc, &objv);
  2427   2421       if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
  2428   2422   	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2429   2423   		"can't interpret \"%s\" as a lambda expression",
  2430         -		Tcl_GetString(objPtr)));
         2424  +		TclGetString(objPtr)));
  2431   2425   	Tcl_SetErrorCode(interp, "TCL", "VALUE", "LAMBDA", NULL);
  2432   2426   	return TCL_ERROR;
  2433   2427       }
  2434   2428   
  2435   2429       argsPtr = objv[0];
  2436   2430       bodyPtr = objv[1];
  2437   2431   

Changes to generic/tclRegexp.c.

   117    117   	ir.twoPtrValue.ptr2 = NULL;					\
   118    118   	Tcl_StoreIntRep((objPtr), &tclRegexpType, &ir);			\
   119    119       } while (0)
   120    120   
   121    121   #define RegexpGetIntRep(objPtr, rePtr)					\
   122    122       do {								\
   123    123   	const Tcl_ObjIntRep *irPtr;					\
   124         -	irPtr = Tcl_FetchIntRep((objPtr), &tclRegexpType);		\
          124  +	irPtr = TclFetchIntRep((objPtr), &tclRegexpType);		\
   125    125   	(rePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   126    126       } while (0)
   127    127   
   128    128   
   129    129   /*
   130    130    *----------------------------------------------------------------------
   131    131    *

Changes to generic/tclResult.c.

   226    226   
   227    227   const char *
   228    228   Tcl_GetStringResult(
   229    229       register Tcl_Interp *interp)/* Interpreter whose result to return. */
   230    230   {
   231    231       Interp *iPtr = (Interp *) interp;
   232    232   
   233         -    return Tcl_GetString(iPtr->objResultPtr);
          233  +    return TclGetString(iPtr->objResultPtr);
   234    234   }
   235    235   
   236    236   /*
   237    237    *----------------------------------------------------------------------
   238    238    *
   239    239    * Tcl_SetObjResult --
   240    240    *

Changes to generic/tclScan.c.

   585    585   
   586    586       if (objc < 3) {
   587    587   	Tcl_WrongNumArgs(interp, 1, objv,
   588    588   		"string format ?varName ...?");
   589    589   	return TCL_ERROR;
   590    590       }
   591    591   
   592         -    format = Tcl_GetString(objv[2]);
          592  +    format = TclGetString(objv[2]);
   593    593       numVars = objc-3;
   594    594   
   595    595       /*
   596    596        * Check for errors in the format string.
   597    597        */
   598    598   
   599    599       if (ValidateFormat(interp, format, numVars, &totalVars) == TCL_ERROR) {
................................................................................
   607    607       if (totalVars > 0) {
   608    608   	objs = Tcl_Alloc(sizeof(Tcl_Obj *) * totalVars);
   609    609   	for (i = 0; i < totalVars; i++) {
   610    610   	    objs[i] = NULL;
   611    611   	}
   612    612       }
   613    613   
   614         -    string = Tcl_GetString(objv[1]);
          614  +    string = TclGetString(objv[1]);
   615    615       baseString = string;
   616    616   
   617    617       /*
   618    618        * Iterate over the format string filling in the result objects until we
   619    619        * reach the end of input, the end of the format string, or there is a
   620    620        * mismatch.
   621    621        */
................................................................................
  1006   1006   		Tcl_DecrRefCount(objPtr);
  1007   1007   		string = end;
  1008   1008   	    } else {
  1009   1009   		double dvalue;
  1010   1010   		if (Tcl_GetDoubleFromObj(NULL, objPtr, &dvalue) != TCL_OK) {
  1011   1011   #ifdef ACCEPT_NAN
  1012   1012   		    const Tcl_ObjIntRep *irPtr
  1013         -			    = Tcl_FetchIntRep(objPtr, &tclDoubleType);
         1013  +			    = TclFetchIntRep(objPtr, &tclDoubleType);
  1014   1014   		    if (irPtr) {
  1015   1015   			dvalue = irPtr->doubleValue;
  1016   1016   		    } else
  1017   1017   #endif
  1018   1018   		    {
  1019   1019   			Tcl_DecrRefCount(objPtr);
  1020   1020   			goto done;

Changes to generic/tclStringObj.c.

  2638   2638   	} while (seekingConversion);
  2639   2639       }
  2640   2640       TclListObjGetElements(NULL, list, &objc, &objv);
  2641   2641       code = Tcl_AppendFormatToObj(NULL, objPtr, format, objc, objv);
  2642   2642       if (code != TCL_OK) {
  2643   2643   	Tcl_AppendPrintfToObj(objPtr,
  2644   2644   		"Unable to format \"%s\" with supplied arguments: %s",
  2645         -		format, Tcl_GetString(list));
         2645  +		format, TclGetString(list));
  2646   2646       }
  2647   2647       Tcl_DecrRefCount(list);
  2648   2648   }
  2649   2649   
  2650   2650   /*
  2651   2651    *---------------------------------------------------------------------------
  2652   2652    *
................................................................................
  2780   2780   		unichar = 1;
  2781   2781   	    }
  2782   2782   	}
  2783   2783       }
  2784   2784   
  2785   2785       if (binary) {
  2786   2786   	/* Result will be pure byte array. Pre-size it */
  2787         -	TclGetByteArrayFromObj(objPtr, &length);
         2787  +	(void)TclGetByteArrayFromObj(objPtr, &length);
  2788   2788       } else if (unichar) {
  2789   2789   	/* Result will be pure Tcl_UniChar array. Pre-size it. */
  2790         -	TclGetUnicodeFromObj(objPtr, &length);
         2790  +	(void)TclGetUnicodeFromObj(objPtr, &length);
  2791   2791       } else {
  2792   2792   	/* Result will be concat of string reps. Pre-size it. */
  2793   2793   	(void)TclGetStringFromObj(objPtr, &length);
  2794   2794       }
  2795   2795   
  2796   2796       if (length == 0) {
  2797   2797   	/* Any repeats of empty is empty. */
................................................................................
  2852   2852   		(count - done) * length);
  2853   2853       } else {
  2854   2854   	/*
  2855   2855   	 * Efficiently concatenate string reps.
  2856   2856   	 */
  2857   2857   
  2858   2858   	if (!inPlace || Tcl_IsShared(objPtr)) {
  2859         -	    objResultPtr = Tcl_NewStringObj(Tcl_GetString(objPtr), length);
         2859  +	    objResultPtr = Tcl_NewStringObj(TclGetString(objPtr), length);
  2860   2860   	} else {
  2861   2861   	    TclFreeIntRep(objPtr);
  2862   2862   	    objResultPtr = objPtr;
  2863   2863   	}
  2864   2864           if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
  2865   2865   	    if (interp) {
  2866   2866   		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
................................................................................
  2871   2871   	    return NULL;
  2872   2872   	}
  2873   2873   	Tcl_SetObjLength(objResultPtr, length);
  2874   2874   	while (count - done > done) {
  2875   2875   	    Tcl_AppendObjToObj(objResultPtr, objResultPtr);
  2876   2876   	    done *= 2;
  2877   2877   	}
  2878         -	Tcl_AppendToObj(objResultPtr, Tcl_GetString(objResultPtr),
         2878  +	Tcl_AppendToObj(objResultPtr, TclGetString(objResultPtr),
  2879   2879   		(count - done) * length);
  2880   2880       }
  2881   2881       return objResultPtr;
  2882   2882   }
  2883   2883   
  2884   2884   /*
  2885   2885    *---------------------------------------------------------------------------
................................................................................
  2976   2976   	    /*
  2977   2977   	     * Every argument is either a bytearray with a ("pure")
  2978   2978   	     * value we know we can safely use, or it is an empty string.
  2979   2979   	     * We don't need to count bytes for the empty strings.
  2980   2980   	     */
  2981   2981   
  2982   2982   	    if (TclIsPureByteArray(objPtr)) {
  2983         -		TclGetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
         2983  +		(void)TclGetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
  2984   2984   
  2985   2985   		if (numBytes) {
  2986   2986   		    last = objc - oc;
  2987   2987   		    if (length == 0) {
  2988   2988   			first = last;
  2989   2989   		    }
  2990   2990   		    length += numBytes;
................................................................................
  3057   3057   		 * There's a pending value followed by more values.  Loop over
  3058   3058   		 * remaining values generating strings until a non-empty value
  3059   3059   		 * is found, or the pending value gets its string generated.
  3060   3060   		 */
  3061   3061   
  3062   3062   		do {
  3063   3063   		    Tcl_Obj *objPtr = *ov++;
  3064         -		    Tcl_GetString(objPtr); /* PANIC? */
         3064  +		    TclGetString(objPtr); /* PANIC? */
  3065   3065   		    numBytes = objPtr->length;
  3066   3066   		} while (--oc && numBytes == 0 && pendingPtr->bytes == NULL);
  3067   3067   
  3068   3068   		if (numBytes) {
  3069   3069   		    last = objc -oc -1;
  3070   3070   		}
  3071   3071   		if (oc || numBytes) {
................................................................................
  3084   3084   
  3085   3085   	while (oc) {
  3086   3086   	    size_t numBytes;
  3087   3087   	    Tcl_Obj *objPtr = *ov++;
  3088   3088   
  3089   3089   	    /* assert ( length > 0 && pendingPtr == NULL )  */
  3090   3090   
  3091         -	    Tcl_GetString(objPtr); /* PANIC? */
         3091  +	    TclGetString(objPtr); /* PANIC? */
  3092   3092   	    numBytes = objPtr->length;
  3093   3093   	    if (numBytes) {
  3094   3094   		last = objc - oc;
  3095   3095   		if (numBytes + length > (size_t)INT_MAX) {
  3096   3096   		    goto overflow;
  3097   3097   		}
  3098   3098   		length += numBytes;
................................................................................
  3118   3118   	 * failure to allocate enough space. Following stanza may panic.
  3119   3119   	 */
  3120   3120   
  3121   3121   	if (inPlace && !Tcl_IsShared(*objv)) {
  3122   3122   	    size_t start;
  3123   3123   
  3124   3124   	    objResultPtr = *objv++; objc--;
  3125         -	    TclGetByteArrayFromObj(objResultPtr, &start);
         3125  +	    (void)TclGetByteArrayFromObj(objResultPtr, &start);
  3126   3126   	    dst = Tcl_SetByteArrayLength(objResultPtr, length) + start;
  3127   3127   	} else {
  3128   3128   	    objResultPtr = Tcl_NewByteArrayObj(NULL, length);
  3129   3129   	    dst = Tcl_SetByteArrayLength(objResultPtr, length);
  3130   3130   	}
  3131   3131   	while (objc--) {
  3132   3132   	    Tcl_Obj *objPtr = *objv++;
................................................................................
  3210   3210   		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3211   3211   		    	"concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
  3212   3212   			length));
  3213   3213   		    Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
  3214   3214   		}
  3215   3215   		return NULL;
  3216   3216   	    }
  3217         -	    dst = Tcl_GetString(objResultPtr) + start;
         3217  +	    dst = TclGetString(objResultPtr) + start;
  3218   3218   
  3219   3219   	    /* assert ( length > start ) */
  3220   3220   	    TclFreeIntRep(objResultPtr);
  3221   3221   	} else {
  3222   3222   	    objResultPtr = Tcl_NewObj();	/* PANIC? */
  3223   3223   	    if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
  3224   3224   		Tcl_DecrRefCount(objResultPtr);
................................................................................
  3226   3226   		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3227   3227   		    	"concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
  3228   3228   			length));
  3229   3229   		    Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
  3230   3230   		}
  3231   3231   		return NULL;
  3232   3232   	    }
  3233         -	    dst = Tcl_GetString(objResultPtr);
         3233  +	    dst = TclGetString(objResultPtr);
  3234   3234   	}
  3235   3235   	while (objc--) {
  3236   3236   	    Tcl_Obj *objPtr = *objv++;
  3237   3237   
  3238   3238   	    if ((objPtr->bytes == NULL) || (objPtr->length)) {
  3239   3239   		size_t more;
  3240   3240   		char *src = TclGetStringFromObj(objPtr, &more);

Changes to generic/tclTest.c.

   976    976       if (!asyncPtr) {
   977    977           /* Woops - this one was deleted between the AsyncMark and now */
   978    978           return TCL_OK;
   979    979       }
   980    980   
   981    981       TclFormatInt(string, code);
   982    982       listArgv[0] = asyncPtr->command;
   983         -    listArgv[1] = Tcl_GetString(Tcl_GetObjResult(interp));
          983  +    listArgv[1] = Tcl_GetStringResult(interp);
   984    984       listArgv[2] = string;
   985    985       listArgv[3] = NULL;
   986    986       cmd = Tcl_Merge(3, listArgv);
   987    987       if (interp != NULL) {
   988    988   	code = Tcl_EvalEx(interp, cmd, -1, 0);
   989    989       } else {
   990    990   	/*

Changes to generic/tclTimer.c.

   817    817       /*
   818    818        * First lets see if the command was passed a number as the first argument.
   819    819        */
   820    820   
   821    821       if (Tcl_GetWideIntFromObj(NULL, objv[1], &ms) != TCL_OK) {
   822    822   	if (Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index)
   823    823   		!= TCL_OK) {
   824         -            const char *arg = Tcl_GetString(objv[1]);
          824  +            const char *arg = TclGetString(objv[1]);
   825    825   
   826    826   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   827    827                       "bad argument \"%s\": must be"
   828    828                       " cancel, idle, info, or an integer", arg));
   829    829               Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "argument",
   830    830                       arg, NULL);
   831    831   	    return TCL_ERROR;

Changes to generic/tclTrace.c.

   320    320   	Tcl_Obj *resultListPtr, *pairObjPtr, *elemObjPtr;
   321    321   
   322    322   	if (objc != 3) {
   323    323   	    Tcl_WrongNumArgs(interp, 2, objv, "name");
   324    324   	    return TCL_ERROR;
   325    325   	}
   326    326   	resultListPtr = Tcl_NewObj();
   327         -	name = Tcl_GetString(objv[2]);
          327  +	name = TclGetString(objv[2]);
   328    328   	FOREACH_VAR_TRACE(interp, name, clientData) {
   329    329   	    TraceVarInfo *tvarPtr = clientData;
   330    330   	    char *q = ops;
   331    331   
   332    332   	    pairObjPtr = Tcl_NewListObj(0, NULL);
   333    333   	    if (tvarPtr->flags & TCL_TRACE_READS) {
   334    334   		*q = 'r';
................................................................................
   481    481   	    tcmdPtr->refCount = 1;
   482    482   	    flags |= TCL_TRACE_DELETE;
   483    483   	    if (flags & (TCL_TRACE_ENTER_DURING_EXEC |
   484    484   		    TCL_TRACE_LEAVE_DURING_EXEC)) {
   485    485   		flags |= (TCL_TRACE_ENTER_EXEC | TCL_TRACE_LEAVE_EXEC);
   486    486   	    }
   487    487   	    memcpy(tcmdPtr->command, command, length+1);
   488         -	    name = Tcl_GetString(objv[3]);
          488  +	    name = TclGetString(objv[3]);
   489    489   	    if (Tcl_TraceCommand(interp, name, flags, TraceCommandProc,
   490    490   		    tcmdPtr) != TCL_OK) {
   491    491   		Tcl_Free(tcmdPtr);
   492    492   		return TCL_ERROR;
   493    493   	    }
   494    494   	} else {
   495    495   	    /*
................................................................................
   500    500   
   501    501   	    ClientData clientData;
   502    502   
   503    503   	    /*
   504    504   	     * First ensure the name given is valid.
   505    505   	     */
   506    506   
   507         -	    name = Tcl_GetString(objv[3]);
          507  +	    name = TclGetString(objv[3]);
   508    508   	    if (Tcl_FindCommand(interp,name,NULL,TCL_LEAVE_ERR_MSG) == NULL) {
   509    509   		return TCL_ERROR;
   510    510   	    }
   511    511   
   512    512   	    FOREACH_COMMAND_TRACE(interp, name, clientData) {
   513    513   		TraceCommandInfo *tcmdPtr = clientData;
   514    514   
................................................................................
   561    561   	Tcl_Obj *resultListPtr;
   562    562   
   563    563   	if (objc != 4) {
   564    564   	    Tcl_WrongNumArgs(interp, 3, objv, "name");
   565    565   	    return TCL_ERROR;
   566    566   	}
   567    567   
   568         -	name = Tcl_GetString(objv[3]);
          568  +	name = TclGetString(objv[3]);
   569    569   
   570    570   	/*
   571    571   	 * First ensure the name given is valid.
   572    572   	 */
   573    573   
   574    574   	if (Tcl_FindCommand(interp, name, NULL, TCL_LEAVE_ERR_MSG) == NULL) {
   575    575   	    return TCL_ERROR;
................................................................................
   714    714   	    tcmdPtr->stepTrace = NULL;
   715    715   	    tcmdPtr->startLevel = 0;
   716    716   	    tcmdPtr->startCmd = NULL;
   717    717   	    tcmdPtr->length = length;
   718    718   	    tcmdPtr->refCount = 1;
   719    719   	    flags |= TCL_TRACE_DELETE;
   720    720   	    memcpy(tcmdPtr->command, command, length+1);
   721         -	    name = Tcl_GetString(objv[3]);
          721  +	    name = TclGetString(objv[3]);
   722    722   	    if (Tcl_TraceCommand(interp, name, flags, TraceCommandProc,
   723    723   		    tcmdPtr) != TCL_OK) {
   724    724   		Tcl_Free(tcmdPtr);
   725    725   		return TCL_ERROR;
   726    726   	    }
   727    727   	} else {
   728    728   	    /*
................................................................................
   733    733   
   734    734   	    ClientData clientData;
   735    735   
   736    736   	    /*
   737    737   	     * First ensure the name given is valid.
   738    738   	     */
   739    739   
   740         -	    name = Tcl_GetString(objv[3]);
          740  +	    name = TclGetString(objv[3]);
   741    741   	    if (Tcl_FindCommand(interp,name,NULL,TCL_LEAVE_ERR_MSG) == NULL) {
   742    742   		return TCL_ERROR;
   743    743   	    }
   744    744   
   745    745   	    FOREACH_COMMAND_TRACE(interp, name, clientData) {
   746    746   		TraceCommandInfo *tcmdPtr = clientData;
   747    747   
................................................................................
   769    769   	    return TCL_ERROR;
   770    770   	}
   771    771   
   772    772   	/*
   773    773   	 * First ensure the name given is valid.
   774    774   	 */
   775    775   
   776         -	name = Tcl_GetString(objv[3]);
          776  +	name = TclGetString(objv[3]);
   777    777   	if (Tcl_FindCommand(interp, name, NULL, TCL_LEAVE_ERR_MSG) == NULL) {
   778    778   	    return TCL_ERROR;
   779    779   	}
   780    780   
   781    781   	resultListPtr = Tcl_NewListObj(0, NULL);
   782    782   	FOREACH_COMMAND_TRACE(interp, name, clientData) {
   783    783   	    int numOps = 0;
................................................................................
   922    922   #endif
   923    923   	    ctvarPtr->traceCmdInfo.length = length;
   924    924   	    flags |= TCL_TRACE_UNSETS | TCL_TRACE_RESULT_OBJECT;
   925    925   	    memcpy(ctvarPtr->traceCmdInfo.command, command, length+1);
   926    926   	    ctvarPtr->traceInfo.traceProc = TraceVarProc;
   927    927   	    ctvarPtr->traceInfo.clientData = &ctvarPtr->traceCmdInfo;
   928    928   	    ctvarPtr->traceInfo.flags = flags;
   929         -	    name = Tcl_GetString(objv[3]);
          929  +	    name = TclGetString(objv[3]);
   930    930   	    if (TraceVarEx(interp, name, NULL, (VarTrace *) ctvarPtr)
   931    931   		    != TCL_OK) {
   932    932   		Tcl_Free(ctvarPtr);
   933    933   		return TCL_ERROR;
   934    934   	    }
   935    935   	} else {
   936    936   	    /*
   937    937   	     * Search through all of our traces on this variable to see if
   938    938   	     * there's one with the given command. If so, then delete the
   939    939   	     * first one that matches.
   940    940   	     */
   941    941   
   942         -	    name = Tcl_GetString(objv[3]);
          942  +	    name = TclGetString(objv[3]);
   943    943   	    FOREACH_VAR_TRACE(interp, name, clientData) {
   944    944   		TraceVarInfo *tvarPtr = clientData;
   945    945   
   946    946   		if ((tvarPtr->length == length)
   947    947   			&& ((tvarPtr->flags
   948    948   #ifndef TCL_REMOVE_OBSOLETE_TRACES
   949    949   & ~TCL_TRACE_OLD_STYLE
................................................................................
   965    965   
   966    966   	if (objc != 4) {
   967    967   	    Tcl_WrongNumArgs(interp, 3, objv, "name");
   968    968   	    return TCL_ERROR;
   969    969   	}
   970    970   
   971    971   	resultListPtr = Tcl_NewObj();
   972         -	name = Tcl_GetString(objv[3]);
          972  +	name = TclGetString(objv[3]);
   973    973   	FOREACH_VAR_TRACE(interp, name, clientData) {
   974    974   	    Tcl_Obj *opObjPtr, *eachTraceObjPtr, *elemObjPtr;
   975    975   	    TraceVarInfo *tvarPtr = clientData;
   976    976   
   977    977   	    /*
   978    978   	     * Build a list with the ops list as the first obj element and the
   979    979   	     * tcmdPtr->command string as the second obj element. Append this
................................................................................
  1827   1827   
  1828   1828   	    /*
  1829   1829   	     * Append command with arguments.
  1830   1830   	     */
  1831   1831   
  1832   1832   	    Tcl_DStringInit(&sub);
  1833   1833   	    for (i = 0; i < objc; i++) {
  1834         -		Tcl_DStringAppendElement(&sub, Tcl_GetString(objv[i]));
         1834  +		Tcl_DStringAppendElement(&sub, TclGetString(objv[i]));
  1835   1835   	    }
  1836   1836   	    Tcl_DStringAppendElement(&cmd, Tcl_DStringValue(&sub));
  1837   1837   	    Tcl_DStringFree(&sub);
  1838   1838   
  1839   1839   	    if (flags & TCL_TRACE_ENTER_EXEC) {
  1840   1840   		/*
  1841   1841   		 * Append trace operation.
................................................................................
  1851   1851   		const char *resultCodeStr;
  1852   1852   
  1853   1853   		/*
  1854   1854   		 * Append result code.
  1855   1855   		 */
  1856   1856   
  1857   1857   		resultCode = Tcl_NewIntObj(code);
  1858         -		resultCodeStr = Tcl_GetString(resultCode);
         1858  +		resultCodeStr = TclGetString(resultCode);
  1859   1859   		Tcl_DStringAppendElement(&cmd, resultCodeStr);
  1860   1860   		Tcl_DecrRefCount(resultCode);
  1861   1861   
  1862   1862   		/*
  1863   1863   		 * Append result string.
  1864   1864   		 */
  1865   1865   
................................................................................
  2274   2274        * This is a bit messy because we have to emulate the old trace interface,
  2275   2275        * which uses strings for everything.
  2276   2276        */
  2277   2277   
  2278   2278       argv = (const char **) TclStackAlloc(interp,
  2279   2279   	    (objc + 1) * sizeof(const char *));
  2280   2280       for (i = 0; i < objc; i++) {
  2281         -	argv[i] = Tcl_GetString(objv[i]);
         2281  +	argv[i] = TclGetString(objv[i]);
  2282   2282       }
  2283   2283       argv[objc] = 0;
  2284   2284   
  2285   2285       /*
  2286   2286        * Invoke the command function. Note that we cast away const-ness on two
  2287   2287        * parameters for compatibility with legacy code; the code MUST NOT modify
  2288   2288        * either command or argv.
................................................................................
  2777   2777   
  2778   2778   	    Tcl_AppendObjToErrorInfo((Tcl_Interp *)iPtr, Tcl_ObjPrintf(
  2779   2779   		    "\n    (%s trace on \"%s%s%s%s\")", type, part1,
  2780   2780   		    (part2 ? "(" : ""), (part2 ? part2 : ""),
  2781   2781   		    (part2 ? ")" : "") ));
  2782   2782   	    if (disposeFlags & TCL_TRACE_RESULT_OBJECT) {
  2783   2783   		TclVarErrMsg((Tcl_Interp *) iPtr, part1, part2, verb,
  2784         -			Tcl_GetString((Tcl_Obj *) result));
         2784  +			TclGetString((Tcl_Obj *) result));
  2785   2785   	    } else {
  2786   2786   		TclVarErrMsg((Tcl_Interp *) iPtr, part1, part2, verb, result);
  2787   2787   	    }
  2788   2788   	    iPtr->flags &= ~(ERR_ALREADY_LOGGED);
  2789   2789   	    Tcl_DiscardInterpState(state);
  2790   2790   	} else {
  2791   2791   	    Tcl_RestoreInterpState((Tcl_Interp *) iPtr, state);

Changes to generic/tclUtil.c.

  3675   3675                                    * "objPtr" holds "end". */
  3676   3676       Tcl_WideInt *widePtr)       /* Location filled in with an integer
  3677   3677                                    * representing an index. */
  3678   3678   {
  3679   3679       Tcl_ObjIntRep *irPtr;
  3680   3680       Tcl_WideInt offset = 0;	/* Offset in the "end-offset" expression */
  3681   3681   
  3682         -    while ((irPtr = Tcl_FetchIntRep(objPtr, &endOffsetType)) == NULL) {
         3682  +    while ((irPtr = TclFetchIntRep(objPtr, &endOffsetType)) == NULL) {
  3683   3683   	Tcl_ObjIntRep ir;
  3684   3684   	size_t length;
  3685   3685   	const char *bytes = TclGetStringFromObj(objPtr, &length);
  3686   3686   
  3687   3687   	if ((length < 3) || (length == 4)) {
  3688   3688   	    /* Too short to be "end" or to be "end-$integer" */
  3689   3689   	    return TCL_ERROR;

Changes to generic/tclVar.c.

   263    263   	ir.twoPtrValue.ptr2 = INT2PTR(index);				\
   264    264   	Tcl_StoreIntRep((objPtr), &localVarNameType, &ir);		\
   265    265       } while (0)
   266    266   
   267    267   #define LocalGetIntRep(objPtr, index, name)				\
   268    268       do {								\
   269    269   	const Tcl_ObjIntRep *irPtr;					\
   270         -	irPtr = Tcl_FetchIntRep((objPtr), &localVarNameType);		\
          270  +	irPtr = TclFetchIntRep((objPtr), &localVarNameType);		\
   271    271   	(name) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   272    272   	(index) = irPtr ? PTR2INT(irPtr->twoPtrValue.ptr2) : -1;	\
   273    273       } while (0)
   274    274   
   275    275   static const Tcl_ObjType parsedVarNameType = {
   276    276       "parsedVarName",
   277    277       FreeParsedVarName, DupParsedVarName, NULL, NULL
................................................................................
   288    288   	ir.twoPtrValue.ptr2 = ptr2;					\
   289    289   	Tcl_StoreIntRep((objPtr), &parsedVarNameType, &ir);		\
   290    290       } while (0)
   291    291   
   292    292   #define ParsedGetIntRep(objPtr, parsed, array, elem)			\
   293    293       do {								\
   294    294   	const Tcl_ObjIntRep *irPtr;					\
   295         -	irPtr = Tcl_FetchIntRep((objPtr), &parsedVarNameType);		\
          295  +	irPtr = TclFetchIntRep((objPtr), &parsedVarNameType);		\
   296    296   	(parsed) = (irPtr != NULL);					\
   297    297   	(array) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL;		\
   298    298   	(elem) = irPtr ? irPtr->twoPtrValue.ptr2 : NULL;		\
   299    299       } while (0)
   300    300   
   301    301   Var *
   302    302   TclVarHashCreateVar(
................................................................................
   339    339   }
   340    340   
   341    341   static int
   342    342   NotArrayError(
   343    343       Tcl_Interp *interp,
   344    344       Tcl_Obj *name)
   345    345   {
   346         -    const char *nameStr = Tcl_GetString(name);
          346  +    const char *nameStr = TclGetString(name);
   347    347   
   348    348       Tcl_SetObjResult(interp,
   349    349   	    Tcl_ObjPrintf("\"%s\" isn't an array", nameStr));
   350    350       Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", nameStr, NULL);
   351    351       return TCL_ERROR;
   352    352   }
   353    353   

Changes to generic/tclZipfs.c.

  1869   1869   {
  1870   1870       if (objc > 4) {
  1871   1871   	Tcl_WrongNumArgs(interp, 1, objv,
  1872   1872   		 "?mountpoint? ?zipfile? ?password?");
  1873   1873   	return TCL_ERROR;
  1874   1874       }
  1875   1875   
  1876         -    return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL,
  1877         -	    (objc > 2) ? Tcl_GetString(objv[2]) : NULL,
  1878         -	    (objc > 3) ? Tcl_GetString(objv[3]) : NULL);
         1876  +    return TclZipfs_Mount(interp, (objc > 1) ? TclGetString(objv[1]) : NULL,
         1877  +	    (objc > 2) ? TclGetString(objv[2]) : NULL,
         1878  +	    (objc > 3) ? TclGetString(objv[3]) : NULL);
  1879   1879   }
  1880   1880   
  1881   1881   /*
  1882   1882    *-------------------------------------------------------------------------
  1883   1883    *
  1884   1884    * ZipFSMountBufferObjCmd --
  1885   1885    *
................................................................................
  1914   1914   
  1915   1915   	ReadLock();
  1916   1916   	ret = ListMountPoints(interp);
  1917   1917   	Unlock();
  1918   1918   	return ret;
  1919   1919       }
  1920   1920   
  1921         -    mountPoint = Tcl_GetString(objv[1]);
         1921  +    mountPoint = TclGetString(objv[1]);
  1922   1922       if (objc < 3) {
  1923   1923   	ReadLock();
  1924   1924   	DescribeMounted(interp, mountPoint);
  1925   1925   	Unlock();
  1926   1926   	return TCL_OK;
  1927   1927       }
  1928   1928   
................................................................................
  1980   1980       int objc,			/* Number of arguments. */
  1981   1981       Tcl_Obj *const objv[])	/* Argument objects. */
  1982   1982   {
  1983   1983       if (objc != 2) {
  1984   1984   	Tcl_WrongNumArgs(interp, 1, objv, "zipfile");
  1985   1985   	return TCL_ERROR;
  1986   1986       }
  1987         -    return TclZipfs_Unmount(interp, Tcl_GetString(objv[1]));
         1987  +    return TclZipfs_Unmount(interp, TclGetString(objv[1]));
  1988   1988   }
  1989   1989   
  1990   1990   /*
  1991   1991    *-------------------------------------------------------------------------
  1992   1992    *
  1993   1993    * ZipFSMkKeyObjCmd --
  1994   1994    *
................................................................................
  2014   2014       int len, i = 0;
  2015   2015       char *pw, passBuf[264];
  2016   2016   
  2017   2017       if (objc != 2) {
  2018   2018   	Tcl_WrongNumArgs(interp, 1, objv, "password");
  2019   2019   	return TCL_ERROR;
  2020   2020       }
  2021         -    pw = Tcl_GetString(objv[1]);
         2021  +    pw = TclGetString(objv[1]);
  2022   2022       len = strlen(pw);
  2023   2023       if (len == 0) {
  2024   2024   	return TCL_OK;
  2025   2025       }
  2026   2026       if ((len > 255) || strchr(pw, 0xff)) {
  2027   2027   	Tcl_SetObjResult(interp, Tcl_NewStringObj("illegal password", -1));
  2028   2028   	return TCL_ERROR;
................................................................................
  2449   2449   
  2450   2450       /*
  2451   2451        * Caller has verified that the number of arguments is correct.
  2452   2452        */
  2453   2453   
  2454   2454       passBuf[0] = 0;
  2455   2455       if (objc > (isList ? 3 : 4)) {
  2456         -	pw = Tcl_GetString(objv[isList ? 3 : 4]);
         2456  +	pw = TclGetString(objv[isList ? 3 : 4]);
  2457   2457   	pwlen = strlen(pw);
  2458   2458   	if ((pwlen > 255) || strchr(pw, 0xff)) {
  2459   2459   	    Tcl_SetObjResult(interp,
  2460   2460   		    Tcl_NewStringObj("illegal password", -1));
  2461   2461   	    Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "BAD_PASS", NULL);
  2462   2462   	    return TCL_ERROR;
  2463   2463   	}
................................................................................
  2493   2493       }
  2494   2494       if (lobjc == 0) {
  2495   2495   	Tcl_DecrRefCount(list);
  2496   2496   	Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1));
  2497   2497   	Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "EMPTY", NULL);
  2498   2498   	return TCL_ERROR;
  2499   2499       }
  2500         -    out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "wb", 0755);
         2500  +    out = Tcl_OpenFileChannel(interp, TclGetString(objv[1]), "wb", 0755);
  2501   2501       if (out == NULL) {
  2502   2502   	Tcl_DecrRefCount(list);
  2503   2503   	return TCL_ERROR;
  2504   2504       }
  2505   2505       if (pwlen <= 0) {
  2506   2506   	pw = NULL;
  2507   2507   	pwlen = 0;
................................................................................
  2508   2508       }
  2509   2509       if (isImg) {
  2510   2510   	ZipFile *zf, zf0;
  2511   2511   	int isMounted = 0;
  2512   2512   	const char *imgName;
  2513   2513   
  2514   2514   	if (isList) {
  2515         -	    imgName = (objc > 4) ? Tcl_GetString(objv[4]) :
         2515  +	    imgName = (objc > 4) ? TclGetString(objv[4]) :
  2516   2516   		    Tcl_GetNameOfExecutable();
  2517   2517   	} else {
  2518         -	    imgName = (objc > 5) ? Tcl_GetString(objv[5]) :
         2518  +	    imgName = (objc > 5) ? TclGetString(objv[5]) :
  2519   2519   		    Tcl_GetNameOfExecutable();
  2520   2520   	}
  2521   2521   	if (pwlen) {
  2522   2522   	    i = 0;
  2523   2523   	    for (len = pwlen; len-- > 0;) {
  2524   2524   		int ch = pw[len];
  2525   2525   
................................................................................
  2641   2641   	}
  2642   2642   	memset(passBuf, 0, sizeof(passBuf));
  2643   2643   	Tcl_Flush(out);
  2644   2644       }
  2645   2645       Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS);
  2646   2646       pos[0] = Tcl_Tell(out);
  2647   2647       if (!isList && (objc > 3)) {
  2648         -	strip = Tcl_GetString(objv[3]);
         2648  +	strip = TclGetString(objv[3]);
  2649   2649   	slen = strlen(strip);
  2650   2650       }
  2651   2651       for (i = 0; i < (size_t) lobjc; i += (isList ? 2 : 1)) {
  2652   2652   	const char *path, *name;
  2653   2653   
  2654         -	path = Tcl_GetString(lobjv[i]);
         2654  +	path = TclGetString(lobjv[i]);
  2655   2655   	if (isList) {
  2656         -	    name = Tcl_GetString(lobjv[i + 1]);
         2656  +	    name = TclGetString(lobjv[i + 1]);
  2657   2657   	} else {
  2658   2658   	    name = path;
  2659   2659   	    if (slen > 0) {
  2660   2660   		len = strlen(name);
  2661   2661   		if ((len <= slen) || (strncmp(strip, name, slen) != 0)) {
  2662   2662   		    continue;
  2663   2663   		}
................................................................................
  2676   2676   	}
  2677   2677       }
  2678   2678       pos[1] = Tcl_Tell(out);
  2679   2679       count = 0;
  2680   2680       for (i = 0; i < (size_t) lobjc; i += (isList ? 2 : 1)) {
  2681   2681   	const char *path, *name;
  2682   2682   
  2683         -	path = Tcl_GetString(lobjv[i]);
         2683  +	path = TclGetString(lobjv[i]);
  2684   2684   	if (isList) {
  2685         -	    name = Tcl_GetString(lobjv[i + 1]);
         2685  +	    name = TclGetString(lobjv[i + 1]);
  2686   2686   	} else {
  2687   2687   	    name = path;
  2688   2688   	    if (slen > 0) {
  2689   2689   		len = strlen(name);
  2690   2690   		if ((len <= slen) || (strncmp(strip, name, slen) != 0)) {
  2691   2691   		    continue;
  2692   2692   		}
................................................................................
  2912   2912   
  2913   2913       if (objc < 2 || objc > 4) {
  2914   2914   	Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? filename ?inZipfs?");
  2915   2915   	return TCL_ERROR;
  2916   2916       }
  2917   2917       Tcl_DStringInit(&dPath);
  2918   2918       if (objc == 2) {
  2919         -	filename = Tcl_GetString(objv[1]);
         2919  +	filename = TclGetString(objv[1]);
  2920   2920   	result = CanonicalPath("", filename, &dPath, 1);
  2921   2921       } else if (objc == 3) {
  2922         -	mntpoint = Tcl_GetString(objv[1]);
  2923         -	filename = Tcl_GetString(objv[2]);
         2922  +	mntpoint = TclGetString(objv[1]);
         2923  +	filename = TclGetString(objv[2]);
  2924   2924   	result = CanonicalPath(mntpoint, filename, &dPath, 1);
  2925   2925       } else {
  2926   2926   	int zipfs = 0;
  2927   2927   
  2928   2928   	if (Tcl_GetBooleanFromObj(interp, objv[3], &zipfs)) {
  2929   2929   	    return TCL_ERROR;
  2930   2930   	}
  2931         -	mntpoint = Tcl_GetString(objv[1]);
  2932         -	filename = Tcl_GetString(objv[2]);
         2931  +	mntpoint = TclGetString(objv[1]);
         2932  +	filename = TclGetString(objv[2]);
  2933   2933   	result = CanonicalPath(mntpoint, filename, &dPath, zipfs);
  2934   2934       }
  2935   2935       Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1));
  2936   2936       return TCL_OK;
  2937   2937   }
  2938   2938   
  2939   2939   /*
................................................................................
  2970   2970   	return TCL_ERROR;
  2971   2971       }
  2972   2972   
  2973   2973       /*
  2974   2974        * Prepend ZIPFS_VOLUME to filename, eliding the final /
  2975   2975        */
  2976   2976   
  2977         -    filename = Tcl_GetString(objv[1]);
         2977  +    filename = TclGetString(objv[1]);
  2978   2978       Tcl_DStringInit(&ds);
  2979   2979       Tcl_DStringAppend(&ds, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN - 1);
  2980   2980       Tcl_DStringAppend(&ds, filename, -1);
  2981   2981       filename = Tcl_DStringValue(&ds);
  2982   2982   
  2983   2983       ReadLock();
  2984   2984       exists = ZipFSLookup(filename) != NULL;
................................................................................
  3017   3017       char *filename;
  3018   3018       ZipEntry *z;
  3019   3019   
  3020   3020       if (objc != 2) {
  3021   3021   	Tcl_WrongNumArgs(interp, 1, objv, "filename");
  3022   3022   	return TCL_ERROR;
  3023   3023       }
  3024         -    filename = Tcl_GetString(objv[1]);
         3024  +    filename = TclGetString(objv[1]);
  3025   3025       ReadLock();
  3026   3026       z = ZipFSLookup(filename);
  3027   3027       if (z) {
  3028   3028   	Tcl_Obj *result = Tcl_GetObjResult(interp);
  3029   3029   
  3030   3030   	Tcl_ListObjAppendElement(interp, result,
  3031   3031   		Tcl_NewStringObj(z->zipFilePtr->name, -1));
................................................................................
  3071   3071       Tcl_Obj *result = Tcl_GetObjResult(interp);
  3072   3072   
  3073   3073       if (objc > 3) {
  3074   3074   	Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?");
  3075   3075   	return TCL_ERROR;
  3076   3076       }
  3077   3077       if (objc == 3) {
  3078         -	int n;
  3079         -	char *what = Tcl_GetStringFromObj(objv[1], &n);
         3078  +	size_t n;
         3079  +	char *what = TclGetStringFromObj(objv[1], &n);
  3080   3080   
  3081   3081   	if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) {
  3082         -	    pattern = Tcl_GetString(objv[2]);
         3082  +	    pattern = TclGetString(objv[2]);
  3083   3083   	} else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) {
  3084         -	    regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2]));
         3084  +	    regexp = Tcl_RegExpCompile(interp, TclGetString(objv[2]));
  3085   3085   	    if (!regexp) {
  3086   3086   		return TCL_ERROR;
  3087   3087   	    }
  3088   3088   	} else {
  3089   3089   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3090   3090   		    "unknown option \"%s\"", what));
  3091   3091   	    Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "BAD_OPT", NULL);
  3092   3092   	    return TCL_ERROR;
  3093   3093   	}
  3094   3094       } else if (objc == 2) {
  3095         -	pattern = Tcl_GetString(objv[1]);
         3095  +	pattern = TclGetString(objv[1]);
  3096   3096       }
  3097   3097       ReadLock();
  3098   3098       if (pattern) {
  3099   3099   	for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search);
  3100   3100   		hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
  3101   3101   	    ZipEntry *z = Tcl_GetHashValue(hPtr);
  3102   3102   
................................................................................
  3705   3705   	    }
  3706   3706   	    goto error;
  3707   3707   	}
  3708   3708   	memset(info->ubuf, 0, info->maxWrite);
  3709   3709   	if (trunc) {
  3710   3710   	    info->numBytes = 0;
  3711   3711   	} else if (z->data) {
  3712         -	    unsigned int j = z->numBytes;
         3712  +	    size_t j = z->numBytes;
  3713   3713   
  3714   3714   	    if (j > info->maxWrite) {
  3715   3715   		j = info->maxWrite;
  3716   3716   	    }
  3717   3717   	    memcpy(info->ubuf, z->data, j);
  3718   3718   	    info->numBytes = j;
  3719   3719   	} else {
................................................................................
  3743   3743   
  3744   3744   		memset(&stream, 0, sizeof(z_stream));
  3745   3745   		stream.zalloc = Z_NULL;
  3746   3746   		stream.zfree = Z_NULL;
  3747   3747   		stream.opaque = Z_NULL;
  3748   3748   		stream.avail_in = z->numCompressedBytes;
  3749   3749   		if (z->isEncrypted) {
  3750         -		    unsigned int j;
         3750  +		    size_t j;
  3751   3751   
  3752   3752   		    stream.avail_in -= 12;
  3753   3753   		    cbuf = Tcl_AttemptAlloc(stream.avail_in);
  3754   3754   		    if (!cbuf) {
  3755   3755   			goto merror0;
  3756   3756   		    }
  3757   3757   		    for (j = 0; j < stream.avail_in; j++) {
................................................................................
  3837   3837   	    }
  3838   3838   	    info->ubuf += i;
  3839   3839   	}
  3840   3840   	if (info->iscompr) {
  3841   3841   	    z_stream stream;
  3842   3842   	    int err;
  3843   3843   	    unsigned char *ubuf = NULL;
  3844         -	    unsigned int j;
         3844  +	    size_t j;
  3845   3845   
  3846   3846   	    memset(&stream, 0, sizeof(z_stream));
  3847   3847   	    stream.zalloc = Z_NULL;
  3848   3848   	    stream.zfree = Z_NULL;
  3849   3849   	    stream.opaque = Z_NULL;
  3850   3850   	    stream.avail_in = z->numCompressedBytes;
  3851   3851   	    if (info->isEncrypted) {
................................................................................
  3907   3907   	    ZIPFS_ERROR(interp, "decompression error");
  3908   3908   	    if (interp) {
  3909   3909   		Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "CORRUPT", NULL);
  3910   3910   	    }
  3911   3911   	    goto error;
  3912   3912   	} else if (info->isEncrypted) {
  3913   3913   	    unsigned char *ubuf = NULL;
  3914         -	    unsigned int j, len;
         3914  +	    size_t j, len;
  3915   3915   
  3916   3916   	    /*
  3917   3917   	     * Decode encrypted but uncompressed file, since we support
  3918   3918   	     * Tcl_Seek() on it, and it can be randomly accessed later.
  3919   3919   	     */
  3920   3920   
  3921   3921   	    len = z->numCompressedBytes - 12;
................................................................................
  4041   4041   static Tcl_Channel
  4042   4042   ZipFSOpenFileChannelProc(
  4043   4043       Tcl_Interp *interp,		/* Current interpreter. */
  4044   4044       Tcl_Obj *pathPtr,
  4045   4045       int mode,
  4046   4046       int permissions)
  4047   4047   {
  4048         -    int len;
  4049         -
  4050   4048       pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4051   4049       if (!pathPtr) {
  4052   4050   	return NULL;
  4053   4051       }
  4054         -    return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), mode,
         4052  +    return ZipChannelOpen(interp, TclGetString(pathPtr), mode,
  4055   4053   	    permissions);
  4056   4054   }
  4057   4055   
  4058   4056   /*
  4059   4057    *-------------------------------------------------------------------------
  4060   4058    *
  4061   4059    * ZipFSStatProc --
................................................................................
  4073   4071    */
  4074   4072   
  4075   4073   static int
  4076   4074   ZipFSStatProc(
  4077   4075       Tcl_Obj *pathPtr,
  4078   4076       Tcl_StatBuf *buf)
  4079   4077   {
  4080         -    int len;
  4081   4078   
  4082   4079       pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4083   4080       if (!pathPtr) {
  4084   4081   	return -1;
  4085   4082       }
  4086         -    return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf);
         4083  +    return ZipEntryStat(TclGetString(pathPtr), buf);
  4087   4084   }
  4088   4085   
  4089   4086   /*
  4090   4087    *-------------------------------------------------------------------------
  4091   4088    *
  4092   4089    * ZipFSAccessProc --
  4093   4090    *
................................................................................
  4104   4101    */
  4105   4102   
  4106   4103   static int
  4107   4104   ZipFSAccessProc(
  4108   4105       Tcl_Obj *pathPtr,
  4109   4106       int mode)
  4110   4107   {
  4111         -    int len;
  4112         -
  4113   4108       pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4114   4109       if (!pathPtr) {
  4115   4110   	return -1;
  4116   4111       }
  4117         -    return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode);
         4112  +    return ZipEntryAccess(TclGetString(pathPtr), mode);
  4118   4113   }
  4119   4114   
  4120   4115   /*
  4121   4116    *-------------------------------------------------------------------------
  4122   4117    *
  4123   4118    * ZipFSFilesystemSeparatorProc --
  4124   4119    *
................................................................................
  4169   4164       Tcl_Obj *pathPtr,
  4170   4165       const char *pattern,
  4171   4166       Tcl_GlobTypeData *types)
  4172   4167   {
  4173   4168       Tcl_HashEntry *hPtr;
  4174   4169       Tcl_HashSearch search;
  4175   4170       Tcl_Obj *normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4176         -    int scnt, l, dirOnly = -1, prefixLen, strip = 0;
  4177         -    size_t len;
         4171  +    int scnt, l, dirOnly = -1, strip = 0;
         4172  +    size_t len, prefixLen;
  4178   4173       char *pat, *prefix, *path;
  4179   4174       Tcl_DString dsPref;
  4180   4175   
  4181   4176       if (!normPathPtr) {
  4182   4177   	return -1;
  4183   4178       }
  4184   4179       if (types) {
................................................................................
  4185   4180   	dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR;
  4186   4181       }
  4187   4182   
  4188   4183       /*
  4189   4184        * The prefix that gets prepended to results.
  4190   4185        */
  4191   4186   
  4192         -    prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen);
         4187  +    prefix = TclGetStringFromObj(pathPtr, &prefixLen);
  4193   4188   
  4194   4189       /*
  4195   4190        * The (normalized) path we're searching.
  4196   4191        */
  4197   4192   
  4198         -    path = Tcl_GetString(normPathPtr);
         4193  +    path = TclGetString(normPathPtr);
  4199   4194       len = normPathPtr->length;
  4200   4195   
  4201   4196       Tcl_DStringInit(&dsPref);
  4202   4197       Tcl_DStringAppend(&dsPref, prefix, prefixLen);
  4203   4198   
  4204   4199       if (strcmp(prefix, path) == 0) {
  4205   4200   	prefix = NULL;
................................................................................
  4364   4359       char *path;
  4365   4360   
  4366   4361       pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4367   4362       if (!pathPtr) {
  4368   4363   	return -1;
  4369   4364       }
  4370   4365   
  4371         -    path = Tcl_GetString(pathPtr);
         4366  +    path = TclGetString(pathPtr);
  4372   4367       if (strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) != 0) {
  4373   4368   	return -1;
  4374   4369       }
  4375   4370   
  4376   4371       len = pathPtr->length;
  4377   4372   
  4378   4373       ReadLock();
................................................................................
  4489   4484   static int
  4490   4485   ZipFSFileAttrsGetProc(
  4491   4486       Tcl_Interp *interp,		/* Current interpreter. */
  4492   4487       int index,
  4493   4488       Tcl_Obj *pathPtr,
  4494   4489       Tcl_Obj **objPtrRef)
  4495   4490   {
  4496         -    int len, ret = TCL_OK;
         4491  +    int ret = TCL_OK;
  4497   4492       char *path;
  4498   4493       ZipEntry *z;
  4499   4494   
  4500   4495       pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  4501   4496       if (!pathPtr) {
  4502   4497   	return -1;
  4503   4498       }
  4504         -    path = Tcl_GetStringFromObj(pathPtr, &len);
         4499  +    path = TclGetString(pathPtr);
  4505   4500       ReadLock();
  4506   4501       z = ZipFSLookup(path);
  4507   4502       if (!z) {
  4508   4503   	Tcl_SetErrno(ENOENT);
  4509   4504   	ZIPFS_POSIX_ERROR(interp, "file not found");
  4510   4505   	ret = TCL_ERROR;
  4511   4506   	goto done;

Changes to generic/tclZlib.c.

   181    181   			    size_t bufferSize, int flush, size_t *writtenPtr);
   182    182   static void		ExtractHeader(gz_header *headerPtr, Tcl_Obj *dictObj);
   183    183   static int		GenerateHeader(Tcl_Interp *interp, Tcl_Obj *dictObj,
   184    184   			    GzipHeader *headerPtr, int *extraSizePtr);
   185    185   static int		ZlibPushSubcmd(Tcl_Interp *interp, int objc,
   186    186   			    Tcl_Obj *const objv[]);
   187    187   static inline int	ResultCopy(ZlibChannelData *cd, char *buf,
   188         -			    int toRead);
          188  +			    size_t toRead);
   189    189   static int		ResultGenerate(ZlibChannelData *cd, int n, int flush,
   190    190   			    int *errorCodePtr);
   191    191   static Tcl_Channel	ZlibStackChannelTransform(Tcl_Interp *interp,
   192    192   			    int mode, int format, int level, int limit,
   193    193   			    Tcl_Channel channel, Tcl_Obj *gzipHeaderDictPtr,
   194    194   			    Tcl_Obj *compDictObj);
   195    195   static void		ZlibStreamCleanup(ZlibStreamHandle *zshPtr);
................................................................................
  3387   3387   	 * Embedded NUL bytes are ok; they'll be C080-encoded.
  3388   3388   	 */
  3389   3389   
  3390   3390   	if (optionName == NULL) {
  3391   3391   	    Tcl_DStringAppendElement(dsPtr, "-dictionary");
  3392   3392   	    if (cd->compDictObj) {
  3393   3393   		Tcl_DStringAppendElement(dsPtr,
  3394         -			Tcl_GetString(cd->compDictObj));
         3394  +			TclGetString(cd->compDictObj));
  3395   3395   	    } else {
  3396   3396   		Tcl_DStringAppendElement(dsPtr, "");
  3397   3397   	    }
  3398   3398   	} else {
  3399   3399   	    if (cd->compDictObj) {
  3400   3400   		const char *str = TclGetString(cd->compDictObj);
  3401   3401   
................................................................................
  3413   3413       if ((cd->flags & IN_HEADER) && ((optionName == NULL) ||
  3414   3414   	    (strcmp(optionName, "-header") == 0))) {
  3415   3415   	Tcl_Obj *tmpObj = Tcl_NewObj();
  3416   3416   
  3417   3417   	ExtractHeader(&cd->inHeader.header, tmpObj);
  3418   3418   	if (optionName == NULL) {
  3419   3419   	    Tcl_DStringAppendElement(dsPtr, "-header");
  3420         -	    Tcl_DStringAppendElement(dsPtr, Tcl_GetString(tmpObj));
         3420  +	    Tcl_DStringAppendElement(dsPtr, TclGetString(tmpObj));
  3421   3421   	    Tcl_DecrRefCount(tmpObj);
  3422   3422   	} else {
  3423   3423   	    TclDStringAppendObj(dsPtr, tmpObj);
  3424   3424   	    Tcl_DecrRefCount(tmpObj);
  3425   3425   	    return TCL_OK;
  3426   3426   	}
  3427   3427       }
................................................................................
  3736   3736    *----------------------------------------------------------------------
  3737   3737    */
  3738   3738   
  3739   3739   static inline int
  3740   3740   ResultCopy(
  3741   3741       ZlibChannelData *cd,	/* The location of the buffer to read from. */
  3742   3742       char *buf,			/* The buffer to copy into */
  3743         -    int toRead)			/* Number of requested bytes */
         3743  +    size_t toRead)			/* Number of requested bytes */
  3744   3744   {
  3745         -    int have = Tcl_DStringLength(&cd->decompressed);
         3745  +    size_t have = Tcl_DStringLength(&cd->decompressed);
  3746   3746   
  3747   3747       if (have == 0) {
  3748   3748   	/*
  3749   3749   	 * Nothing to copy in the case of an empty buffer.
  3750   3750   	 */
  3751   3751   
  3752   3752   	return 0;
................................................................................
  3999   3999       return TCL_OK;
  4000   4000   }
  4001   4001   
  4002   4002   int
  4003   4003   Tcl_ZlibStreamGet(
  4004   4004       Tcl_ZlibStream zshandle,
  4005   4005       Tcl_Obj *data,
  4006         -    int count)
         4006  +    size_t count)
  4007   4007   {
  4008   4008       return TCL_OK;
  4009   4009   }
  4010   4010   
  4011   4011   int
  4012   4012   Tcl_ZlibDeflate(
  4013   4013       Tcl_Interp *interp,
................................................................................
  4037   4037       }
  4038   4038       return TCL_ERROR;
  4039   4039   }
  4040   4040   
  4041   4041   unsigned int
  4042   4042   Tcl_ZlibCRC32(
  4043   4043       unsigned int crc,
  4044         -    const char *buf,
         4044  +    const unsigned char *buf,
  4045   4045       size_t len)
  4046   4046   {
  4047   4047       return 0;
  4048   4048   }
  4049   4049   
  4050   4050   unsigned int
  4051   4051   Tcl_ZlibAdler32(
  4052   4052       unsigned int adler,
  4053         -    const char *buf,
         4053  +    const unsigned char *buf,
  4054   4054       size_t len)
  4055   4055   {
  4056   4056       return 0;
  4057   4057   }
  4058   4058   
  4059   4059   void
  4060   4060   Tcl_ZlibStreamSetCompressionDictionary(

Changes to libtommath/bn_mp_prime_is_prime.c.

    67     67         if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) {
    68     68            *result = MP_YES;
    69     69            return MP_OKAY;
    70     70         }
    71     71      }
    72     72   #ifdef MP_8BIT
    73     73      /* The search in the loop above was exhaustive in this case */
    74         -   if (a->used == 1 && PRIME_SIZE >= 31) {
           74  +   if ((a->used == 1) && (PRIME_SIZE >= 31)) {
    75     75         return MP_OKAY;
    76     76      }
    77     77   #endif
    78     78   
    79     79      /* first perform trial division */
    80     80      if ((err = mp_prime_is_divisible(a, &res)) != MP_OKAY) {
    81     81         return err;
................................................................................
   122    122         /*
   123    123          * Use a Frobenius-Underwood test instead of the Lucas-Selfridge test for
   124    124          * MP_8BIT (It is unknown if the Lucas-Selfridge test works with 16-bit
   125    125          * integers but the necesssary analysis is on the todo-list).
   126    126          */
   127    127   #if defined (MP_8BIT) || defined (LTM_USE_FROBENIUS_TEST)
   128    128         err = mp_prime_frobenius_underwood(a, &res);
   129         -      if (err != MP_OKAY && err != MP_ITER) {
          129  +      if ((err != MP_OKAY) && (err != MP_ITER)) {
   130    130            goto LBL_B;
   131    131         }
   132    132         if (res == MP_NO) {
   133    133            goto LBL_B;
   134    134         }
   135    135   #else
   136    136         if ((err = mp_prime_strong_lucas_selfridge(a, &res)) != MP_OKAY) {
................................................................................
   292    292             */
   293    293            fips_rand = (unsigned int)(b.dp[0] & (mp_digit) mask);
   294    294   #ifdef MP_8BIT
   295    295            /*
   296    296             * One 8-bit digit is too small, so concatenate two if the size of
   297    297             * unsigned int allows for it.
   298    298             */
   299         -         if ((sizeof(unsigned int) * CHAR_BIT)/2 >= (sizeof(mp_digit) * CHAR_BIT)) {
          299  +         if (((sizeof(unsigned int) * CHAR_BIT)/2) >= (sizeof(mp_digit) * CHAR_BIT)) {
   300    300               if ((err = mp_rand(&b, 1)) != MP_OKAY) {
   301    301                  goto LBL_B;
   302    302               }
   303    303               fips_rand <<= sizeof(mp_digit) * CHAR_BIT;
   304    304               fips_rand |= (unsigned int) b.dp[0];
   305    305               fips_rand &= mask;
   306    306            }
   307    307   #endif
   308         -         if (fips_rand > ((unsigned int) INT_MAX - DIGIT_BIT)) {
          308  +         if (fips_rand > (unsigned int)(INT_MAX - DIGIT_BIT)) {
   309    309               len = INT_MAX / DIGIT_BIT;
   310         -         }
   311         -         else {
          310  +         } else {
   312    311               len = (((int)fips_rand + DIGIT_BIT) / DIGIT_BIT);
   313    312            }
   314    313            /*  Unlikely. */
   315    314            if (len < 0) {
   316    315               ix--;
   317    316               continue;
   318    317            }

Changes to libtommath/changes.txt.

            1  +Jan 28th, 2019
            2  +v1.1.0
            3  +       -- Christoph Zurnieden contributed FIPS 186.4 compliant
            4  +          prime-checking (PR #113), several other fixes and a load of documentation
            5  +       -- Daniel Mendler provided two's-complement functions (PR #124)
            6  +          and mp_{set,get}_double() (PR #123)
            7  +       -- Francois Perrad took care of linting the sources, provided all fixes and
            8  +          a astylerc to auto-format the sources.
            9  +       -- A bunch of patches by Kevin B Kenny have been back-ported from TCL
           10  +       -- Jan Nijtmans provided the patches to `const`ify all API
           11  +          function arguments (also from TCL)
           12  +       -- mp_rand() has now several native random provider implementations
           13  +          and doesn't rely on `rand()` anymore
           14  +       -- Karel Miko provided fixes when building for MS Windows
           15  +          and re-worked the makefile generating process
           16  +       -- The entire environment and build logic has been extended and improved
           17  +          regarding auto-detection of platforms, libtool and a lot more
           18  +       -- Prevent some potential BOF cases
           19  +       -- Improved/fixed mp_lshd() and mp_invmod()
           20  +       -- A load more bugs were fixed by various contributors
           21  +
           22  +
     1     23   Aug 29th, 2017
     2     24   v1.0.1
     3     25          -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy()
     4     26          -- Matt Johnston contributed some improvements to mp_div_2d(),
     5     27             mp_exptmod_fast(), mp_mod() and mp_mulmod()
     6     28          -- Julien Nabet provided a fix to the error handling in mp_init_multi()
     7     29          -- Ben Gardner provided a fix regarding usage of reserved keywords

Added libtommath/libtommath_VS2008.sln.

            1  +
            2  +Microsoft Visual Studio Solution File, Format Version 10.00
            3  +# Visual Studio 2008
            4  +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}"
            5  +EndProject
            6  +Global
            7  +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
            8  +		Debug|Win32 = Debug|Win32
            9  +		Debug|x64 = Debug|x64
           10  +		Release|Win32 = Release|Win32
           11  +		Release|x64 = Release|x64
           12  +	EndGlobalSection
           13  +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
           14  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.ActiveCfg = Debug|Win32
           15  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.Build.0 = Debug|Win32
           16  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|x64.ActiveCfg = Debug|x64
           17  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|x64.Build.0 = Debug|x64
           18  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.ActiveCfg = Release|Win32
           19  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.Build.0 = Release|Win32
           20  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|x64.ActiveCfg = Release|x64
           21  +		{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|x64.Build.0 = Release|x64
           22  +	EndGlobalSection
           23  +	GlobalSection(SolutionProperties) = preSolution
           24  +		HideSolutionNode = FALSE
           25  +	EndGlobalSection
           26  +	GlobalSection(ExtensibilityGlobals) = postSolution
           27  +		SolutionGuid = {83B84178-7B4F-4B78-9C5D-17B8201D5B61}
           28  +	EndGlobalSection
           29  +EndGlobal

Added libtommath/libtommath_VS2008.vcproj.

            1  +<?xml version="1.0" encoding="Windows-1252"?>
            2  +<VisualStudioProject
            3  +	ProjectType="Visual C++"
            4  +	Version="9.00"
            5  +	Name="tommath"
            6  +	ProjectGUID="{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}"
            7  +	RootNamespace="tommath"
            8  +	TargetFrameworkVersion="0"
            9  +	>
           10  +	<Platforms>
           11  +		<Platform
           12  +			Name="Win32"
           13  +		/>
           14  +		<Platform
           15  +			Name="x64"
           16  +		/>
           17  +	</Platforms>
           18  +	<ToolFiles>
           19  +	</ToolFiles>
           20  +	<Configurations>
           21  +		<Configuration
           22  +			Name="Debug|Win32"
           23  +			OutputDirectory="MSVC_$(PlatformName)_$(ConfigurationName)"
           24  +			IntermediateDirectory="MSVC_$(PlatformName)_$(ConfigurationName)\Intermediate"
           25  +			ConfigurationType="4"
           26  +			UseOfMFC="0"
           27  +			ATLMinimizesCRunTimeLibraryUsage="false"
           28  +			CharacterSet="0"
           29  +			>
           30  +			<Tool
           31  +				Name="VCPreBuildEventTool"
           32  +			/>
           33  +			<Tool
           34  +				Name="VCCustomBuildTool"
           35  +			/>
           36  +			<Tool
           37  +				Name="VCXMLDataGeneratorTool"
           38  +			/>
           39  +			<Tool
           40  +				Name="VCMIDLTool"
           41  +			/>
           42  +			<Tool
           43  +				Name="VCCLCompilerTool"
           44  +				Optimization="0"
           45  +				AdditionalIncludeDirectories="."
           46  +				PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
           47  +				MinimalRebuild="true"
           48  +				ExceptionHandling="0"
           49  +				BasicRuntimeChecks="3"
           50  +				RuntimeLibrary="1"
           51  +				PrecompiledHeaderFile="$(IntDir)\libtomcrypt.pch"
           52  +				AssemblerListingLocation="$(IntDir)\"
           53  +				ObjectFile="$(IntDir)\"
           54  +				ProgramDataBaseFileName="$(IntDir)\"
           55  +				WarningLevel="3"
           56  +				SuppressStartupBanner="true"
           57  +				DebugInformationFormat="4"
           58  +				CompileAs="1"
           59  +			/>
           60  +			<Tool
           61  +				Name="VCManagedResourceCompilerTool"
           62  +			/>
           63  +			<Tool
           64  +				Name="VCResourceCompilerTool"
           65  +				PreprocessorDefinitions="_DEBUG"
           66  +				Culture="1033"
           67  +			/>
           68  +			<Tool
           69  +				Name="VCPreLinkEventTool"
           70  +			/>
           71  +			<Tool
           72  +				Name="VCLibrarianTool"
           73  +				OutputFile="$(OutDir)\tommath.lib"
           74  +				SuppressStartupBanner="true"
           75  +			/>
           76  +			<Tool
           77  +				Name="VCALinkTool"
           78  +			/>
           79  +			<Tool
           80  +				Name="VCXDCMakeTool"
           81  +			/>
           82  +			<Tool
           83  +				Name="VCBscMakeTool"
           84  +				SuppressStartupBanner="true"
           85  +				OutputFile="$(OutDir)\tommath.bsc"
           86  +			/>
           87  +			<Tool
           88  +				Name="VCFxCopTool"
           89  +			/>
           90  +			<Tool
           91  +				Name="VCPostBuildEventTool"
           92  +			/>
           93  +		</Configuration>
           94  +		<Configuration
           95  +			Name="Debug|x64"
           96  +			OutputDirectory="MSVC_$(PlatformName)_$(ConfigurationName)"
           97  +			IntermediateDirectory="MSVC_$(PlatformName)_$(ConfigurationName)\Intermediate"
           98  +			ConfigurationType="4"
           99  +			UseOfMFC="0"
          100  +			ATLMinimizesCRunTimeLibraryUsage="false"
          101  +			CharacterSet="0"
          102  +			>
          103  +			<Tool
          104  +				Name="VCPreBuildEventTool"
          105  +			/>
          106  +			<Tool
          107  +				Name="VCCustomBuildTool"
          108  +			/>
          109  +			<Tool
          110  +				Name="VCXMLDataGeneratorTool"
          111  +			/>
          112  +			<Tool
          113  +				Name="VCMIDLTool"
          114  +				TargetEnvironment="3"
          115  +			/>
          116  +			<Tool
          117  +				Name="VCCLCompilerTool"
          118  +				Optimization="0"
          119  +				AdditionalIncludeDirectories="."
          120  +				PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
          121  +				MinimalRebuild="true"
          122  +				ExceptionHandling="0"
          123  +				BasicRuntimeChecks="3"
          124  +				RuntimeLibrary="1"
          125  +				PrecompiledHeaderFile="$(IntDir)\libtomcrypt.pch"
          126  +				AssemblerListingLocation="$(IntDir)\"
          127  +				ObjectFile="$(IntDir)\"
          128  +				ProgramDataBaseFileName="$(IntDir)\"
          129  +				WarningLevel="3"
          130  +				SuppressStartupBanner="true"
          131  +				DebugInformationFormat="3"
          132  +				CompileAs="1"
          133  +			/>
          134  +			<Tool
          135  +				Name="VCManagedResourceCompilerTool"
          136  +			/>
          137  +			<Tool
          138  +				Name="VCResourceCompilerTool"
          139  +				PreprocessorDefinitions="_DEBUG"
          140  +				Culture="1033"
          141  +			/>
          142  +			<Tool
          143  +				Name="VCPreLinkEventTool"
          144  +			/>
          145  +			<Tool
          146  +				Name="VCLibrarianTool"
          147  +				OutputFile="$(OutDir)\tommath.lib"
          148  +				SuppressStartupBanner="true"
          149  +			/>
          150  +			<Tool
          151  +				Name="VCALinkTool"
          152  +			/>
          153  +			<Tool
          154  +				Name="VCXDCMakeTool"
          155  +			/>
          156  +			<Tool
          157  +				Name="VCBscMakeTool"
          158  +				SuppressStartupBanner="true"
          159  +				OutputFile="$(OutDir)\tommath.bsc"
          160  +			/>
          161  +			<Tool
          162  +				Name="VCFxCopTool"
          163  +			/>
          164  +			<Tool
          165  +				Name="VCPostBuildEventTool"
          166  +			/>
          167  +		</Configuration>
          168  +		<Configuration
          169  +			Name="Release|Win32"
          170  +			OutputDirectory="MSVC_$(PlatformName)_$(ConfigurationName)"
          171  +			IntermediateDirectory="MSVC_$(PlatformName)_$(ConfigurationName)\Intermediate"
          172  +			ConfigurationType="4"
          173  +			UseOfMFC="0"
          174  +			ATLMinimizesCRunTimeLibraryUsage="false"
          175  +			CharacterSet="0"
          176  +			>
          177  +			<Tool
          178  +				Name="VCPreBuildEventTool"
          179  +			/>
          180  +			<Tool
          181  +				Name="VCCustomBuildTool"
          182  +			/>
          183  +			<Tool
          184  +				Name="VCXMLDataGeneratorTool"
          185  +			/>
          186  +			<Tool
          187  +				Name="VCMIDLTool"
          188  +			/>
          189  +			<Tool
          190  +				Name="VCCLCompilerTool"
          191  +				Optimization="2"
          192  +				InlineFunctionExpansion="1"
          193  +				AdditionalIncludeDirectories="."
          194  +				PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
          195  +				StringPooling="true"
          196  +				RuntimeLibrary="0"
          197  +				EnableFunctionLevelLinking="true"
          198  +				PrecompiledHeaderFile="$(IntDir)\libtomcrypt.pch"
          199  +				AssemblerListingLocation="$(IntDir)\"
          200  +				ObjectFile="$(IntDir)\"
          201  +				ProgramDataBaseFileName="$(IntDir)\"
          202  +				WarningLevel="3"
          203  +				SuppressStartupBanner="true"
          204  +			/>
          205  +			<Tool
          206  +				Name="VCManagedResourceCompilerTool"
          207  +			/>
          208  +			<Tool
          209  +				Name="VCResourceCompilerTool"
          210  +				PreprocessorDefinitions="NDEBUG"
          211  +				Culture="1033"
          212  +			/>
          213  +			<Tool
          214  +				Name="VCPreLinkEventTool"
          215  +			/>
          216  +			<Tool
          217  +				Name="VCLibrarianTool"
          218  +				OutputFile="$(OutDir)\tommath.lib"
          219  +				SuppressStartupBanner="true"
          220  +			/>
          221  +			<Tool
          222  +				Name="VCALinkTool"
          223  +			/>
          224  +			<Tool
          225  +				Name="VCXDCMakeTool"
          226  +			/>
          227  +			<Tool
          228  +				Name="VCBscMakeTool"
          229  +				SuppressStartupBanner="true"
          230  +				OutputFile="$(OutDir)\tommath.bsc"
          231  +			/>
          232  +			<Tool
          233  +				Name="VCFxCopTool"
          234  +			/>
          235  +			<Tool
          236  +				Name="VCPostBuildEventTool"
          237  +			/>
          238  +		</Configuration>
          239  +		<Configuration
          240  +			Name="Release|x64"
          241  +			OutputDirectory="MSVC_$(PlatformName)_$(ConfigurationName)"
          242  +			IntermediateDirectory="MSVC_$(PlatformName)_$(ConfigurationName)\Intermediate"
          243  +			ConfigurationType="4"
          244  +			UseOfMFC="0"
          245  +			ATLMinimizesCRunTimeLibraryUsage="false"
          246  +			CharacterSet="0"
          247  +			>
          248  +			<Tool
          249  +				Name="VCPreBuildEventTool"
          250  +			/>
          251  +			<Tool
          252  +				Name="VCCustomBuildTool"
          253  +			/>
          254  +			<Tool
          255  +				Name="VCXMLDataGeneratorTool"
          256  +			/>
          257  +			<Tool
          258  +				Name="VCMIDLTool"
          259  +				TargetEnvironment="3"
          260  +			/>
          261  +			<Tool
          262  +				Name="VCCLCompilerTool"
          263  +				Optimization="2"
          264  +				InlineFunctionExpansion="1"
          265  +				AdditionalIncludeDirectories="."
          266  +				PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
          267  +				StringPooling="true"
          268  +				RuntimeLibrary="0"
          269  +				EnableFunctionLevelLinking="true"
          270  +				PrecompiledHeaderFile="$(IntDir)\libtomcrypt.pch"
          271  +				AssemblerListingLocation="$(IntDir)\"
          272  +				ObjectFile="$(IntDir)\"
          273  +				ProgramDataBaseFileName="$(IntDir)\"
          274  +				WarningLevel="3"
          275  +				SuppressStartupBanner="true"
          276  +			/>
          277  +			<Tool
          278  +				Name="VCManagedResourceCompilerTool"
          279  +			/>
          280  +			<Tool
          281  +				Name="VCResourceCompilerTool"
          282  +				PreprocessorDefinitions="NDEBUG"
          283  +				Culture="1033"
          284  +			/>
          285  +			<Tool
          286  +				Name="VCPreLinkEventTool"
          287  +			/>
          288  +			<Tool
          289  +				Name="VCLibrarianTool"
          290  +				OutputFile="$(OutDir)\tommath.lib"
          291  +				SuppressStartupBanner="true"
          292  +			/>
          293  +			<Tool
          294  +				Name="VCALinkTool"
          295  +			/>
          296  +			<Tool
          297  +				Name="VCXDCMakeTool"
          298  +			/>
          299  +			<Tool
          300  +				Name="VCBscMakeTool"
          301  +				SuppressStartupBanner="true"
          302  +				OutputFile="$(OutDir)\tommath.bsc"
          303  +			/>
          304  +			<Tool
          305  +				Name="VCFxCopTool"
          306  +			/>
          307  +			<Tool
          308  +				Name="VCPostBuildEventTool"
          309  +			/>
          310  +		</Configuration>
          311  +	</Configurations>
          312  +	<References>
          313  +	</References>
          314  +	<Files>
          315  +		<File
          316  +			RelativePath="bn_error.c"
          317  +			>
          318  +		</File>
          319  +		<File
          320  +			RelativePath="bn_fast_mp_invmod.c"
          321  +			>
          322  +		</File>
          323  +		<File
          324  +			RelativePath="bn_fast_mp_montgomery_reduce.c"
          325  +			>
          326  +		</File>
          327  +		<File
          328  +			RelativePath="bn_fast_s_mp_mul_digs.c"
          329  +			>
          330  +		</File>
          331  +		<File
          332  +			RelativePath="bn_fast_s_mp_mul_high_digs.c"
          333  +			>
          334  +		</File>
          335  +		<File
          336  +			RelativePath="bn_fast_s_mp_sqr.c"
          337  +			>
          338  +		</File>
          339  +		<File
          340  +			RelativePath="bn_mp_2expt.c"
          341  +			>
          342  +		</File>
          343  +		<File
          344  +			RelativePath="bn_mp_abs.c"
          345  +			>
          346  +		</File>
          347  +		<File
          348  +			RelativePath="bn_mp_add.c"
          349  +			>
          350  +		</File>
          351  +		<File
          352  +			RelativePath="bn_mp_add_d.c"
          353  +			>
          354  +		</File>
          355  +		<File
          356  +			RelativePath="bn_mp_addmod.c"
          357  +			>
          358  +		</File>
          359  +		<File
          360  +			RelativePath="bn_mp_and.c"
          361  +			>
          362  +		</File>
          363  +		<File
          364  +			RelativePath="bn_mp_clamp.c"
          365  +			>
          366  +		</File>
          367  +		<File
          368  +			RelativePath="bn_mp_clear.c"
          369  +			>
          370  +		</File>
          371  +		<File
          372  +			RelativePath="bn_mp_clear_multi.c"
          373  +			>
          374  +		</File>
          375  +		<File
          376  +			RelativePath="bn_mp_cmp.c"
          377  +			>
          378  +		</File>
          379  +		<File
          380  +			RelativePath="bn_mp_cmp_d.c"
          381  +			>
          382  +		</File>
          383  +		<File
          384  +			RelativePath="bn_mp_cmp_mag.c"
          385  +			>
          386  +		</File>
          387  +		<File
          388  +			RelativePath="bn_mp_cnt_lsb.c"
          389  +			>
          390  +		</File>
          391  +		<File
          392  +			RelativePath="bn_mp_complement.c"
          393  +			>
          394  +		</File>
          395  +		<File
          396  +			RelativePath="bn_mp_copy.c"
          397  +			>
          398  +		</File>
          399  +		<File
          400  +			RelativePath="bn_mp_count_bits.c"
          401  +			>
          402  +		</File>
          403  +		<File
          404  +			RelativePath="bn_mp_div.c"
          405  +			>
          406  +		</File>
          407  +		<File
          408  +			RelativePath="bn_mp_div_2.c"
          409  +			>
          410  +		</File>
          411  +		<File
          412  +			RelativePath="bn_mp_div_2d.c"
          413  +			>
          414  +		</File>
          415  +		<File
          416  +			RelativePath="bn_mp_div_3.c"
          417  +			>
          418  +		</File>
          419  +		<File
          420  +			RelativePath="bn_mp_div_d.c"
          421  +			>
          422  +		</File>
          423  +		<File
          424  +			RelativePath="bn_mp_dr_is_modulus.c"
          425  +			>
          426  +		</File>
          427  +		<File
          428  +			RelativePath="bn_mp_dr_reduce.c"
          429  +			>
          430  +		</File>
          431  +		<File
          432  +			RelativePath="bn_mp_dr_setup.c"
          433  +			>
          434  +		</File>
          435  +		<File
          436  +			RelativePath="bn_mp_exch.c"
          437  +			>
          438  +		</File>
          439  +		<File
          440  +			RelativePath="bn_mp_export.c"
          441  +			>
          442  +		</File>
          443  +		<File
          444  +			RelativePath="bn_mp_expt_d.c"
          445  +			>
          446  +		</File>
          447  +		<File
          448  +			RelativePath="bn_mp_expt_d_ex.c"
          449  +			>
          450  +		</File>
          451  +		<File
          452  +			RelativePath="bn_mp_exptmod.c"
          453  +			>
          454  +		</File>
          455  +		<File
          456  +			RelativePath="bn_mp_exptmod_fast.c"
          457  +			>
          458  +		</File>
          459  +		<File
          460  +			RelativePath="bn_mp_exteuclid.c"
          461  +			>
          462  +		</File>
          463  +		<File
          464  +			RelativePath="bn_mp_fread.c"
          465  +			>
          466  +		</File>
          467  +		<File
          468  +			RelativePath="bn_mp_fwrite.c"
          469  +			>
          470  +		</File>
          471  +		<File
          472  +			RelativePath="bn_mp_gcd.c"
          473  +			>
          474  +		</File>
          475  +		<File
          476  +			RelativePath="bn_mp_get_bit.c"
          477  +			>
          478  +		</File>
          479  +		<File
          480  +			RelativePath="bn_mp_get_double.c"
          481  +			>
          482  +		</File>
          483  +		<File
          484  +			RelativePath="bn_mp_get_int.c"
          485  +			>
          486  +		</File>
          487  +		<File
          488  +			RelativePath="bn_mp_get_long.c"
          489  +			>
          490  +		</File>
          491  +		<File
          492  +			RelativePath="bn_mp_get_long_long.c"
          493  +			>
          494  +		</File>
          495  +		<File
          496  +			RelativePath="bn_mp_grow.c"
          497  +			>
          498  +		</File>
          499  +		<File
          500  +			RelativePath="bn_mp_import.c"
          501  +			>
          502  +		</File>
          503  +		<File
          504  +			RelativePath="bn_mp_init.c"
          505  +			>
          506  +		</File>
          507  +		<File
          508  +			RelativePath="bn_mp_init_copy.c"
          509  +			>
          510  +		</File>
          511  +		<File
          512  +			RelativePath="bn_mp_init_multi.c"
          513  +			>
          514  +		</File>
          515  +		<File
          516  +			RelativePath="bn_mp_init_set.c"
          517  +			>
          518  +		</File>
          519  +		<File
          520  +			RelativePath="bn_mp_init_set_int.c"
          521  +			>
          522  +		</File>
          523  +		<File
          524  +			RelativePath="bn_mp_init_size.c"
          525  +			>
          526  +		</File>
          527  +		<File
          528  +			RelativePath="bn_mp_invmod.c"
          529  +			>
          530  +		</File>
          531  +		<File
          532  +			RelativePath="bn_mp_invmod_slow.c"
          533  +			>
          534  +		</File>
          535  +		<File
          536  +			RelativePath="bn_mp_is_square.c"
          537  +			>
          538  +		</File>
          539  +		<File
          540  +			RelativePath="bn_mp_jacobi.c"
          541  +			>
          542  +		</File>
          543  +		<File
          544  +			RelativePath="bn_mp_karatsuba_mul.c"
          545  +			>
          546  +		</File>
          547  +		<File
          548  +			RelativePath="bn_mp_karatsuba_sqr.c"
          549  +			>
          550  +		</File>
          551  +		<File
          552  +			RelativePath="bn_mp_kronecker.c"
          553  +			>
          554  +		</File>
          555  +		<File
          556  +			RelativePath="bn_mp_lcm.c"
          557  +			>
          558  +		</File>
          559  +		<File
          560  +			RelativePath="bn_mp_lshd.c"
          561  +			>
          562  +		</File>
          563  +		<File
          564  +			RelativePath="bn_mp_mod.c"
          565  +			>
          566  +		</File>
          567  +		<File
          568  +			RelativePath="bn_mp_mod_2d.c"
          569  +			>
          570  +		</File>
          571  +		<File
          572  +			RelativePath="bn_mp_mod_d.c"
          573  +			>
          574  +		</File>
          575  +		<File
          576  +			RelativePath="bn_mp_montgomery_calc_normalization.c"
          577  +			>
          578  +		</File>
          579  +		<File
          580  +			RelativePath="bn_mp_montgomery_reduce.c"
          581  +			>
          582  +		</File>
          583  +		<File
          584  +			RelativePath="bn_mp_montgomery_setup.c"
          585  +			>
          586  +		</File>
          587  +		<File
          588  +			RelativePath="bn_mp_mul.c"
          589  +			>
          590  +		</File>
          591  +		<File
          592  +			RelativePath="bn_mp_mul_2.c"
          593  +			>
          594  +		</File>
          595  +		<File
          596  +			RelativePath="bn_mp_mul_2d.c"
          597  +			>
          598  +		</File>
          599  +		<File
          600  +			RelativePath="bn_mp_mul_d.c"
          601  +			>
          602  +		</File>
          603  +		<File
          604  +			RelativePath="bn_mp_mulmod.c"
          605  +			>
          606  +		</File>
          607  +		<File
          608  +			RelativePath="bn_mp_n_root.c"
          609  +			>
          610  +		</File>
          611  +		<File
          612  +			RelativePath="bn_mp_n_root_ex.c"
          613  +			>
          614  +		</File>
          615  +		<File
          616  +			RelativePath="bn_mp_neg.c"
          617  +			>
          618  +		</File>
          619  +		<File
          620  +			RelativePath="bn_mp_or.c"
          621  +			>
          622  +		</File>
          623  +		<File
          624  +			RelativePath="bn_mp_prime_fermat.c"
          625  +			>
          626  +		</File>
          627  +		<File
          628  +			RelativePath="bn_mp_prime_frobenius_underwood.c"
          629  +			>
          630  +		</File>
          631  +		<File
          632  +			RelativePath="bn_mp_prime_is_divisible.c"
          633  +			>
          634  +		</File>
          635  +		<File
          636  +			RelativePath="bn_mp_prime_is_prime.c"
          637  +			>
          638  +		</File>
          639  +		<File
          640  +			RelativePath="bn_mp_prime_miller_rabin.c"
          641  +			>
          642  +		</File>
          643  +		<File
          644  +			RelativePath="bn_mp_prime_next_prime.c"
          645  +			>
          646  +		</File>
          647  +		<File
          648  +			RelativePath="bn_mp_prime_rabin_miller_trials.c"
          649  +			>
          650  +		</File>
          651  +		<File
          652  +			RelativePath="bn_mp_prime_random_ex.c"
          653  +			>
          654  +		</File>
          655  +		<File
          656  +			RelativePath="bn_mp_prime_strong_lucas_selfridge.c"
          657  +			>
          658  +		</File>
          659  +		<File
          660  +			RelativePath="bn_mp_radix_size.c"
          661  +			>
          662  +		</File>
          663  +		<File
          664  +			RelativePath="bn_mp_radix_smap.c"
          665  +			>
          666  +		</File>
          667  +		<File
          668  +			RelativePath="bn_mp_rand.c"
          669  +			>
          670  +		</File>
          671  +		<File
          672  +			RelativePath="bn_mp_read_radix.c"
          673  +			>
          674  +		</File>
          675  +		<File
          676  +			RelativePath="bn_mp_read_signed_bin.c"
          677  +			>
          678  +		</File>
          679  +		<File
          680  +			RelativePath="bn_mp_read_unsigned_bin.c"
          681  +			>
          682  +		</File>
          683  +		<File
          684  +			RelativePath="bn_mp_reduce.c"
          685  +			>
          686  +		</File>
          687  +		<File
          688  +			RelativePath="bn_mp_reduce_2k.c"
          689  +			>
          690  +		</File>
          691  +		<File
          692  +			RelativePath="bn_mp_reduce_2k_l.c"
          693  +			>
          694  +		</File>
          695  +		<File
          696  +			RelativePath="bn_mp_reduce_2k_setup.c"
          697  +			>
          698  +		</File>
          699  +		<File
          700  +			RelativePath="bn_mp_reduce_2k_setup_l.c"
          701  +			>
          702  +		</File>
          703  +		<File
          704  +			RelativePath="bn_mp_reduce_is_2k.c"
          705  +			>
          706  +		</File>
          707  +		<File
          708  +			RelativePath="bn_mp_reduce_is_2k_l.c"
          709  +			>
          710  +		</File>
          711  +		<File
          712  +			RelativePath="bn_mp_reduce_setup.c"
          713  +			>
          714  +		</File>
          715  +		<File
          716  +			RelativePath="bn_mp_rshd.c"
          717  +			>
          718  +		</File>
          719  +		<File
          720  +			RelativePath="bn_mp_set.c"
          721  +			>
          722  +		</File>
          723  +		<File
          724  +			RelativePath="bn_mp_set_double.c"
          725  +			>
          726  +		</File>
          727  +		<File
          728  +			RelativePath="bn_mp_set_int.c"
          729  +			>
          730  +		</File>
          731  +		<File
          732  +			RelativePath="bn_mp_set_long.c"
          733  +			>
          734  +		</File>
          735  +		<File
          736  +			RelativePath="bn_mp_set_long_long.c"
          737  +			>
          738  +		</File>
          739  +		<File
          740  +			RelativePath="bn_mp_shrink.c"
          741  +			>
          742  +		</File>
          743  +		<File
          744  +			RelativePath="bn_mp_signed_bin_size.c"
          745  +			>
          746  +		</File>
          747  +		<File
          748  +			RelativePath="bn_mp_sqr.c"
          749  +			>
          750  +		</File>
          751  +		<File
          752  +			RelativePath="bn_mp_sqrmod.c"
          753  +			>
          754  +		</File>
          755  +		<File
          756  +			RelativePath="bn_mp_sqrt.c"
          757  +			>
          758  +		</File>
          759  +		<File
          760  +			RelativePath="bn_mp_sqrtmod_prime.c"
          761  +			>
          762  +		</File>
          763  +		<File
          764  +			RelativePath="bn_mp_sub.c"
          765  +			>
          766  +		</File>
          767  +		<File
          768  +			RelativePath="bn_mp_sub_d.c"
          769  +			>
          770  +		</File>
          771  +		<File
          772  +			RelativePath="bn_mp_submod.c"
          773  +			>
          774  +		</File>
          775  +		<File
          776  +			RelativePath="bn_mp_tc_and.c"
          777  +			>
          778  +		</File>
          779  +		<File
          780  +			RelativePath="bn_mp_tc_div_2d.c"
          781  +			>
          782  +		</File>
          783  +		<File
          784  +			RelativePath="bn_mp_tc_or.c"
          785  +			>
          786  +		</File>
          787  +		<File
          788  +			RelativePath="bn_mp_tc_xor.c"
          789  +			>
          790  +		</File>
          791  +		<File
          792  +			RelativePath="bn_mp_to_signed_bin.c"
          793  +			>
          794  +		</File>
          795  +		<File
          796  +			RelativePath="bn_mp_to_signed_bin_n.c"
          797  +			>
          798  +		</File>
          799  +		<File
          800  +			RelativePath="bn_mp_to_unsigned_bin.c"
          801  +			>
          802  +		</File>
          803  +		<File
          804  +			RelativePath="bn_mp_to_unsigned_bin_n.c"
          805  +			>
          806  +		</File>
          807  +		<File
          808  +			RelativePath="bn_mp_toom_mul.c"
          809  +			>
          810  +		</File>
          811  +		<File
          812  +			RelativePath="bn_mp_toom_sqr.c"
          813  +			>
          814  +		</File>
          815  +		<File
          816  +			RelativePath="bn_mp_toradix.c"
          817  +			>
          818  +		</File>
          819  +		<File
          820  +			RelativePath="bn_mp_toradix_n.c"
          821  +			>
          822  +		</File>
          823  +		<File
          824  +			RelativePath="bn_mp_unsigned_bin_size.c"
          825  +			>
          826  +		</File>
          827  +		<File
          828  +			RelativePath="bn_mp_xor.c"
          829  +			>
          830  +		</File>
          831  +		<File
          832  +			RelativePath="bn_mp_zero.c"
          833  +			>
          834  +		</File>
          835  +		<File
          836  +			RelativePath="bn_prime_tab.c"
          837  +			>
          838  +		</File>
          839  +		<File
          840  +			RelativePath="bn_reverse.c"
          841  +			>
          842  +		</File>
          843  +		<File
          844  +			RelativePath="bn_s_mp_add.c"
          845  +			>
          846  +		</File>
          847  +		<File
          848  +			RelativePath="bn_s_mp_exptmod.c"
          849  +			>
          850  +		</File>
          851  +		<File
          852  +			RelativePath="bn_s_mp_mul_digs.c"
          853  +			>
          854  +		</File>
          855  +		<File
          856  +			RelativePath="bn_s_mp_mul_high_digs.c"
          857  +			>
          858  +		</File>
          859  +		<File
          860  +			RelativePath="bn_s_mp_sqr.c"
          861  +			>
          862  +		</File>
          863  +		<File
          864  +			RelativePath="bn_s_mp_sub.c"
          865  +			>
          866  +		</File>
          867  +		<File
          868  +			RelativePath="bncore.c"
          869  +			>
          870  +		</File>
          871  +		<File
          872  +			RelativePath="tommath.h"
          873  +			>
          874  +		</File>
          875  +		<File
          876  +			RelativePath="tommath_class.h"
          877  +			>
          878  +		</File>
          879  +		<File
          880  +			RelativePath="tommath_private.h"
          881  +			>
          882  +		</File>
          883  +		<File
          884  +			RelativePath="tommath_superclass.h"
          885  +			>
          886  +		</File>
          887  +	</Files>
          888  +	<Globals>
          889  +	</Globals>
          890  +</VisualStudioProject>

Changes to libtommath/makefile.

   137    137   	@echo 'fixme check'
   138    138   	[email protected](find libtommath-$(VERSION)/ -type f | xargs grep 'FIXM[E]') && echo '############## BEWARE: the "fixme" marker was found !!! ##############' || true
   139    139   	mkdir -p libtommath-$(VERSION)/doc
   140    140   	cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
   141    141   	$(MAKE) -C libtommath-$(VERSION)/ pre_gen
   142    142   	tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
   143    143   	zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
          144  +	cp doc/bn.pdf bn-$(VERSION).pdf
          145  +	cp doc/tommath.pdf tommath-$(VERSION).pdf
   144    146   	rm -rf libtommath-$(VERSION)
   145    147   	gpg -b -a ltm-$(VERSION).tar.xz
   146    148   	gpg -b -a ltm-$(VERSION).zip
   147    149   
   148    150   new_file:
   149    151   	bash updatemakes.sh
   150    152   	perl dep.pl
   151    153   
   152    154   perlcritic:
   153    155   	perlcritic *.pl doc/*.pl
   154    156   
   155    157   astyle:
   156    158   	astyle --options=astylerc $(OBJECTS:.o=.c) tommath*.h demo/*.c etc/*.c mtest/mtest.c

Changes to libtommath/makefile.shared.

    79     79   	$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
    80     80   	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
    81     81   
    82     82   test_standalone: $(LIBNAME) demo/demo.o
    83     83   	$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
    84     84   	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
    85     85   
           86  +.PHONY: mtest
    86     87   mtest:
    87     88   	cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest
    88     89   
    89     90   timing: $(LIBNAME) demo/timing.c
    90     91   	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o timing

Changes to libtommath/makefile.unix.

    17     17   CC        = cc
    18     18   AR        = ar
    19     19   ARFLAGS   = r
    20     20   RANLIB    = ranlib
    21     21   CFLAGS    = -O2
    22     22   LDFLAGS   =
    23     23   
    24         -VERSION   = 1.0.1
           24  +VERSION   = 1.1.0
    25     25   
    26     26   #Compilation flags
    27     27   LTM_CFLAGS  = -I. $(CFLAGS)
    28     28   LTM_LDFLAGS = $(LDFLAGS)
    29     29   
    30     30   #Library to be created (this makefile builds only static library)
    31     31   LIBMAIN_S = libtommath.a

Changes to libtommath/makefile_include.mk.

     1      1   #
     2      2   # Include makefile for libtommath
     3      3   #
     4      4   
     5      5   #version of library
     6         -VERSION=1.0.1
     7         -VERSION_PC=1.0.1
     8         -VERSION_SO=1:1
            6  +VERSION=1.1.0
            7  +VERSION_PC=1.1.0
            8  +VERSION_SO=2:0:1
     9      9   
    10     10   PLATFORM := $(shell uname | sed -e 's/_.*//')
    11     11   
    12     12   # default make target
    13     13   default: ${LIBNAME}
    14     14   
    15     15   # Compiler and Linker Names

Changes to libtommath/tommath.h.

   280    280   
   281    281   /* makes a pseudo-random mp_int of a given size */
   282    282   int mp_rand(mp_int *a, int digits);
   283    283   /* makes a pseudo-random small int of a given size */
   284    284   int mp_rand_digit(mp_digit *r);
   285    285   
   286    286   #ifdef MP_PRNG_ENABLE_LTM_RNG
   287         -/* as last resort we will fall back to libtomcrypt's rng_get_bytes()
   288         - * in case you don't use libtomcrypt or use it w/o rng_get_bytes()
   289         - * you have to implement it somewhere else, as it's required */
          287  +/* A last resort to provide random data on systems without any of the other
          288  + * implemented ways to gather entropy.
          289  + * It is compatible with `rng_get_bytes()` from libtomcrypt so you could
          290  + * provide that one and then set `ltm_rng = rng_get_bytes;` */
   290    291   extern unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
   291    292   extern void (*ltm_rng_callback)(void);
   292    293   #endif
   293    294   
   294    295   /* ---> binary operations <--- */
   295    296   /* c = a XOR b  */
   296    297   int mp_xor(const mp_int *a, const mp_int *b, mp_int *c);

Changes to libtommath/tommath_class.h.

     5      5    *
     6      6    * The library was designed directly after the MPI library by
     7      7    * Michael Fromberger but has been written from scratch with
     8      8    * additional optimizations in place.
     9      9    *
    10     10    * SPDX-License-Identifier: Unlicense
    11     11    */
           12  +
    12     13   #if !(defined(LTM1) && defined(LTM2) && defined(LTM3))
    13     14   #if defined(LTM2)
    14     15   #   define LTM3
    15     16   #endif
    16     17   #if defined(LTM1)
    17     18   #   define LTM2
    18     19   #endif

Changes to tests/process.test.

    10     10   
    11     11   if {[lsearch [namespace children] ::tcltest] == -1} {
    12     12       package require tcltest 2
    13     13       namespace import -force ::tcltest::*
    14     14   }
    15     15   
    16     16   # Utilities
           17  +file delete [set path(test-signalfile)  [makeFile {} test-signalfile]]
           18  +set path(test-signalfile2) [makeFile {} test-signalfile2]
           19  +# $path(sleep) time ?filename? -- sleep for time (in ms) and stop if it gets signaled (file gets deleted)
    17     20   set path(sleep) [makeFile {
    18         -    after [expr $argv*1000]
           21  +    after [expr {[lindex $argv 0]*1000}] {set stop 1}
           22  +    if {[set fn [lindex $::argv 1]] ne ""} {
           23  +	close [open $fn w]
           24  +	proc check {} {
           25  +	    if {![file exists $::fn]} { # exit signaled
           26  +		after 10 {set ::stop 2}
           27  +	    }
           28  +	    after 10 check
           29  +	}
           30  +	after 10 check
           31  +    }
           32  +    vwait stop
    19     33       exit
    20     34   } sleep]
           35  +
           36  +proc wait_for_file {fn {timeout 10000}} {
           37  +    if {![file exists $fn]} {
           38  +	set toev [after $timeout {set found 0}]
           39  +	proc check {fn} {
           40  +	    if {[file exists $fn]} {
           41  +		set ::found 1
           42  +		return
           43  +	    }
           44  +	    after 10 [list check $fn]
           45  +	}
           46  +	after 10 [list check $fn]
           47  +	vwait ::found
           48  +	after cancel $toev
           49  +	unset ::found
           50  +    }
           51  +    file exists $fn
           52  +}
           53  +proc signal_exit {fn {wait 1}} {
           54  +    # wait for until file created if expected:
           55  +    if {!$wait || [wait_for_file $fn]} {
           56  +	# delete file to signal exit for child-process:
           57  +	while {1} {
           58  +	    if {![catch { file delete $fn } msg opt]
           59  +		|| [lrange [dict get $opt -errorcode] 0 1] ne {POSIX EACCES}
           60  +	    } break
           61  +	}
           62  +    }
           63  +}
           64  +
    21     65   set path(exit) [makeFile {
    22         -    exit $argv
           66  +    exit [lindex $argv 0]
    23     67   } exit]
    24     68   
    25     69   # Basic syntax checking
    26     70   test process-1.1 {tcl::process command basic syntax} -returnCodes error -body {
    27     71       tcl::process
    28     72   } -result {wrong # args: should be "tcl::process subcommand ?arg ...?"}
    29     73   test process-1.2 {tcl::process subcommands} -returnCodes error -body {
................................................................................
   209    253   } -result {1} -cleanup {
   210    254       close $f
   211    255       tcl::process purge
   212    256       tcl::process autopurge 1
   213    257   }
   214    258   
   215    259   # Async child status
   216         -test process-6.1 {async status} -body {
          260  +test process-6.1 {async status} -setup {
          261  +    signal_exit $path(test-signalfile) 0; # clean signal-file
          262  +} -body {
   217    263       tcl::process autopurge 0
   218         -    set pid [exec [interpreter] $path(sleep) 1 &]
          264  +    set pid [exec [interpreter] $path(sleep) 1 $path(test-signalfile) &]
   219    265       set status1 [lindex [tcl::process status $pid] 1]
          266  +    signal_exit $path(test-signalfile); # signal exit (stop sleep)
   220    267       set status2 [lindex [tcl::process status -wait $pid] 1]
   221    268       expr {
   222    269              $status1 eq {}
   223    270           && $status2 eq 0
   224    271       }
   225    272   } -result {1} -cleanup {
   226    273       tcl::process purge
   227    274       tcl::process autopurge 1
   228    275   }
   229         -test process-6.2 {selective wait} -body {
          276  +test process-6.2 {selective wait} -setup {
          277  +    signal_exit $path(test-signalfile)  0; # clean signal-files
          278  +    signal_exit $path(test-signalfile2) 0;
          279  +} -body {
   230    280       tcl::process autopurge 0
   231    281       # Child 1 sleeps 1s
   232         -    set pid1 [exec [interpreter] $path(sleep) 1 &]
          282  +    set pid1 [exec [interpreter] $path(sleep) 1 $path(test-signalfile) &]
   233    283       # Child 2 sleeps 1s
   234         -    set pid2 [exec [interpreter] $path(sleep) 2 &]
          284  +    set pid2 [exec [interpreter] $path(sleep) 2 $path(test-signalfile2) &]
   235    285       # Initial status
   236    286       set status1_1 [lindex [tcl::process status $pid1] 1]
   237    287       set status1_2 [lindex [tcl::process status $pid2] 1]
   238    288       # Wait until child 1 termination
          289  +    signal_exit $path(test-signalfile); # signal exit for pid1 (stop sleep)
   239    290       set status2_1 [lindex [tcl::process status -wait $pid1] 1]
   240    291       set status2_2 [lindex [tcl::process status $pid2] 1]
   241    292       # Wait until child 2 termination
          293  +    signal_exit $path(test-signalfile2); # signal exit for pid2 (stop sleep)
   242    294       set status3_2 [lindex [tcl::process status -wait $pid2] 1]
   243    295       set status3_1 [lindex [tcl::process status $pid1] 1]
   244    296       expr {
   245    297              $status1_1 eq {}
   246    298           && $status1_2 eq {}
   247    299           && $status2_1 eq 0
   248    300           && $status2_2 eq {}
................................................................................
   276    328       set pid [exec [interpreter] $path(exit) -1 &]
   277    329       lindex [tcl::process status -wait $pid] 1
   278    330   } -match glob -result {1 {child killed: unknown signal} {CHILDKILLED * {unknown signal} {unknown signal}}} -cleanup {
   279    331       tcl::process purge
   280    332       tcl::process autopurge 1
   281    333   }
   282    334   
          335  +rename wait_for_file {}
          336  +rename signal_exit {}
   283    337   ::tcltest::cleanupTests
   284    338   return

Changes to tests/var.test.

   198    198           namespace delete [namespace current]
   199    199   	set result
   200    200       }
   201    201   } -result {0 2 1 {can't set "foo": upvar refers to element in deleted array}}
   202    202   test var-1.19 {TclLookupVar, right error message when parsing variable name} -body {
   203    203       [format set] thisvar(doesntexist)
   204    204   } -returnCodes error -result {can't read "thisvar(doesntexist)": no such variable}
          205  +test var-1.20 {TclLookupVar, regression on utf-8 variable names} -setup {
          206  +    proc p [list \u20ac \xe4] {info vars}
          207  +} -body {
          208  +    # test variable with non-ascii name is available (euro and a-uml chars here):
          209  +    list \
          210  +	[p 1 2] \
          211  +	[apply [list [list \u20ac \xe4] {info vars}] 1 2] \
          212  +	[apply [list [list [list \u20ac \u20ac] [list \xe4 \xe4]] {info vars}]] \
          213  +} -cleanup {
          214  +    rename p {}
          215  +} -result [lrepeat 3 [list \u20ac \xe4]]
          216  +test var-1.21 {TclLookupVar, regression on utf-8 variable names} -setup {
          217  +    proc p [list [list \u20ac v\u20ac] [list \xe4 v\xe4]] {list [set \u20ac] [set \xe4]}
          218  +} -body {
          219  +    # test variable with non-ascii name (and default) is resolvable (euro and a-uml chars here):
          220  +    list \
          221  +	[p] \
          222  +	[apply [list [list \u20ac \xe4] {list [set \u20ac] [set \xe4]}] v\u20ac v\xe4] \
          223  +	[apply [list [list [list \u20ac v\u20ac] [list \xe4 v\xe4]] {list [set \u20ac] [set \xe4]}]] \
          224  +} -cleanup {
          225  +    rename p {}
          226  +} -result [lrepeat 3 [list v\u20ac v\xe4]]
   205    227   
   206    228   test var-2.1 {Tcl_LappendObjCmd, create var if new} {
   207    229       catch {unset x}
   208    230       lappend x 1 2
   209    231   } {1 2}
   210    232   
   211    233   test var-3.1 {MakeUpvar, TCL_NAMESPACE_ONLY not specified for other var} -setup {

Changes to unix/tclEpollNotfy.c.

    20     20   #include <fcntl.h>
    21     21   #include <signal.h>
    22     22   #include <sys/epoll.h>
    23     23   #ifdef HAVE_EVENTFD
    24     24   #include <sys/eventfd.h>
    25     25   #endif /* HAVE_EVENTFD */
    26     26   #include <sys/queue.h>
    27         -#include <unistd.h>
    28     27   
    29     28   /*
    30     29    * This structure is used to keep track of the notifier info for a registered
    31     30    * file.
    32     31    */
    33     32   
    34     33   struct PlatformEventData;

Changes to unix/tclLoadDl.c.

   102    102   	/*
   103    103   	 * Let the OS loader examine the binary search path for whatever
   104    104   	 * string the user gave us which hopefully refers to a file on the
   105    105   	 * binary path.
   106    106   	 */
   107    107   
   108    108   	Tcl_DString ds;
   109         -	const char *fileName = Tcl_GetString(pathPtr);
          109  +	const char *fileName = TclGetString(pathPtr);
   110    110   
   111    111   	native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
   112    112   	/*
   113    113   	 * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070]
   114    114   	 */
   115    115   	handle = dlopen(native, dlopenflags);
   116    116   	Tcl_DStringFree(&ds);
................................................................................
   123    123   	 */
   124    124   
   125    125   	const char *errorStr = dlerror();
   126    126   
   127    127   	if (interp) {
   128    128   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   129    129   		    "couldn't load file \"%s\": %s",
   130         -		    Tcl_GetString(pathPtr), errorStr));
          130  +		    TclGetString(pathPtr), errorStr));
   131    131   	}
   132    132   	return TCL_ERROR;
   133    133       }
   134    134       newHandle = Tcl_Alloc(sizeof(*newHandle));
   135    135       newHandle->clientData = handle;
   136    136       newHandle->findSymbolProcPtr = &FindSymbol;
   137    137       newHandle->unloadFileProcPtr = &UnloadFile;

Changes to unix/tclLoadDyld.c.

   180    180       /*
   181    181        * First try the full path the user gave us. This is particularly
   182    182        * important if the cwd is inside a vfs, and we are trying to load using a
   183    183        * relative path.
   184    184        */
   185    185   
   186    186       nativePath = Tcl_FSGetNativePath(pathPtr);
   187         -    nativeFileName = Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr),
          187  +    nativeFileName = Tcl_UtfToExternalDString(NULL, TclGetString(pathPtr),
   188    188   	    -1, &ds);
   189    189   
   190    190   #if TCL_DYLD_USE_DLFCN
   191    191       /*
   192    192        * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070]
   193    193        */
   194    194   

Changes to unix/tclLoadNext.c.

    57     57       char *fileName;
    58     58       char *files[2];
    59     59       const char *native;
    60     60       int result = 1;
    61     61   
    62     62       NXStream *errorStream = NXOpenMemory(0,0,NX_READWRITE);
    63     63   
    64         -    fileName = Tcl_GetString(pathPtr);
           64  +    fileName = TclGetString(pathPtr);
    65     65   
    66     66       /*
    67     67        * First try the full path the user gave us. This is particularly
    68     68        * important if the cwd is inside a vfs, and we are trying to load using a
    69     69        * relative path.
    70     70        */
    71     71   

Changes to unix/tclLoadOSF.c.

    75     75   				 * function which should be used for this
    76     76   				 * file. */
    77     77       int flags)
    78     78   {
    79     79       Tcl_LoadHandle newHandle;
    80     80       ldr_module_t lm;
    81     81       char *pkg;
    82         -    char *fileName = Tcl_GetString(pathPtr);
           82  +    char *fileName = TclGetString(pathPtr);
    83     83       const char *native;
    84     84   
    85     85       /*
    86     86        * First try the full path the user gave us.  This is particularly
    87     87        * important if the cwd is inside a vfs, and we are trying to load using a
    88     88        * relative path.
    89     89        */

Changes to unix/tclLoadShl.c.

    53     53   				 * function which should be used for this
    54     54   				 * file. */
    55     55       int flags)
    56     56   {
    57     57       shl_t handle;
    58     58       Tcl_LoadHandle newHandle;
    59     59       const char *native;
    60         -    char *fileName = Tcl_GetString(pathPtr);
           60  +    char *fileName = TclGetString(pathPtr);
    61     61   
    62     62       /*
    63     63        * The flags below used to be BIND_IMMEDIATE; they were changed at the
    64     64        * suggestion of Wolfgang Kechel ([email protected]): "This enables
    65     65        * verbosity for missing symbols when loading a shared lib and allows to
    66     66        * load libtk8.0.sl into tclsh8.0 without problems.  In general, this
    67     67        * delays resolving symbols until they are actually needed.  Shared libs

Changes to unix/tclUnixChan.c.

   575    575   TtySetOptionProc(
   576    576       ClientData instanceData,	/* File state. */
   577    577       Tcl_Interp *interp,		/* For error reporting - can be NULL. */
   578    578       const char *optionName,	/* Which option to set? */
   579    579       const char *value)		/* New value for option. */
   580    580   {
   581    581       FileState *fsPtr = instanceData;
   582         -    unsigned int len, vlen;
          582  +    size_t len, vlen;
   583    583       TtyAttrs tty;
   584    584       int argc;
   585    585       const char **argv;
   586    586       struct termios iostate;
   587    587   
   588    588       len = strlen(optionName);
   589    589       vlen = strlen(value);
................................................................................
   802    802   TtyGetOptionProc(
   803    803       ClientData instanceData,	/* File state. */
   804    804       Tcl_Interp *interp,		/* For error reporting - can be NULL. */
   805    805       const char *optionName,	/* Option to get. */
   806    806       Tcl_DString *dsPtr)		/* Where to store value(s). */
   807    807   {
   808    808       FileState *fsPtr = instanceData;
   809         -    unsigned int len;
          809  +    size_t len;
   810    810       char buf[3*TCL_INTEGER_SPACE + 16];
   811    811       int valid = 0;		/* Flag if valid option parsed. */
   812    812   
   813    813       if (optionName == NULL) {
   814    814   	len = 0;
   815    815       } else {
   816    816   	len = strlen(optionName);

Changes to unix/tclUnixPipe.c.

   520    520        * an error message.
   521    521        */
   522    522   
   523    523       TclpCloseFile(errPipeOut);
   524    524       errPipeOut = NULL;
   525    525   
   526    526       fd = GetFd(errPipeIn);
   527         -    count = read(fd, errSpace, (size_t) (sizeof(errSpace) - 1));
          527  +    count = read(fd, errSpace, sizeof(errSpace) - 1);
   528    528       if (count > 0) {
   529    529   	char *end;
   530    530   
   531    531   	errSpace[count] = 0;
   532    532   	errno = strtol(errSpace, &end, 10);
   533    533   	Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s: %s",
   534    534   		end, Tcl_PosixError(interp)));
................................................................................
  1270   1270       if (objc == 1) {
  1271   1271   	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(getpid()));
  1272   1272       } else {
  1273   1273   	/*
  1274   1274   	 * Get the channel and make sure that it refers to a pipe.
  1275   1275   	 */
  1276   1276   
  1277         -	chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL);
         1277  +	chan = Tcl_GetChannel(interp, TclGetString(objv[1]), NULL);
  1278   1278   	if (chan == NULL) {
  1279   1279   	    return TCL_ERROR;
  1280   1280   	}
  1281   1281   	if (Tcl_GetChannelType(chan) != &pipeChannelType) {
  1282   1282   	    return TCL_OK;
  1283   1283   	}
  1284   1284   

Changes to unix/tclUnixPort.h.

   152    152   #ifdef HAVE_INTTYPES_H
   153    153   #   include <inttypes.h>
   154    154   #endif
   155    155   #include <limits.h>
   156    156   #ifdef HAVE_STDINT_H
   157    157   #   include <stdint.h>
   158    158   #endif
   159         -#ifdef HAVE_UNISTD_H
   160         -#   include <unistd.h>
   161         -#else
   162         -#   include "../compat/unistd.h"
   163         -#endif
          159  +#include <unistd.h>
   164    160   
   165    161   MODULE_SCOPE int TclUnixSetBlockingMode(int fd, int mode);
   166    162   
   167    163   #include <utime.h>
   168    164   
   169    165   /*
   170    166    *---------------------------------------------------------------------------

Changes to unix/tclUnixSock.c.

   309    309    *
   310    310    * ----------------------------------------------------------------------
   311    311    */
   312    312   
   313    313   const char *
   314    314   Tcl_GetHostName(void)
   315    315   {
   316         -    return Tcl_GetString(TclGetProcessGlobalValue(&hostName));
          316  +    Tcl_Obj *tclObj = TclGetProcessGlobalValue(&hostName);
          317  +    return TclGetString(tclObj);
   317    318   }
   318    319   
   319    320   /*
   320    321    * ----------------------------------------------------------------------
   321    322    *
   322    323    * TclpHasSockets --
   323    324    *

Changes to win/tcl.dsp.

   198    198   
   199    199   SOURCE=..\compat\strtoul.c
   200    200   # End Source File
   201    201   # Begin Source File
   202    202   
   203    203   SOURCE=..\compat\tclErrno.h
   204    204   # End Source File
   205         -# Begin Source File
   206         -
   207         -SOURCE=..\compat\unistd.h
   208         -# End Source File
   209    205   # Begin Source File
   210    206   
   211    207   SOURCE=..\compat\waitpid.c
   212    208   # End Source File
   213    209   # End Group
   214    210   # Begin Group "doc"
   215    211   

Changes to win/tclWinFCmd.c.

   907    907   
   908    908       normSrcPtr = Tcl_FSGetNormalizedPath(NULL,srcPathPtr);
   909    909       normDestPtr = Tcl_FSGetNormalizedPath(NULL,destPathPtr);
   910    910       if ((normSrcPtr == NULL) || (normDestPtr == NULL)) {
   911    911   	return TCL_ERROR;
   912    912       }
   913    913   
   914         -    Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString);
   915         -    Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString);
          914  +    Tcl_WinUtfToTChar(TclGetString(normSrcPtr), -1, &srcString);
          915  +    Tcl_WinUtfToTChar(TclGetString(normDestPtr), -1, &dstString);
   916    916   
   917    917       ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds);
   918    918   
   919    919       Tcl_DStringFree(&srcString);
   920    920       Tcl_DStringFree(&dstString);
   921    921   
   922    922       if (ret != TCL_OK) {
................................................................................
   980    980   	 */
   981    981   
   982    982   	Tcl_DString native;
   983    983   	normPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
   984    984   	if (normPtr == NULL) {
   985    985   	    return TCL_ERROR;
   986    986   	}
   987         -	Tcl_WinUtfToTChar(Tcl_GetString(normPtr), -1, &native);
          987  +	Tcl_WinUtfToTChar(TclGetString(normPtr), -1, &native);
   988    988   	ret = DoRemoveDirectory(&native, recursive, &ds);
   989    989   	Tcl_DStringFree(&native);
   990    990       } else {
   991    991   	ret = DoRemoveJustDirectory(Tcl_FSGetNativePath(pathPtr), 0, &ds);
   992    992       }
   993    993   
   994    994       if (ret != TCL_OK) {
................................................................................
  1589   1589   
  1590   1590       splitPath = Tcl_FSSplitPath(fileName, &pathc);
  1591   1591   
  1592   1592       if (splitPath == NULL || pathc == 0) {
  1593   1593   	if (interp != NULL) {
  1594   1594   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1595   1595   		    "could not read \"%s\": no such file or directory",
  1596         -		    Tcl_GetString(fileName)));
         1596  +		    TclGetString(fileName)));
  1597   1597   	    errno = ENOENT;
  1598   1598   	    Tcl_PosixError(interp);
  1599   1599   	}
  1600   1600   	goto cleanup;
  1601   1601       }
  1602   1602   
  1603   1603       /*
................................................................................
  1879   1879       Tcl_Interp *interp,		/* The interp we are using for errors. */
  1880   1880       int objIndex,		/* The index of the attribute. */
  1881   1881       Tcl_Obj *fileName,		/* The name of the file. */
  1882   1882       Tcl_Obj *attributePtr)	/* The new value of the attribute. */
  1883   1883   {
  1884   1884       Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1885   1885   	    "cannot set attribute \"%s\" for file \"%s\": attribute is readonly",
  1886         -	    tclpFileAttrStrings[objIndex], Tcl_GetString(fileName)));
         1886  +	    tclpFileAttrStrings[objIndex], TclGetString(fileName)));
  1887   1887       errno = EINVAL;
  1888   1888       Tcl_PosixError(interp);
  1889   1889       return TCL_ERROR;
  1890   1890   }
  1891   1891   
  1892   1892   /*
  1893   1893    *---------------------------------------------------------------------------

Changes to win/tclWinFile.c.

   969    969   
   970    970   	/*
   971    971   	 * Build up the directory name for searching, including a trailing
   972    972   	 * directory separator.
   973    973   	 */
   974    974   
   975    975   	Tcl_DStringInit(&dsOrig);
   976         -	dirName = TclGetString(fileNamePtr);
   977         -	dirLength = fileNamePtr->length;
          976  +	dirName = TclGetStringFromObj(fileNamePtr, &dirLength);
   978    977   	Tcl_DStringAppend(&dsOrig, dirName, dirLength);
   979    978   
   980    979   	lastChar = dirName[dirLength -1];
   981    980   	if ((lastChar != '\\') && (lastChar != '/') && (lastChar != ':')) {
   982    981   	    TclDStringAppendLiteral(&dsOrig, "/");
   983    982   	    dirLength++;
   984    983   	}
................................................................................
  2394   2393       char *firstSeparator;
  2395   2394       const char *path;
  2396   2395       Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
  2397   2396   
  2398   2397       if (normPath == NULL) {
  2399   2398   	return NULL;
  2400   2399       }
  2401         -    path = Tcl_GetString(normPath);
         2400  +    path = TclGetString(normPath);
  2402   2401       if (path == NULL) {
  2403   2402   	return NULL;
  2404   2403       }
  2405   2404   
  2406   2405       firstSeparator = strchr(path, '/');
  2407   2406       if (firstSeparator == NULL) {
  2408   2407   	found = GetVolumeInformation(Tcl_FSGetNativePath(pathPtr),
................................................................................
  2472   2471       Tcl_DString dsNorm;		/* This will hold the normalized string. */
  2473   2472       char *path, *currentPathEndPosition;
  2474   2473       Tcl_Obj *temp = NULL;
  2475   2474       int isDrive = 1;
  2476   2475       Tcl_DString ds;		/* Some workspace. */
  2477   2476   
  2478   2477       Tcl_DStringInit(&dsNorm);
  2479         -    path = Tcl_GetString(pathPtr);
         2478  +    path = TclGetString(pathPtr);
  2480   2479   
  2481   2480       currentPathEndPosition = path + nextCheckpoint;
  2482   2481       if (*currentPathEndPosition == '/') {
  2483   2482   	currentPathEndPosition++;
  2484   2483       }
  2485   2484       while (1) {
  2486   2485   	char cur = *currentPathEndPosition;
................................................................................
  2566   2565   		    nextCheckpoint = 0;
  2567   2566   		    Tcl_AppendToObj(to, currentPathEndPosition, -1);
  2568   2567   
  2569   2568   		    /*
  2570   2569   		     * Convert link to forward slashes.
  2571   2570   		     */
  2572   2571   
  2573         -		    for (path = Tcl_GetString(to); *path != 0; path++) {
         2572  +		    for (path = TclGetString(to); *path != 0; path++) {
  2574   2573   			if (*path == '\\') {
  2575   2574   			    *path = '/';
  2576   2575   			}
  2577   2576   		    }
  2578         -		    path = Tcl_GetString(to);
         2577  +		    path = TclGetString(to);
  2579   2578   		    currentPathEndPosition = path + nextCheckpoint;
  2580   2579   		    if (temp != NULL) {
  2581   2580   			Tcl_DecrRefCount(temp);
  2582   2581   		    }
  2583   2582   		    temp = to;
  2584   2583   
  2585   2584   		    /*
................................................................................
  2803   2802   
  2804   2803       if (path[0] == '/') {
  2805   2804   	/*
  2806   2805   	 * Path of form /foo/bar which is a path in the root directory of the
  2807   2806   	 * current volume.
  2808   2807   	 */
  2809   2808   
  2810         -	const char *drive = Tcl_GetString(useThisCwd);
         2809  +	const char *drive = TclGetString(useThisCwd);
  2811   2810   
  2812   2811   	absolutePath = Tcl_NewStringObj(drive,2);
  2813   2812   	Tcl_AppendToObj(absolutePath, path, -1);
  2814   2813   	Tcl_IncrRefCount(absolutePath);
  2815   2814   
  2816   2815   	/*
  2817   2816   	 * We have a refCount on the cwd.
................................................................................
  2818   2817   	 */
  2819   2818       } else {
  2820   2819   	/*
  2821   2820   	 * Path of form C:foo/bar, but this only makes sense if the cwd is
  2822   2821   	 * also on drive C.
  2823   2822   	 */
  2824   2823   
  2825         -	const char *drive = TclGetString(useThisCwd);
  2826         -	size_t cwdLen = useThisCwd->length;
         2824  +	size_t cwdLen;
         2825  +	const char *drive = TclGetStringFromObj(useThisCwd, &cwdLen);
  2827   2826   	char drive_cur = path[0];
  2828   2827   
  2829   2828   	if (drive_cur >= 'a') {
  2830   2829   	    drive_cur -= ('a' - 'A');
  2831   2830   	}
  2832   2831   	if (drive[0] == drive_cur) {
  2833   2832   	    absolutePath = Tcl_DuplicateObj(useThisCwd);
................................................................................
  2982   2981   	if (validPathPtr == NULL) {
  2983   2982   	    return NULL;
  2984   2983   	}
  2985   2984   	/* validPathPtr returned from Tcl_FSGetNormalizedPath is owned by Tcl, so incr refCount here */
  2986   2985   	Tcl_IncrRefCount(validPathPtr);
  2987   2986       }
  2988   2987   
  2989         -    str = Tcl_GetString(validPathPtr);
  2990         -    len = validPathPtr->length;
         2988  +    str = TclGetStringFromObj(validPathPtr, &len);
  2991   2989   
  2992         -    if (strlen(str)!=(unsigned int)len) {
         2990  +    if (strlen(str) != len) {
  2993   2991   	/* String contains NUL-bytes. This is invalid. */
  2994   2992   	goto done;
  2995   2993       }
  2996   2994       /* For a reserved device, strip a possible postfix ':' */
  2997   2995       len = WinIsReserved(str);
  2998   2996       if (len == 0) {
  2999   2997   	/* Let MultiByteToWideChar check for other invalid sequences, like

Changes to win/tclWinInit.c.

   219    219        * Look for the library in its source checkout location.
   220    220        */
   221    221   
   222    222       Tcl_ListObjAppendElement(NULL, pathPtr,
   223    223   	    TclGetProcessGlobalValue(&sourceLibraryDir));
   224    224   
   225    225       *encodingPtr = NULL;
   226         -    bytes = TclGetString(pathPtr);
   227         -    *lengthPtr = pathPtr->length;
          226  +    bytes = TclGetStringFromObj(pathPtr, lengthPtr);
   228    227       *valuePtr = Tcl_Alloc(*lengthPtr + 1);
   229    228       memcpy(*valuePtr, bytes, *lengthPtr + 1);
   230    229       Tcl_DecrRefCount(pathPtr);
   231    230   }
   232    231   
   233    232   /*
   234    233    *---------------------------------------------------------------------------

Changes to win/tclWinLoad.c.

    91     91           /*
    92     92            * Remember the first error on load attempt to be used if the
    93     93            * second load attempt below also fails.
    94     94           */
    95     95           firstError = (nativeName == NULL) ?
    96     96   		ERROR_MOD_NOT_FOUND : GetLastError();
    97     97   
    98         -	nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds);
           98  +	nativeName = Tcl_WinUtfToTChar(TclGetString(pathPtr), -1, &ds);
    99     99   	hInstance = LoadLibraryEx(nativeName, NULL,
   100    100   		LOAD_WITH_ALTERED_SEARCH_PATH);
   101    101   	Tcl_DStringFree(&ds);
   102    102       }
   103    103   
   104    104       if (hInstance == NULL) {
   105    105   	DWORD lastError;
................................................................................
   113    113           if (firstError == ERROR_MOD_NOT_FOUND ||
   114    114               firstError == ERROR_DLL_NOT_FOUND)
   115    115               lastError = GetLastError();
   116    116           else
   117    117               lastError = firstError;
   118    118   
   119    119   	errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ",
   120         -		Tcl_GetString(pathPtr));
          120  +		TclGetString(pathPtr));
   121    121   
   122    122   	/*
   123    123   	 * Check for possible DLL errors. This doesn't work quite right,
   124    124   	 * because Windows seems to only return ERROR_MOD_NOT_FOUND for just
   125    125   	 * about any problem, but it's better than nothing. It'd be even
   126    126   	 * better if there was a way to get what DLLs
   127    127   	 */

Changes to win/tclWinPipe.c.

  2213   2213   
  2214   2214   	    if (infoPtr->writeBuf) {
  2215   2215   		Tcl_Free(infoPtr->writeBuf);
  2216   2216   	    }
  2217   2217   	    infoPtr->writeBufLen = toWrite;
  2218   2218   	    infoPtr->writeBuf = Tcl_Alloc(toWrite);
  2219   2219   	}
  2220         -	memcpy(infoPtr->writeBuf, buf, (size_t) toWrite);
         2220  +	memcpy(infoPtr->writeBuf, buf, toWrite);
  2221   2221   	infoPtr->toWrite = toWrite;
  2222   2222   	ResetEvent(infoPtr->writable);
  2223   2223   	TclPipeThreadSignal(&infoPtr->writeTI);
  2224   2224   	bytesWritten = toWrite;
  2225   2225       } else {
  2226   2226   	/*
  2227   2227   	 * In the blocking case, just try to write the buffer directly. This
................................................................................
  2668   2668       if (objc > 2) {
  2669   2669   	Tcl_WrongNumArgs(interp, 1, objv, "?channelId?");
  2670   2670   	return TCL_ERROR;
  2671   2671       }
  2672   2672       if (objc == 1) {
  2673   2673   	Tcl_SetObjResult(interp, Tcl_NewWideIntObj((unsigned) getpid()));
  2674   2674       } else {
  2675         -	chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]),
         2675  +	chan = Tcl_GetChannel(interp, TclGetString(objv[1]),
  2676   2676   		NULL);
  2677   2677   	if (chan == (Tcl_Channel) NULL) {
  2678   2678   	    return TCL_ERROR;
  2679   2679   	}
  2680   2680   	chanTypePtr = Tcl_GetChannelType(chan);
  2681   2681   	if (chanTypePtr != &pipeChannelType) {
  2682   2682   	    return TCL_OK;
................................................................................
  3119   3119       namePtr = (char *) name;
  3120   3120       length = GetTempPath(MAX_PATH, name);
  3121   3121       if (length == 0) {
  3122   3122   	goto gotError;
  3123   3123       }
  3124   3124       namePtr += length * sizeof(TCHAR);
  3125   3125       if (basenameObj) {
  3126         -	const char *string = Tcl_GetString(basenameObj);
         3126  +	size_t length;
         3127  +	const char *string = TclGetStringFromObj(basenameObj, &length);
  3127   3128   
  3128         -	Tcl_WinUtfToTChar(string, basenameObj->length, &buf);
         3129  +	Tcl_WinUtfToTChar(string, length, &buf);
  3129   3130   	memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf));
  3130   3131   	namePtr += Tcl_DStringLength(&buf);
  3131   3132   	Tcl_DStringFree(&buf);
  3132   3133       } else {
  3133   3134   	const TCHAR *baseStr = TEXT("TCL");
  3134   3135   	length = 3 * sizeof(TCHAR);
  3135   3136