diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-19 13:21:56 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-19 13:21:56 (GMT) |
commit | 11b8f6eb00bb80ed84c0b8f4c382b9626f94e7ea (patch) | |
tree | fb7f2d96d4fe7aaed651b4d6145ad93a333803ea | |
parent | f6830a72ec9060084f21dea70771bc1092d5f207 (diff) | |
download | tcl-11b8f6eb00bb80ed84c0b8f4c382b9626f94e7ea.zip tcl-11b8f6eb00bb80ed84c0b8f4c382b9626f94e7ea.tar.gz tcl-11b8f6eb00bb80ed84c0b8f4c382b9626f94e7ea.tar.bz2 |
Fix [3c04fcdd1a] - join truncates large lists
-rw-r--r-- | generic/tclInt.h | 2 | ||||
-rw-r--r-- | generic/tclStringObj.c | 13 | ||||
-rw-r--r-- | tests/bigdata.test | 9 |
3 files changed, 12 insertions, 12 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index d602afd..7efc0a7 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4033,7 +4033,7 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, * candidates for public interface. */ -MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc, +MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int flags); MODULE_SCOPE Tcl_Obj * TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack, Tcl_Size start); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3063ea3..2bbc4bc 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3115,23 +3115,24 @@ TclStringRepeat( Tcl_Obj * TclStringCat( Tcl_Interp *interp, - int objc, + Tcl_Size objc, Tcl_Obj * const objv[], int flags) { Tcl_Obj *objResultPtr, * const *ov; - int oc, binary = 1; + int binary = 1; + Tcl_Size oc; Tcl_Size length = 0; int allowUniChar = 1, requestUniChar = 0, forceUniChar = 0; - int first = objc - 1; /* Index of first value possibly not empty */ - int last = 0; /* Index of last value possibly not empty */ + Tcl_Size first = objc - 1; /* Index of first value possibly not empty */ + Tcl_Size last = 0; /* Index of last value possibly not empty */ int inPlace = flags & TCL_STRING_IN_PLACE; /* assert ( objc >= 0 ) */ if (objc <= 1) { - /* Only one or no objects; return first or empty */ - return objc ? objv[0] : Tcl_NewObj(); + /* Negative (shouldn't be), one or no objects; return first or empty */ + return objc == 1 ? objv[0] : Tcl_NewObj(); } /* assert ( objc >= 2 ) */ diff --git a/tests/bigdata.test b/tests/bigdata.test index 5519ded..78b8baf 100644 --- a/tests/bigdata.test +++ b/tests/bigdata.test @@ -989,15 +989,14 @@ bigtestRO lsort-bigdata-1 "lsort" [list 4294967296 [lrepeat 10 0] [lrepeat 10 9] # # join -bigtestRO join-bigdata-1 "join" 1 -body { - puts len:[string length [join $l ""]] - #string equal [join $l ""] $s +bigtestRO join-bigdata-1 "join" [list 0123456789 6789012345] -body { + set s [join $l ""] + list [string range $s 0 9] [string range $s end-9 end] } -setup { set l [bigList 0x100000000] - set s [bigString 0x100000000] } -cleanup { bigClean -} -constraints bug-3c04fcdd1a +} bigtest split-bigdata-1 "split" {4294967296 {0 1 2 3 4} {1 2 3 4 5}} -body { # Fill list compare needs too much memory |