Correct result of NSRegularExpression -rangeOfFirstMatchInString:...

When no match is found location must be set to NSNotFound.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34348 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2011-12-23 14:59:14 +00:00
parent 42ffcb55bf
commit f7afd83ded
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2011-12-23 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSRegularExpression.m (-rangeOfFirstMatchInString:...):
Return range (NSNotFound, 0) when no match is found.
2011-12-22 Wolfgang Lux <wolfgang.lux@gmail.com> 2011-12-22 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSRegularExpression.m (-initWithPattern:options:error:, * Source/NSRegularExpression.m (-initWithPattern:options:error:,

View file

@ -491,7 +491,7 @@ prepareResult(NSRegularExpression *regex,
options: (NSMatchingOptions)opts options: (NSMatchingOptions)opts
range: (NSRange)range range: (NSRange)range
{ {
__block NSRange r; __block NSRange r = {NSNotFound, 0};
opts &= ~NSMatchingReportProgress; opts &= ~NSMatchingReportProgress;
opts &= ~NSMatchingReportCompletion; opts &= ~NSMatchingReportCompletion;
@ -623,7 +623,7 @@ prepareResult(NSRegularExpression *regex,
options: (NSMatchingOptions)opts options: (NSMatchingOptions)opts
range: (NSRange)range range: (NSRange)range
{ {
NSRange result = {0,0}; NSRange result = {NSNotFound, 0};
FAKE_BLOCK_HACK(result, FAKE_BLOCK_HACK(result,
{ {