diff --git a/cocos2dx/CCDrawingPrimitives.cpp b/cocos2dx/CCDrawingPrimitives.cpp index 5a122765af..d8032cfc29 100644 --- a/cocos2dx/CCDrawingPrimitives.cpp +++ b/cocos2dx/CCDrawingPrimitives.cpp @@ -226,7 +226,7 @@ void ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor CC_INCREMENT_GL_DRAWS(1); } -void ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter) +void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter) { lazy_init(); @@ -265,7 +265,7 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, int segment CC_INCREMENT_GL_DRAWS(1); } -void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments) +void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments) { lazy_init(); @@ -294,7 +294,7 @@ void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoi CC_INCREMENT_GL_DRAWS(1); } -void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments) +void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments) { lazy_init(); diff --git a/cocos2dx/CCDrawingPrimitives.h b/cocos2dx/CCDrawingPrimitives.h index 77297585e5..4b65fe690c 100644 --- a/cocos2dx/CCDrawingPrimitives.h +++ b/cocos2dx/CCDrawingPrimitives.h @@ -73,17 +73,17 @@ void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, boo void CC_DLL ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color ); /** draws a circle given the center, radius and number of segments. */ -void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter); +void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); /** draws a quad bezier path @since v0.8 */ -void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments); +void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments); /** draws a cubic bezier path @since v0.8 */ -void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments); +void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments); /** set the drawing color with 4 unsigned bytes @since v2.0 diff --git a/cocos2dx/extensions/CCBReader/CCBReader_v2.cpp b/cocos2dx/extensions/CCBReader/CCBReader_v2.cpp index e04be27088..9f72761d9e 100644 --- a/cocos2dx/extensions/CCBReader/CCBReader_v2.cpp +++ b/cocos2dx/extensions/CCBReader/CCBReader_v2.cpp @@ -40,13 +40,13 @@ int CCBReader::intValFromDict(CCDictionary* dict, const std::string key) float CCBReader::floatValFromDict(CCDictionary* dict, const std::string key) { CCString* valueString = (CCString*) dict->objectForKey(key.c_str()); - return valueString? valueString->floatValue() : 0; + return valueString? valueString->floatValue() : 0.0f; } bool CCBReader::boolValFromDict(CCDictionary* dict, const std::string key) { CCString* valueString = (CCString*) dict->objectForKey(key.c_str()); - return valueString? ((bool)(valueString->intValue())) : false; + return (valueString && valueString->intValue()) ? true : false; } CCPoint CCBReader::pointValFromDict(CCDictionary* dict, const std::string key) diff --git a/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index 5686dd072d..96a1d3ec5a 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -94,8 +94,8 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos // Clamp the position of the icon within the circle // Get the center point of the bkgd image - float centerX = m_startPos.x + m_background->boundingBox().size.width*.5; - float centerY = m_startPos.y + m_background->boundingBox().size.height*.5; + float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f; + float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f; // Work out the distance difference between the location and center float dx = sliderPosition.x - centerX; @@ -106,7 +106,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos float angle = atan2f(dy, dx); // Set the limit to the slider movement within the colour picker - float limit = m_background->boundingBox().size.width*.5; + float limit = m_background->boundingBox().size.width*0.5f; // Check distance doesn't exceed the bounds of the circle if (dist > limit) @@ -126,7 +126,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos else if (sliderPosition.y > m_startPos.y + boxPos + boxSize) sliderPosition.y = m_startPos.y + boxPos + boxSize; // Use the position / slider width to determin the percentage the dragger is at - m_saturation = 1.0 - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize); + m_saturation = 1.0f - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize); m_brightness = fabs((m_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize); } @@ -135,8 +135,8 @@ bool CCControlSaturationBrightnessPicker::checkSliderPosition(CCPoint location) // Clamp the position of the icon within the circle // get the center point of the bkgd image - float centerX = m_startPos.x + m_background->boundingBox().size.width*.5; - float centerY = m_startPos.y + m_background->boundingBox().size.height*.5; + float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f; + float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f; // work out the distance difference between the location and center float dx = location.x - centerX; diff --git a/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp b/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp index dff0484dc2..824d27dd0d 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp @@ -206,7 +206,7 @@ void CCControlSwitchSprite::needsLayout() m_pOffSprite->getContentSize().height / 2)); } - CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight(m_pMaskTexture->getContentSize().width, m_pMaskTexture->getContentSize().height); + CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight((int)m_pMaskTexture->getContentSize().width, (int)m_pMaskTexture->getContentSize().height); rt->begin(); m_pOnSprite->visit(); @@ -358,7 +358,7 @@ void CCControlSwitch::setIsEnabled(bool enabled) { m_bEnabled = enabled; - m_pSwitchSprite->setOpacity((enabled) ? 255.0f : 128.0f); + m_pSwitchSprite->setOpacity((enabled) ? 255 : 128); } CCPoint CCControlSwitch::locationFromTouch(CCTouch* pTouch) diff --git a/cocos2dx/extensions/CCListView/CCListView.cpp b/cocos2dx/extensions/CCListView/CCListView.cpp index 4a91352afe..dd71dee560 100644 --- a/cocos2dx/extensions/CCListView/CCListView.cpp +++ b/cocos2dx/extensions/CCListView/CCListView.cpp @@ -31,7 +31,7 @@ using namespace std; NS_CC_EXT_BEGIN -#define ND_LISTVIEW_ACTION_INTERVAL 0.6666 +#define ND_LISTVIEW_ACTION_INTERVAL 0.6666f /****************************************** **************Public Functions************* *******************************************/ @@ -1142,6 +1142,9 @@ unsigned int CCListView::triggerNumberOfCells(void) { unsigned int nRow = 0; CCListViewProtrolData data; + data.nNumberOfRows = 0; + data.nRow = 0; + data.cell = NULL; if (m_strDeletegate.size() > 0) { @@ -2151,7 +2154,7 @@ bool CCListView::isMenuTouch(CCTouch *touch, CCNode *parent) CCArray *pChildrens = parent->getChildren(); if (pChildrens && pChildrens->count() > 0) { - for (int i = 0; i < pChildrens->count(); i++) + for (unsigned int i = 0; i < pChildrens->count(); i++) { CCNode *pChildren = (CCNode*)pChildrens->objectAtIndex(i); if (this->isMenuTouch(touch, pChildren)) diff --git a/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp b/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp index efa08d7188..ca3185d906 100644 --- a/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp +++ b/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp @@ -45,7 +45,7 @@ CCTextureWatcher::CCTextureWatcher() // layer CCSize size = CCDirector::sharedDirector()->getWinSize(); - size.height *= 0.6; + size.height *= 0.6f; m_pLayer->setContentSize(size); // the menu of disabling touch event @@ -256,12 +256,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro CCSize listItemSize = CCSize(m_pList->getContentSize().width / NUM_PER_PAGE, m_pList->getContentSize().height); - CCSize size = CCSize(listItemSize.width * 0.9, listItemSize.height * 0.6); + CCSize size = CCSize(listItemSize.width * 0.9f, listItemSize.height * 0.6f); sprintf(m_pszString, "%d/%d", m_nCurrnetPage, m_nTotalPage); m_labelPage->setString(m_pszString); - float offX = 0, offY = 0, offsetX = 0, offsetY = 0; + float offX = 0.0f, offY = 0.0f, offsetX = 0.0f, offsetY = 0.0f; CC_UNUSED_PARAM(offsetY); int nCount = 0; int nStart = (m_nCurrnetPage - 1) * NUM_PER_PAGE; @@ -288,8 +288,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro { labelCount->setColor(ccc3(255, 0, 0)); } - offX = offsetX + listItemSize.width * 0.5 - labelCount->getContentSize().width * 0.5; - offY = (listItemSize.height - size.height) * 0.5 - labelCount->getContentSize().height; + offX = offsetX + listItemSize.width * 0.5f - labelCount->getContentSize().width * 0.5f; + offY = (listItemSize.height - size.height) * 0.5f - labelCount->getContentSize().height; labelCount->setPosition(ccp(offX, offY)); labelCount->setAnchorPoint(ccp(0, 0)); cell->addChild(labelCount); @@ -297,10 +297,10 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro // texture size sprintf(m_pszString, "%.0f*%.0f", textrue->getContentSize().width, textrue->getContentSize().height); CCLabelTTF *labelSize = CCLabelTTF::labelWithString(m_pszString, "Arial", 16); - offX = offsetX + listItemSize.width * 0.5; - offY = (listItemSize.height - size.height) * 0.5 + size.height; + offX = offsetX + listItemSize.width * 0.5f; + offY = (listItemSize.height - size.height) * 0.5f + size.height; labelSize->setPosition(ccp(offX, offY)); - labelSize->setAnchorPoint(ccp(0.5, 0)); + labelSize->setAnchorPoint(ccp(0.5f, 0)); cell->addChild(labelSize); // texture name @@ -313,12 +313,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro string name = key.substr(pos, len - pos); sprintf(m_pszString, "%s", name.c_str()); - CCSize dimensions = CCSizeMake(listItemSize.width * 0.9, labelSize->getContentSize().height); + CCSize dimensions = CCSizeMake(listItemSize.width * 0.9f, labelSize->getContentSize().height); CCLabelTTF *labelName = CCLabelTTF::labelWithString(m_pszString, dimensions, CCTextAlignmentCenter, "Arial", 16); - offX = offsetX + listItemSize.width * 0.5; + offX = offsetX + listItemSize.width * 0.5f; offY = offY + labelName->getContentSize().height; labelName->setPosition(ccp(offX, offY)); - labelName->setAnchorPoint(ccp(0.5, 0)); + labelName->setAnchorPoint(ccp(0.5f, 0)); cell->addChild(labelName); CCSprite *sprite = CCSprite::spriteWithTexture(textrue); @@ -341,8 +341,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro sprite->setScale(scale); spriteSize.width *= scale; spriteSize.height *= scale; - offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5; - offY = (listItemSize.height - spriteSize.height) * 0.5; + offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5f; + offY = (listItemSize.height - spriteSize.height) * 0.5f; sprite->setPosition(ccp(offX, offY)); cell->addChild(sprite); offsetX += listItemSize.width; diff --git a/cocos2dx/kazmath/src/mat3.c b/cocos2dx/kazmath/src/mat3.c index 0b047e06f4..d5549a7792 100644 --- a/cocos2dx/kazmath/src/mat3.c +++ b/cocos2dx/kazmath/src/mat3.c @@ -92,7 +92,7 @@ kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmM return NULL; } - detInv = 1.0 / pDeterminate; + detInv = 1.0f / pDeterminate; kmMat3Adjugate(&adjugate, pM); kmMat3ScalarMultiply(pOut, &adjugate, detInv); diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index d202028fca..357e6590e4 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -864,7 +864,7 @@ void CCLabelBMFont::createFontChars() } totalHeight = m_pConfiguration->m_uCommonHeight * quantityOfLines; - nextFontPositionY = -(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines); + nextFontPositionY = 0-(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines); for (unsigned int i= 0; i < stringLen; i++) { @@ -1086,7 +1086,7 @@ void CCLabelBMFont::updateLabel() vector last_word; last_word.reserve( stringLength ); - int line = 1, i = 0; + unsigned int line = 1, i = 0; bool start_line = false, start_word = false; float startOfLine = -1, startOfWord = -1; int skip = 0; @@ -1101,7 +1101,7 @@ void CCLabelBMFont::updateLabel() if (!characterSprite->getIsVisible()) continue; - if (i >= stringLength || i < 0) + if (i >= stringLength) break; unsigned short character = str_whole[i]; @@ -1132,7 +1132,7 @@ void CCLabelBMFont::updateLabel() i++; line++; - if (i >= stringLength || i < 0) + if (i >= stringLength) break; character = str_whole[i]; @@ -1195,7 +1195,7 @@ void CCLabelBMFont::updateLabel() startOfLine = -1; line++; - if (i >= stringLength || i < 0) + if (i >= stringLength) break; if (!startOfWord) @@ -1229,7 +1229,9 @@ void CCLabelBMFont::updateLabel() unsigned short* str_new = new unsigned short[size + 1]; for (int i = 0; i < size; ++i) + { str_new[i] = multiline_string[i]; + } str_new[size] = 0; diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 6b640ceb16..4caf9aef7a 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -285,7 +285,7 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { if (m_pScriptHandlerEntry) { - return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch); + return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch) == 0 ? false : true; } CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp index f15398e80c..32096364f9 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp @@ -62,7 +62,7 @@ void CCTransitionProgress::onEnter() CCSize size = CCDirector::sharedDirector()->getWinSize(); // create the second render texture for outScene - CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(size.width, size.height); + CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height); texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); texture->setPosition(ccp(size.width/2, size.height/2)); texture->setAnchorPoint(ccp(0.5f,0.5f)); diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index 0ae5a07d90..b764005d4b 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -347,7 +347,7 @@ bool CCParticleSystem::initWithTotalParticles(unsigned int numberOfParticles) if (m_pBatchNode) { - for (int i = 0; i < m_uTotalParticles; i++) + for (unsigned int i = 0; i < m_uTotalParticles; i++) { m_pParticles[i].atlasIndex=i; } @@ -1203,7 +1203,7 @@ void CCParticleSystem::setBatchNode(CCParticleBatchNode* batchNode) if( batchNode ) { //each particle needs a unique index - for (int i = 0; i < m_uTotalParticles; i++) + for (unsigned int i = 0; i < m_uTotalParticles; i++) { m_pParticles[i].atlasIndex=i; } diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp index eaba6348f8..ce5220fb5c 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp @@ -416,7 +416,7 @@ void CCParticleSystemQuad::setTotalParticles(unsigned int tp) // Init particles if (m_pBatchNode) { - for (int i = 0; i < m_uTotalParticles; i++) + for (unsigned int i = 0; i < m_uTotalParticles; i++) { m_pParticles[i].atlasIndex=i; } diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp index dfaffb2395..ccf65b5a57 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.cpp +++ b/cocos2dx/platform/CCEGLViewProtocol.cpp @@ -83,8 +83,8 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height) // calculate the factor and the rect of viewport m_fScreenScaleFactor = MIN((float)m_sSizeInPixel.width / m_sSizeInPoint.width, (float)m_sSizeInPixel.height / m_sSizeInPoint.height); - int viewPortW = (int)(m_sSizeInPoint.width * m_fScreenScaleFactor); - int viewPortH = (int)(m_sSizeInPoint.height * m_fScreenScaleFactor); + float viewPortW = m_sSizeInPoint.width * m_fScreenScaleFactor; + float viewPortH = m_sSizeInPoint.height * m_fScreenScaleFactor; m_rcViewPort.setRect((m_sSizeInPixel.width - viewPortW) / 2, (m_sSizeInPixel.height - viewPortH) / 2, viewPortW, viewPortH); @@ -136,8 +136,8 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float if (m_bNeedScale) { float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR(); - glViewport((GLint)(x * factor) + m_rcViewPort.origin.x, - (GLint)(y * factor) + m_rcViewPort.origin.y, + glViewport((GLint)(x * factor + m_rcViewPort.origin.x), + (GLint)(y * factor + m_rcViewPort.origin.y), (GLsizei)(w * factor), (GLsizei)(h * factor)); } @@ -155,8 +155,8 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h if (m_bNeedScale) { float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR(); - glScissor((GLint)(x * factor) + m_rcViewPort.origin.x, - (GLint)(y * factor) + m_rcViewPort.origin.y, + glScissor((GLint)(x * factor + m_rcViewPort.origin.x), + (GLint)(y * factor + m_rcViewPort.origin.y), (GLsizei)(w * factor), (GLsizei)(h * factor)); } diff --git a/cocos2dx/platform/CCImage.h b/cocos2dx/platform/CCImage.h index 34d8513e77..f7322740c9 100644 --- a/cocos2dx/platform/CCImage.h +++ b/cocos2dx/platform/CCImage.h @@ -120,8 +120,8 @@ public: */ bool saveToFile(const char *pszFilePath, bool bIsToRGB = true); - CC_SYNTHESIZE_READONLY(short, m_nWidth, Width); - CC_SYNTHESIZE_READONLY(short, m_nHeight, Height); + CC_SYNTHESIZE_READONLY(unsigned short, m_nWidth, Width); + CC_SYNTHESIZE_READONLY(unsigned short, m_nHeight, Height); CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent); protected: diff --git a/cocos2dx/platform/CCImageCommon_cpp.h b/cocos2dx/platform/CCImageCommon_cpp.h index 3ebd41c6a4..1b42085847 100644 --- a/cocos2dx/platform/CCImageCommon_cpp.h +++ b/cocos2dx/platform/CCImageCommon_cpp.h @@ -354,7 +354,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen) if (row_pointers) { const unsigned int stride = m_nWidth * channels; - for (size_t i = 0; i < m_nHeight; ++i) + for (unsigned short i = 0; i < m_nHeight; ++i) { png_uint_32 q = i * stride; row_pointers[i] = (png_bytep)m_pData + q; @@ -364,9 +364,9 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen) if (m_bHasAlpha) { unsigned int *tmp = (unsigned int *)m_pData; - for(unsigned int i = 0; i < m_nHeight; i++) + for(unsigned short i = 0; i < m_nHeight; i++) { - for(int j = 0; j < m_nWidth * channels; j += 4) + for(unsigned int j = 0; j < m_nWidth * channels; j += 4) { *tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1], row_pointers[i][j + 2], row_pointers[i][j + 3] ); @@ -515,9 +515,9 @@ bool CCImage::_initWithTiffData(void* pData, int nDataLen) CC_BREAK_IF(NULL == tif); - uint32 w, h; - uint16 bitsPerSample, samplePerPixel, planarConfig, extraSample; - size_t npixels; + uint32 w = 0, h = 0; + uint16 bitsPerSample = 0, samplePerPixel = 0, planarConfig = 0; + size_t npixels = 0; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index 3e8c916ea5..f58d480936 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -461,7 +461,7 @@ void CCEGLView::resize(int width, int height) void CCEGLView::setFrameSize(float width, float height) { - Create((LPCTSTR)m_szViewName, width, height); + Create((LPCTSTR)m_szViewName, (int)width, (int)height); CCEGLViewProtocol::setFrameSize(width, height); } diff --git a/cocos2dx/shaders/ccGLStateCache.cpp b/cocos2dx/shaders/ccGLStateCache.cpp index 3f2100d0fa..828124880e 100644 --- a/cocos2dx/shaders/ccGLStateCache.cpp +++ b/cocos2dx/shaders/ccGLStateCache.cpp @@ -163,10 +163,10 @@ void ccGLEnable( ccGLServerState flags ) { #if CC_ENABLE_GL_STATE_CACHE - bool enabled = false; + int enabled = 0; /* GL_BLEND */ - if( (enabled=(flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) { + if( (enabled = (flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) { if( enabled ) { glEnable( GL_BLEND ); s_eGLServerState |= CC_GL_BLEND; diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index f4fa712e2c..8ce755d087 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -563,7 +563,7 @@ void CCTextureAtlas::fillWithEmptyQuadsFromIndex(unsigned int index, unsigned in memset(&quad, 0, sizeof(quad)); unsigned int to = index + amount; - for (int i = index ; i < to ; i++) + for (unsigned int i = index ; i < to ; i++) { m_pQuads[i] = quad; } diff --git a/cocos2dx/textures/CCTexturePVR.cpp b/cocos2dx/textures/CCTexturePVR.cpp index c1c83879cd..ad3edf450e 100755 --- a/cocos2dx/textures/CCTexturePVR.cpp +++ b/cocos2dx/textures/CCTexturePVR.cpp @@ -244,7 +244,7 @@ bool CCTexturePVR::unpackPVRData(unsigned char* data, unsigned int len) It means that image is compressed as flipped. We don't support automatic flipping. */ - bool flipped = (bool)(flags & kPVRTextureFlagVerticalFlip); + bool flipped = (flags & kPVRTextureFlagVerticalFlip) ? true : false; if ( flipped ) { CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool");