diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-30 13:14:43 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-30 13:14:43 (GMT) |
| commit | 72998869a3be3534fec99499faabe2d1557d6bcb (patch) | |
| tree | 85593ed297518fcde58853b7fa1d2cb98b1a0e6d /generic/tclCmdIL.c | |
| parent | c47ba70f4545f7c961160a6beb0a466e3bfd5532 (diff) | |
| download | tcl-72998869a3be3534fec99499faabe2d1557d6bcb.zip tcl-72998869a3be3534fec99499faabe2d1557d6bcb.tar.gz tcl-72998869a3be3534fec99499faabe2d1557d6bcb.tar.bz2 | |
Fix [8e1e31eac0fd6b6c4452bc108a98ab08c6b64588|8e1e31eac0]: lsort treats NUL chars strangely. Also fix various initializations, which only make a difference when TCL_UTF_MAX == 4.
Add new test-cases which demonstrate the fix. For TCL_UTF_MAX == 4, surrogates will now be handled as expected as well when sorting.
Diffstat (limited to 'generic/tclCmdIL.c')
| -rw-r--r-- | generic/tclCmdIL.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 47076ec..b41d312 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2945,7 +2945,7 @@ Tcl_LsearchObjCmd( double patDouble, objDouble; SortInfo sortInfo; Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr; - SortStrCmpFn_t strCmpFn = strcmp; + SortStrCmpFn_t strCmpFn = TclUtfCmp; Tcl_RegExp regexp = NULL; static const char *const options[] = { "-all", "-ascii", "-bisect", "-decreasing", "-dictionary", @@ -4263,7 +4263,7 @@ SortCompare( int order = 0; if (infoPtr->sortMode == SORTMODE_ASCII) { - order = strcmp(elemPtr1->collationKey.strValuePtr, + order = TclUtfCmp(elemPtr1->collationKey.strValuePtr, elemPtr2->collationKey.strValuePtr); } else if (infoPtr->sortMode == SORTMODE_ASCII_NC) { order = TclUtfCasecmp(elemPtr1->collationKey.strValuePtr, |
