mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
bcbb4d0e50
commit
1ed1a96981
2 changed files with 24 additions and 8 deletions
|
@ -6,6 +6,8 @@
|
||||||
* Tests/base/NSFileHandle/basic.m:
|
* Tests/base/NSFileHandle/basic.m:
|
||||||
* Tests/base/NSFileHandle/singleton.m:
|
* Tests/base/NSFileHandle/singleton.m:
|
||||||
Correct faulty tests.
|
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>
|
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]]);
|
rightIsNil = (rightResult == nil || [rightResult isEqual: [NSNull null]]);
|
||||||
if (leftIsNil || rightIsNil)
|
if (leftIsNil || rightIsNil)
|
||||||
{
|
{
|
||||||
/* One of the values is nil. The result is YES,
|
if (leftIsNil == rightIsNil)
|
||||||
* if both are nil and equality is requested.
|
{
|
||||||
*/
|
/* Both of the values are nil.
|
||||||
return ((leftIsNil == rightIsNil)
|
* The result is YES if equality is requested.
|
||||||
&& ((_type == NSEqualToPredicateOperatorType)
|
*/
|
||||||
|| (_type == NSLessThanOrEqualToPredicateOperatorType)
|
if (NSEqualToPredicateOperatorType == _type
|
||||||
|| (_type == NSGreaterThanOrEqualToPredicateOperatorType))) ? YES : NO;
|
|| 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.
|
// Change predicate options into string options.
|
||||||
|
@ -992,7 +1005,8 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
|
||||||
!= NSNotFound ? YES : NO);
|
!= NSNotFound ? YES : NO);
|
||||||
case NSCustomSelectorPredicateOperatorType:
|
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);
|
return function(leftResult, _selector, rightResult);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue