From 3dc167a9f9bb839749d5fcf03e1fb370a2bdfa02 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 11 Jul 2016 12:01:09 +0800 Subject: [PATCH] use std::abs instead --- cocos/2d/CCSpriteFrameCache.cpp | 8 ++++---- cocos/renderer/CCTextureAtlas.cpp | 2 +- .../scripting/lua-bindings/manual/LuaBasicConversions.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index b41dbef6ca..f5ca7c6fb6 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -200,8 +200,8 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist"); } // abs ow/oh - ow = abs(ow); - oh = abs(oh); + ow = std::abs(ow); + oh = std::abs(oh); // create frame spriteFrame = SpriteFrame::createWithTexture(texture, Rect(x, y, w, h), @@ -635,8 +635,8 @@ void SpriteFrameCache::reloadSpriteFramesWithDictionary(ValueMap& dictionary, Te CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist"); } // abs ow/oh - ow = abs(ow); - oh = abs(oh); + ow = std::abs(ow); + oh = std::abs(oh); // create frame spriteFrame = SpriteFrame::createWithTexture(texture, Rect(x, y, w, h), diff --git a/cocos/renderer/CCTextureAtlas.cpp b/cocos/renderer/CCTextureAtlas.cpp index bba4518153..1962d0b643 100644 --- a/cocos/renderer/CCTextureAtlas.cpp +++ b/cocos/renderer/CCTextureAtlas.cpp @@ -390,7 +390,7 @@ void TextureAtlas::insertQuadFromIndex(ssize_t oldIndex, ssize_t newIndex) return; } // because it is ambiguous in iphone, so we implement abs ourselves - // unsigned int howMany = abs( oldIndex - newIndex); + // unsigned int howMany = std::abs( oldIndex - newIndex); auto howMany = (oldIndex - newIndex) > 0 ? (oldIndex - newIndex) : (newIndex - oldIndex); auto dst = oldIndex; auto src = oldIndex + 1; diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp index 1c89ccad13..36e409d4de 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -72,7 +72,7 @@ extern int lua_isusertype (lua_State* L, int lo, const char* type); bool luaval_is_usertype(lua_State* L,int lo,const char* type, int def) { - if (def && lua_gettop(L)