Merge pull request #292 from liswei/master

#512 fix warnings in /Wall flag
This commit is contained in:
Walzer 2011-06-11 08:33:31 -07:00
commit 37a40caa8d
70 changed files with 294 additions and 221 deletions

View File

@ -139,6 +139,6 @@ LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/l
-lskia
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
LOCAL_CFLAGS := -DUSE_FILE32API -Wno-unused-value
include $(BUILD_SHARED_LIBRARY)

View File

@ -36,14 +36,14 @@ static CCConfiguration g_SharedConfiguration;
static char *g_pGlExtensions;
CCConfiguration::CCConfiguration(void)
: m_bSupportsBGRA8888(false)
, m_bSupportsDiscardFramebuffer(false)
, m_bSupportsNPOT(false)
, m_bSupportsPVRTC(false)
:m_nMaxTextureSize(0)
, m_nMaxModelviewStackDepth(0)
, m_nMaxSamplesAllowed(0)
, m_nMaxTextureSize(0)
, m_bSupportsPVRTC(false)
, m_bSupportsNPOT(false)
, m_bSupportsBGRA8888(false)
, m_bSupportsDiscardFramebuffer(false)
, m_uOSVersion(0)
, m_nMaxSamplesAllowed(0)
{
}
@ -90,15 +90,15 @@ CCGlesVersion CCConfiguration::getGlesVersion()
{
// To get the Opengl ES version
std::string strVersion((char *)glGetString(GL_VERSION));
if (strVersion.find("1.0") != -1)
if ((int)strVersion.find("1.0") != -1)
{
return GLES_VER_1_0;
}
else if (strVersion.find("1.1") != -1)
else if ((int)strVersion.find("1.1") != -1)
{
return GLES_VER_1_1;
}
else if (strVersion.find("2.0") != -1)
else if ((int)strVersion.find("2.0") != -1)
{
return GLES_VER_2_0;
}

View File

@ -479,6 +479,7 @@ CCSize CCDirector::getDisplaySizeInPixels(void)
void CCDirector::reshapeProjection(CCSize newWindowSize)
{
CC_UNUSED_PARAM(newWindowSize);
m_obWinSizeInPoints = m_pobOpenGLView->getSize();
m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor,
m_obWinSizeInPoints.height * m_fContentScaleFactor);
@ -748,6 +749,7 @@ tPixelFormat CCDirector::getPiexFormat(void)
bool CCDirector::setDirectorType(ccDirectorType obDirectorType)
{
CC_UNUSED_PARAM(obDirectorType);
// we only support CCDisplayLinkDirector
CCDirector::sharedDirector();

View File

@ -128,14 +128,14 @@ void CCTimer::update(ccTime dt)
static CCScheduler *pSharedScheduler;
CCScheduler::CCScheduler(void)
: m_bCurrentTargetSalvaged(false)
, m_fTimeScale(0.0)
, m_pCurrentTarget(NULL)
, m_pHashForSelectors(NULL)
, m_pHashForUpdates(NULL)
, m_pUpdates0List(NULL)
: m_fTimeScale(0.0)
, m_pUpdatesNegList(NULL)
, m_pUpdates0List(NULL)
, m_pUpdatesPosList(NULL)
, m_pHashForUpdates(NULL)
, m_pHashForSelectors(NULL)
, m_pCurrentTarget(NULL)
, m_bCurrentTargetSalvaged(false)
{
assert(pSharedScheduler == NULL);
}
@ -191,12 +191,15 @@ void CCScheduler::removeHashElement(_hashSelectorEntry *pElement)
void CCScheduler::scheduleTimer(CCTimer *pTimer)
{
CC_UNUSED_PARAM(pTimer);
assert(false);
}
void CCScheduler::unscheduleTimer(CCTimer *pTimer)
{
assert(false);
//CC_UNUSED_PARAM(pTimer);
pTimer = NULL;
assert(false);
}
void CCScheduler::unscheduleAllTimers()

View File

@ -94,11 +94,13 @@ bool CCAction::isDone()
void CCAction::step(ccTime dt)
{
CC_UNUSED_PARAM(dt);
CCLOG("[Action step]. override me");
}
void CCAction::update(ccTime time)
{
CC_UNUSED_PARAM(time);
CCLOG("[Action update]. override me");
}
@ -291,6 +293,7 @@ CCObject *CCFollow::copyWithZone(CCZone *pZone)
}
void CCFollow::step(ccTime dt)
{
CC_UNUSED_PARAM(dt);
#define CLAMP(x,y,z) MIN(MAX(x,y),z)
if(m_bBoundarySet)

View File

@ -411,6 +411,7 @@ namespace cocos2d
void CCLens3D::update(cocos2d::ccTime time)
{
CC_UNUSED_PARAM(time);
if (m_bDirty)
{
int i, j;
@ -601,6 +602,7 @@ namespace cocos2d
void CCShaky3D::update(cocos2d::ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < (m_sGridSize.x+1); ++i)

View File

@ -57,10 +57,12 @@ namespace cocos2d {
}
void CCActionInstant::step(ccTime dt)
{
CC_UNUSED_PARAM(dt);
update(1);
}
void CCActionInstant::update(ccTime time)
{
CC_UNUSED_PARAM(time);
// ignore
}
CCFiniteTimeAction * CCActionInstant::reverse()

View File

@ -114,6 +114,7 @@ void CCActionInterval::step(ccTime dt)
void CCActionInterval::setAmplitudeRate(CGFloat amp)
{
CC_UNUSED_PARAM(amp);
// Abstract class needs implementation
assert(0);
}
@ -1710,6 +1711,7 @@ CCObject* CCDelayTime::copyWithZone(cocos2d::CCZone *pZone)
void CCDelayTime::update(cocos2d::ccTime time)
{
CC_UNUSED_PARAM(time);
return;
}

View File

@ -84,8 +84,8 @@ void CCActionManager::selectorProtocolRelease()
}
CCActionManager::CCActionManager(void)
: m_pCurrentTarget(NULL),
m_pTargets(NULL),
: m_pTargets(NULL),
m_pCurrentTarget(NULL),
m_bCurrentTargetSalvaged(false)
{
assert(gSharedManager == NULL);
@ -286,7 +286,7 @@ void CCActionManager::removeAction(cocos2d::CCAction *pAction)
if (pElement)
{
unsigned int i = ccArrayGetIndexOfObject(pElement->actions, pAction);
if (i != -1)
if ((int)i != -1)
{
removeActionAtIndex(i, pElement);
}

View File

@ -98,6 +98,7 @@ namespace cocos2d
void CCShakyTiles3D::update(cocos2d::ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < m_sGridSize.x; ++i)
@ -191,6 +192,7 @@ namespace cocos2d
void CCShatteredTiles3D::update(cocos2d::ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
if (m_bOnce == false)

View File

@ -33,13 +33,13 @@ namespace cocos2d {
// CCAtlasNode - Creation & Init
CCAtlasNode::CCAtlasNode()
: m_pTextureAtlas(NULL)
, m_bIsOpacityModifyRGB(false)
: m_nItemsPerRow(0)
, m_nItemsPerColumn(0)
, m_nItemWidth(0)
, m_nItemHeight(0)
, m_pTextureAtlas(NULL)
, m_bIsOpacityModifyRGB(false)
, m_cOpacity(0)
, m_nItemsPerRow(0)
, m_nItemsPerColumn(0)
{
}

View File

@ -43,35 +43,35 @@ THE SOFTWARE.
namespace cocos2d {
CCNode::CCNode(void)
:m_bIsRunning(false)
,m_fRotation(0.0f)
,m_fScaleX(1.0f)
,m_fScaleY(1.0f)
,m_tPosition(CCPointZero)
,m_tPositionInPixels(CCPointZero)
,m_tAnchorPointInPixels(CCPointZero)
,m_tAnchorPoint(CCPointZero)
,m_tContentSize(CCSizeZero)
,m_tContentSizeInPixels(CCSizeZero)
// "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false
,m_bIsRelativeAnchorPoint(true)
,m_bIsTransformDirty(true)
,m_bIsInverseDirty(true)
#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
,m_bIsTransformGLDirty(true)
#endif
,m_fVertexZ(0.0f)
,m_pGrid(NULL)
,m_bIsVisible(true)
,m_nTag(kCCNodeTagInvalid)
,m_nZOrder(0)
// lazy alloc
,m_pCamera(NULL)
: m_nZOrder(0)
, m_fVertexZ(0.0f)
, m_fRotation(0.0f)
, m_fScaleX(1.0f)
, m_fScaleY(1.0f)
, m_tPosition(CCPointZero)
, m_tPositionInPixels(CCPointZero)
// children (lazy allocs)
,m_pChildren(NULL)
, m_pChildren(NULL)
// lazy alloc
, m_pCamera(NULL)
, m_pGrid(NULL)
, m_bIsVisible(true)
, m_tAnchorPoint(CCPointZero)
, m_tAnchorPointInPixels(CCPointZero)
, m_tContentSize(CCSizeZero)
, m_tContentSizeInPixels(CCSizeZero)
, m_bIsRunning(false)
, m_pParent(NULL)
// "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false
, m_bIsRelativeAnchorPoint(true)
, m_nTag(kCCNodeTagInvalid)
// userData is always inited as nil
,m_pUserData(NULL)
,m_pParent(NULL)
, m_pUserData(NULL)
, m_bIsTransformDirty(true)
, m_bIsInverseDirty(true)
#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
, m_bIsTransformGLDirty(true)
#endif
{
// nothing
}

View File

@ -67,6 +67,8 @@ void* CCData::bytes(void)
//@todo implement
CCData* CCData::dataWithBytes(unsigned char *pBytes, int size)
{
CC_UNUSED_PARAM(pBytes);
CC_UNUSED_PARAM(size);
return NULL;
}
}//namespace cocos2d

View File

@ -64,7 +64,7 @@ bool splitWithForm(const char* pStr, strArray& strs)
int nPosRight = content.find('}');
// don't have '{' and '}'
CC_BREAK_IF(nPosLeft == std::string::npos || nPosRight == std::string::npos);
CC_BREAK_IF(nPosLeft == (int)std::string::npos || nPosRight == (int)std::string::npos);
// '}' is before '{'
CC_BREAK_IF(nPosLeft > nPosRight);
@ -75,7 +75,7 @@ bool splitWithForm(const char* pStr, strArray& strs)
int nPos1 = pointStr.find('{');
int nPos2 = pointStr.find('}');
// contain '{' or '}'
CC_BREAK_IF(nPos1 != std::string::npos || nPos2 != std::string::npos);
CC_BREAK_IF(nPos1 != (int)std::string::npos || nPos2 != (int)std::string::npos);
split(pointStr, ",", strs);
if (strs.size() != 2 || strs[0].length() == 0 || strs[1].length() == 0)
@ -107,19 +107,19 @@ namespace cocos2d
int nPosRight = content.find('}');
for (int i = 1; i < 3; ++i)
{
if (nPosRight == std::string::npos)
if (nPosRight == (int)std::string::npos)
{
break;
}
nPosRight = content.find('}', nPosRight + 1);
}
CC_BREAK_IF(nPosLeft == std::string::npos || nPosRight == std::string::npos);
CC_BREAK_IF(nPosLeft == (int)std::string::npos || nPosRight == (int)std::string::npos);
content = content.substr(nPosLeft + 1, nPosRight - nPosLeft - 1);
int nPointEnd = content.find('}');
CC_BREAK_IF(nPointEnd == std::string::npos);
CC_BREAK_IF(nPointEnd == (int)std::string::npos);
nPointEnd = content.find(',', nPointEnd);
CC_BREAK_IF(nPointEnd == std::string::npos);
CC_BREAK_IF(nPointEnd == (int)std::string::npos);
// get the point string and size string
std::string pointStr = content.substr(0, nPointEnd);

View File

@ -30,6 +30,7 @@ namespace cocos2d {
CCObject* CCCopying::copyWithZone(CCZone *pZone)
{
CC_UNUSED_PARAM(pZone);
assert(0);
return NULL;
}

View File

@ -76,6 +76,7 @@ namespace cocos2d
void CCGrabber::beforeRender(cocos2d::CCTexture2D *pTexture)
{
CC_UNUSED_PARAM(pTexture);
// If the gles version is lower than GLES_VER_1_0,
// all the functions in CCGrabber return directly.
if (m_eGlesVersion <= GLES_VER_1_0)
@ -101,6 +102,7 @@ namespace cocos2d
void CCGrabber::afterRender(cocos2d::CCTexture2D *pTexture)
{
CC_UNUSED_PARAM(pTexture);
// If the gles version is lower than GLES_VER_1_0,
// all the functions in CCGrabber return directly.
if (m_eGlesVersion <= GLES_VER_1_0)

View File

@ -377,10 +377,10 @@ namespace cocos2d
float y1 = y * m_obStep.y;
float y2= y1 + m_obStep.y;
GLushort a = x * (m_sGridSize.y + 1) + y;
GLushort b = (x + 1) * (m_sGridSize.y + 1) + y;
GLushort c = (x + 1) * (m_sGridSize.y + 1) + (y + 1);
GLushort d = x * (m_sGridSize.y + 1) + (y + 1);
GLushort a = (GLushort)(x * (m_sGridSize.y + 1) + y);
GLushort b = (GLushort)((x + 1) * (m_sGridSize.y + 1) + y);
GLushort c = (GLushort)((x + 1) * (m_sGridSize.y + 1) + (y + 1));
GLushort d = (GLushort)(x * (m_sGridSize.y + 1) + (y + 1));
GLushort tempidx[6] = {a, b, d, b, c, d};
@ -587,13 +587,13 @@ namespace cocos2d
for (x = 0; x < numQuads; x++)
{
idxArray[x*6+0] = x * 4 + 0;
idxArray[x*6+1] = x * 4 + 1;
idxArray[x*6+2] = x * 4 + 2;
idxArray[x*6+0] = (GLushort)(x * 4 + 0);
idxArray[x*6+1] = (GLushort)(x * 4 + 1);
idxArray[x*6+2] = (GLushort)(x * 4 + 2);
idxArray[x*6+3] = x * 4 + 1;
idxArray[x*6+4] = x * 4 + 2;
idxArray[x*6+5] = x * 4 + 3;
idxArray[x*6+3] = (GLushort)(x * 4 + 1);
idxArray[x*6+4] = (GLushort)(x * 4 + 2);
idxArray[x*6+5] = (GLushort)(x * 4 + 3);
}
memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat));

View File

@ -48,7 +48,7 @@ receiving acceleration-related data from the system.
class CC_DLL CCAccelerometerDelegate
{
public:
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {}
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);}
//! call the release() in child layer
virtual void AccelerometerDestroy(void) {}

View File

@ -194,12 +194,12 @@ class CC_DLL CCFollow : public CCAction
public:
CCFollow()
: m_pobFollowedNode(NULL)
, m_bBoundaryFullyCovered(false)
, m_bBoundarySet(false)
, m_fBottomBoundary(0.0)
, m_bBoundarySet(false)
, m_bBoundaryFullyCovered(false)
, m_fLeftBoundary(0.0)
, m_fRightBoundary(0.0)
, m_fTopBoundary(0.0)
, m_fBottomBoundary(0.0)
{}
virtual ~CCFollow(void);

View File

@ -73,16 +73,16 @@ namespace cocos2d {
{
public:
CCOrbitCamera()
: m_fAngleX(0.0)
, m_fAngleZ(0.0)
: m_fRadius(0.0)
, m_fDeltaRadius(0.0)
, m_fAngleZ(0.0)
, m_fDeltaAngleZ(0.0)
, m_fAngleX(0.0)
, m_fDeltaAngleX(0.0)
, m_fDeltaAngleZ(0.0)
, m_fDeltaRadius(0.0)
, m_fRadDeltaX(0.0)
, m_fRadDeltaZ(0.0)
, m_fRadius(0.0)
, m_fRadX(0.0)
, m_fRadZ(0.0)
, m_fRadZ(0.0)
, m_fRadDeltaZ(0.0)
, m_fRadX(0.0)
, m_fRadDeltaX(0.0)
{}
~CCOrbitCamera(){}
/** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */

View File

@ -171,9 +171,9 @@ namespace cocos2d {
{
public:
CCCallFunc()
: m_pCallFunc(NULL)
, m_pSelectorTarget(NULL)
{
: m_pSelectorTarget(NULL)
, m_pCallFunc(NULL)
{
}
virtual ~CCCallFunc()
{

View File

@ -74,7 +74,7 @@ protected:
/**
@brief Called by CCIMEDispatcher when some text input from IME.
*/
virtual void insertText(const char * text, int len) {}
virtual void insertText(const char * text, int len) {CC_UNUSED_PARAM(text);CC_UNUSED_PARAM(len);}
/**
@brief Called by CCIMEDispatcher when user clicked the backward key.
@ -89,10 +89,10 @@ protected:
//////////////////////////////////////////////////////////////////////////
// keyboard show/hide notification
//////////////////////////////////////////////////////////////////////////
virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info) {}
virtual void keyboardDidShow(CCIMEKeyboardNotificationInfo& info) {}
virtual void keyboardWillHide(CCIMEKeyboardNotificationInfo& info) {}
virtual void keyboardDidHide(CCIMEKeyboardNotificationInfo& info) {}
virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info) {CC_UNUSED_PARAM(info);}
virtual void keyboardDidShow(CCIMEKeyboardNotificationInfo& info) {CC_UNUSED_PARAM(info);}
virtual void keyboardWillHide(CCIMEKeyboardNotificationInfo& info) {CC_UNUSED_PARAM(info);}
virtual void keyboardDidHide(CCIMEKeyboardNotificationInfo& info) {CC_UNUSED_PARAM(info);}
protected:
CCIMEDelegate();

View File

@ -85,8 +85,8 @@ namespace cocos2d{
struct _KerningHashElement *m_pKerningDictionary;
public:
CCBMFontConfiguration()
: m_pKerningDictionary(NULL)
, m_uCommonHeight(0)
: m_uCommonHeight(0)
, m_pKerningDictionary(NULL)
{}
virtual ~CCBMFontConfiguration();
char * description();
@ -148,10 +148,10 @@ namespace cocos2d{
CCBMFontConfiguration *m_pConfiguration;
public:
CCLabelBMFont()
: m_pConfiguration(NULL)
: m_cOpacity(0)
, m_bIsOpacityModifyRGB(false)
, m_cOpacity(0)
, m_sString("")
, m_pConfiguration(NULL)
{}
virtual ~CCLabelBMFont();
/** Purges the cached data.

View File

@ -58,7 +58,7 @@ public:
virtual void destroy(void);
virtual void keep(void);
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {}
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);}
virtual void AccelerometerDestroy(void);
virtual void AccelerometerKeep(void);

View File

@ -117,8 +117,8 @@ namespace cocos2d{
protected:
tCCMenuState m_eState;
CCMenuItem *m_pSelectedItem;
GLubyte m_cOpacity;
GLubyte m_cOpacity;
CCMenuItem *m_pSelectedItem;
ccColor3B m_tColor;
};
}

View File

@ -51,9 +51,9 @@ namespace cocos2d{
CC_PROPERTY(bool, m_bIsEnabled, IsEnabled);
public:
CCMenuItem()
: m_pListener(NULL)
, m_bIsEnabled(false)
, m_bIsSelected(false)
: m_bIsSelected(false)
, m_bIsEnabled(false)
, m_pListener(NULL)
, m_pfnSelector(NULL)
{}
virtual ~CCMenuItem(){}
@ -248,8 +248,8 @@ namespace cocos2d{
public:
CCMenuItemToggle()
: m_cOpacity(0)
, m_pSubItems(NULL)
, m_uSelectedIndex(0)
, m_uSelectedIndex(0)
, m_pSubItems(NULL)
{}
virtual ~CCMenuItemToggle();
/** creates a menu item from a list of items with a target/selector */

View File

@ -57,10 +57,10 @@ class CC_DLL CCMotionStreak : public CCNode, public CCTextureProtocol
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
public:
CCMotionStreak()
: m_fSegThreshold(0.0)
, m_fWidth(0.0)
, m_pRibbon(NULL)
, m_pTexture(NULL)
: m_pRibbon(NULL)
, m_pTexture(NULL)
, m_fSegThreshold(0.0)
, m_fWidth(0.0)
{}
virtual ~CCMotionStreak(){}
/** creates the a MotionStreak. The image will be loaded using the TextureMgr. */

View File

@ -63,7 +63,7 @@ public:
Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
@since v0.8
*/
virtual void setIsOpacityModifyRGB(bool bValue) {}
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
@since v0.8
@ -101,7 +101,7 @@ public:
virtual CCTexture2D* getTexture(void) = 0;
// sets a new texture. it will be retained
virtual void setTexture(CCTexture2D *texture) {}
virtual void setTexture(CCTexture2D *texture) {CC_UNUSED_PARAM(texture);}
};
//! @brief Common interface for Labels

View File

@ -108,8 +108,8 @@ public:
public:
CCRibbonSegment()
: m_bFinished(false)
, m_uBegin(0)
, m_uEnd(0)
, m_uEnd(0)
, m_uBegin(0)
{}
virtual ~CCRibbonSegment();
char * description();

View File

@ -41,6 +41,7 @@ public:
*/
virtual bool onTextFieldAttachWithIME(CCTextFieldTTF * sender)
{
CC_UNUSED_PARAM(sender);
return false;
}
@ -49,6 +50,7 @@ public:
*/
virtual bool onTextFieldDetachWithIME(CCTextFieldTTF * sender)
{
CC_UNUSED_PARAM(sender);
return false;
}
@ -57,6 +59,9 @@ public:
*/
virtual bool onTextFieldInsertText(CCTextFieldTTF * sender, const char * text, int nLen)
{
CC_UNUSED_PARAM(sender);
CC_UNUSED_PARAM(text);
CC_UNUSED_PARAM(nLen);
return false;
}
@ -65,6 +70,9 @@ public:
*/
virtual bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const char * delText, int nLen)
{
CC_UNUSED_PARAM(sender);
CC_UNUSED_PARAM(delText);
CC_UNUSED_PARAM(nLen);
return false;
}
@ -73,6 +81,7 @@ public:
*/
virtual bool onDraw(CCTextFieldTTF * sender)
{
CC_UNUSED_PARAM(sender);
return false;
}
};

View File

@ -36,8 +36,8 @@ public:
CCTouch() {}
CCTouch(int nViewId, float x, float y) : m_nViewId(nViewId), m_point(x, y), m_prevPoint(x, y) {}
CCPoint locationInView(int nViewId) { return m_point; }
CCPoint previousLocationInView(int nViewId) { return m_prevPoint; }
CCPoint locationInView(int nViewId) {CC_UNUSED_PARAM(nViewId); return m_point; }
CCPoint previousLocationInView(int nViewId) {CC_UNUSED_PARAM(nViewId); return m_prevPoint; }
int view() { return m_nViewId; }
void SetTouchInfo(int nViewId, float x, float y)

View File

@ -56,18 +56,18 @@ public:
//! call the retain() in child (layer or menu)
virtual void keep(void) {}
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { return false;};
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); return false;};
// optional
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
// optional
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
};
/**
@brief
@ -90,12 +90,12 @@ public:
/** Return YES to claim the touch.
@since v0
*/
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { return false;};
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;};
// optional
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {}
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
};
/** @brief
@ -107,10 +107,10 @@ public:
public:
CCStandardTouchDelegate() { m_eTouchDelegateType = ccTouchDelegateStandardBit; }
// optional
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {}
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
};
}//namespace cocos2d

View File

@ -96,10 +96,11 @@ public:
~CCTouchDispatcher();
bool init(void);
CCTouchDispatcher()
: m_pHandlersToAdd(NULL)
: m_pTargetedHandlers(NULL)
, m_pStandardHandlers(NULL)
, m_pHandlersToAdd(NULL)
, m_pHandlersToRemove(NULL)
, m_pStandardHandlers(NULL)
, m_pTargetedHandlers(NULL)
{}
public:

View File

@ -35,13 +35,13 @@ class CCEvent;
class CC_DLL SelectorProtocol
{
public:
virtual void update(ccTime dt) {};
virtual void tick(ccTime dt){};
virtual void update(ccTime dt) {CC_UNUSED_PARAM(dt);};
virtual void tick(ccTime dt){CC_UNUSED_PARAM(dt);};
virtual void callfunc(){};
virtual void callfunc(CCNode* pSender){};
virtual void callfunc(CCNode* pSender, void* pData){};
virtual void menuHandler(CCObject* pSender){};
virtual void eventHandler(CCEvent* pEvent) {};
virtual void callfunc(CCNode* pSender){CC_UNUSED_PARAM(pSender);};
virtual void callfunc(CCNode* pSender, void* pData){CC_UNUSED_PARAM(pSender);CC_UNUSED_PARAM(pData);};
virtual void menuHandler(CCObject* pSender){CC_UNUSED_PARAM(pSender);};
virtual void eventHandler(CCEvent* pEvent) {CC_UNUSED_PARAM(pEvent);};
// the child call responding retain/release function
virtual void selectorProtocolRetain(void) {};

View File

@ -142,7 +142,7 @@ namespace cocos2d{
while (strLeft.length() > 0) {
int pos = strLeft.find('\n');
if (pos != std::string::npos)
if (pos != (int)std::string::npos)
{
// the data is more than a line.get one line
line = strLeft.substr(0, pos);

View File

@ -29,10 +29,10 @@ namespace cocos2d{
//CCLabelTTF
//
CCLabelTTF::CCLabelTTF()
: m_pFontName(NULL)
: m_eAlignment(CCTextAlignmentCenter)
, m_pFontName(NULL)
, m_fFontSize(0.0)
, m_pString(NULL)
, m_fFontSize(0.0)
, m_eAlignment(CCTextAlignmentCenter)
{
}

View File

@ -53,11 +53,11 @@ bool CCLayer::init()
do
{
CCDirector * pDirector;
CC_BREAK_IF( ! (pDirector = CCDirector::sharedDirector()) );
CC_BREAK_IF(!(pDirector = CCDirector::sharedDirector()));
this->setContentSize(pDirector->getWinSize());
// success
bRet = true;
} while (0);
} while(0);
return bRet;
}
@ -251,6 +251,8 @@ void CCLayer::onEnterTransitionDidFinish()
bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent);
CCAssert(false, "Layer#ccTouchBegan override me");
return true;
}

View File

@ -143,6 +143,7 @@ void CCTransitionScene::finish()
void CCTransitionScene::setNewScene(ccTime dt)
{
CC_UNUSED_PARAM(dt);
// [self unschedule:_cmd];
// "_cmd" is a local variable automatically defined in a method
// that contains the selector for the method

View File

@ -146,6 +146,7 @@ namespace cocos2d{
bool CCMenu::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
CC_UNUSED_PARAM(event);
if (m_eState != kCCMenuStateWaiting || ! m_bIsVisible)
{
return false;
@ -162,6 +163,8 @@ namespace cocos2d{
void CCMenu::ccTouchEnded(CCTouch *touch, CCEvent* event)
{
CC_UNUSED_PARAM(touch);
CC_UNUSED_PARAM(event);
CCAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchEnded] -- invalid state");
if (m_pSelectedItem)
{
@ -173,6 +176,8 @@ namespace cocos2d{
void CCMenu::ccTouchCancelled(CCTouch *touch, CCEvent* event)
{
CC_UNUSED_PARAM(touch);
CC_UNUSED_PARAM(event);
CCAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchCancelled] -- invalid state");
if (m_pSelectedItem)
{
@ -183,6 +188,7 @@ namespace cocos2d{
void CCMenu::ccTouchMoved(CCTouch* touch, CCEvent* event)
{
CC_UNUSED_PARAM(event);
CCAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchMoved] -- invalid state");
CCMenuItem *currentItem = this->itemForTouch(touch);
if (currentItem != m_pSelectedItem)
@ -348,8 +354,8 @@ namespace cocos2d{
row = 0;
rowHeight = 0;
rowColumns = 0;
float w;
float x;
float w = 0.0;
float x = 0.0;
float y = (float)(height / 2);
if (m_pChildren && m_pChildren->count() > 0)
@ -465,7 +471,7 @@ namespace cocos2d{
columnWidth = 0;
columnRows = 0;
float x = (float)(-width / 2);
float y;
float y = 0.0;
if (m_pChildren && m_pChildren->count() > 0)
{

View File

@ -244,6 +244,8 @@ bool CCRenderTexture::saveBuffer(const char *name)
}
bool CCRenderTexture::saveBuffer(const char *fileName, int format)
{
CC_UNUSED_PARAM(fileName);
CC_UNUSED_PARAM(format);
bool bRet = false;
//@ todo CCRenderTexture::saveBuffer
// UIImage *myImage = this->getUIImageFromBuffer(format);
@ -263,6 +265,7 @@ bool CCRenderTexture::saveBuffer(const char *fileName, int format)
CCData * CCRenderTexture::getUIImageAsDataFromBuffer(int format)
{
CC_UNUSED_PARAM(format);
CCData * pData = NULL;
//@ todo CCRenderTexture::getUIImageAsDataFromBuffer

View File

@ -656,6 +656,8 @@ void CCParticleSystem::update(ccTime dt)
}
void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition)
{
CC_UNUSED_PARAM(particle);
CC_UNUSED_PARAM(newPosition);
// should be overriden
}
void CCParticleSystem::postStep()

View File

@ -62,9 +62,9 @@ public:
CCDictMaker()
: m_pRootDict(NULL),
m_pCurDict(NULL),
m_tState(SAX_NONE),
m_pArray(NULL),
m_bInArray(false)
m_tState(SAX_NONE),
m_bInArray(false),
m_pArray(NULL)
{
}
@ -88,6 +88,8 @@ public:
void startElement(void *ctx, const char *name, const char **atts)
{
CC_UNUSED_PARAM(ctx);
CC_UNUSED_PARAM(atts);
std::string sName((char*)name);
if( sName == "dict" )
{
@ -137,6 +139,7 @@ public:
void endElement(void *ctx, const char *name)
{
CC_UNUSED_PARAM(ctx);
std::string sName((char*)name);
if( sName == "dict" )
{
@ -185,6 +188,7 @@ public:
void textHandler(void *ctx, const char *ch, int len)
{
CC_UNUSED_PARAM(ctx);
if (m_tState == SAX_NONE)
{
return;
@ -213,6 +217,8 @@ public:
}
break;
}
default:
break;
}
pText->release();
}
@ -274,7 +280,7 @@ unsigned char* CCFileUtils::getFileDataFromZip(const char* pszZipFilePath, const
pBuffer = new unsigned char[FileInfo.uncompressed_size];
int nSize = 0;
nSize = unzReadCurrentFile(pFile, pBuffer, FileInfo.uncompressed_size);
CCAssert(nSize == 0 || nSize == FileInfo.uncompressed_size, "the file size is wrong");
CCAssert(nSize == 0 || nSize == (int)FileInfo.uncompressed_size, "the file size is wrong");
*pSize = FileInfo.uncompressed_size;
unzCloseCurrentFile(pFile);

View File

@ -86,6 +86,7 @@ CCImage::~CCImage()
bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = eFmtPng*/)
{
CC_UNUSED_PARAM(eImgFmt);
CCFileData data(CCFileUtils::fullPathFromRelativePath(strPath), "rb");
return initWithImageData(data.getBuffer(), data.getSize());
}
@ -153,8 +154,8 @@ bool CCImage::_initWithJpgData(void * data, int nSize)
jpeg_start_decompress( &cinfo );
/* init image info */
m_nWidth = cinfo.image_width;
m_nHeight = cinfo.image_height;
m_nWidth = (short)(cinfo.image_width);
m_nHeight = (short)(cinfo.image_height);
m_bHasAlpha = false;
m_bPreMulti = false;
m_nBitsPerComponent = 8;
@ -206,7 +207,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
// init png_info
info_ptr = png_create_info_struct(png_ptr);
CC_BREAK_IF(! info_ptr || setjmp(png_jmpbuf(png_ptr)));
CC_BREAK_IF(!info_ptr || setjmp(png_jmpbuf(png_ptr)));
// set the read call back function
tImageSource imageSource;

View File

@ -100,7 +100,7 @@ public:
/**
@brief Save the CCImage data to specified file with specified format.
*/
bool saveToFile(const char * pszFilePath) { return false; }
bool saveToFile(const char * pszFilePath) { CC_UNUSED_PARAM(pszFilePath);return false; }
CC_SYNTHESIZE_READONLY(short, m_nWidth, Width);
CC_SYNTHESIZE_READONLY(short, m_nHeight, Height);

View File

@ -151,7 +151,7 @@ There are config below:
// Check the supportive of platform
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#pragma warning (disable:4127)
#endif // CC_PLATFORM_WIN32
#endif // __CC_PLATFORM_CONFIG_H__

View File

@ -120,9 +120,9 @@ public: inline void set##funName(varType var){ varName = var; }
// cocos2d debug
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
#define CCLOG(...) do {} while (0)
#define CCLOGINFO(...) do {} while (0)
#define CCLOGERROR(...) do {} while (0)
#define CCLOG(...)
#define CCLOGINFO(...)
#define CCLOGERROR(...)
#elif COCOS2D_DEBUG == 1
#define CCLOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)
@ -141,6 +141,9 @@ public: inline void set##funName(varType var){ varName = var; }
// assertion
#include <assert.h>
#define CC_ASSERT(cond) assert(cond)
#define CC_UNUSED_PARAM(unusedparam) unusedparam
// platform depended macros

View File

@ -43,6 +43,7 @@ CCSAXParser::~CCSAXParser(void)
bool CCSAXParser::init(const char *pszEncoding)
{
CC_UNUSED_PARAM(pszEncoding);
// nothing to do
return true;
}

View File

@ -35,9 +35,9 @@ THE SOFTWARE.
namespace cocos2d {
CCEGLView::CCEGLView()
: m_pDelegate(NULL),
m_fScreenScaleFactor(1.0),
m_bNotHVGA(false)
: m_bNotHVGA(false),
m_pDelegate(NULL),
m_fScreenScaleFactor(1.0)
{
}

View File

@ -350,7 +350,7 @@ extern "C"
void setKeyboardStateJNI(int bOpen)
{
TMethodJNI t;
jint open = bOpen;
//jint open = bOpen;
if (getMethodID(t
, "org/cocos2dx/lib/Cocos2dxGLSurfaceView"
, (bOpen) ? "openIMEKeyboard" : "closeIMEKeyboard"

View File

@ -30,6 +30,7 @@ NS_CC_BEGIN;
int CCTime::gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp)
{
CC_UNUSED_PARAM(tzp);
if (tp)
{
gettimeofday((struct timeval *)tp, 0);

View File

@ -35,8 +35,8 @@ public:
static CCAccelerometer* sharedAccelerometer() { return NULL; }
void removeDelegate(CCAccelerometerDelegate* pDelegate) {}
void addDelegate(CCAccelerometerDelegate* pDelegate) {}
void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}
void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}
};
}//namespace cocos2d

View File

@ -182,8 +182,8 @@ static LRESULT CALLBACK _WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
CCEGLView::CCEGLView()
: m_bCaptured(false)
, m_bOrientationInitVertical(false)
, m_bOrientationReverted(false)
, m_bOrientationInitVertical(false)
, m_pDelegate(NULL)
, m_pEGL(NULL)
, m_hWnd(NULL)

View File

@ -144,6 +144,7 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz
void CCFileUtils::setResource(const char* pszZipFileName)
{
CC_UNUSED_PARAM(pszZipFileName);
CCAssert(0, "Have not implement!");
}
@ -155,6 +156,7 @@ const char* CCFileUtils::getResourcePath(void)
void CCFileUtils::setRelativePath(const char* pszRelativePath)
{
CC_UNUSED_PARAM(pszRelativePath);
CCAssert(0, "Have not implement!");
}

View File

@ -235,8 +235,7 @@ public:
// draw text
HGDIOBJ hOldFont = SelectObject(m_hDC, m_hFont);
HGDIOBJ hOldBmp = SelectObject(m_hDC, m_hBmp);
RECT rc = {0, 0, tSize.cx, tSize.cy};
SetBkMode(m_hDC, TRANSPARENT);
SetTextColor(m_hDC, RGB(255, 255, 255)); // white color
@ -282,8 +281,7 @@ bool CCImage::initWithString(
unsigned char * pImageData = 0;
do
{
CC_BREAK_IF(! pText);
int nLen = strlen(pText);
CC_BREAK_IF(! pText);
BitmapDC& dc = sharedBitmapDC();

View File

@ -117,6 +117,9 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect)
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset)
{
CC_UNUSED_PARAM(pTexture);
CC_UNUSED_PARAM(rect);
CC_UNUSED_PARAM(offset);
// not implement
assert(0);
return NULL;

View File

@ -537,7 +537,7 @@ namespace cocos2d
pobSprite->useSelfRender();
unsigned int uIndex = m_pobDescendants->indexOfObject(pobSprite);
if (uIndex != -1)
if ((int)uIndex != -1)
{
m_pobDescendants->removeObjectAtIndex(uIndex);

View File

@ -79,6 +79,7 @@ CCSpriteFrame::~CCSpriteFrame(void)
CCObject* CCSpriteFrame::copyWithZone(CCZone *pZone)
{
CC_UNUSED_PARAM(pZone);
CCSpriteFrame *pCopy = new CCSpriteFrame();
pCopy->initWithTexture(m_pobTexture, m_obRectInPixels, m_bRotated, m_obOffsetInPixels, m_obOriginalSizeInPixels);

View File

@ -95,7 +95,7 @@ void CCSpriteFrameCache::addSpriteFramesWithDictionary(CCDictionary<std::string,
framesDict->begin();
std::string key = "";
CCDictionary<std::string, CCObject*> *frameDict = NULL;
while( frameDict = (CCDictionary<std::string, CCObject*>*)framesDict->next(&key) )
while( (frameDict = (CCDictionary<std::string, CCObject*>*)framesDict->next(&key)) )
{
CCSpriteFrame *spriteFrame = m_pSpriteFrames->objectForKey(key);
if (spriteFrame)
@ -237,7 +237,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist)
// stringByDeletingLastPathComponent
string textureBase(pszPath);
int indexOfLastSeperator = textureBase.find_last_of('/');
if (indexOfLastSeperator == textureBase.length() - 1)
if (indexOfLastSeperator == (int)textureBase.length() - 1)
{
textureBase.erase(indexOfLastSeperator, 1);
indexOfLastSeperator = textureBase.find_last_of('/');
@ -293,7 +293,7 @@ void CCSpriteFrameCache::removeUnusedSpriteFrames(void)
m_pSpriteFrames->begin();
std::string key = "";
CCSpriteFrame *spriteFrame = NULL;
while( spriteFrame = m_pSpriteFrames->next(&key) )
while( (spriteFrame = m_pSpriteFrames->next(&key)) )
{
if( spriteFrame->retainCount() == 1 )
{
@ -343,7 +343,7 @@ void CCSpriteFrameCache::removeSpriteFramesFromDictionary(CCDictionary<std::stri
framesDict->begin();
std::string key = "";
CCDictionary<std::string, CCObject*> *frameDict = NULL;
while( frameDict = (CCDictionary<std::string, CCObject*>*)framesDict->next(&key) )
while( (frameDict = (CCDictionary<std::string, CCObject*>*)framesDict->next(&key)) )
{
if (m_pSpriteFrames->objectForKey(key))
{
@ -366,7 +366,7 @@ void CCSpriteFrameCache::removeSpriteFramesFromTexture(CCTexture2D* texture)
m_pSpriteFrames->begin();
std::string key = "";
CCDictionary<std::string, CCObject*> *frameDict = NULL;
while( frameDict = (CCDictionary<std::string, CCObject*>*)m_pSpriteFrames->next(&key) )
while( (frameDict = (CCDictionary<std::string, CCObject*>*)m_pSpriteFrames->next(&key)) )
{
CCSpriteFrame *frame = m_pSpriteFrames->objectForKey(key);
if (frame && (frame->getTexture() == texture))

View File

@ -118,13 +118,13 @@ static inline unsigned int ccArrayGetIndexOfObject(ccArray *arr, CCObject* objec
}
}
return -1;
return (unsigned int)-1;
}
/** Returns a Boolean value that indicates whether object is present in array. */
static inline bool ccArrayContainsObject(ccArray *arr, CCObject* object)
{
return ccArrayGetIndexOfObject(arr, object) != -1;
return (int)ccArrayGetIndexOfObject(arr, object) != -1;
}
/** Appends an object. Bahaviour undefined if array doesn't have enough capacity. */
@ -210,7 +210,7 @@ static inline void ccArrayFastRemoveObjectAtIndex(ccArray *arr, unsigned int ind
static inline void ccArrayFastRemoveObject(ccArray *arr, CCObject* object)
{
unsigned int index = ccArrayGetIndexOfObject(arr, object);
if (index != -1)
if ((int)index != -1)
ccArrayFastRemoveObjectAtIndex(arr, index);
}
@ -220,7 +220,7 @@ static inline void ccArrayRemoveObject(ccArray *arr, CCObject* object)
{
unsigned int index = ccArrayGetIndexOfObject(arr, object);
if (index != -1)
if ((int)index != -1)
{
ccArrayRemoveObjectAtIndex(arr, index);
}
@ -422,7 +422,7 @@ static inline void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, unsigned int in
static inline void ccCArrayRemoveValue(ccCArray *arr, void* value)
{
unsigned int index = ccCArrayGetIndexOfValue(arr, value);
if (index != -1)
if ((int)index != -1)
{
ccCArrayRemoveValueAtIndex(arr, index);
}

View File

@ -33,7 +33,7 @@ static int _calcCharCount(const char * pszText)
{
int n = 0;
char ch = 0;
while (ch = *pszText)
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
@ -174,7 +174,7 @@ void CCTextFieldTTF::insertText(const char * text, int len)
// insert \n means input end
int nPos = sInsert.find('\n');
if (sInsert.npos != nPos)
if ((int)sInsert.npos != nPos)
{
len = nPos;
sInsert.erase(nPos);
@ -194,7 +194,7 @@ void CCTextFieldTTF::insertText(const char * text, int len)
setString(sText.c_str());
}
if (sInsert.npos == nPos) {
if ((int)sInsert.npos == nPos) {
return;
}

View File

@ -62,12 +62,12 @@ namespace cocos2d {
static CCTexture2DPixelFormat g_defaultAlphaPixelFormat = kCCTexture2DPixelFormat_Default;
CCTexture2D::CCTexture2D()
: m_uName(0)
, m_bHasPremultipliedAlpha(false)
: m_uPixelsWide(0)
, m_uPixelsHigh(0)
, m_uName(0)
, m_fMaxS(0.0)
, m_fMaxT(0.0)
, m_uPixelsHigh(0)
, m_uPixelsWide(0)
, m_bHasPremultipliedAlpha(false)
{
}
@ -145,6 +145,7 @@ void CCTexture2D::releaseData(void *data)
void* CCTexture2D::keepData(void *data, unsigned int length)
{
CC_UNUSED_PARAM(length);
//The texture data mustn't be saved becuase it isn't a mutable texture.
return data;
}
@ -291,7 +292,7 @@ bool CCTexture2D::initPremultipliedATextureWithImage(CCImage *image, unsigned in
tempData = (unsigned char*)(image->getData());
CCAssert(tempData != NULL, "NULL image data.");
if(image->getWidth() == POTWide && image->getHeight() == POTHigh)
if(image->getWidth() == (short)POTWide && image->getHeight() == (short)POTHigh)
{
data = new unsigned char[POTHigh * POTWide * 4];
memcpy(data, tempData, POTHigh * POTWide * 4);
@ -315,7 +316,7 @@ bool CCTexture2D::initPremultipliedATextureWithImage(CCImage *image, unsigned in
case kCCTexture2DPixelFormat_RGB888:
tempData = (unsigned char*)(image->getData());
CCAssert(tempData != NULL, "NULL image data.");
if(image->getWidth() == POTWide && image->getHeight() == POTHigh)
if(image->getWidth() == (short)POTWide && image->getHeight() == (short)POTHigh)
{
data = new unsigned char[POTHigh * POTWide * 3];
memcpy(data, tempData, POTHigh * POTWide * 3);

View File

@ -40,8 +40,8 @@ THE SOFTWARE.
namespace cocos2d {
CCTextureAtlas::CCTextureAtlas()
:m_pTexture(NULL)
,m_pIndices(NULL)
:m_pIndices(NULL)
,m_pTexture(NULL)
,m_pQuads(NULL)
{}
@ -189,14 +189,14 @@ void CCTextureAtlas::initIndices()
m_pIndices[i*6+4] = i*4+3;
m_pIndices[i*6+5] = i*4+3;
#else
m_pIndices[i*6+0] = i*4+0;
m_pIndices[i*6+1] = i*4+1;
m_pIndices[i*6+2] = i*4+2;
m_pIndices[i*6+0] = (GLushort)(i*4+0);
m_pIndices[i*6+1] = (GLushort)(i*4+1);
m_pIndices[i*6+2] = (GLushort)(i*4+2);
// inverted index. issue #179
m_pIndices[i*6+3] = i*4+3;
m_pIndices[i*6+4] = i*4+2;
m_pIndices[i*6+5] = i*4+1;
m_pIndices[i*6+3] = (GLushort)(i*4+3);
m_pIndices[i*6+4] = (GLushort)(i*4+2);
m_pIndices[i*6+5] = (GLushort)(i*4+1);
// m_pIndices[i*6+3] = i*4+2;
// m_pIndices[i*6+4] = i*4+3;
// m_pIndices[i*6+5] = i*4+1;

View File

@ -363,7 +363,7 @@ CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key)
do
{
// If key is nil, then create a new texture each time
if(texture = m_pTextures->objectForKey(forKey))
if((texture = m_pTextures->objectForKey(forKey)))
{
break;
}
@ -456,10 +456,10 @@ VolatileTexture::VolatileTexture(CCTexture2D *t)
, m_bIsString(false)
, m_strFileName("")
, m_FmtImage(CCImage::kFmtPng)
, m_alignment(CCTextAlignmentCenter)
, m_strFontName("")
, m_strText("")
, m_fFontSize(0.0f)
, m_alignment(CCTextAlignmentCenter)
{
m_size = CCSizeMake(0, 0);
textures.push_back(this);

View File

@ -71,6 +71,9 @@ namespace cocos2d {
}
void CCParallaxNode::addChild(CCNode * child, int zOrder, int tag)
{
CC_UNUSED_PARAM(zOrder);
CC_UNUSED_PARAM(child);
CC_UNUSED_PARAM(tag);
CCAssert(0,"ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
}
void CCParallaxNode::addChild(CCNode *child, int z, CCPoint ratio, CCPoint offset)

View File

@ -92,14 +92,14 @@ namespace cocos2d {
return false;
}
CCTMXLayer::CCTMXLayer()
:m_pTiles(NULL)
:m_tLayerSize(CCSizeZero)
,m_tMapTileSize(CCSizeZero)
,m_pTiles(NULL)
,m_pTileSet(NULL)
,m_pProperties(NULL)
,m_sLayerName("")
,m_pReusedTile(NULL)
,m_pAtlasIndexArray(NULL)
,m_tLayerSize(CCSizeZero)
,m_tMapTileSize(CCSizeZero)
,m_sLayerName("")
,m_pAtlasIndexArray(NULL)
{}
CCTMXLayer::~CCTMXLayer()
{
@ -446,6 +446,9 @@ namespace cocos2d {
}
void CCTMXLayer::addChild(CCNode * child, int zOrder, int tag)
{
CC_UNUSED_PARAM(child);
CC_UNUSED_PARAM(zOrder);
CC_UNUSED_PARAM(tag);
CCAssert(0, "addChild: is not supported on CCTMXLayer. Instead use setTileGID:at:/tileAt:");
}
void CCTMXLayer::removeChild(CCNode* node, bool cleanup)

View File

@ -30,8 +30,8 @@ namespace cocos2d {
//implementation CCTMXObjectGroup
CCTMXObjectGroup::CCTMXObjectGroup()
:m_sGroupName("")
,m_tPositionOffset(CCPointZero)
:m_tPositionOffset(CCPointZero)
,m_sGroupName("")
{
m_pObjects = new CCMutableArray<CCStringToStringDictionary*>();
m_pProperties = new CCStringToStringDictionary();

View File

@ -104,8 +104,8 @@ namespace cocos2d{
return true;
}
CCTMXTiledMap::CCTMXTiledMap()
:m_tTileSize(CCSizeZero)
,m_tMapSize(CCSizeZero)
:m_tMapSize(CCSizeZero)
,m_tTileSize(CCSizeZero)
,m_pObjectGroups(NULL)
,m_pProperties(NULL)
,m_pTileProperties(NULL)

View File

@ -64,12 +64,12 @@ namespace cocos2d {
}
// implementation CCTMXLayerInfo
CCTMXLayerInfo::CCTMXLayerInfo()
:m_bOwnTiles(true)
,m_uMinGID(100000)
,m_uMaxGID(0)
,m_sName("")
,m_pTiles(NULL)
,m_tOffset(CCPointZero)
: m_sName("")
, m_pTiles(NULL)
, m_bOwnTiles(true)
, m_uMinGID(100000)
, m_uMaxGID(0)
, m_tOffset(CCPointZero)
{
m_pProperties= new CCStringToStringDictionary();;
}
@ -150,13 +150,13 @@ namespace cocos2d {
return parseXMLFile(m_sTMXFileName.c_str());
}
CCTMXMapInfo::CCTMXMapInfo()
:m_bStoringCharacters(false)
,m_nLayerAttribs(0)
,m_tMapSize(CCSizeZero)
,m_tTileSize(CCSizeZero)
,m_pLayers(NULL)
,m_pTilesets(NULL)
,m_pObjectGroups(NULL)
:m_tMapSize(CCSizeZero)
,m_tTileSize(CCSizeZero)
,m_pLayers(NULL)
,m_pTilesets(NULL)
,m_pObjectGroups(NULL)
,m_nLayerAttribs(0)
,m_bStoringCharacters(false)
,m_pProperties(NULL)
,m_pTileProperties(NULL)
{
@ -239,6 +239,7 @@ namespace cocos2d {
// the XML parser calls here with all the elements
void CCTMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
{
CC_UNUSED_PARAM(ctx);
CCTMXMapInfo *pTMXMapInfo = this;
std::string elementName = (char*)name;
std::map<std::string, std::string> *attributeDict = new std::map<std::string, std::string>();
@ -519,6 +520,7 @@ namespace cocos2d {
void CCTMXMapInfo::endElement(void *ctx, const char *name)
{
CC_UNUSED_PARAM(ctx);
CCTMXMapInfo *pTMXMapInfo = this;
std::string elementName = (char*)name;
@ -586,6 +588,7 @@ namespace cocos2d {
void CCTMXMapInfo::textHandler(void *ctx, const char *ch, int len)
{
CC_UNUSED_PARAM(ctx);
CCTMXMapInfo *pTMXMapInfo = this;
std::string pText((char*)ch,0,len);

View File

@ -59,8 +59,8 @@ namespace cocos2d {
return false;
}
CCTileMapAtlas::CCTileMapAtlas()
:m_pPosToAtlasIndex(NULL)
,m_pTGAInfo(NULL)
:m_pTGAInfo(NULL)
,m_pPosToAtlasIndex(NULL)
,m_nItemsToRender(0)
{
}

View File

@ -231,6 +231,8 @@ void CCTouchDispatcher::removeAllDelegates(void)
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
{
CC_UNUSED_PARAM(nPriority);
CC_UNUSED_PARAM(pDelegate);
assert(0);
}