Merge pull request #15874 from mogemimi/fix-unused-variable

Fix unused variable warnings when compiling release mode
This commit is contained in:
minggo 2016-06-23 15:55:11 +08:00 committed by GitHub
commit ee7ceee007
2 changed files with 14 additions and 1 deletions

View File

@ -253,7 +253,6 @@ std::vector<cocos2d::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2
int curx = startx;
int cury = starty;
unsigned int count = 0;
unsigned int totalPixel = _width*_height;
bool problem = false;
std::vector<int> case9s;
std::vector<int> case6s;
@ -408,7 +407,11 @@ std::vector<cocos2d::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2
prevx = stepx;
prevy = stepy;
problem = false;
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
const auto totalPixel = _width * _height;
CCASSERT(count <= totalPixel, "oh no, marching square cannot find starting position");
#endif
} while(curx != startx || cury != starty);
return _points;
}

View File

@ -326,6 +326,11 @@ Sprite* createSpriteFromBase64Cached(const char* base64String, const char* key)
CCASSERT(imageResult, "Failed to create image from base64!");
free(decoded);
if (!imageResult) {
CC_SAFE_RELEASE_NULL(image);
return nullptr;
}
texture = Director::getInstance()->getTextureCache()->addImage(image, key);
image->release();
}
@ -345,6 +350,11 @@ Sprite* createSpriteFromBase64(const char* base64String)
CCASSERT(imageResult, "Failed to create image from base64!");
free(decoded);
if (!imageResult) {
CC_SAFE_RELEASE_NULL(image);
return nullptr;
}
Texture2D *texture = new (std::nothrow) Texture2D();
texture->initWithImage(image);
texture->setAliasTexParameters();