Browse files

Fix warnings found in the DCTKit project

  • Loading branch information...
1 parent 8cc7255 commit 7d87ea33fee8efc3527076bb5c5825e976fd0fc8 @danielctull danielctull committed Feb 20, 2011
View
2 Automated Setup/NSManagedObject+DCTAutomatedSetup.h
@@ -152,4 +152,4 @@
*/
+ (NSDictionary *)dct_mappingFromRemoteNamesToLocalNames;
-@end
+@end
View
2 Automated Setup/NSManagedObject+DCTAutomatedSync.h
@@ -58,4 +58,4 @@ typedef enum {
- (NSString *)dct_lastUpdatedDateKey;
- (void)dct_synchroniseToSource;
-@end
+@end
View
6 NSManagedObject+DCTOrdering.h
@@ -43,10 +43,10 @@
- (void)dct_addOrderedObject:(NSManagedObject<DCTOrderedObject> *)object forKey:(NSString *)key;
- (void)dct_addOrderedObject:(NSManagedObject<DCTOrderedObject> *)object forKey:(NSString *)key lastObject:(NSManagedObject<DCTOrderedObject> *)last;
-- (void)dct_insertOrderedObject:(NSManagedObject<DCTOrderedObject> *)object atIndex:(NSInteger)index forKey:(NSString *)key;
-- (void)dct_removeOrderedObjectAtIndex:(NSInteger)index forKey:(NSString *)key;
+- (void)dct_insertOrderedObject:(NSManagedObject<DCTOrderedObject> *)object atIndex:(NSUInteger)index forKey:(NSString *)key;
+- (void)dct_removeOrderedObjectAtIndex:(NSUInteger)index forKey:(NSString *)key;
-- (NSManagedObject<DCTOrderedObject> *)dct_orderedObjectAtIndex:(NSInteger)index forKey:(NSString *)key;
+- (NSManagedObject<DCTOrderedObject> *)dct_orderedObjectAtIndex:(NSUInteger)index forKey:(NSString *)key;
- (NSManagedObject<DCTOrderedObject> *)dct_lastOrderedObjectForKey:(NSString *)key;
- (NSManagedObject<DCTOrderedObject> *)dct_firstOrderedObjectForKey:(NSString *)key;
View
44 NSManagedObject+DCTOrdering.m
@@ -94,13 +94,13 @@ - (void)dct_addOrderedObject:(NSManagedObject<DCTOrderedObject> *)object
if ([last dctInternal_nextOrderedObject])
return [self dct_addOrderedObject:object forKey:key];
- NSInteger index = [last.dctOrderedObjectIndex integerValue] + 1;
+ NSUInteger insertionIndex = [last.dctOrderedObjectIndex integerValue] + 1;
// if the set count is larger than the new object's insertion point, it's not the end so call the proper insert method
- if ([[self valueForKey:key] count] > index)
+ if ([[self valueForKey:key] count] > insertionIndex)
return [self dct_addOrderedObject:object forKey:key];
- object.dctOrderedObjectIndex = [NSNumber numberWithInteger:index];
+ object.dctOrderedObjectIndex = [NSNumber numberWithInteger:insertionIndex];
[object dctInternal_setNextOrderedObject:last];
@@ -109,7 +109,7 @@ - (void)dct_addOrderedObject:(NSManagedObject<DCTOrderedObject> *)object
- (void)dct_insertOrderedObject:(NSManagedObject<DCTOrderedObject> *)object
- atIndex:(NSInteger)index
+ atIndex:(NSUInteger)insertionIndex
forKey:(NSString *)key {
if (![self dctInternal_containsRelationshipForKey:key]) return;
@@ -120,69 +120,69 @@ - (void)dct_insertOrderedObject:(NSManagedObject<DCTOrderedObject> *)object
NSArray *orderedObjects = [self dct_orderedObjectsForKey:key];
- if ([orderedObjects count] > index) {
+ if ([orderedObjects count] > insertionIndex) {
- NSRange range = NSMakeRange(index, [orderedObjects count]-index);
+ NSRange range = NSMakeRange(insertionIndex, [orderedObjects count] - insertionIndex);
NSArray *objectsAfter = [orderedObjects subarrayWithRange:range];
for (NSManagedObject<DCTOrderedObject> *o in objectsAfter)
o.dctOrderedObjectIndex = [NSNumber numberWithInteger:[o.dctOrderedObjectIndex integerValue]+1];
- [object dctInternal_setNextOrderedObject:[orderedObjects objectAtIndex:index]];
+ [object dctInternal_setNextOrderedObject:[orderedObjects objectAtIndex:insertionIndex]];
}
// work out the object before insert
- [object dctInternal_setPreviousOrderedObject:[orderedObjects objectAtIndex:index-1]];
+ [object dctInternal_setPreviousOrderedObject:[orderedObjects objectAtIndex:insertionIndex - 1]];
}
- object.dctOrderedObjectIndex = [NSNumber numberWithInteger:index];
+ object.dctOrderedObjectIndex = [NSNumber numberWithInteger:insertionIndex];
[self dct_addRelatedObject:object forKey:key];
}
-- (void)dct_removeOrderedObjectAtIndex:(NSInteger)index
+- (void)dct_removeOrderedObjectAtIndex:(NSUInteger)theIndex
forKey:(NSString *)key {
if (![self dctInternal_containsRelationshipForKey:key]) return;
NSSet *set = [self dctInternal_orderedObjectsSetForKey:key];
- if ([set count] < index) return;
+ if ([set count] < theIndex) return;
NSArray *orderedObjects = [self dct_orderedObjectsForKey:key];
- NSManagedObject<DCTOrderedObject> *previous = [orderedObjects objectAtIndex:index-1];
+ NSManagedObject<DCTOrderedObject> *previous = [orderedObjects objectAtIndex:theIndex - 1];
[previous dctInternal_setNextOrderedObject:nil];
- NSManagedObject<DCTOrderedObject> *object = [orderedObjects objectAtIndex:index];
+ NSManagedObject<DCTOrderedObject> *object = [orderedObjects objectAtIndex:theIndex];
- if ([orderedObjects count] > index) {
+ if ([orderedObjects count] > theIndex) {
- NSManagedObject<DCTOrderedObject> *next = [orderedObjects objectAtIndex:index+1];
+ NSManagedObject<DCTOrderedObject> *next = [orderedObjects objectAtIndex:theIndex + 1];
[previous dctInternal_setNextOrderedObject:next];
- NSRange range = NSMakeRange(index, [orderedObjects count]-index);
+ NSRange range = NSMakeRange(theIndex, [orderedObjects count] - theIndex);
NSArray *objectsAfter = [orderedObjects subarrayWithRange:range];
for (NSManagedObject<DCTOrderedObject> *o in objectsAfter)
- o.dctOrderedObjectIndex = [NSNumber numberWithInteger:[o.dctOrderedObjectIndex integerValue]-1];
+ o.dctOrderedObjectIndex = [NSNumber numberWithInteger:[o.dctOrderedObjectIndex integerValue] - 1];
}
[self dct_removeRelatedObject:object forKey:key];
}
-- (void)dct_replaceOrderedObjectAtIndex:(NSInteger)index
+- (void)dct_replaceOrderedObjectAtIndex:(NSUInteger)theIndex
withObject:(NSManagedObject<DCTOrderedObject> *)object
forKey:(NSString *)key {
if (![self dctInternal_containsRelationshipForKey:key]) return;
- NSManagedObject<DCTOrderedObject> *objectToReplace = [self dct_orderedObjectAtIndex:index forKey:key];
+ NSManagedObject<DCTOrderedObject> *objectToReplace = [self dct_orderedObjectAtIndex:theIndex forKey:key];
object.dctOrderedObjectIndex = objectToReplace.dctOrderedObjectIndex;
@@ -200,14 +200,14 @@ - (void)dct_replaceOrderedObjectAtIndex:(NSInteger)index
-- (NSManagedObject<DCTOrderedObject> *)dct_orderedObjectAtIndex:(NSInteger)index
+- (NSManagedObject<DCTOrderedObject> *)dct_orderedObjectAtIndex:(NSUInteger)theIndex
forKey:(NSString *)key {
NSArray *orderedObjects = [self dct_orderedObjectsForKey:key];
- if (!orderedObjects || [orderedObjects count] < index) return nil;
+ if (!orderedObjects || [orderedObjects count] < theIndex) return nil;
- NSManagedObject *mo = [orderedObjects objectAtIndex:index];
+ NSManagedObject *mo = [orderedObjects objectAtIndex:theIndex];
if (![mo conformsToProtocol:@protocol(DCTOrderedObject)]) return nil;

0 comments on commit 7d87ea3

Please sign in to comment.