Skip to content

Commit

Permalink
Fix pointer signedness comparison issues. Wherever possible, I've cas…
Browse files Browse the repository at this point in the history
…t NSUInteger back to NSInteger as we're not using any values large enough for this to be an issue.
  • Loading branch information
tonyarnold committed Feb 7, 2012
1 parent bbcb65d commit f3f5af8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions GMGridView/GMGridView.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#import "GMGridViewLayoutStrategies.h" #import "GMGridViewLayoutStrategies.h"
#import "UIGestureRecognizer+GMGridViewAdditions.h" #import "UIGestureRecognizer+GMGridViewAdditions.h"


static const NSUInteger kTagOffset = 50; static const NSInteger kTagOffset = 50;
static const CGFloat kDefaultAnimationDuration = 0.3; static const CGFloat kDefaultAnimationDuration = 0.3;
static const UIViewAnimationOptions kDefaultAnimationOptions = UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction; static const UIViewAnimationOptions kDefaultAnimationOptions = UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction;


Expand Down Expand Up @@ -429,7 +429,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated
{ {
for (GMGridViewCell *cell in [self itemSubviews]) for (GMGridViewCell *cell in [self itemSubviews])
{ {
NSUInteger index = [self positionForItemSubview:cell]; NSInteger index = [self positionForItemSubview:cell];
if (index != GMGV_INVALID_POSITION) if (index != GMGV_INVALID_POSITION)
{ {
BOOL allowEdit = editing && [self.dataSource GMGridView:self canDeleteItemAtIndex:index]; BOOL allowEdit = editing && [self.dataSource GMGridView:self canDeleteItemAtIndex:index];
Expand Down Expand Up @@ -1296,8 +1296,8 @@ - (void)loadRequiredItems
NSRange loadedPositionsRange = NSMakeRange(self.firstPositionLoaded, self.lastPositionLoaded - self.firstPositionLoaded); NSRange loadedPositionsRange = NSMakeRange(self.firstPositionLoaded, self.lastPositionLoaded - self.firstPositionLoaded);


// calculate new position range // calculate new position range
self.firstPositionLoaded = self.firstPositionLoaded == GMGV_INVALID_POSITION ? rangeOfPositions.location : MIN(self.firstPositionLoaded, 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, rangeOfPositions.length + rangeOfPositions.location); self.lastPositionLoaded = self.lastPositionLoaded == GMGV_INVALID_POSITION ? NSMaxRange(rangeOfPositions) : MAX(self.lastPositionLoaded, (NSInteger)(rangeOfPositions.length + rangeOfPositions.location));


// remove now invisible items // remove now invisible items
[self setSubviewsCacheAsInvalid]; [self setSubviewsCacheAsInvalid];
Expand All @@ -1306,7 +1306,7 @@ - (void)loadRequiredItems
// add new cells // add new cells
BOOL forceLoad = self.firstPositionLoaded == GMGV_INVALID_POSITION || self.lastPositionLoaded == GMGV_INVALID_POSITION; BOOL forceLoad = self.firstPositionLoaded == GMGV_INVALID_POSITION || self.lastPositionLoaded == GMGV_INVALID_POSITION;
NSInteger positionToLoad; NSInteger positionToLoad;
for (int i = 0; i < rangeOfPositions.length; i++) for (NSUInteger i = 0; i < rangeOfPositions.length; i++)
{ {
positionToLoad = i + rangeOfPositions.location; positionToLoad = i + rangeOfPositions.location;


Expand All @@ -1327,9 +1327,9 @@ - (void)cleanupUnseenItems
NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset]; NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset];
GMGridViewCell *cell; 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]; cell = [self cellForItemAtIndex:i];
if(cell) if(cell)
Expand All @@ -1343,9 +1343,9 @@ - (void)cleanupUnseenItems
[self setSubviewsCacheAsInvalid]; [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]; cell = [self cellForItemAtIndex:i];
if(cell) if(cell)
Expand Down

0 comments on commit f3f5af8

Please sign in to comment.