diff options
Diffstat (limited to 'generic/tclRegexp.c')
-rw-r--r-- | generic/tclRegexp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 67195bb..5df76c3 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -264,7 +264,7 @@ Tcl_RegExpRange( if (index > regexpPtr->re.re_nsub) { *startPtr = *endPtr = NULL; - } else if (regexpPtr->matches[index].rm_so == -1) { + } else if (regexpPtr->matches[index].rm_so == (size_t)-1) { *startPtr = *endPtr = NULL; } else { if (regexpPtr->objPtr) { @@ -363,21 +363,21 @@ TclRegExpRangeUniChar( * passed to Tcl_RegExpExec. */ size_t index, /* 0 means give the range of the entire match, * > 0 means give the range of a matching - * subrange, -1 means the range of the + * subrange, TCL_INDEX_NONE means the range of the * rm_extend field. */ - int *startPtr, /* Store address of first character in + size_t *startPtr, /* Store address of first character in * (sub-)range here. */ - int *endPtr) /* Store address of character just after last + size_t *endPtr) /* Store address of character just after last * in (sub-)range here. */ { TclRegexp *regexpPtr = (TclRegexp *) re; - if ((regexpPtr->flags®_EXPECT) && index == TCL_AUTO_LENGTH) { + if ((regexpPtr->flags®_EXPECT) && (index == TCL_INDEX_NONE)) { *startPtr = regexpPtr->details.rm_extend.rm_so; *endPtr = regexpPtr->details.rm_extend.rm_eo; - } else if (index > regexpPtr->re.re_nsub) { - *startPtr = -1; - *endPtr = -1; + } else if (index + 1 > regexpPtr->re.re_nsub + 1) { + *startPtr = TCL_INDEX_NONE; + *endPtr = TCL_INDEX_NONE; } else { *startPtr = regexpPtr->matches[index].rm_so; *endPtr = regexpPtr->matches[index].rm_eo; @@ -677,7 +677,7 @@ TclRegAbout( resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewWideIntObj((Tcl_WideInt) regexpPtr->re.re_nsub)); + TclNewWideIntObjFromSize(regexpPtr->re.re_nsub)); /* * Now append a list of all the bit-flags set for the RE. |