diff --git a/.gitignore b/.gitignore index c7d48f102e..cbe1b531fd 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,8 @@ obj/ [Rr]elease*/ _ReSharper*/ [Tt]est[Rr]esult* +ipch/ +*.opensdf # Ignore files build by ndk and eclipse libs/ diff --git a/cocos2dx/kazmath/src/ray2.c b/cocos2dx/kazmath/src/ray2.c index 679d50285c..8f3b430233 100644 --- a/cocos2dx/kazmath/src/ray2.c +++ b/cocos2dx/kazmath/src/ray2.c @@ -119,9 +119,7 @@ void calculate_line_normal(kmVec2 p1, kmVec2 p2, kmVec2* normal_out) { kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out) { kmVec2 intersect; - kmVec2 final_intersect; - kmVec2 normal; - //kmVec2 final_intersect = {.x = 0, .y = 0}, normal = {.x = 0, .y = 0}; // Silencing LLVM SA + kmVec2 final_intersect = {0., 0.}, normal = {0., 0.}; // Silencing LLVM SA. kmScalar distance = 10000.0f; kmBool intersected = KM_FALSE; diff --git a/cocos2dx/platform/mac/CCImage.mm b/cocos2dx/platform/mac/CCImage.mm index 2e52405618..4043bd1f1a 100755 --- a/cocos2dx/platform/mac/CCImage.mm +++ b/cocos2dx/platform/mac/CCImage.mm @@ -235,7 +235,7 @@ static bool _initPremultipliedATextureWithImage(CGImageRef image, NSUInteger POT CGContextRelease(context); return true; } - +// TODO: rename _initWithImage, it also makes a draw call. static bool _initWithImage(CGImageRef CGImage, tImageInfo *pImageinfo, double scaleX, double scaleY) { NSUInteger POTWide, POTHigh; @@ -258,10 +258,8 @@ static bool _initWithImage(CGImageRef CGImage, tImageInfo *pImageinfo, double sc } - // always load premultiplied images - _initPremultipliedATextureWithImage(CGImage, POTWide, POTHigh, pImageinfo); - - return true; + // load and draw image + return _initPremultipliedATextureWithImage(CGImage, POTWide, POTHigh, pImageinfo); } static bool _initWithFile(const char* path, tImageInfo *pImageinfo) @@ -277,17 +275,19 @@ static bool _initWithFile(const char* path, tImageInfo *pImageinfo) jpg = [[NSImage alloc] initWithContentsOfFile: fullPath]; //png = [[NSImage alloc] initWithData:UIImagePNGRepresentation(jpg)]; CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)[jpg TIFFRepresentation], NULL); - CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); + CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); ret = _initWithImage(CGImage, pImageinfo, 1.0, 1.0); //[png release]; [jpg release]; - + if (CGImage) CFRelease(CGImage); + if (source) CFRelease(source); + return ret; } - +// TODO: rename _initWithData, it also makes a draw call. static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo, double scaleX, double scaleY) { bool ret = false; @@ -302,8 +302,9 @@ static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo, do CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); ret = _initWithImage(CGImage, pImageinfo, scaleX, scaleY); + if (CGImage) CFRelease(CGImage); + if (source) CFRelease(source); } - return ret; } @@ -462,21 +463,19 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl NSUInteger textureSize = POTWide*POTHigh*4; unsigned char* dataNew = new unsigned char[textureSize]; - CC_BREAK_IF(!dataNew); - memcpy(dataNew, data, textureSize); - + if (dataNew) { + memcpy(dataNew, data, textureSize); + // output params + pInfo->width = POTWide; + pInfo->height = POTHigh; + pInfo->data = dataNew; + pInfo->hasAlpha = true; + pInfo->isPremultipliedAlpha = true; + pInfo->bitsPerComponent = 8; + bRet = true; + } [bitmap release]; - [image release]; - - // output params - pInfo->width = POTWide; - pInfo->height = POTHigh; - pInfo->data = dataNew; - pInfo->hasAlpha = true; - pInfo->isPremultipliedAlpha = true; - pInfo->bitsPerComponent = 8; - - bRet = true; + [image release]; } while (0); return bRet; } diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index 219c992f32..22b956d0df 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -196,10 +196,10 @@ int CCBReader::readInt(bool pSigned) { long long current = 0; for(int a = numBits - 1; a >= 0; a--) { if(this->getBit()) { - current |= 1 << a; + current |= 1LL << a; } } - current |= 1 << numBits; + current |= 1LL << numBits; int num; if(pSigned) { diff --git a/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp b/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp index 7871b416e9..148b169ef7 100644 --- a/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp +++ b/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp @@ -876,7 +876,7 @@ std::string ActionCallFuncND::subtitle() void ActionCallFuncND::removeFromParentAndCleanup(CCNode* pSender, void* data) { - bool bCleanUp = (bool)data; + bool bCleanUp = data != NULL; m_grossini->removeFromParentAndCleanup(bCleanUp); } diff --git a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 1b07cc3b49..7a0741db42 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -168,7 +168,7 @@ void HttpClientTest::onHttpRequestCompleted(cocos2d::CCNode *sender, void *data) // dump data std::vector *buffer = response->getResponseData(); printf("Http Test, dump data: "); - for (int i = 0; i < buffer->size(); i++) + for (unsigned int i = 0; i < buffer->size(); i++) { printf("%c", (*buffer)[i]); } diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 9d60bd5768..7a3c43f374 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -230,7 +230,7 @@ bool ScriptingCore::evalString(const char *string, jsval *outVal) CCLog("error evaluating script:\n%s", string); } str = JS_ValueToString(cx, rval); - return ok; + return ok!=0; } void ScriptingCore::runScript(const char *path) diff --git a/scripting/javascript/bindings/cocos2d_generated.cpp.REMOVED.git-id b/scripting/javascript/bindings/cocos2d_generated.cpp.REMOVED.git-id index c40ced74a8..3bc51f0960 100644 --- a/scripting/javascript/bindings/cocos2d_generated.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/cocos2d_generated.cpp.REMOVED.git-id @@ -1 +1 @@ -c3a4fa7cf2bdc8ce0bd3cbd98b7829bcdd253a2e \ No newline at end of file +092a4fc2dae615c23d2a1b327c514193718f8a93 \ No newline at end of file diff --git a/scripting/javascript/bindings/cocos2d_manual_bindings.cpp b/scripting/javascript/bindings/cocos2d_manual_bindings.cpp index ad3c560960..0f7efd6327 100644 --- a/scripting/javascript/bindings/cocos2d_manual_bindings.cpp +++ b/scripting/javascript/bindings/cocos2d_manual_bindings.cpp @@ -75,7 +75,7 @@ JSBool S_CCSequence::jsactions(JSContext *cx, uint32_t argc, jsval *vp) { // get first element S_CCSequence* prev; JSGET_PTRSHELL(S_CCSequence, prev, JSVAL_TO_OBJECT(argv[0])); - for (int i=1; i < argc; i++) { + for (unsigned int i=1; i < argc; i++) { CCFiniteTimeAction *next; JSGET_PTRSHELL(CCFiniteTimeAction, next, JSVAL_TO_OBJECT(argv[i])); prev = (S_CCSequence *)CCSequence::actionOneTwo(prev, next); } diff --git a/scripting/javascript/bindings/cocos_denshion_generated.cpp b/scripting/javascript/bindings/cocos_denshion_generated.cpp index 4cb326927a..13ab3ce71a 100644 --- a/scripting/javascript/bindings/cocos_denshion_generated.cpp +++ b/scripting/javascript/bindings/cocos_denshion_generated.cpp @@ -160,7 +160,7 @@ JSBool S_SimpleAudioEngine::jsplayBackgroundMusic(JSContext *cx, uint32_t argc, JSBool arg1; JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1); char *narg0 = JS_EncodeString(cx, arg0); - self->playBackgroundMusic(narg0, arg1); + self->playBackgroundMusic(narg0, arg1!=0); JS_SET_RVAL(cx, vp, JSVAL_TRUE); return JS_TRUE; @@ -175,7 +175,7 @@ JSBool S_SimpleAudioEngine::jsstopBackgroundMusic(JSContext *cx, uint32_t argc, if (argc == 1) { JSBool arg0; JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "b", &arg0); - self->stopBackgroundMusic(arg0); + self->stopBackgroundMusic(arg0!=0); JS_SET_RVAL(cx, vp, JSVAL_TRUE); return JS_TRUE; @@ -262,7 +262,7 @@ JSBool S_SimpleAudioEngine::jsplayEffect(JSContext *cx, uint32_t argc, jsval *vp JSBool arg1; JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1); char *narg0 = JS_EncodeString(cx, arg0); - unsigned int ret = self->playEffect(narg0, arg1); + unsigned int ret = self->playEffect(narg0, arg1!=0); do { jsval tmp; JS_NewNumberValue(cx, ret, &tmp); JS_SET_RVAL(cx, vp, tmp); } while (0); return JS_TRUE; diff --git a/scripting/lua/tolua/tolua_is.c b/scripting/lua/tolua/tolua_is.c index a5fdc4e29a..393c47df36 100644 --- a/scripting/lua/tolua/tolua_is.c +++ b/scripting/lua/tolua/tolua_is.c @@ -116,7 +116,7 @@ TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) } /* the equivalent of lua_is* for usertable */ -static int lua_isusertable (lua_State* L, int lo, const const char* type) +static int lua_isusertable (lua_State* L, int lo, const char* type) { int r = 0; if (lo < 0) lo = lua_gettop(L)+lo+1;