mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
add check for NSNotEqualToPredicateOperatorType
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
163a0d9601
commit
ea1c58655b
2 changed files with 24 additions and 8 deletions
|
@ -6,6 +6,8 @@
|
|||
* Tests/base/NSFileHandle/basic.m:
|
||||
* Tests/base/NSFileHandle/singleton.m:
|
||||
Correct faulty tests.
|
||||
* Source/NSPredicate.m: ([_evaluateLeftValue:rightValue:object:])
|
||||
Add missing check for NSNotEqualToPredicateOperatorType spotted by Fred
|
||||
|
||||
2013-10-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -878,13 +878,26 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
|
|||
rightIsNil = (rightResult == nil || [rightResult isEqual: [NSNull null]]);
|
||||
if (leftIsNil || rightIsNil)
|
||||
{
|
||||
/* One of the values is nil. The result is YES,
|
||||
* if both are nil and equality is requested.
|
||||
*/
|
||||
return ((leftIsNil == rightIsNil)
|
||||
&& ((_type == NSEqualToPredicateOperatorType)
|
||||
|| (_type == NSLessThanOrEqualToPredicateOperatorType)
|
||||
|| (_type == NSGreaterThanOrEqualToPredicateOperatorType))) ? YES : NO;
|
||||
if (leftIsNil == rightIsNil)
|
||||
{
|
||||
/* Both of the values are nil.
|
||||
* The result is YES if equality is requested.
|
||||
*/
|
||||
if (NSEqualToPredicateOperatorType == _type
|
||||
|| NSLessThanOrEqualToPredicateOperatorType == _type
|
||||
|| NSGreaterThanOrEqualToPredicateOperatorType == _type)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
else if (NSNotEqualToPredicateOperatorType == _type)
|
||||
{
|
||||
/* One, but not both of the values are nil.
|
||||
* The result is YES if inequality is requested.
|
||||
*/
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Change predicate options into string options.
|
||||
|
@ -992,7 +1005,8 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
|
|||
!= NSNotFound ? YES : NO);
|
||||
case NSCustomSelectorPredicateOperatorType:
|
||||
{
|
||||
BOOL (*function)(id,SEL,id) = (BOOL (*)(id,SEL,id))[leftResult methodForSelector: _selector];
|
||||
BOOL (*function)(id,SEL,id)
|
||||
= (BOOL (*)(id,SEL,id))[leftResult methodForSelector: _selector];
|
||||
return function(leftResult, _selector, rightResult);
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue