mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Fix handling of capture groups not participating in the current match.
The Cocoa API specifies to return theses as (NSNotFound,0) ranges, but the ICU API returns them as (-1,-1) pairs of start/end indices. The necessary conversion was missing here. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38963 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0f44f60d7c
commit
8b8e32b080
2 changed files with 16 additions and 2 deletions
|
@ -297,8 +297,18 @@ prepareResult(NSRegularExpression *regex,
|
|||
|
||||
for (i = 0; i < groups; i++)
|
||||
{
|
||||
NSUInteger start = uregex_start(r, i, s);
|
||||
NSUInteger end = uregex_end(r, i, s);
|
||||
NSInteger start = uregex_start(r, i, s);
|
||||
NSInteger end = uregex_end(r, i, s);
|
||||
// The ICU API defines -1 as not found. Convert to
|
||||
// NSNotFound if applicable.
|
||||
if (start == -1)
|
||||
{
|
||||
start = NSNotFound;
|
||||
}
|
||||
if (end == -1)
|
||||
{
|
||||
end = NSNotFound;
|
||||
}
|
||||
|
||||
if (end < start)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue