mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
|
@ -1,3 +1,7 @@
|
|||
2015-09-01 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Source/NSRegularExpression.m: Fix handling of empty capture groups.
|
||||
|
||||
2015-08-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSOperation.m: Fix potential deadlock with adding observers.
|
||||
|
|
|
@ -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…
Reference in a new issue