Fixing warning generated by VS2012.

This commit is contained in:
James Chen 2013-11-20 10:39:30 +08:00
parent 95cda661f2
commit 424431690a
5 changed files with 11 additions and 11 deletions

View File

@ -210,7 +210,7 @@ Sequence* Sequence::create(Array* arrayOfActions)
if (count > 1) if (count > 1)
{ {
for (unsigned int i = 1; i < count; ++i) for (long i = 1; i < count; ++i)
{ {
prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i))); prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i)));
} }
@ -220,7 +220,7 @@ Sequence* Sequence::create(Array* arrayOfActions)
// If only one action is added to Sequence, make up a Sequence by adding a simplest finite time action. // If only one action is added to Sequence, make up a Sequence by adding a simplest finite time action.
prev = createWithTwoActions(prev, ExtraAction::create()); prev = createWithTwoActions(prev, ExtraAction::create());
} }
pRet = (Sequence*)prev; pRet = static_cast<Sequence*>(prev);
}while (0); }while (0);
return pRet; return pRet;
} }

View File

@ -346,7 +346,7 @@ void DrawNode::drawPolygon(Point *verts, long count, const Color4F &fillColor, f
struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count); struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count);
memset(extrude, 0, sizeof(struct ExtrudeVerts)*count); memset(extrude, 0, sizeof(struct ExtrudeVerts)*count);
for(unsigned int i = 0; i < count; i++) for (long i = 0; i < count; i++)
{ {
Vertex2F v0 = __v2f(verts[(i-1+count)%count]); Vertex2F v0 = __v2f(verts[(i-1+count)%count]);
Vertex2F v1 = __v2f(verts[i]); Vertex2F v1 = __v2f(verts[i]);
@ -370,7 +370,7 @@ void DrawNode::drawPolygon(Point *verts, long count, const Color4F &fillColor, f
V2F_C4B_T2F_Triangle *cursor = triangles; V2F_C4B_T2F_Triangle *cursor = triangles;
float inset = (outline == false ? 0.5 : 0.0); float inset = (outline == false ? 0.5 : 0.0);
for(unsigned int i = 0; i < count-2; i++) for (long i = 0; i < count-2; i++)
{ {
Vertex2F v0 = v2fsub(__v2f(verts[0 ]), v2fmult(extrude[0 ].offset, inset)); Vertex2F v0 = v2fsub(__v2f(verts[0 ]), v2fmult(extrude[0 ].offset, inset));
Vertex2F v1 = v2fsub(__v2f(verts[i+1]), v2fmult(extrude[i+1].offset, inset)); Vertex2F v1 = v2fsub(__v2f(verts[i+1]), v2fmult(extrude[i+1].offset, inset));

View File

@ -491,7 +491,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, s
auto fixedPriorityListeners = listeners->getFixedPriorityListeners(); auto fixedPriorityListeners = listeners->getFixedPriorityListeners();
auto sceneGraphPriorityListeners = listeners->getSceneGraphPriorityListeners(); auto sceneGraphPriorityListeners = listeners->getSceneGraphPriorityListeners();
int i = 0; long i = 0;
// priority < 0 // priority < 0
if (fixedPriorityListeners) if (fixedPriorityListeners)
{ {
@ -527,7 +527,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, s
if (!shouldStopPropagation) if (!shouldStopPropagation)
{ {
// priority > 0 // priority > 0
for (; i < fixedPriorityListeners->size(); ++i) for (; i < static_cast<long>(fixedPriorityListeners->size()); ++i)
{ {
auto l = fixedPriorityListeners->at(i); auto l = fixedPriorityListeners->at(i);
@ -976,7 +976,7 @@ void EventDispatcher::sortEventListenersOfFixedPriority(EventListener::ListenerI
}); });
// FIXME: Should use binary search // FIXME: Should use binary search
int index = 0; long index = 0;
for (auto& listener : *fixedlisteners) for (auto& listener : *fixedlisteners)
{ {
if (listener->getFixedPriority() >= 0) if (listener->getFixedPriority() >= 0)

View File

@ -136,12 +136,12 @@ private:
inline std::vector<EventListener*>* getFixedPriorityListeners() const { return _fixedListeners; }; inline std::vector<EventListener*>* getFixedPriorityListeners() const { return _fixedListeners; };
inline std::vector<EventListener*>* getSceneGraphPriorityListeners() const { return _sceneGraphListeners; }; inline std::vector<EventListener*>* getSceneGraphPriorityListeners() const { return _sceneGraphListeners; };
inline int getGt0Index() const { return _gt0Index; }; inline long getGt0Index() const { return _gt0Index; };
inline void setGt0Index(int index) { _gt0Index = index; }; inline void setGt0Index(long index) { _gt0Index = index; };
private: private:
std::vector<EventListener*>* _fixedListeners; std::vector<EventListener*>* _fixedListeners;
std::vector<EventListener*>* _sceneGraphListeners; std::vector<EventListener*>* _sceneGraphListeners;
int _gt0Index; long _gt0Index;
}; };
/** Adds event listener with item */ /** Adds event listener with item */

View File

@ -319,7 +319,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames(void)
void SpriteFrameCache::removeSpriteFrameByName(const std::string& name) void SpriteFrameCache::removeSpriteFrameByName(const std::string& name)
{ {
// explicit nil handling // explicit nil handling
if( ! name.size()>0 ) if( !(name.size()>0) )
return; return;
// Is this an alias ? // Is this an alias ?