From a3e572a6a4e5c2b2211e05faa57c3b3c7b9960ec Mon Sep 17 00:00:00 2001 From: Indiegogo Pair Date: Fri, 31 Jan 2014 17:16:26 -0800 Subject: [PATCH 1/2] fix 64-bit arch compilation warnings, include 64-bit architecture slice into build target --- MagicPie.xcodeproj/project.pbxproj | 4 ---- MagicPieLayer/NSMutableArray+pieEx.m | 14 +++++++------- MagicPieLayer/PieLayer.m | 12 ++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/MagicPie.xcodeproj/project.pbxproj b/MagicPie.xcodeproj/project.pbxproj index 93b1c04..52f65a6 100644 --- a/MagicPie.xcodeproj/project.pbxproj +++ b/MagicPie.xcodeproj/project.pbxproj @@ -529,7 +529,6 @@ BD0CFE8717F94CC60038FBC1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -547,7 +546,6 @@ BD0CFE8817F94CC60038FBC1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -565,7 +563,6 @@ BD0CFE8A17F94CC60038FBC1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MagicPie.app/MagicPie"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -588,7 +585,6 @@ BD0CFE8B17F94CC60038FBC1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MagicPie.app/MagicPie"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", diff --git a/MagicPieLayer/NSMutableArray+pieEx.m b/MagicPieLayer/NSMutableArray+pieEx.m index bad157d..b418fad 100644 --- a/MagicPieLayer/NSMutableArray+pieEx.m +++ b/MagicPieLayer/NSMutableArray+pieEx.m @@ -44,10 +44,10 @@ - (void)sortWithIndexes:(NSArray*)indexes - (void)insertSortedObjects:(NSArray*)objects indexes:(NSArray*)indexes { - int decrementIdx = 0; - for(int i = 0; i < indexes.count; i++){ + NSInteger decrementIdx = 0; + for(NSInteger i = 0; i < indexes.count; i++){ //after each insert, each next index must be displaced - int insertIdx = [indexes[i] integerValue] - decrementIdx; + NSInteger insertIdx = [indexes[i] integerValue] - decrementIdx; if(insertIdx < self.count) decrementIdx++; [self insertObject:objects[i] atIndex:insertIdx]; @@ -66,11 +66,11 @@ - (void)insertObjects:(NSArray*)objects indexes:(NSArray*)indexes - (void)updateIndexesWithUnusedIndexes:(NSArray*)unusedIndexes { unusedIndexes = [unusedIndexes sortedArrayUsingSelector:@selector(compare:)]; - int indexesCount = self.count; + NSInteger indexesCount = self.count; for(NSNumber* unusedIdxNum in unusedIndexes){ - int unusedIdx = unusedIdxNum.integerValue; - for(int i = 0; i < indexesCount; i++){ - int idx = [self[i] integerValue]; + NSInteger unusedIdx = unusedIdxNum.integerValue; + for(NSInteger i = 0; i < indexesCount; i++){ + NSInteger idx = [self[i] integerValue]; if(idx >= unusedIdx) self[i] = @(idx+1); } diff --git a/MagicPieLayer/PieLayer.m b/MagicPieLayer/PieLayer.m index bda2a04..6b11eac 100644 --- a/MagicPieLayer/PieLayer.m +++ b/MagicPieLayer/PieLayer.m @@ -104,10 +104,10 @@ - (void)setup #pragma mark - Adding, inserting and deleting - (void)addValues:(NSArray *)addingNewValues animated:(BOOL)animated { - int count = addingNewValues.count; - int currCount = self.values.count; + NSInteger count = addingNewValues.count; + NSInteger currCount = self.values.count; NSMutableArray* indexes = [NSMutableArray arrayWithCapacity:addingNewValues.count]; - for(int i = 0; i < count; i++){ + for(NSInteger i = 0; i < count; i++){ [indexes addObject:@(i+currCount)]; } [self insertValues:addingNewValues atIndexes:indexes animated:animated]; @@ -130,7 +130,7 @@ - (BOOL)performDelayedAnimation animationBeginState = [[NSMutableArray alloc] initWithArray:currentValues copyItems:YES]; animationEndState = [NSMutableArray arrayWithArray:self.values]; for(NSNumber* delIdxNum in animationDeletingIndexes){ - int delIdx = delIdxNum.integerValue; + NSInteger delIdx = delIdxNum.integerValue; PieElement* elem = [currentValues[delIdx] copy]; [elem setVal_:0.0]; elem.titleAlpha = 0.0; @@ -143,7 +143,7 @@ - (BOOL)performDelayedAnimation - (void)insertValues:(NSArray *)array atIndexes:(NSArray *)indexes animated:(BOOL)animated { - NSAssert2(array.count == indexes.count, @"Array sizes must be equal: values.count = %d; indexes.count = %d;", array.count, indexes.count); + NSAssert2(array.count == indexes.count, @"Array sizes must be equal: values.count = %d; indexes.count = %d;", (int)array.count, (int)indexes.count); for(PieElement* elem in array){ [elem addedToPieLayer:self]; } @@ -232,7 +232,7 @@ - (void)delayedAnimateChanges - (void)animateFromValues:(NSArray*)fromValues toValues:(NSArray*)toValues timingFunction:(NSString*)timingFunction { - NSAssert2(fromValues.count == toValues.count, @"Array sizes must be equal: fromValues.count = %d; toValues.count = %d;", fromValues.count, toValues.count); + NSAssert2(fromValues.count == toValues.count, @"Array sizes must be equal: fromValues.count = %d; toValues.count = %d;", (int)fromValues.count, (int)toValues.count); float fromSum = [[fromValues valueForKeyPath:@"@sum.val"] floatValue]; float toSum = [[toValues valueForKeyPath:@"@sum.val"] floatValue]; if(fromSum <= 0 || toSum <= 0){ From 5607a408c67413aef856fb77f8f80982b563b91e Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 1 Feb 2014 13:48:37 +0400 Subject: [PATCH 2/2] Already change types in examples --- MagicPie/Example1Controller.m | 2 +- MagicPie/Example3PieLayer.m | 2 +- MagicPie/TestPieLayer.m | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MagicPie/Example1Controller.m b/MagicPie/Example1Controller.m index 59fcd91..839a6b5 100644 --- a/MagicPie/Example1Controller.m +++ b/MagicPie/Example1Controller.m @@ -71,7 +71,7 @@ - (IBAction)deletePressed:(id)sender - (IBAction)animateChangeVal:(id)sender { if(self.pieView.layer.values.count == 0)return; - int randCount = MAX(MIN(self.pieView.layer.values.count, 2), arc4random() % self.pieView.layer.values.count); + NSUInteger randCount = MAX(MIN(self.pieView.layer.values.count, 2), arc4random() % self.pieView.layer.values.count); NSMutableArray* randIndexes = [NSMutableArray new]; NSMutableArray* changeValArr = [NSMutableArray new]; [PieElement animateChanges:^{ diff --git a/MagicPie/Example3PieLayer.m b/MagicPie/Example3PieLayer.m index 57239f8..72455fc 100644 --- a/MagicPie/Example3PieLayer.m +++ b/MagicPie/Example3PieLayer.m @@ -26,7 +26,7 @@ - (void)drawElement:(PieElement *)elem context:(CGContextRef)ctx float endRadius = MIN(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0); float startRadius = self.minRadius; - int lvlCount = self.colorsArr.count; + NSUInteger lvlCount = self.colorsArr.count; float levelWidth = (endRadius - startRadius - (lvlCount-1)*indent) / lvlCount; float currRadius = startRadius; diff --git a/MagicPie/TestPieLayer.m b/MagicPie/TestPieLayer.m index 020a802..516129c 100644 --- a/MagicPie/TestPieLayer.m +++ b/MagicPie/TestPieLayer.m @@ -31,22 +31,22 @@ + (void)testsOnPieLayer:(PieLayer*)pieLayer testCount:(int)count eachActionBlock + (void)timerAction:(NSTimer*)timer { NSMutableString* timerCountStr = timer.userInfo[@"count"]; - int count = [timerCountStr integerValue]; + NSUInteger count = [timerCountStr integerValue]; if(count <= 0){ [timer invalidate]; return; } else { count--; - [timerCountStr setString:[NSString stringWithFormat:@"%d", count]]; + [timerCountStr setString:[NSString stringWithFormat:@"%lu", count]]; } void(^actionBlock)(NSString* actionDesc) = timer.userInfo[@"actionBlock"]; PieLayer* pieLayer = timer.userInfo[@"pieLayer"]; if(actionBlock){ - int valuesCount = pieLayer.values.count; + NSUInteger valuesCount = pieLayer.values.count; NSString* actionDesc = [self runRandomActionWithPie:pieLayer]; if(actionDesc){ - actionDesc = [NSString stringWithFormat:@"Curr values count %d. %@", valuesCount, actionDesc]; + actionDesc = [NSString stringWithFormat:@"Curr values count %lu. %@", valuesCount, actionDesc]; actionBlock(actionDesc); } }else @@ -62,13 +62,13 @@ + (NSString*)runRandomActionWithPie:(PieLayer*)pieLayer return nil; [pieLayer addValues:arr animated:YES]; - return [NSString stringWithFormat:@"Add %d elements", arr.count]; + return [NSString stringWithFormat:@"Add %lu elements", arr.count]; } else if(action == PieActionInsert){ NSArray* arr = [self randArr]; if(arr.count == 0) return nil; - int count = pieLayer.values.count; + NSUInteger count = pieLayer.values.count; NSMutableArray* indxArr = [NSMutableArray array]; for(int i = 0; i < arr.count; i++){ int indx = arc4random() % (count+1); @@ -77,7 +77,7 @@ + (NSString*)runRandomActionWithPie:(PieLayer*)pieLayer count++; } [pieLayer insertValues:arr atIndexes:indxArr animated:YES]; - return [NSString stringWithFormat:@"Insert %d elements at indexes: %@", arr.count, [self arrDesc:indxArr]]; + return [NSString stringWithFormat:@"Insert %lu elements at indexes: %@", arr.count, [self arrDesc:indxArr]]; } else if(action == PieActionDelete) { if(pieLayer.values.count == 0) return nil;