summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIOUtil.c')
-rwxr-xr-x[-rw-r--r--]generic/tclIOUtil.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 436d364..57c9fe7 100644..100755
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -178,7 +178,7 @@ const Tcl_Filesystem tclNativeFilesystem = {
/*
* An initial record in the linked list for the native filesystem. Remains at
* the tail of the list and is never freed. Currently the native filesystem is
- * hard-coded. It may make sense to modify this to accomodate unconventional
+ * hard-coded. It may make sense to modify this to accommodate unconventional
* uses of Tcl that provide no native filesystem.
*/
@@ -293,7 +293,7 @@ Tcl_Stat(
#endif /* !TCL_WIDE_INT_IS_LONG */
/*
- * Copy across all supported fields, with possible type coercions on
+ * Copy across all supported fields, with possible type coercion on
* those fields that change between the normal and lf64 versions of
* the stat structure (on Solaris at least). This is slow when the
* structure sizes coincide, but that's what you get for using an
@@ -521,7 +521,7 @@ TclFSCwdPointerEquals(
if (tsdPtr->cwdPathPtr == *pathPtrPtr) {
return 1;
} else {
- size_t len1, len2;
+ Tcl_Size len1, len2;
const char *str1, *str2;
str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1);
@@ -663,7 +663,7 @@ FsUpdateCwd(
Tcl_Obj *cwdObj,
void *clientData)
{
- size_t len = 0;
+ Tcl_Size len = 0;
const char *str = NULL;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
@@ -989,7 +989,7 @@ Tcl_FSMatchInDirectory(
{
const Tcl_Filesystem *fsPtr;
Tcl_Obj *cwd, *tmpResultPtr, **elemsPtr;
- size_t resLength, i;
+ Tcl_Size resLength, i;
int ret = -1;
if (types != NULL && (types->type & TCL_GLOB_TYPE_MOUNT)) {
@@ -1106,7 +1106,7 @@ FsAddMountsToGlobResult(
* directory flag is particularly significant.
*/
{
- size_t mLength, gLength, i;
+ Tcl_Size mLength, gLength, i;
int dir = (types == NULL || (types->type & TCL_GLOB_TYPE_DIR));
Tcl_Obj *mounts = FsListMounts(pathPtr, pattern);
@@ -1122,7 +1122,7 @@ FsAddMountsToGlobResult(
}
for (i=0 ; i<mLength ; i++) {
Tcl_Obj *mElt;
- size_t j;
+ Tcl_Size j;
int found = 0;
Tcl_ListObjIndex(NULL, mounts, i, &mElt);
@@ -1146,7 +1146,7 @@ FsAddMountsToGlobResult(
}
if (!found && dir) {
Tcl_Obj *norm;
- size_t len, mlen;
+ Tcl_Size len, mlen;
/*
* mElt is normalized and lies inside pathPtr so
@@ -1303,7 +1303,7 @@ Tcl_FSData(
* None (beyond the memory allocation for the result).
*
* Special notes:
- * If the filesystem-specific normalizePathProcs can re-introduce ../, ./
+ * If the filesystem-specific normalizePathProcs can reintroduce ../, ./
* components into the pathname, this function does not return the correct
* result. This may be possible with symbolic links on unix.
*
@@ -1324,7 +1324,7 @@ TclFSNormalizeToUniquePath(
{
FilesystemRecord *fsRecPtr, *firstFsRecPtr;
- size_t i;
+ Tcl_Size i;
int isVfsPath = 0;
const char *path;
@@ -1475,7 +1475,7 @@ TclGetOpenModeEx(
* operations after opening the file. */
{
int mode, c, gotRW;
- size_t modeArgc, i;
+ Tcl_Size modeArgc, i;
const char **modeArgv, *flag;
#define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR)
@@ -1686,8 +1686,8 @@ Tcl_FSEvalFileEx(
const char *encodingName) /* Either the name of an encoding or NULL to
use the utf-8 encoding. */
{
- size_t length;
- int result = TCL_ERROR;
+ Tcl_Size length;
+ int result = TCL_ERROR;
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile;
Interp *iPtr;
@@ -1802,7 +1802,7 @@ Tcl_FSEvalFileEx(
const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
unsigned limit = 150;
- int overflow = (length > limit);
+ int overflow = ((unsigned)length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (file \"%.*s%s\" line %d)",
@@ -1952,9 +1952,9 @@ EvalFileCallback(
* Record information about where the error occurred.
*/
- size_t length;
+ Tcl_Size length;
const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
- const unsigned int limit = 150;
+ const unsigned limit = 150;
int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -2063,8 +2063,7 @@ Tcl_PosixError(
* Tcl_FSStat --
* Calls 'statProc' of the filesystem corresponding to pathPtr.
*
- * Replaces the standard library routines stat.
- *
+ * Replaces the standard library "stat" routine.
*
* Results:
* See stat documentation.
@@ -2459,7 +2458,7 @@ TclFSFileAttrIndex(
* It's a constant attribute table, so use T_GIFO.
*/
- Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, TCL_INDEX_NONE);
+ Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, -1);
int result;
result = Tcl_GetIndexFromObj(NULL, tmpObj, attrTable, NULL, TCL_EXACT,
@@ -2474,7 +2473,7 @@ TclFSFileAttrIndex(
* It's a non-constant attribute list, so do a literal search.
*/
- size_t i, objc;
+ Tcl_Size i, objc;
Tcl_Obj **objv;
if (TclListObjGetElementsM(NULL, listObj, &objc, &objv) != TCL_OK) {
@@ -2795,7 +2794,7 @@ Tcl_FSGetCwd(
* infinite loop bug when trying to normalize tsdPtr->cwdPathPtr.
*/
- size_t len1, len2;
+ Tcl_Size len1, len2;
const char *str1, *str2;
str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1);
@@ -3292,7 +3291,7 @@ Tcl_LoadFile(
Tcl_DecrRefCount(copyToPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "couldn't load from current filesystem", TCL_INDEX_NONE));
+ "couldn't load from current filesystem", -1));
}
return TCL_ERROR;
}
@@ -3876,13 +3875,13 @@ FsListMounts(
Tcl_Obj *
Tcl_FSSplitPath(
Tcl_Obj *pathPtr, /* The pathname to split. */
- size_t *lenPtr) /* A place to hold the number of pathname
+ Tcl_Size *lenPtr) /* A place to hold the number of pathname
* elements. */
{
Tcl_Obj *result = NULL; /* Just to squelch gcc warnings. */
const Tcl_Filesystem *fsPtr;
char separator = '/';
- size_t driveNameLength;
+ Tcl_Size driveNameLength;
const char *p;
/*
@@ -3928,7 +3927,7 @@ Tcl_FSSplitPath(
for (;;) {
const char *elementStart = p;
- size_t length;
+ Tcl_Size length;
while ((*p != '\0') && (*p != separator)) {
p++;
@@ -3973,14 +3972,14 @@ TclGetPathType(
/* If not NULL, a place in which to store a
* pointer to the filesystem for this pathname
* if it is absolute. */
- size_t *driveNameLengthPtr, /* If not NULL, a place in which to store the
+ Tcl_Size *driveNameLengthPtr, /* If not NULL, a place in which to store the
* length of the volume name. */
Tcl_Obj **driveNameRef) /* If not NULL, for an absolute pathname, a
* place to store a pointer to an object with a
* refCount of 1, and whose value is the name
* of the volume. */
{
- size_t pathLen;
+ Tcl_Size pathLen;
const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen);
Tcl_PathType type;
@@ -4022,12 +4021,12 @@ TclGetPathType(
Tcl_PathType
TclFSNonnativePathType(
const char *path, /* Pathname to determine the type of. */
- size_t pathLen, /* Length of the pathname. */
+ Tcl_Size pathLen, /* Length of the pathname. */
const Tcl_Filesystem **filesystemPtrPtr,
/* If not NULL, a place to store a pointer to
* the filesystem for this pathname when it is
* an absolute pathname. */
- size_t *driveNameLengthPtr, /* If not NULL, a place to store the length of
+ Tcl_Size *driveNameLengthPtr,/* If not NULL, a place to store the length of
* the volume name if the pathname is absolute.
*/
Tcl_Obj **driveNameRef) /* If not NULL, a place to store a pointer to
@@ -4064,7 +4063,7 @@ TclFSNonnativePathType(
if ((fsRecPtr->fsPtr != &tclNativeFilesystem)
&& (fsRecPtr->fsPtr->listVolumesProc != NULL)) {
- size_t numVolumes;
+ Tcl_Size numVolumes;
Tcl_Obj *thisFsVolumes = fsRecPtr->fsPtr->listVolumesProc();
if (thisFsVolumes != NULL) {
@@ -4081,9 +4080,9 @@ TclFSNonnativePathType(
numVolumes = TCL_INDEX_NONE;
}
- while (numVolumes + 1 > 1) {
+ while (numVolumes > 0) {
Tcl_Obj *vol;
- size_t len;
+ Tcl_Size len;
const char *strVol;
numVolumes--;
@@ -4430,7 +4429,7 @@ Tcl_FSRemoveDirectory(
Tcl_Obj *cwdPtr = Tcl_FSGetCwd(NULL);
if (cwdPtr != NULL) {
const char *cwdStr, *normPathStr;
- size_t cwdLen, normLen;
+ Tcl_Size cwdLen, normLen;
Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (normPath != NULL) {
@@ -4612,7 +4611,7 @@ Tcl_FSFileSystemInfo(
resPtr = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, resPtr,
- Tcl_NewStringObj(fsPtr->typeName, TCL_INDEX_NONE));
+ Tcl_NewStringObj(fsPtr->typeName, -1));
if (fsPtr->filesystemPathTypeProc != NULL) {
Tcl_Obj *typePtr = fsPtr->filesystemPathTypeProc(pathPtr);