diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index d83c7fe107..0468f1a8cf 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -2006,7 +2006,7 @@ bool Animate::initWithAnimation(Animation *pAnimation) Object* pObj = NULL; CCARRAY_FOREACH(pFrames, pObj) { - AnimationFrame* frame = (AnimationFrame*)pObj; + AnimationFrame* frame = static_cast(pObj); float value = (accumUnitsOfTime * newUnitOfTimeValue) / singleDuration; accumUnitsOfTime += frame->getDelayUnits(); _splitTimes->push_back(value); diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 51ad4cf06c..2d56bf4c97 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -128,7 +128,7 @@ Node::~Node(void) Object* child; CCARRAY_FOREACH(_children, child) { - Node* pChild = (Node*) child; + Node* pChild = static_cast(child); if (pChild) { pChild->_parent = NULL; @@ -580,7 +580,7 @@ Node* Node::getChildByTag(int aTag) Object* child; CCARRAY_FOREACH(_children, child) { - Node* pNode = (Node*) child; + Node* pNode = static_cast(child); if(pNode && pNode->_tag == aTag) return pNode; } @@ -701,7 +701,7 @@ void Node::removeAllChildrenWithCleanup(bool cleanup) Object* child; CCARRAY_FOREACH(_children, child) { - Node* pNode = (Node*) child; + Node* pNode = static_cast(child); if (pNode) { // IMPORTANT: diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h index c470e596d7..1f0065a538 100644 --- a/cocos2dx/cocoa/CCArray.h +++ b/cocos2dx/cocoa/CCArray.h @@ -76,10 +76,10 @@ I found that it's not work in C++. So it keep what it's look like in version 1.0 do { \ if(pArray && pArray->count() > 0) \ { \ - Object* child; \ + Object* child; \ CCARRAY_FOREACH(pArray, child) \ { \ - elementType pNode = (elementType) child; \ + elementType pNode = static_cast(child); \ if(pNode) \ { \ pNode->func(); \ @@ -93,10 +93,10 @@ while(false) do { \ if(pArray && pArray->count() > 0) \ { \ - Object* child = NULL; \ + Object* child; \ CCARRAY_FOREACH(pArray, child) \ { \ - elementType pNode = (elementType) child; \ + elementType pNode = static_cast(child); \ if(pNode) \ { \ pNode->func(pObject); \ diff --git a/cocos2dx/cocoa/CCAutoreleasePool.cpp b/cocos2dx/cocoa/CCAutoreleasePool.cpp index 14fe092154..d1c258217a 100644 --- a/cocos2dx/cocoa/CCAutoreleasePool.cpp +++ b/cocos2dx/cocoa/CCAutoreleasePool.cpp @@ -133,7 +133,7 @@ void PoolManager::finalize() { if(!pObj) break; - AutoreleasePool* pPool = (AutoreleasePool*)pObj; + AutoreleasePool* pPool = static_cast(pObj); pPool->clear(); } } diff --git a/cocos2dx/keypad_dispatcher/CCKeypadDispatcher.cpp b/cocos2dx/keypad_dispatcher/CCKeypadDispatcher.cpp index f7f6a96dc6..5d4817f349 100644 --- a/cocos2dx/keypad_dispatcher/CCKeypadDispatcher.cpp +++ b/cocos2dx/keypad_dispatcher/CCKeypadDispatcher.cpp @@ -109,7 +109,7 @@ void KeypadDispatcher::forceRemoveDelegate(KeypadDelegate* pDelegate) Object* pObj = NULL; CCARRAY_FOREACH(_delegates, pObj) { - pHandler = (KeypadHandler*)pObj; + pHandler = static_cast(pObj); if (pHandler && pHandler->getDelegate() == pDelegate) { _delegates->removeObject(pHandler); @@ -132,7 +132,7 @@ bool KeypadDispatcher::dispatchKeypadMSG(ccKeypadMSGType nMsgType) { CC_BREAK_IF(!pObj); - pHandler = (KeypadHandler*)pObj; + pHandler = static_cast(pObj); pDelegate = pHandler->getDelegate(); switch (nMsgType) diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index bc53d38d05..58056423c3 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -44,7 +44,7 @@ static std::vector ccarray_to_std_vector(Array* pArray) Object* pObj; CCARRAY_FOREACH(pArray, pObj) { - Integer* pInteger = (Integer*)pObj; + Integer* pInteger = static_cast(pObj); ret.push_back((unsigned int)pInteger->getValue()); } return ret; @@ -142,7 +142,7 @@ bool Menu::initWithArray(Array* pArrayOfItems) Object* pObj = NULL; CCARRAY_FOREACH(pArrayOfItems, pObj) { - MenuItem* item = (MenuItem*)pObj; + MenuItem* item = static_cast(pObj); this->addChild(item, z); z++; } diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 2447bb7108..c86a6b16cc 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -1036,7 +1036,7 @@ void MenuItemToggle::setEnabled(bool enabled) Object* pObj = NULL; CCARRAY_FOREACH(_subItems, pObj) { - MenuItem* pItem = (MenuItem*)pObj; + MenuItem* pItem = static_cast(pObj); pItem->setEnabled(enabled); } } diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index eab2105f54..225848203f 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -594,7 +594,7 @@ void RenderTexture::draw() Object *pElement; CCARRAY_FOREACH(_children, pElement) { - Node *pChild = (Node*)pElement; + Node *pChild = static_cast(pElement); if (pChild != _sprite) { diff --git a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp index b18c97ffa1..b774c769a4 100644 --- a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp +++ b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp @@ -476,7 +476,7 @@ void ParticleBatchNode::updateAllAtlasIndexes() CCARRAY_FOREACH(_children,pObj) { - ParticleSystem* child = (ParticleSystem*)pObj; + ParticleSystem* child = static_cast(pObj); child->setAtlasIndex(index); index += child->getTotalParticles(); } diff --git a/cocos2dx/sprite_nodes/CCAnimation.cpp b/cocos2dx/sprite_nodes/CCAnimation.cpp index 6b0b5e6c62..5c085d7211 100644 --- a/cocos2dx/sprite_nodes/CCAnimation.cpp +++ b/cocos2dx/sprite_nodes/CCAnimation.cpp @@ -116,7 +116,7 @@ bool Animation::initWithSpriteFrames(Array *pFrames, float delay/* = 0.0f*/) Object* pObj = NULL; CCARRAY_FOREACH(pFrames, pObj) { - SpriteFrame* frame = (SpriteFrame*)pObj; + SpriteFrame* frame = static_cast(pObj); AnimationFrame *animFrame = new AnimationFrame(); animFrame->initWithSpriteFrame(frame, 1, NULL); _frames->addObject(animFrame); @@ -141,7 +141,7 @@ bool Animation::initWithAnimationFrames(Array* arrayOfAnimationFrames, float del Object* pObj = NULL; CCARRAY_FOREACH(_frames, pObj) { - AnimationFrame* animFrame = (AnimationFrame*)pObj; + AnimationFrame* animFrame = static_cast(pObj); _totalDelayUnits += animFrame->getDelayUnits(); } return true; diff --git a/cocos2dx/sprite_nodes/CCAnimationCache.cpp b/cocos2dx/sprite_nodes/CCAnimationCache.cpp index 1bd0d3eecd..446609168b 100644 --- a/cocos2dx/sprite_nodes/CCAnimationCache.cpp +++ b/cocos2dx/sprite_nodes/CCAnimationCache.cpp @@ -114,7 +114,7 @@ void AnimationCache::parseVersion1(Dictionary* animations) Object* pObj = NULL; CCARRAY_FOREACH(frameNames, pObj) { - const char* frameName = ((String*)pObj)->getCString(); + const char* frameName = static_cast(pObj)->getCString(); SpriteFrame* spriteFrame = frameCache->spriteFrameByName(frameName); if ( ! spriteFrame ) { @@ -170,7 +170,7 @@ void AnimationCache::parseVersion2(Dictionary* animations) Object* pObj = NULL; CCARRAY_FOREACH(frameArray, pObj) { - Dictionary* entry = (Dictionary*)(pObj); + Dictionary* entry = static_cast(pObj); const char* spriteFrameName = entry->valueForKey("spriteframe")->getCString(); SpriteFrame *spriteFrame = frameCache->spriteFrameByName(spriteFrameName); @@ -222,7 +222,7 @@ void AnimationCache::addAnimationsWithDictionary(Dictionary* dictionary) Object* pObj = NULL; CCARRAY_FOREACH(spritesheets, pObj) { - String* name = (String*)(pObj); + String* name = static_cast(pObj); SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(name->getCString()); } } diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index d0e0e1d1d5..74658c63a5 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -280,7 +280,7 @@ void SpriteBatchNode::sortAllChildren() // and at the same time reorder descendants and the quads to the right index CCARRAY_FOREACH(_children, pObj) { - Sprite* pChild = (Sprite*)pObj; + Sprite* pChild = static_cast(pObj); updateAtlasIndex(pChild, &index); } } @@ -314,7 +314,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex) { bool needNewIndex=true; - if (((Sprite*) (pArray->data->arr[0]))->getZOrder() >= 0) + if (static_cast(pArray->data->arr[0])->getZOrder() >= 0) { //all children are in front of the parent oldIndex = sprite->getAtlasIndex(); @@ -332,7 +332,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex) Object* pObj = NULL; CCARRAY_FOREACH(pArray,pObj) { - Sprite* child = (Sprite*)pObj; + Sprite* child = static_cast(pObj); if (needNewIndex && child->getZOrder() >= 0) { oldIndex = sprite->getAtlasIndex(); @@ -434,7 +434,7 @@ unsigned int SpriteBatchNode::rebuildIndexInOrder(Sprite *pobParent, unsigned in Object* pObject = NULL; CCARRAY_FOREACH(pChildren, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild && (pChild->getZOrder() < 0)) { uIndex = rebuildIndexInOrder(pChild, uIndex); @@ -454,7 +454,7 @@ unsigned int SpriteBatchNode::rebuildIndexInOrder(Sprite *pobParent, unsigned in Object* pObject = NULL; CCARRAY_FOREACH(pChildren, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild && (pChild->getZOrder() >= 0)) { uIndex = rebuildIndexInOrder(pChild, uIndex); @@ -576,17 +576,17 @@ void SpriteBatchNode::insertChild(Sprite *pSprite, unsigned int uIndex) // update indices unsigned int i = uIndex+1; - Sprite* pChild = NULL; + Sprite* pChild = nullptr; for(; inum; i++){ - pChild = (Sprite*)descendantsData->arr[i]; + pChild = static_cast(descendantsData->arr[i]); pChild->setAtlasIndex(pChild->getAtlasIndex() + 1); } // add children recursively - Object* pObj = NULL; + Object* pObj = nullptr; CCARRAY_FOREACH(pSprite->getChildren(), pObj) { - pChild = (Sprite*)pObj; + pChild = static_cast(pObj); unsigned int idx = atlasIndexForChild(pChild, pChild->getZOrder()); insertChild(pChild, idx); } @@ -616,10 +616,10 @@ void SpriteBatchNode::appendChild(Sprite* sprite) // add children recursively - Object* pObj = NULL; + Object* pObj = nullptr; CCARRAY_FOREACH(sprite->getChildren(), pObj) { - Sprite* child = (Sprite*)pObj; + Sprite* child = static_cast(pObj); appendChild(child); } } @@ -654,7 +654,7 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *pobSprite) Object* pObject = NULL; CCARRAY_FOREACH(pChildren, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild) { removeSpriteFromAtlas(pChild); @@ -760,7 +760,7 @@ SpriteBatchNode * SpriteBatchNode::addSpriteWithoutQuad(Sprite*child, unsigned i Object* pObject = NULL; CCARRAY_FOREACH(_descendants, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild && (pChild->getAtlasIndex() >= z)) { ++i; diff --git a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp index 242550012a..d5da72e357 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp @@ -177,7 +177,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(Dictionary* dictionary, Tex Object* pObj = NULL; CCARRAY_FOREACH(aliases, pObj) { - std::string oneAlias = ((String*)pObj)->getCString(); + std::string oneAlias = static_cast(pObj)->getCString(); if (_spriteFramesAliases->objectForKey(oneAlias.c_str())) { CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str()); diff --git a/cocos2dx/support/CCNotificationCenter.cpp b/cocos2dx/support/CCNotificationCenter.cpp index 49cdc1b566..c0cfe39ff6 100644 --- a/cocos2dx/support/CCNotificationCenter.cpp +++ b/cocos2dx/support/CCNotificationCenter.cpp @@ -101,7 +101,7 @@ void NotificationCenter::removeObserver(Object *target,const char *name) Object* obj = NULL; CCARRAY_FOREACH(_observers, obj) { - NotificationObserver* observer = (NotificationObserver*) obj; + NotificationObserver* observer = static_cast(obj); if (!observer) continue; @@ -120,7 +120,7 @@ int NotificationCenter::removeAllObservers(Object *target) CCARRAY_FOREACH(_observers, obj) { - NotificationObserver *observer = (NotificationObserver *)obj; + NotificationObserver *observer = static_cast(obj); if (!observer) continue; @@ -154,7 +154,7 @@ void NotificationCenter::unregisterScriptObserver(Object *target,const char* nam Object* obj = NULL; CCARRAY_FOREACH(_observers, obj) { - NotificationObserver* observer = (NotificationObserver*) obj; + NotificationObserver* observer = static_cast(obj); if (!observer) continue; @@ -172,7 +172,7 @@ void NotificationCenter::postNotification(const char *name, Object *object) Object* obj = NULL; CCARRAY_FOREACH(ObserversCopy, obj) { - NotificationObserver* observer = (NotificationObserver*) obj; + NotificationObserver* observer = static_cast(obj); if (!observer) continue; @@ -207,7 +207,7 @@ int NotificationCenter::getObserverHandlerByName(const char* name) Object* obj = NULL; CCARRAY_FOREACH(_observers, obj) { - NotificationObserver* observer = (NotificationObserver*) obj; + NotificationObserver* observer = static_cast(obj); if (NULL == observer) continue; diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp index ba1452b45f..29af85f96a 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp @@ -405,10 +405,10 @@ Sprite * TMXLayer::insertTileForGID(unsigned int gid, const Point& pos) // update possible children if (_children && _children->count()>0) { - Object* pObject = NULL; + Object* pObject = nullptr; CCARRAY_FOREACH(_children, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild) { unsigned int ai = pChild->getAtlasIndex(); @@ -608,10 +608,10 @@ void TMXLayer::removeTileAt(const Point& pos) // update possible children if (_children && _children->count()>0) { - Object* pObject = NULL; + Object* pObject = nullptr; CCARRAY_FOREACH(_children, pObject) { - Sprite* pChild = (Sprite*) pObject; + Sprite* pChild = static_cast(pObject); if (pChild) { unsigned int ai = pChild->getAtlasIndex(); diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp index e79b9e49ab..e503a9a1c4 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp @@ -49,10 +49,10 @@ Dictionary* TMXObjectGroup::objectNamed(const char *objectName) { if (_objects && _objects->count() > 0) { - Object* pObj = NULL; + Object* pObj = nullptr; CCARRAY_FOREACH(_objects, pObj) { - Dictionary* pDict = (Dictionary*)pObj; + Dictionary* pDict = static_cast(pObj); String *name = (String*)pDict->objectForKey("name"); if (name && name->_string == objectName) { diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp index 567d87e28e..e82982c7a6 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp @@ -149,7 +149,7 @@ TMXTilesetInfo * TMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInf Object* pObj = NULL; CCARRAY_FOREACH_REVERSE(tilesets, pObj) { - tileset = (TMXTilesetInfo*)pObj; + tileset = static_cast(pObj); if (tileset) { for( unsigned int y=0; y < size.height; y++ ) @@ -211,7 +211,7 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo) Object* pObj = NULL; CCARRAY_FOREACH(layers, pObj) { - layerInfo = (TMXLayerInfo*)pObj; + layerInfo = static_cast(pObj); if (layerInfo && layerInfo->_visible) { TMXLayer *child = parseLayer(layerInfo, mapInfo); @@ -262,7 +262,7 @@ TMXObjectGroup * TMXTiledMap::objectGroupNamed(const char *groupName) Object* pObj = NULL; CCARRAY_FOREACH(_objectGroups, pObj) { - objectGroup = (TMXObjectGroup*)(pObj); + objectGroup = static_cast(pObj); if (objectGroup && objectGroup->getGroupName() == sGroupName) { return objectGroup; diff --git a/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp b/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp index eec9e80ba4..9cb1e881a6 100644 --- a/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp +++ b/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp @@ -108,7 +108,7 @@ void TouchDispatcher::forceAddHandler(TouchHandler *pHandler, Array *pArray) Object* pObj = NULL; CCARRAY_FOREACH(pArray, pObj) { - TouchHandler *h = (TouchHandler *)pObj; + TouchHandler *h = static_cast(pObj); if (h) { if (h->getPriority() < pHandler->getPriority()) @@ -183,7 +183,7 @@ void TouchDispatcher::forceRemoveDelegate(TouchDelegate *pDelegate) Object* pObj = NULL; CCARRAY_FOREACH(_standardHandlers, pObj) { - pHandler = (TouchHandler*)pObj; + pHandler = static_cast(pObj); if (pHandler && pHandler->getDelegate() == pDelegate) { _standardHandlers->removeObject(pHandler); @@ -194,7 +194,7 @@ void TouchDispatcher::forceRemoveDelegate(TouchDelegate *pDelegate) // remove handler from _targetedHandlers CCARRAY_FOREACH(_targetedHandlers, pObj) { - pHandler = (TouchHandler*)pObj; + pHandler = static_cast(pObj); if (pHandler && pHandler->getDelegate() == pDelegate) { _targetedHandlers->removeObject(pHandler); @@ -254,7 +254,7 @@ TouchHandler* TouchDispatcher::findHandler(TouchDelegate *pDelegate) Object* pObj = NULL; CCARRAY_FOREACH(_targetedHandlers, pObj) { - TouchHandler* pHandler = (TouchHandler*)pObj; + TouchHandler* pHandler = static_cast(pObj); if (pHandler->getDelegate() == pDelegate) { return pHandler; @@ -263,7 +263,7 @@ TouchHandler* TouchDispatcher::findHandler(TouchDelegate *pDelegate) CCARRAY_FOREACH(_standardHandlers, pObj) { - TouchHandler* pHandler = (TouchHandler*)pObj; + TouchHandler* pHandler = static_cast(pObj); if (pHandler->getDelegate() == pDelegate) { return pHandler; @@ -280,7 +280,7 @@ TouchHandler* TouchDispatcher::findHandler(Array* pArray, TouchDelegate *pDelega Object* pObj = NULL; CCARRAY_FOREACH(pArray, pObj) { - TouchHandler* pHandle = (TouchHandler*)pObj; + TouchHandler* pHandle = static_cast(pObj); if (pHandle->getDelegate() == pDelegate) { return pHandle; @@ -346,7 +346,7 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex) Object* pObj = NULL; CCARRAY_FOREACH(_targetedHandlers, pObj) { - pHandler = (TargetedTouchHandler *)(pObj); + pHandler = static_cast(pObj); if (! pHandler) { @@ -403,10 +403,10 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex) if (uStandardHandlersCount > 0 && pMutableTouches->count() > 0) { StandardTouchHandler *pHandler = NULL; - Object* pObj = NULL; + Object* pObj = nullptr; CCARRAY_FOREACH(_standardHandlers, pObj) { - pHandler = (StandardTouchHandler*)(pObj); + pHandler = static_cast(pObj); if (! pHandler) { @@ -455,10 +455,10 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex) { _toAdd = false; TouchHandler* pHandler = NULL; - Object* pObj = NULL; + Object* pObj = nullptr; CCARRAY_FOREACH(_handlersToAdd, pObj) { - pHandler = (TouchHandler*)pObj; + pHandler = static_cast(pObj); if (! pHandler) { break; diff --git a/extensions/CCArmature/CCArmature.cpp b/extensions/CCArmature/CCArmature.cpp index 2c9b0f3678..48979f750f 100644 --- a/extensions/CCArmature/CCArmature.cpp +++ b/extensions/CCArmature/CCArmature.cpp @@ -418,7 +418,7 @@ void Armature::update(float dt) Object *object = NULL; CCARRAY_FOREACH(_topBoneList, object) { - ((Bone *)object)->update(dt); + static_cast(object)->update(dt); } } @@ -433,7 +433,7 @@ void Armature::draw() Object *object = NULL; CCARRAY_FOREACH(_children, object) { - Bone *bone = (Bone *)object; + Bone *bone = static_cast(object); DisplayManager *displayManager = bone->getDisplayManager(); Node *node = displayManager->getDisplayRenderNode(); @@ -534,7 +534,7 @@ Rect Armature::boundingBox() Object *object = NULL; CCARRAY_FOREACH(_children, object) { - Bone *bone = (Bone *)object; + Bone *bone = static_cast(object); Rect r = bone->getDisplayManager()->getBoundingBox(); if(first) diff --git a/extensions/CCArmature/CCBone.cpp b/extensions/CCArmature/CCBone.cpp index aed808649e..61a7cebfdb 100644 --- a/extensions/CCArmature/CCBone.cpp +++ b/extensions/CCArmature/CCBone.cpp @@ -188,7 +188,7 @@ void Bone::update(float delta) Object *object = NULL; CCARRAY_FOREACH(_children, object) { - Bone *childBone = (Bone *)object; + Bone *childBone = static_cast(object); childBone->update(delta); } @@ -247,7 +247,7 @@ void Bone::removeChildBone(Bone *bone, bool recursion) Object *_object = NULL; CCARRAY_FOREACH(_ccbones, _object) { - Bone *_ccBone = (Bone *)_object; + Bone *_ccBone = static_cast(_object); bone->removeChildBone(_ccBone, recursion); } } diff --git a/extensions/CCArmature/animation/CCArmatureAnimation.cpp b/extensions/CCArmature/animation/CCArmatureAnimation.cpp index 5bc78cb5fe..ef0a8cd7d2 100644 --- a/extensions/CCArmature/animation/CCArmatureAnimation.cpp +++ b/extensions/CCArmature/animation/CCArmatureAnimation.cpp @@ -84,7 +84,7 @@ void ArmatureAnimation:: pause() Object *object = NULL; CCARRAY_FOREACH(_tweenList, object) { - ((Tween *)object)->pause(); + static_cast(object)->pause(); } ProcessBase::pause(); } @@ -94,7 +94,7 @@ void ArmatureAnimation::resume() Object *object = NULL; CCARRAY_FOREACH(_tweenList, object) { - ((Tween *)object)->resume(); + static_cast(object)->resume(); } ProcessBase::resume(); } @@ -104,7 +104,7 @@ void ArmatureAnimation::stop() Object *object = NULL; CCARRAY_FOREACH(_tweenList, object) { - ((Tween *)object)->stop(); + static_cast(object)->stop(); } _tweenList->removeAllObjects(); ProcessBase::stop(); @@ -237,7 +237,7 @@ void ArmatureAnimation::update(float dt) Object *object = NULL; CCARRAY_FOREACH(_tweenList, object) { - ((Tween *)object)->update(dt); + static_cast(object)->update(dt); } } diff --git a/extensions/CCArmature/display/CCDisplayManager.cpp b/extensions/CCArmature/display/CCDisplayManager.cpp index 5e57d33435..9b45629539 100644 --- a/extensions/CCArmature/display/CCDisplayManager.cpp +++ b/extensions/CCArmature/display/CCDisplayManager.cpp @@ -225,7 +225,7 @@ void DisplayManager::initDisplayList(BoneData *boneData) Array *displayDataList = &boneData->displayDataList; CCARRAY_FOREACH(displayDataList, object) { - DisplayData *displayData = (DisplayData *)object; + DisplayData *displayData = static_cast(object); DecorativeDisplay *decoDisplay = DecorativeDisplay::create(); decoDisplay->setDisplayData(displayData); diff --git a/extensions/CCArmature/physics/CCColliderDetector.cpp b/extensions/CCArmature/physics/CCColliderDetector.cpp index 8a830abf7f..c78e641847 100644 --- a/extensions/CCArmature/physics/CCColliderDetector.cpp +++ b/extensions/CCArmature/physics/CCColliderDetector.cpp @@ -63,7 +63,7 @@ ColliderDetector::~ColliderDetector() Object *object = NULL; CCARRAY_FOREACH(_colliderBodyList, object) { - ColliderBody *colliderBody = (ColliderBody *)object; + ColliderBody *colliderBody = static_cast(object); b2Body *body = colliderBody->getB2Body(); PhysicsWorld::sharedPhysicsWorld()->getNoGravityWorld()->DestroyBody(body); @@ -101,7 +101,7 @@ void ColliderDetector::addContourData(ContourData *contourData) int i = 0; CCARRAY_FOREACH(array, object) { - ContourVertex2F *v = (ContourVertex2F *)object; + ContourVertex2F *v = static_cast(object); b2bv[i].Set(v->x / PT_RATIO, v->y / PT_RATIO); i++; } @@ -134,7 +134,7 @@ void ColliderDetector::addContourDataList(Array *contourDataList) Object *object = NULL; CCARRAY_FOREACH(contourDataList, object) { - addContourData((ContourData *)object); + addContourData(static_cast(object)); } } @@ -153,7 +153,7 @@ void ColliderDetector::setColliderFilter(b2Filter &filter) Object *object = NULL; CCARRAY_FOREACH(_colliderBodyList, object) { - ColliderBody *colliderBody = (ColliderBody *)object; + ColliderBody *colliderBody = static_cast(object); colliderBody->getB2Body()->GetFixtureList()->SetFilterData(filter); } } @@ -163,7 +163,7 @@ void ColliderDetector::setActive(bool active) Object *object = NULL; CCARRAY_FOREACH(_colliderBodyList, object) { - ColliderBody *colliderBody = (ColliderBody *)object; + ColliderBody *colliderBody = static_cast(object); colliderBody->getB2Body()->SetActive(active); } } @@ -175,7 +175,7 @@ void ColliderDetector::updateTransform(AffineTransform &t) Object *object = NULL; CCARRAY_FOREACH(_colliderBodyList, object) { - ColliderBody *colliderBody = (ColliderBody *)object; + ColliderBody *colliderBody = static_cast(object); ContourData *contourData = colliderBody->getContourData(); b2Body *body = colliderBody->getB2Body(); @@ -188,7 +188,7 @@ void ColliderDetector::updateTransform(AffineTransform &t) int i = 0; CCARRAY_FOREACH(array, object) { - ContourVertex2F *cv = (ContourVertex2F *)object; + ContourVertex2F *cv = static_cast(object); b2Vec2 &bv = shape->m_vertices[i]; helpPoint.setPoint(cv->x, cv->y); diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index c34c5e3625..60e881641a 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -238,7 +238,7 @@ int CCBAnimationManager::getSequenceId(const char* pSequenceName) string seqName(pSequenceName); CCARRAY_FOREACH(mSequences, pElement) { - CCBSequence *seq = (CCBSequence*)pElement; + CCBSequence *seq = static_cast(pElement); if (seqName.compare(seq->getName()) == 0) { return seq->getSequenceId(); @@ -252,7 +252,7 @@ CCBSequence* CCBAnimationManager::getSequence(int nSequenceId) Object *pElement = NULL; CCARRAY_FOREACH(mSequences, pElement) { - CCBSequence *seq = (CCBSequence*)pElement; + CCBSequence *seq = static_cast(pElement); if (seq->getSequenceId() == nSequenceId) { return seq; diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index c2b9ecbe1c..832e65cb71 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -333,7 +333,7 @@ void CCBReader::cleanUpNodeGraph(Node *pNode) Object *pChild = NULL; CCARRAY_FOREACH(pNode->getChildren(), pChild) { - cleanUpNodeGraph((Node*)pChild); + cleanUpNodeGraph(static_cast(pChild)); } } diff --git a/extensions/CCBReader/CCNodeLoader.cpp b/extensions/CCBReader/CCNodeLoader.cpp index 9b86cb096d..94ff86a79a 100644 --- a/extensions/CCBReader/CCNodeLoader.cpp +++ b/extensions/CCBReader/CCNodeLoader.cpp @@ -78,7 +78,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * pCCBR bool bFound = false; CCARRAY_FOREACH(extraPropsNames, pObj) { - String* pStr = (String*)pObj; + String* pStr = static_cast(pObj); if (0 == pStr->compare(propertyName.c_str())) { bFound = true; @@ -90,7 +90,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * pCCBR } else if (isExtraProp && pNode == pCCBReader->getAnimationManager()->getRootNode()) { - Array *extraPropsNames = (Array*)pNode->getUserObject(); + Array *extraPropsNames = static_cast(pNode->getUserObject()); if (! extraPropsNames) { extraPropsNames = Array::create(); diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index 4a541c0268..98751d06d4 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -124,7 +124,7 @@ void Control::sendActionsForControlEvents(ControlEvent controlEvents) Object* pObj = NULL; CCARRAY_FOREACH(invocationList, pObj) { - Invocation* invocation = (Invocation*)pObj; + Invocation* invocation = static_cast(pObj); invocation->invoke(this); } //Call ScriptFunc @@ -212,7 +212,7 @@ void Control::removeTargetWithActionForControlEvent(Object* target, SEL_CCContro Object* pObj = NULL; CCARRAY_FOREACH(eventInvocationList, pObj) { - Invocation *invocation = (Invocation*)pObj; + Invocation *invocation = static_cast(pObj); bool shouldBeRemoved=true; if (target) { diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index b1ca60519c..c9ab3e47cb 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -157,7 +157,7 @@ void ScrollView::pause(Object* sender) CCARRAY_FOREACH(pChildren, pObj) { - Node* pChild = (Node*)pObj; + Node* pChild = static_cast(pObj); pChild->pauseSchedulerAndActions(); } } @@ -169,7 +169,7 @@ void ScrollView::resume(Object* sender) CCARRAY_FOREACH(pChildren, pObj) { - Node* pChild = (Node*)pObj; + Node* pChild = static_cast(pObj); pChild->resumeSchedulerAndActions(); } diff --git a/extensions/GUI/CCScrollView/CCTableView.cpp b/extensions/GUI/CCScrollView/CCTableView.cpp index d703948c9e..ccfdb144bc 100644 --- a/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/extensions/GUI/CCScrollView/CCTableView.cpp @@ -106,7 +106,7 @@ void TableView::reloadData() Object* pObj = NULL; CCARRAY_FOREACH(_cellsUsed, pObj) { - TableViewCell* cell = (TableViewCell*)pObj; + TableViewCell* cell = static_cast(pObj); if(_tableViewDelegate != NULL) { _tableViewDelegate->tableCellWillRecycle(this, cell); @@ -494,7 +494,7 @@ void TableView::scrollViewDidScroll(ScrollView* view) int i = 0; CCARRAY_FOREACH(_cellsUsed, pObj) { - TableViewCell* pCell = (TableViewCell*)pObj; + TableViewCell* pCell = static_cast(pObj); CCLog("cells Used index %d, value = %d", i, pCell->getIdx()); i++; } @@ -502,7 +502,7 @@ void TableView::scrollViewDidScroll(ScrollView* view) i = 0; CCARRAY_FOREACH(_cellsFreed, pObj) { - TableViewCell* pCell = (TableViewCell*)pObj; + TableViewCell* pCell = static_cast(pObj); CCLog("cells freed index %d, value = %d", i, pCell->getIdx()); i++; } diff --git a/samples/Cpp/TestCpp/Classes/BugsTest/Bug-422.cpp b/samples/Cpp/TestCpp/Classes/BugsTest/Bug-422.cpp index f59e145625..bf3ff4babd 100644 --- a/samples/Cpp/TestCpp/Classes/BugsTest/Bug-422.cpp +++ b/samples/Cpp/TestCpp/Classes/BugsTest/Bug-422.cpp @@ -52,7 +52,7 @@ void Bug422Layer::check(Node* t) CCARRAY_FOREACH(array, pChild) { CC_BREAK_IF(! pChild); - Node* pNode = (Node*) pChild; + Node* pNode = static_cast(pChild); CCLog("%p, rc: %d", pNode, pNode->retainCount()); check(pNode); } diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp index aec6d05155..b16c1ac606 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp @@ -66,7 +66,7 @@ void ProjectileController::update(float delta) CCARRAY_FOREACH(targetsToDelete, jt) { Sprite *target = dynamic_cast(jt); - ((EnemyController*)(target->getComponent("EnemyController")))->die(); + static_cast(target->getComponent("EnemyController"))->die(); } bool isDied = targetsToDelete->count(); diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp index 63e79adcf6..c2d8aac782 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp @@ -49,7 +49,7 @@ bool ControlButtonTest_HelloVariableSize::init() int i = 0; CCARRAY_FOREACH(stringArray, pObj) { - String* title = (String*)pObj; + String* title = static_cast(pObj); // Creates a button with this string as title ControlButton *button = standardButtonWithTitle(title->getCString()); if (i == 0) diff --git a/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp b/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp index 91e89bdb16..f905fb7c6c 100644 --- a/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp @@ -129,7 +129,7 @@ static void setEnableRecursiveCascading(Node* node, bool enable) Array* children = node->getChildren(); CCARRAY_FOREACH(children, obj) { - Node* child = (Node*)obj; + Node* child = static_cast(obj); setEnableRecursiveCascading(child, enable); } } diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index fc72b8a948..28f1d51ecd 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -220,7 +220,7 @@ void IterateSpriteSheetFastEnum::update(float dt) CCARRAY_FOREACH(pChildren, pObject) { - Sprite* pSprite = (Sprite*) pObject; + Sprite* pSprite = static_cast(pObject); pSprite->setVisible(false); } @@ -257,7 +257,7 @@ void IterateSpriteSheetCArray::update(float dt) CCARRAY_FOREACH(pChildren, pObject) { - Sprite* pSprite = (Sprite*)pObject; + Sprite* pSprite = static_cast(pObject); pSprite->setVisible(false); } diff --git a/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp b/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp index 9d42edc59b..8de9c398b5 100644 --- a/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp +++ b/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp @@ -133,7 +133,7 @@ TMXOrthoTest::TMXOrthoTest() Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { - child = (SpriteBatchNode*)pObject; + child = static_cast(pObject); if(!child) break; @@ -182,7 +182,7 @@ TMXOrthoTest2::TMXOrthoTest2() Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { - child = (SpriteBatchNode*)pObject; + child = static_cast(pObject); if(!child) break; @@ -216,7 +216,7 @@ TMXOrthoTest3::TMXOrthoTest3() Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { - child = (SpriteBatchNode*)pObject; + child = static_cast(pObject); if(!child) break; @@ -251,7 +251,7 @@ TMXOrthoTest4::TMXOrthoTest4() Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { - child = (SpriteBatchNode*)pObject; + child = static_cast(pObject); if(!child) break; @@ -556,7 +556,7 @@ TMXUncompressedTest::TMXUncompressedTest() Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { - layer= (TMXLayer*)pObject; + layer= static_cast(pObject); if(!layer) break; @@ -621,7 +621,7 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest() Object* pObj = NULL; CCARRAY_FOREACH(objects, pObj) { - dict = (Dictionary*)pObj;//dynamic_cast(*it); + dict = static_cast(pObj); if(!dict) break; @@ -644,7 +644,7 @@ void TMXOrthoObjectsTest::draw() Object* pObj = NULL; CCARRAY_FOREACH(objects, pObj) { - dict = (Dictionary*)pObj;//dynamic_cast(*it); + dict = static_cast(pObj); if(!dict) break; @@ -702,7 +702,7 @@ TMXIsoObjectsTest::TMXIsoObjectsTest() Object* pObj = NULL; CCARRAY_FOREACH(objects, pObj) { - dict = (Dictionary*)pObj; + dict = static_cast(pObj); if(!dict) break; @@ -721,18 +721,18 @@ void TMXIsoObjectsTest::draw() Object* pObj = NULL; CCARRAY_FOREACH(objects, pObj) { - dict = (Dictionary*)pObj;//dynamic_cast(*it); + dict = static_cast(pObj); if(!dict) break; const char* key = "x"; - int x = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast(dict->objectForKey("x"))->getNumber(); + int x = static_cast(dict->objectForKey(key))->intValue(); key = "y"; - int y = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast(dict->objectForKey("y"))->getNumber(); + int y = static_cast(dict->objectForKey(key))->intValue(); key = "width"; - int width = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast(dict->objectForKey("width"))->getNumber(); + int width = static_cast(dict->objectForKey(key))->intValue(); key = "height"; - int height = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast(dict->objectForKey("height"))->getNumber(); + int height = static_cast(dict->objectForKey(key))->intValue(); glLineWidth(3); @@ -1157,7 +1157,7 @@ TMXOrthoFlipTest::TMXOrthoFlipTest() Object* pObj = NULL; CCARRAY_FOREACH(map->getChildren(), pObj) { - SpriteBatchNode* child = (SpriteBatchNode*)pObj; + SpriteBatchNode* child = static_cast(pObj); child->getTexture()->setAntiAliasTexParameters(); } @@ -1187,7 +1187,7 @@ TMXOrthoFlipRunTimeTest::TMXOrthoFlipRunTimeTest() Object* pObj = NULL; CCARRAY_FOREACH(map->getChildren(), pObj) { - SpriteBatchNode* child = (SpriteBatchNode*)pObj; + SpriteBatchNode* child = static_cast(pObj); child->getTexture()->setAntiAliasTexParameters(); } @@ -1266,7 +1266,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() Object* pObj = NULL; CCARRAY_FOREACH(map->getChildren(), pObj) { - SpriteBatchNode* child = (SpriteBatchNode*)pObj; + SpriteBatchNode* child = static_cast(pObj); child->getTexture()->setAntiAliasTexParameters(); } @@ -1297,7 +1297,7 @@ TMXBug987::TMXBug987() Object* pObject = NULL; CCARRAY_FOREACH(childs, pObject) { - pNode = (TMXLayer*) pObject; + pNode = static_cast(pObject); CC_BREAK_IF(!pNode); pNode->getTexture()->setAntiAliasTexParameters(); } @@ -1523,7 +1523,7 @@ void TMXGIDObjectsTest::draw() Object* pObj = NULL; CCARRAY_FOREACH(array, pObj) { - dict = (Dictionary*)pObj; + dict = static_cast(pObj); if(!dict) { break; diff --git a/samples/Cpp/TestCpp/Classes/TouchesTest/TouchesTest.cpp b/samples/Cpp/TestCpp/Classes/TouchesTest/TouchesTest.cpp index 407b930da5..0b4212ed3b 100644 --- a/samples/Cpp/TestCpp/Classes/TouchesTest/TouchesTest.cpp +++ b/samples/Cpp/TestCpp/Classes/TouchesTest/TouchesTest.cpp @@ -71,7 +71,7 @@ PongLayer::PongLayer() Object* pObj = NULL; CCARRAY_FOREACH(_paddles, pObj) { - paddle = (Paddle*)(pObj); + paddle = static_cast(pObj); if(!paddle) break; @@ -105,7 +105,7 @@ void PongLayer::doStep(float delta) Object* pObj = NULL; CCARRAY_FOREACH(_paddles, pObj) { - paddle = (Paddle*)(pObj); + paddle = static_cast(pObj); if(!paddle) break; diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id index 073cb5d25b..d76b8ffd48 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id @@ -1 +1 @@ -ef40a853a2bf6590fbd9af75f8b318844caf4b64 \ No newline at end of file +283cec6d4443dbb957d240238c35201064da699f \ No newline at end of file diff --git a/scripting/lua/cocos2dx_support/Lua_web_socket.cpp b/scripting/lua/cocos2dx_support/Lua_web_socket.cpp index 6ee6232f46..b94f3a5b17 100644 --- a/scripting/lua/cocos2dx_support/Lua_web_socket.cpp +++ b/scripting/lua/cocos2dx_support/Lua_web_socket.cpp @@ -279,7 +279,7 @@ static int tolua_Cocos2d_WebSocket_createByProtocolArray00(lua_State* tolua_S) Object* pObj = NULL; CCARRAY_FOREACH(protocolArray, pObj) { - String* pStr = (String*)pObj; + String* pStr = static_cast(pObj); if (NULL != pStr) { protocols.push_back(pStr->getCString()); }