diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-08 10:23:13 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-08 10:23:13 (GMT) |
| commit | 8ef685ede6f3371073dfb6f84eff77b62398787c (patch) | |
| tree | fd4894d3b57bc034901dff8f04b0b9b465057ce1 /generic/tclPathObj.c | |
| parent | aa312430e34a7bd58cddb79b7dd6840e86ced518 (diff) | |
| parent | bdccbf1c921b2158d107e97cc64b72ab81a05ee5 (diff) | |
| download | tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.zip tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.gz tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.bz2 | |
TIP #616: Tcl lists > 2^31 elements
Diffstat (limited to 'generic/tclPathObj.c')
| -rw-r--r-- | generic/tclPathObj.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index ff08bd4..f7da276 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -476,7 +476,7 @@ Tcl_PathType TclFSGetPathType( Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr) + size_t *driveNameLengthPtr) { FsPath *fsPathPtr; @@ -666,7 +666,7 @@ TclPathPart( goto standardPath; } } else { - int splitElements; + size_t splitElements; Tcl_Obj *splitPtr, *resultPtr; standardPath: @@ -804,17 +804,17 @@ Tcl_Obj * Tcl_FSJoinPath( Tcl_Obj *listObj, /* Path elements to join, may have a zero * reference count. */ - int elements) /* Number of elements to use (-1 = all) */ + size_t elements) /* Number of elements to use (-1 = all) */ { Tcl_Obj *res; - int objc; + size_t objc; Tcl_Obj **objv; if (TclListObjLengthM(NULL, listObj, &objc) != TCL_OK) { return NULL; } - elements = ((elements >= 0) && (elements <= objc)) ? elements : objc; + elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc; TclListObjGetElementsM(NULL, listObj, &objc, &objv); res = TclJoinPath(elements, objv, 0); return res; @@ -822,17 +822,15 @@ Tcl_FSJoinPath( Tcl_Obj * TclJoinPath( - int elements, /* Number of elements to use (-1 = all) */ + size_t elements, /* Number of elements to use */ Tcl_Obj * const objv[], /* Path elements to join */ int forceRelative) /* If non-zero, assume all more paths are * relative (e. g. simple normalization) */ { Tcl_Obj *res = NULL; - int i; + size_t i; const Tcl_Filesystem *fsPtr = NULL; - assert ( elements >= 0 ); - if (elements == 0) { TclNewObj(res); return res; @@ -934,7 +932,7 @@ TclJoinPath( assert ( res == NULL ); for (i = 0; i < elements; i++) { - int driveNameLength; + size_t driveNameLength; size_t strEltLen, length; Tcl_PathType type; char *strElt, *ptr; @@ -2310,7 +2308,7 @@ SetFsPathFromAny( * beginning with ~ are part of the native filesystem. */ - int objc; + size_t objc; Tcl_Obj **objv; Tcl_Obj *parts = TclpNativeSplitPath(pathPtr, NULL); |
