Skip to content

Commit

Permalink
Fix various 64-bit errors across Nimbus and fix an off-by-one error i…
Browse files Browse the repository at this point in the history
…n NIDOM.m
  • Loading branch information
dmaclach authored and stephanemoore committed Jun 11, 2014
1 parent d420366 commit f23e259
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/catalog/Catalog/BadgedLauncherButtonView.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)shouldUpdateViewWithObject:(BadgedLauncherViewObject *)object {
NSInteger badgeNumber = NIBoundi(object.badgeNumber, 0, 100);
if (object.badgeNumber > 0) {
if (badgeNumber < 100) {
self.badgeView.text = [NSString stringWithFormat:@"%d", badgeNumber];
self.badgeView.text = [NSString stringWithFormat:@"%zd", badgeNumber];
} else {
self.badgeView.text = @"99+";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ - (NSInteger)launcherView:(NILauncherView *)launcherView numberOfButtonsInPage:(
- (void)launcherView:(NILauncherView *)launcher didSelectItemOnPage:(NSInteger)page atIndex:(NSInteger)index {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Notice"
message:
[NSString stringWithFormat:@"Did tap button index %d on page %d",
[NSString stringWithFormat:@"Did tap button index %zd on page %zd",
index, page]
delegate:nil
cancelButtonTitle:@"OK"
Expand Down
2 changes: 1 addition & 1 deletion examples/catalog/Catalog/BlockCellsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (id)initWithStyle:(UITableViewStyle)style {
for (NSInteger ix = 0; ix < 1000; ++ix) {
[tableContents addObject:
[NIDrawRectBlockCellObject objectWithBlock:drawTextBlock object:
[NSString stringWithFormat:@"This is cell #%d", ix]]];
[NSString stringWithFormat:@"This is cell #%zd", ix]]];
}

_model = [[NITableViewModel alloc] initWithListArray:tableContents
Expand Down
4 changes: 2 additions & 2 deletions examples/catalog/Catalog/FormCellCatalogViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce

- (void)radioGroup:(NIRadioGroup *)radioGroup didSelectIdentifier:(NSInteger)identifier {
if (radioGroup == self.radioGroup) {
NSLog(@"Radio group selection: %d", identifier);
NSLog(@"Radio group selection: %zd", identifier);
} else if (radioGroup == self.subRadioGroup) {
NSLog(@"Sub radio group selection: %d", identifier);
NSLog(@"Sub radio group selection: %zd", identifier);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfa
#pragma mark - NIRadioGroupDelegate

- (void)radioGroup:(NIRadioGroup *)radioGroup didSelectIdentifier:(NSInteger)identifier {
NSLog(@"Did select radio group option %d", identifier);
NSLog(@"Did select radio group option %zd", identifier);

// Dismiss the modal view controller that's showing the radio group options.
[self dismissViewControllerAnimated:YES completion:nil];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfa

- (void)radioGroup:(NIRadioGroup *)radioGroup didSelectIdentifier:(NSInteger)identifier {
// When the radio group selection changes, this method will be called with the new identifier.
NSLog(@"Did select radio group option %d", identifier);
NSLog(@"Did select radio group option %zd", identifier);
}

- (NSString *)radioGroup:(NIRadioGroup *)radioGroup textForIdentifier:(NSInteger)identifier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ - (BOOL)didTapObject:(id)object {

- (void)radioGroup:(NIRadioGroup *)radioGroup didSelectIdentifier:(NSInteger)identifier {
// When the radio group selection changes, this method will be called with the new identifier.
NSLog(@"Did select radio group option %d", identifier);
NSLog(@"Did select radio group option %zd", identifier);
}

@end
2 changes: 1 addition & 1 deletion examples/catalog/Catalog/SamplePageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ - (id)initWithFrame:(CGRect)frame {
- (void)setPageIndex:(NSInteger)pageIndex {
_pageIndex = pageIndex;

self.label.text = [NSString stringWithFormat:@"This is page %i", pageIndex];
self.label.text = [NSString stringWithFormat:@"This is page %zd", pageIndex];

UIColor* bgColor;
UIColor* textColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (void)dealloc {
}

- (NSString *)cacheKeyForPhotoIndex:(NSInteger)photoIndex {
return [NSString stringWithFormat:@"%d", photoIndex];
return [NSString stringWithFormat:@"%zd", photoIndex];
}

- (NSInteger)identifierWithPhotoSize:(NIPhotoScrollViewPhotoSize)photoSize
Expand All @@ -60,7 +60,7 @@ - (NSInteger)identifierWithPhotoSize:(NIPhotoScrollViewPhotoSize)photoSize
}

- (id)identifierKeyFromIdentifier:(NSInteger)identifier {
return [NSNumber numberWithInt:identifier];
return [NSNumber numberWithInteger:identifier];
}

- (void)requestImageFromSource:(NSString *)source
Expand Down
2 changes: 1 addition & 1 deletion src/css/src/NIChameleonObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ -(void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindServic

-(void)netServiceDidResolveAddress:(NSNetService *)sender
{
_host = [NSString stringWithFormat:@"http://%@:%d/", [sender hostName], [sender port]];
_host = [NSString stringWithFormat:@"http://%@:%zd/", [sender hostName], [sender port]];
self.netService = nil;
[self watchSkinChanges];
}
Expand Down
9 changes: 4 additions & 5 deletions src/css/src/NIDOM.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,17 @@ -(void)addCssClass:(NSString *)cssClass toView:(UIView *)view
}
}

-(void)removeCssClass:(NSString *)cssClass fromView:(UIView *)view
{
-(void)removeCssClass:(NSString *)cssClass fromView:(UIView *)view {
NSString* selector = [@"." stringByAppendingString:cssClass];
NSString* pseudoBase = [selector stringByAppendingString:@":"];
NSMutableArray *selectors = [_viewToSelectorsMap objectForKey:[self keyForView:view]];
if (selectors) {
// Iterate over the selectors finding the id selector (if any) so we can
// also remove it from the id map
for (int i = selectors.count-1; i >= 0; i--) {
NSString *s = [selectors objectAtIndex:i];
for (NSUInteger i = selectors.count; i >= 1; i--) {
NSString *s = [selectors objectAtIndex:i - 1];
if ([s isEqualToString:selector] && [s hasPrefix:pseudoBase]) {
[selectors removeObjectAtIndex:i];
[selectors removeObjectAtIndex:i - 1];
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/css/src/UIView+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ - (NSString*)applyOrDescribe: (BOOL) apply ruleSet: (NICSSRuleset*) ruleSet inDO
if (apply) {
self.autoresizingMask = ruleSet.autoresizing;
} else {
[desc appendFormat:@"%@.autoresizingMask = (UIViewAutoresizing) %d;\n", name, ruleSet.autoresizing];
[desc appendFormat:@"%@.autoresizingMask = (UIViewAutoresizing) %zd;\n", name, ruleSet.autoresizing];
}
}
if ([ruleSet hasVisible]) {
Expand Down Expand Up @@ -639,7 +639,7 @@ -(NSArray *)buildSubviews:(NSArray *)viewSpecs inDOM:(NIDOM *)dom
NSMutableArray *subviews = [[NSMutableArray alloc] init];
[self _buildSubviews:viewSpecs inDOM:dom withViewArray:subviews];

for (int ix = 0, ct = subviews.count; ix < ct; ix++) {
for (NSUInteger ix = 0, ct = subviews.count; ix < ct; ix++) {
NIPrivateViewInfo *viewInfo = [subviews objectAtIndex:ix];
NSString *firstClass = [viewInfo.cssClasses count] ? [viewInfo.cssClasses objectAtIndex:0] : nil;
[dom registerView:viewInfo.view withCSSClass:firstClass andId:viewInfo.viewId];
Expand All @@ -654,7 +654,7 @@ -(NSArray *)buildSubviews:(NSArray *)viewSpecs inDOM:(NIDOM *)dom
}
}
if (viewInfo.cssClasses.count > 1) {
for (int i = 1, cct = viewInfo.cssClasses.count; i < cct; i++) {
for (NSUInteger i = 1, cct = viewInfo.cssClasses.count; i < cct; i++) {
[dom addCssClass:[viewInfo.cssClasses objectAtIndex:i] toView:viewInfo.view];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/networkimage/src/NIImageProcessing.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ + (CGRect)sourceRectWithImageSize:(CGSize)imageSize

} else {
// Not implemented
NIDERROR(@"The following content mode has not been implemented: %d", contentMode);
NIDERROR(@"The following content mode has not been implemented: %zd", contentMode);
return CGRectMake(0, 0, imageSize.width, imageSize.height);
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ + (CGRect)destinationRectWithImageSize:(CGSize)imageSize

} else {
// Not implemented
NIDERROR(@"The following content mode has not been implemented: %d", contentMode);
NIDERROR(@"The following content mode has not been implemented: %zd", contentMode);
return CGRectMake(0, 0, displaySize.width, displaySize.height);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pagingscrollview/src/NIPagingScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ - (void)updateVisiblePagesShouldNotifyDelegate:(BOOL)shouldNotifyDelegate {
}

// Add missing pages.
for (int pageIndex = rangeOfVisiblePages.location;
for (NSUInteger pageIndex = rangeOfVisiblePages.location;
pageIndex < (NSInteger)NSMaxRange(rangeOfVisiblePages); ++pageIndex) {
if (![self isDisplayingPageForIndex:pageIndex]) {
[self displayPageAtIndex:pageIndex];
Expand Down
2 changes: 1 addition & 1 deletion src/photos/src/NIToolbarPhotoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ - (void)refreshChromeState {
}

- (void)setChromeTitle {
self.title = [NSString stringWithFormat:@"%d of %d",
self.title = [NSString stringWithFormat:@"%zd of %zd",
(self.photoAlbumView.centerPageIndex + 1),
self.photoAlbumView.numberOfPages];
}
Expand Down

0 comments on commit f23e259

Please sign in to comment.