From 7fc6b260a2dcaae21cbaa371aa5929a71aa3afdf Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Wed, 20 Jun 2007 04:36:31 +0000 Subject: [PATCH] fix bug #20215 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25272 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSPredicate.m | 46 ++++++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index d526a2923..94131fa25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-20 Richard Frith-Macdonald + + * Source/NSPredicate.m: Fix bug #20215 ... scanning of greater than + and less than operators. + 2007-06-15 Adam Fedor * Source/NSTimeZone.m ([NSTimeZone +timeZoneArray]): Skip .tab diff --git a/Source/NSPredicate.m b/Source/NSPredicate.m index 9996bdfa8..6558765a2 100644 --- a/Source/NSPredicate.m +++ b/Source/NSPredicate.m @@ -1605,41 +1605,41 @@ { NSPredicate *l = [self parseNot]; - while ([self scanPredicateKeyword: @"OR"] || - [self scanPredicateKeyword: @"||"]) + while ([self scanPredicateKeyword: @"OR"] + || [self scanPredicateKeyword: @"||"]) { NSPredicate *r = [self parseNot]; if ([r isKindOfClass: [NSCompoundPredicate class]] - && [(NSCompoundPredicate *)r compoundPredicateType] - == NSOrPredicateType) + && [(NSCompoundPredicate *)r compoundPredicateType] + == NSOrPredicateType) { // merge if ([l isKindOfClass: [NSCompoundPredicate class]] - && [(NSCompoundPredicate *)l compoundPredicateType] - == NSOrPredicateType) + && [(NSCompoundPredicate *)l compoundPredicateType] + == NSOrPredicateType) { [(NSMutableArray *)[(NSCompoundPredicate *)l subpredicates] - addObjectsFromArray: [(NSCompoundPredicate *)r subpredicates]]; + addObjectsFromArray: [(NSCompoundPredicate *)r subpredicates]]; } else { [(NSMutableArray *)[(NSCompoundPredicate *)r subpredicates] - insertObject: l atIndex: 0]; + insertObject: l atIndex: 0]; l = r; } } else if ([l isKindOfClass: [NSCompoundPredicate class]] - && [(NSCompoundPredicate *)l compoundPredicateType] - == NSOrPredicateType) + && [(NSCompoundPredicate *)l compoundPredicateType] + == NSOrPredicateType) { [(NSMutableArray *) [(NSCompoundPredicate *) l subpredicates] - addObject:r]; + addObject:r]; } else { l = [NSCompoundPredicate orPredicateWithSubpredicates: - [NSArray arrayWithObjects: l, r, nil]]; + [NSArray arrayWithObjects: l, r, nil]]; } } return l; @@ -1677,34 +1677,34 @@ } left = [self parseExpression]; - if ([self scanString: @"<" intoString: NULL]) + if ([self scanString: @"!=" intoString: NULL] + || [self scanString: @"<>" intoString: NULL]) { - type = NSLessThanPredicateOperatorType; + type = NSNotEqualToPredicateOperatorType; } else if ([self scanString: @"<=" intoString: NULL] || [self scanString: @"=<" intoString: NULL]) { type = NSLessThanOrEqualToPredicateOperatorType; } - else if ([self scanString: @">" intoString: NULL]) - { - type = NSGreaterThanPredicateOperatorType; - } else if ([self scanString: @">=" intoString: NULL] || [self scanString: @"=>" intoString: NULL]) { type = NSGreaterThanOrEqualToPredicateOperatorType; } + else if ([self scanString: @"<" intoString: NULL]) + { + type = NSLessThanPredicateOperatorType; + } + else if ([self scanString: @">" intoString: NULL]) + { + type = NSGreaterThanPredicateOperatorType; + } else if ([self scanString: @"==" intoString: NULL] || [self scanString: @"=" intoString: NULL]) { type = NSEqualToPredicateOperatorType; } - else if ([self scanString: @"!=" intoString: NULL] - || [self scanString: @"<>" intoString: NULL]) - { - type = NSNotEqualToPredicateOperatorType; - } else if ([self scanPredicateKeyword: @"MATCHES"]) { type = NSMatchesPredicateOperatorType;