From c694c96a3241a11bebd6fafb9f9b994a7ccf0eba Mon Sep 17 00:00:00 2001 From: cacaodev Date: Mon, 2 Nov 2009 23:55:07 +0100 Subject: [PATCH] CPPredicate & co style cleaning --- Foundation/CPPredicate/CPCompoundPredicate.j | 11 +++++++---- Foundation/CPPredicate/CPExpression_aggregate.j | 2 +- Foundation/CPPredicate/CPPredicate.j | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Foundation/CPPredicate/CPCompoundPredicate.j b/Foundation/CPPredicate/CPCompoundPredicate.j index 1fff80f4a..7ba504e6a 100644 --- a/Foundation/CPPredicate/CPCompoundPredicate.j +++ b/Foundation/CPPredicate/CPCompoundPredicate.j @@ -104,9 +104,10 @@ var CPCompoundPredicateType; - (CPPredicate)predicateWithSubstitutionVariables:(CPDictionary)variables { var subp = [CPArray array], + count = [subp count]; i; - for (i = 0; i < [subp count]; i++) + for (i = 0; i < count; i++) { var p = [subp objectAtIndex:i], sp = [p predicateWithSubstitutionVariables:variables]; @@ -125,7 +126,7 @@ var CPCompoundPredicateType; i; if (count == 0) - return @"TRUPREDICATE"; + return @"TRUPREDICATE"; for (i = 0; i < count; i++) { @@ -146,12 +147,14 @@ var CPCompoundPredicateType; break; case CPAndPredicateType: result += [args objectAtIndex:0]; - for (var j = 1; j < [args count]; j++) + var count = [args count]; + for (var j = 1; j < count; j++) result += " AND " + [args objectAtIndex:j]; break; case CPOrPredicateType: result += [args objectAtIndex:0]; - for (var j = 1; j < [args count]; j++) + var count = [args count]; + for (var j = 1; j < count; j++) result += " OR " + [args objectAtIndex:j]; break; } diff --git a/Foundation/CPPredicate/CPExpression_aggregate.j b/Foundation/CPPredicate/CPExpression_aggregate.j index 01a123b4c..90b25c8ec 100644 --- a/Foundation/CPPredicate/CPExpression_aggregate.j +++ b/Foundation/CPPredicate/CPExpression_aggregate.j @@ -84,7 +84,7 @@ count = [_aggregate count], result = "{"; - for (i = 0;i < count;i++) + for (i = 0; i < count; i++) result = result + [CPString stringWithFormat:@"%s%s", [[_aggregate objectAtIndex:i] description], (i + 1 < count) ? @", " : @""]; result = result + "}"; diff --git a/Foundation/CPPredicate/CPPredicate.j b/Foundation/CPPredicate/CPPredicate.j index d65a1eeaa..ce06129dd 100644 --- a/Foundation/CPPredicate/CPPredicate.j +++ b/Foundation/CPPredicate/CPPredicate.j @@ -181,7 +181,7 @@ { var count = [self count]; - while (--count >= 0) + while (count--) { var object = [self objectAtIndex:count];