From f3f5af838f73493ec2201ecbbf89d24712202c19 Mon Sep 17 00:00:00 2001 From: Tony Arnold Date: Tue, 7 Feb 2012 15:06:16 +1100 Subject: [PATCH] Fix pointer signedness comparison issues. Wherever possible, I've cast NSUInteger back to NSInteger as we're not using any values large enough for this to be an issue. --- GMGridView/GMGridView.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/GMGridView/GMGridView.m b/GMGridView/GMGridView.m index 6975f06..1b9726c 100644 --- a/GMGridView/GMGridView.m +++ b/GMGridView/GMGridView.m @@ -32,7 +32,7 @@ #import "GMGridViewLayoutStrategies.h" #import "UIGestureRecognizer+GMGridViewAdditions.h" -static const NSUInteger kTagOffset = 50; +static const NSInteger kTagOffset = 50; static const CGFloat kDefaultAnimationDuration = 0.3; static const UIViewAnimationOptions kDefaultAnimationOptions = UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction; @@ -429,7 +429,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated { for (GMGridViewCell *cell in [self itemSubviews]) { - NSUInteger index = [self positionForItemSubview:cell]; + NSInteger index = [self positionForItemSubview:cell]; if (index != GMGV_INVALID_POSITION) { BOOL allowEdit = editing && [self.dataSource GMGridView:self canDeleteItemAtIndex:index]; @@ -1296,8 +1296,8 @@ - (void)loadRequiredItems NSRange loadedPositionsRange = NSMakeRange(self.firstPositionLoaded, self.lastPositionLoaded - self.firstPositionLoaded); // calculate new position range - self.firstPositionLoaded = self.firstPositionLoaded == GMGV_INVALID_POSITION ? rangeOfPositions.location : MIN(self.firstPositionLoaded, rangeOfPositions.location); - self.lastPositionLoaded = self.lastPositionLoaded == GMGV_INVALID_POSITION ? NSMaxRange(rangeOfPositions) : MAX(self.lastPositionLoaded, rangeOfPositions.length + rangeOfPositions.location); + self.firstPositionLoaded = self.firstPositionLoaded == GMGV_INVALID_POSITION ? rangeOfPositions.location : MIN(self.firstPositionLoaded, (NSInteger)rangeOfPositions.location); + self.lastPositionLoaded = self.lastPositionLoaded == GMGV_INVALID_POSITION ? NSMaxRange(rangeOfPositions) : MAX(self.lastPositionLoaded, (NSInteger)(rangeOfPositions.length + rangeOfPositions.location)); // remove now invisible items [self setSubviewsCacheAsInvalid]; @@ -1306,7 +1306,7 @@ - (void)loadRequiredItems // add new cells BOOL forceLoad = self.firstPositionLoaded == GMGV_INVALID_POSITION || self.lastPositionLoaded == GMGV_INVALID_POSITION; NSInteger positionToLoad; - for (int i = 0; i < rangeOfPositions.length; i++) + for (NSUInteger i = 0; i < rangeOfPositions.length; i++) { positionToLoad = i + rangeOfPositions.location; @@ -1327,9 +1327,9 @@ - (void)cleanupUnseenItems NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset]; GMGridViewCell *cell; - if (rangeOfPositions.location > self.firstPositionLoaded) + if ((NSInteger)rangeOfPositions.location > self.firstPositionLoaded) { - for (int i = self.firstPositionLoaded; i < rangeOfPositions.location; i++) + for (NSInteger i = self.firstPositionLoaded; i < (NSInteger)rangeOfPositions.location; i++) { cell = [self cellForItemAtIndex:i]; if(cell) @@ -1343,9 +1343,9 @@ - (void)cleanupUnseenItems [self setSubviewsCacheAsInvalid]; } - if (NSMaxRange(rangeOfPositions) < self.lastPositionLoaded) + if ((NSInteger)NSMaxRange(rangeOfPositions) < self.lastPositionLoaded) { - for (int i = NSMaxRange(rangeOfPositions); i <= self.lastPositionLoaded; i++) + for (NSInteger i = NSMaxRange(rangeOfPositions); i <= self.lastPositionLoaded; i++) { cell = [self cellForItemAtIndex:i]; if(cell)