Skip to content

Commit 4695110

Browse files
committed
Merge pull request #581 from cocos2d/64-bit
64 bit fixes. Former-commit-id: 8daf964
2 parents 624f0a4 + d14df11 commit 4695110

28 files changed

+200
-129
lines changed

Chipmunk7-ios.xcodeproj/project.pbxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@
397397
);
398398
OTHER_LDFLAGS = "-ObjC";
399399
PRODUCT_NAME = "$(TARGET_NAME)";
400-
SDKROOT = iphoneos;
401400
SKIP_INSTALL = YES;
402401
};
403402
name = Debug;
@@ -421,7 +420,6 @@
421420
);
422421
OTHER_LDFLAGS = "-ObjC";
423422
PRODUCT_NAME = "$(TARGET_NAME)";
424-
SDKROOT = iphoneos;
425423
SKIP_INSTALL = YES;
426424
VALIDATE_PRODUCT = YES;
427425
};
@@ -430,6 +428,7 @@
430428
D3E5F01B0AA32EAC004E361B /* Debug */ = {
431429
isa = XCBuildConfiguration;
432430
buildSettings = {
431+
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
433432
CLANG_WARN_BOOL_CONVERSION = YES;
434433
CLANG_WARN_CONSTANT_CONVERSION = YES;
435434
CLANG_WARN_EMPTY_BODY = YES;
@@ -446,13 +445,14 @@
446445
GCC_WARN_UNUSED_FUNCTION = YES;
447446
GCC_WARN_UNUSED_VARIABLE = YES;
448447
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/external/Chipmunk/include\"";
449-
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
448+
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
450449
MACOSX_DEPLOYMENT_TARGET = 10.5;
451-
ONLY_ACTIVE_ARCH = YES;
450+
ONLY_ACTIVE_ARCH = NO;
452451
OTHER_CFLAGS = (
453452
"-DDEBUG",
454453
"-ffast-math",
455454
);
455+
SDKROOT = iphoneos;
456456
WARNING_CFLAGS = (
457457
"-Wall",
458458
"-W",
@@ -466,6 +466,7 @@
466466
D3E5F01C0AA32EAC004E361B /* Release */ = {
467467
isa = XCBuildConfiguration;
468468
buildSettings = {
469+
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
469470
CLANG_WARN_BOOL_CONVERSION = YES;
470471
CLANG_WARN_CONSTANT_CONVERSION = YES;
471472
CLANG_WARN_EMPTY_BODY = YES;
@@ -482,12 +483,14 @@
482483
GCC_WARN_UNUSED_FUNCTION = YES;
483484
GCC_WARN_UNUSED_VARIABLE = YES;
484485
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/external/Chipmunk/include\"";
485-
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
486+
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
486487
MACOSX_DEPLOYMENT_TARGET = 10.5;
488+
ONLY_ACTIVE_ARCH = NO;
487489
OTHER_CFLAGS = (
488490
"-DNDEBUG",
489491
"-ffast-math",
490492
);
493+
SDKROOT = iphoneos;
491494
WARNING_CFLAGS = (
492495
"-Wall",
493496
"-W",

UnitTests/CCPhysicsTests.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,46 +361,50 @@ -(void)testBasicSequences11
361361

362362
-(void)testDynamicAnchorPoint
363363
{
364+
cpFloat accuracy = 1e-4;
365+
364366
CCPhysicsNode *physicsNode = [CCPhysicsNode node];
365367

366368
CCNode *node = [CCNode node];
367369
node.contentSize = CGSizeMake(2, 2);
368370
node.anchorPoint = ccp(0.5, 0.5);
369-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
371+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
370372

371373
node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:1.0 andCenter:CGPointZero];
372374
node.physicsBody.type = CCPhysicsBodyTypeDynamic;
373-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
375+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
374376

375377
[physicsNode addChild:node];
376378
[physicsNode onEnter];
377-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
379+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
378380

379381
node.rotation = 90;
380-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
382+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
381383

382384
[physicsNode onExit];
383385
}
384386

385387
-(void)testStaticAnchorPoint
386388
{
389+
cpFloat accuracy = 1e-4;
390+
387391
CCPhysicsNode *physicsNode = [CCPhysicsNode node];
388392

389393
CCNode *node = [CCNode node];
390394
node.contentSize = CGSizeMake(2, 2);
391395
node.anchorPoint = ccp(0.5, 0.5);
392-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
396+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
393397

394398
node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:1.0 andCenter:CGPointZero];
395399
node.physicsBody.type = CCPhysicsBodyTypeStatic;
396-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
400+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
397401

398402
[physicsNode addChild:node];
399403
[physicsNode onEnter];
400-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
404+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
401405

402406
node.rotation = 90;
403-
XCTAssert(ccpDistance(node.position, CGPointZero) == 0.0, @"");
407+
XCTAssert(ccpDistance(node.position, CGPointZero) < accuracy, @"");
404408

405409
[physicsNode onExit];
406410
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11bc1d4cdb4f251665a23432b31a4395f2e92a41
1+
4bf2f73a96f043b11ee11d5725f7f4a14bcb4c5f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6bfba6541f551ed7ddbeba927e7e7d32813c55ee
1+
06369bce67a32b973ff96054cf1489afadb70db2

cocos2d-ui-tests/TestBase.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ - (void) setupTestWithIndex:(NSInteger)testNum
203203
SEL constructor = NSSelectorFromString(constructorName);
204204
if ([self respondsToSelector:constructor])
205205
{
206-
objc_msgSend(self, constructor);
206+
typedef void (*Func)(id, SEL);
207+
((Func)objc_msgSend)(self, constructor);
207208
}
208209

209210
_currentTest = testNum;

cocos2d-ui-tests/tests/CCResponderTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ - (id) init
4545

4646
- (void) update:(CCTime)delta
4747
{
48-
_lblNumTouches.string = [NSString stringWithFormat:@"Num touches: %d", _currentTouches.count];
48+
_lblNumTouches.string = [NSString stringWithFormat:@"Num touches: %d", (unsigned int)_currentTouches.count];
4949
}
5050

5151
- (void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event

cocos2d-ui/CCBReader/CCBReader.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,17 @@ - (void) readPropertyForNode:(CCNode*) node parent:(CCNode*)parent isExtraProp:(
656656

657657
void (^block)(id sender);
658658
block = ^(id sender) {
659-
objc_msgSend(t, selector, sender);
659+
typedef void (*Func)(id, SEL, id);
660+
((Func)objc_msgSend)(t, selector, sender);
660661
};
661662

662663
NSString* setSelectorName = [NSString stringWithFormat:@"set%@:",[name capitalizedString]];
663664
SEL setSelector = NSSelectorFromString(setSelectorName);
664665

665666
if ([node respondsToSelector:setSelector])
666667
{
667-
objc_msgSend(node, setSelector, block);
668+
typedef void (*Func)(id, SEL, id);
669+
((Func)objc_msgSend)(node, setSelector, block);
668670
}
669671
else
670672
{

cocos2d-ui/CCControl.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ - (void) setTarget:(id)target selector:(SEL)selector
6161
{
6262
__weak id weakTarget = target; // avoid retain cycle
6363
[self setBlock:^(id sender) {
64-
objc_msgSend(weakTarget, selector, sender);
64+
typedef void (*Func)(id, SEL, id);
65+
((Func)objc_msgSend)(weakTarget, selector, sender);
6566
}];
6667
}
6768

cocos2d-ui/CCScrollView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceive
680680

681681
NSArray* responders = [[CCDirector sharedDirector].responderManager nodesAtPoint:touchWorldPos];
682682
BOOL foundSelf = NO;
683-
for (int i = responders.count - 1; i >= 0; i--)
683+
for (int i = (int)responders.count - 1; i >= 0; i--)
684684
{
685685
CCNode* responder = [responders objectAtIndex:i];
686686
if (foundSelf)

cocos2d-ui/CCTableView.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ - (void) setTarget:(id)target selector:(SEL)selector
387387
{
388388
__weak id weakTarget = target; // avoid retain cycle
389389
[self setBlock:^(id sender) {
390-
objc_msgSend(weakTarget, selector, sender);
390+
typedef void (*Func)(id, SEL, id);
391+
((Func)objc_msgSend)(weakTarget, selector, sender);
391392
}];
392393
}
393394

0 commit comments

Comments
 (0)