mirror of https://github.com/axmolengine/axmol.git
fixed #516 Undefined Behaviour in ccCArray.h (signed / unsigned conversion)
This commit is contained in:
parent
93b61bb544
commit
91326028ec
|
@ -286,7 +286,7 @@ void CCActionManager::removeAction(cocos2d::CCAction *pAction)
|
||||||
if (pElement)
|
if (pElement)
|
||||||
{
|
{
|
||||||
unsigned int i = ccArrayGetIndexOfObject(pElement->actions, pAction);
|
unsigned int i = ccArrayGetIndexOfObject(pElement->actions, pAction);
|
||||||
if ((int)i != -1)
|
if (UINT_MAX == i)
|
||||||
{
|
{
|
||||||
removeActionAtIndex(i, pElement);
|
removeActionAtIndex(i, pElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,8 @@ namespace cocos2d
|
||||||
// ignore parent Z if parent is spriteSheet
|
// ignore parent Z if parent is spriteSheet
|
||||||
bool bIgnoreParent = (CCSpriteBatchNode*)(pobSprite->getParent()) == this;
|
bool bIgnoreParent = (CCSpriteBatchNode*)(pobSprite->getParent()) == this;
|
||||||
CCSprite *pPrevious = NULL;
|
CCSprite *pPrevious = NULL;
|
||||||
if (uChildIndex > 0)
|
if (uChildIndex > 0 &&
|
||||||
|
uChildIndex < UINT_MAX)
|
||||||
{
|
{
|
||||||
pPrevious = (CCSprite*)(pBrothers->objectAtIndex(uChildIndex - 1));
|
pPrevious = (CCSprite*)(pBrothers->objectAtIndex(uChildIndex - 1));
|
||||||
}
|
}
|
||||||
|
@ -537,7 +538,7 @@ namespace cocos2d
|
||||||
pobSprite->useSelfRender();
|
pobSprite->useSelfRender();
|
||||||
|
|
||||||
unsigned int uIndex = m_pobDescendants->indexOfObject(pobSprite);
|
unsigned int uIndex = m_pobDescendants->indexOfObject(pobSprite);
|
||||||
if ((int)uIndex != -1)
|
if (uIndex != UINT_MAX)
|
||||||
{
|
{
|
||||||
m_pobDescendants->removeObjectAtIndex(uIndex);
|
m_pobDescendants->removeObjectAtIndex(uIndex);
|
||||||
|
|
||||||
|
|
|
@ -118,13 +118,13 @@ static inline unsigned int ccArrayGetIndexOfObject(ccArray *arr, CCObject* objec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (unsigned int)-1;
|
return UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a Boolean value that indicates whether object is present in array. */
|
/** Returns a Boolean value that indicates whether object is present in array. */
|
||||||
static inline bool ccArrayContainsObject(ccArray *arr, CCObject* object)
|
static inline bool ccArrayContainsObject(ccArray *arr, CCObject* object)
|
||||||
{
|
{
|
||||||
return (int)ccArrayGetIndexOfObject(arr, object) != -1;
|
return ccArrayGetIndexOfObject(arr, object) != UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Appends an object. Bahaviour undefined if array doesn't have enough capacity. */
|
/** 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)
|
static inline void ccArrayFastRemoveObject(ccArray *arr, CCObject* object)
|
||||||
{
|
{
|
||||||
unsigned int index = ccArrayGetIndexOfObject(arr, object);
|
unsigned int index = ccArrayGetIndexOfObject(arr, object);
|
||||||
if ((int)index != -1)
|
if (index != UINT_MAX)
|
||||||
ccArrayFastRemoveObjectAtIndex(arr, index);
|
ccArrayFastRemoveObjectAtIndex(arr, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ static inline void ccArrayRemoveObject(ccArray *arr, CCObject* object)
|
||||||
{
|
{
|
||||||
unsigned int index = ccArrayGetIndexOfObject(arr, object);
|
unsigned int index = ccArrayGetIndexOfObject(arr, object);
|
||||||
|
|
||||||
if ((int)index != -1)
|
if (index != UINT_MAX)
|
||||||
{
|
{
|
||||||
ccArrayRemoveObjectAtIndex(arr, index);
|
ccArrayRemoveObjectAtIndex(arr, index);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ static inline void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, unsigned int in
|
||||||
static inline void ccCArrayRemoveValue(ccCArray *arr, void* value)
|
static inline void ccCArrayRemoveValue(ccCArray *arr, void* value)
|
||||||
{
|
{
|
||||||
unsigned int index = ccCArrayGetIndexOfValue(arr, value);
|
unsigned int index = ccCArrayGetIndexOfValue(arr, value);
|
||||||
if ((int)index != -1)
|
if (index != UINT_MAX)
|
||||||
{
|
{
|
||||||
ccCArrayRemoveValueAtIndex(arr, index);
|
ccCArrayRemoveValueAtIndex(arr, index);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue