From 6733f786a51a063f41ffcafc56b231f69c2e5f4a Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 14 Jan 2013 16:06:18 +0800 Subject: [PATCH] fixed #1649: Reverted some invokings of function that returns const reference. --- cocos2dx/base_nodes/CCAtlasNode.cpp | 2 +- cocos2dx/label_nodes/CCLabelAtlas.cpp | 2 +- cocos2dx/label_nodes/CCLabelBMFont.cpp | 2 +- cocos2dx/particle_nodes/CCParticleSystemQuad.cpp | 2 +- cocos2dx/sprite_nodes/CCSprite.cpp | 2 +- cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp | 2 +- extensions/CCBReader/CCBAnimationManager.cpp | 2 +- extensions/CCBReader/CCBAnimationManager.h | 2 +- extensions/CCBReader/CCBValue.cpp | 2 +- extensions/CCBReader/CCBValue.h | 2 +- extensions/GUI/CCControlExtension/CCControlButton.h | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index 5eb9a5f0af..c2671c03bd 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -117,7 +117,7 @@ bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, uns void CCAtlasNode::calculateMaxItems() { - CCSize s = m_pTextureAtlas->getTexture()->getContentSize(); + const CCSize& s = m_pTextureAtlas->getTexture()->getContentSize(); m_uItemsPerColumn = (int)(s.height / m_uItemHeight); m_uItemsPerRow = (int)(s.width / m_uItemWidth); } diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index 5c07088777..4465f749cd 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -198,7 +198,7 @@ void CCLabelAtlas::draw() { CCAtlasNode::draw(); - CCSize s = this->getContentSize(); + const CCSize& s = this->getContentSize(); CCPoint vertices[4]={ ccp(0,0),ccp(s.width,0), ccp(s.width,s.height),ccp(0,s.height), diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 474b63e378..c029394490 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -1448,7 +1448,7 @@ const char* CCLabelBMFont::getFntFile() void CCLabelBMFont::draw() { CCSpriteBatchNode::draw(); - CCSize s = this->getContentSize(); + const CCSize& s = this->getContentSize(); CCPoint vertices[4]={ ccp(0,0),ccp(s.width,0), ccp(s.width,s.height),ccp(0,s.height), diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp index e5125be14e..7b9f00822e 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp @@ -206,7 +206,7 @@ void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, const CCRect } void CCParticleSystemQuad::setTexture(CCTexture2D* texture) { - CCSize s = texture->getContentSize(); + const CCSize& s = texture->getContentSize(); this->setTextureWithRect(texture, CCRectMake(0, 0, s.width, s.height)); } void CCParticleSystemQuad::setDisplayFrame(CCSpriteFrame *spriteFrame) diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 49e4dbf169..dfa0dec207 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -281,7 +281,7 @@ CCSprite* CCSprite::initWithCGImage(CGImageRef pImage, const char *pszKey) // XXX: possible bug. See issue #349. New API should be added CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addCGImage(pImage, pszKey); - CCSize size = pTexture->getContentSize(); + const CCSize& size = pTexture->getContentSize(); CCRect rect = CCRectMake(0 ,0, size.width, size.height); return initWithTexture(texture, rect); diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp index c78866bdc3..06d106ffa8 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXTiledMap.cpp @@ -218,7 +218,7 @@ void CCTMXTiledMap::buildWithMapInfo(CCTMXMapInfo* mapInfo) addChild((CCNode*)child, idx, idx); // update content size with the max size - CCSize childSize = child->getContentSize(); + const CCSize& childSize = child->getContentSize(); CCSize currentSize = this->getContentSize(); currentSize.width = MAX( currentSize.width, childSize.width ); currentSize.height = MAX( currentSize.height, childSize.height ); diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index 10c1fd0c0c..e475f80f67 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -177,7 +177,7 @@ const char* CCBAnimationManager::getRunningSequenceName() return mRunningSequence->getName(); } -CCSize CCBAnimationManager::getContainerSize(CCNode *pNode) +const CCSize& CCBAnimationManager::getContainerSize(CCNode *pNode) { if (pNode) { diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index aafda53094..adf22e295b 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -80,7 +80,7 @@ public: const char* getRunningSequenceName(); - CCSize getContainerSize(CCNode* pNode); + const CCSize& getContainerSize(CCNode* pNode); void addNode(CCNode *pNode, CCDictionary *pSeq); void setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName); diff --git a/extensions/CCBReader/CCBValue.cpp b/extensions/CCBReader/CCBValue.cpp index a0dbf29d48..29ccdf7fe8 100644 --- a/extensions/CCBReader/CCBValue.cpp +++ b/extensions/CCBReader/CCBValue.cpp @@ -21,7 +21,7 @@ ccColor3BWapper* ccColor3BWapper::create(const ccColor3B& color) return ret; } -ccColor3B ccColor3BWapper::getColor() +const ccColor3B& ccColor3BWapper::getColor() const { return color; } diff --git a/extensions/CCBReader/CCBValue.h b/extensions/CCBReader/CCBValue.h index 29dbd9a66b..f9a2715867 100644 --- a/extensions/CCBReader/CCBValue.h +++ b/extensions/CCBReader/CCBValue.h @@ -18,7 +18,7 @@ private: public: static ccColor3BWapper* create(const ccColor3B& color); - ccColor3B getColor(); + const ccColor3B& getColor() const; }; enum diff --git a/extensions/GUI/CCControlExtension/CCControlButton.h b/extensions/GUI/CCControlExtension/CCControlButton.h index bc57244fa9..062bef22ab 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.h +++ b/extensions/GUI/CCControlExtension/CCControlButton.h @@ -68,7 +68,7 @@ protected: CC_SYNTHESIZE_READONLY(CCString*, m_currentTitle, CurrentTitle); /** The current color used to display the title. */ - CC_SYNTHESIZE_READONLY(ccColor3B, m_currentTitleColor, CurrentTitleColor); + CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_currentTitleColor, CurrentTitleColor); /** Adjust the background image. YES by default. If the property is set to NO, the background will use the prefered size of the background image. */