Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pointer signedness comparison issues. #41

Merged
merged 1 commit into from Feb 7, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions GMGridView/GMGridView.m
Expand Up @@ -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;

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand All @@ -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;

Expand All @@ -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)
Expand All @@ -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)
Expand Down