Skip to content

Commit

Permalink
[overview] Fix strict warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Aug 17, 2012
1 parent 05211b0 commit e409684
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/overview/src/NIDeviceInfo.m
Expand Up @@ -41,7 +41,7 @@

// Determine what magnitude the number of bytes is by shifting off 10 bits at a time
// (equivalent to dividing by 1024).
NSInteger magnitude = 0;
unsigned long magnitude = 0;
unsigned long long highbits = bytes;
unsigned long long inverseBits = ~((unsigned long long)0x3FF);
while ((highbits & inverseBits)
Expand Down
4 changes: 2 additions & 2 deletions src/overview/src/NIOverview.m
Expand Up @@ -75,8 +75,8 @@ void NIOverviewLogMethod(const char* message, unsigned length, BOOL withSyslogBa
static NSDateFormatter* formatter = nil;
if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
[formatter setTimeStyle:kCFDateFormatterMediumStyle];
[formatter setDateStyle:kCFDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterMediumStyle];
[formatter setDateStyle:NSDateFormatterMediumStyle];
}

// Don't autorelease here in an attempt to minimize autorelease thrashing in tight
Expand Down
5 changes: 5 additions & 0 deletions src/overview/src/NIOverviewMemoryCacheController.m
Expand Up @@ -28,6 +28,11 @@ @interface NIMemoryCache(Private)
@property (nonatomic, readwrite, retain) NILinkedList* lruCacheObjects;
@end

// Anonymous private category for LRU cache objects.
@interface NSObject(Private)
- (NSDate *)lastAccessTime;
@end

@interface NIOverviewMemoryCacheController()
@property (nonatomic, readonly, retain) NIMemoryCache* cache;
@property (nonatomic, readwrite, retain) NITableViewModel* model;
Expand Down
4 changes: 4 additions & 0 deletions src/overview/src/NIOverviewPageView.m
Expand Up @@ -30,6 +30,10 @@
static UIEdgeInsets kPagePadding;
static const CGFloat kGraphRightMargin = 5;

@interface NSObject (Private)
- (id)initWithMemoryCache:(NIMemoryCache *)memoryCache;
@end


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
47 changes: 24 additions & 23 deletions src/overview/src/NIOverviewSwizzling.m
Expand Up @@ -27,10 +27,13 @@

#ifdef DEBUG

@interface UIApplication (NIDebugging)

@interface UIApplication (Private)
- (CGRect)_statusBarFrame;
- (CGFloat)statusBarHeightForOrientation:(UIInterfaceOrientation)orientation;
@end

@interface UIViewController (Private)
- (CGFloat)_statusBarHeightForCurrentInterfaceOrientation;
@end

CGFloat NIOverviewStatusBarHeight(void);
Expand All @@ -45,27 +48,6 @@ CGFloat NIOverviewStatusBarHeight(void) {
}


///////////////////////////////////////////////////////////////////////////////////////////////////
void NIOverviewSwizzleMethods(void) {
NISwapInstanceMethods([UIViewController class],
@selector(_statusBarHeightForCurrentInterfaceOrientation),
@selector(__statusBarHeightForCurrentInterfaceOrientation));
NISwapInstanceMethods([UIApplication class],
@selector(statusBarFrame),
@selector(_statusBarFrame));
NISwapInstanceMethods([UIApplication class],
@selector(statusBarHeightForOrientation:),
@selector(_statusBarHeightForOrientation:));
NISwapInstanceMethods([UIApplication class],
@selector(setStatusBarHidden:withAnimation:),
@selector(_setStatusBarHidden:withAnimation:));
NISwapInstanceMethods([UIApplication class],
@selector(setStatusBarStyle:animated:),
@selector(_setStatusBarStyle:animated:));

}


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -188,4 +170,23 @@ - (void)_setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)anima
@end


///////////////////////////////////////////////////////////////////////////////////////////////////
void NIOverviewSwizzleMethods(void) {
NISwapInstanceMethods([UIViewController class],
@selector(_statusBarHeightForCurrentInterfaceOrientation),
@selector(__statusBarHeightForCurrentInterfaceOrientation));
NISwapInstanceMethods([UIApplication class],
@selector(statusBarFrame),
@selector(_statusBarFrame));
NISwapInstanceMethods([UIApplication class],
@selector(statusBarHeightForOrientation:),
@selector(_statusBarHeightForOrientation:));
NISwapInstanceMethods([UIApplication class],
@selector(setStatusBarHidden:withAnimation:),
@selector(_setStatusBarHidden:withAnimation:));
NISwapInstanceMethods([UIApplication class],
@selector(setStatusBarStyle:animated:),
@selector(_setStatusBarStyle:animated:));
}

#endif
4 changes: 2 additions & 2 deletions src/overview/src/NIOverviewView.m
Expand Up @@ -120,7 +120,7 @@ - (CGRect)frameForPageAtIndex:(NSInteger)pageIndex {
- (void)layoutPages {
_pagingScrollView.contentSize = [self contentSizeForPagingScrollView];

for (NSInteger ix = 0; ix < [_pageViews count]; ++ix) {
for (NSUInteger ix = 0; ix < [_pageViews count]; ++ix) {
UIView* pageView = [_pageViews objectAtIndex:ix];
pageView.frame = [self frameForPageAtIndex:ix];
}
Expand All @@ -132,7 +132,7 @@ - (NSInteger)visiblePageIndex {
CGFloat offset = _pagingScrollView.contentOffset.x;
CGFloat pageWidth = _pagingScrollView.bounds.size.width;

return floorf(offset / pageWidth);
return (NSInteger)(offset / pageWidth);
}


Expand Down

0 comments on commit e409684

Please sign in to comment.