calls `delete[]` instead of `delete`

calls `delete[]` instead of `delete`
This commit is contained in:
Ricardo Quesada 2013-11-11 16:07:46 -08:00
parent 51cfd3fb4b
commit d6446e9b14
2 changed files with 7 additions and 5 deletions

View File

@ -37,8 +37,10 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
- (id) init
{
_acceleration = new cocos2d::Acceleration();
_motionManager = [[CMMotionManager alloc] init];
if( (self = [super init]) ) {
_acceleration = new cocos2d::Acceleration();
_motionManager = [[CMMotionManager alloc] init];
}
return self;
}

View File

@ -539,7 +539,7 @@ bool PhysicsShapePolygon::init(const Point* points, int count, const PhysicsMate
cpVect* vecs = new cpVect[count];
PhysicsHelper::points2cpvs(points, vecs, count);
cpShape* shape = cpPolyShapeNew(_info->getSharedBody(), count, vecs, PhysicsHelper::point2cpv(offset));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
CC_BREAK_IF(shape == nullptr);
@ -563,7 +563,7 @@ float PhysicsShapePolygon::calculateArea(const Point* points, int count)
cpVect* vecs = new cpVect[count];
PhysicsHelper::points2cpvs(points, vecs, count);
float area = PhysicsHelper::cpfloat2float(cpAreaForPoly(count, vecs));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
return area;
}
@ -574,7 +574,7 @@ float PhysicsShapePolygon::calculateMoment(float mass, const Point* points, int
PhysicsHelper::points2cpvs(points, vecs, count);
float moment = mass == PHYSICS_INFINITY ? PHYSICS_INFINITY
: PhysicsHelper::cpfloat2float(cpMomentForPoly(mass, count, vecs, PhysicsHelper::point2cpv(offset)));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
return moment;
}