diff --git a/CocosDenshion/android/SimpleAudioEngine.cpp b/CocosDenshion/android/SimpleAudioEngine.cpp index 0cc8c6d302..3be2f5656b 100644 --- a/CocosDenshion/android/SimpleAudioEngine.cpp +++ b/CocosDenshion/android/SimpleAudioEngine.cpp @@ -74,7 +74,7 @@ SimpleAudioEngine::SimpleAudioEngine() const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL); - LOGD(deviceModel); + LOGD("%s", deviceModel); if (strcmp(I9100_MODEL, deviceModel) == 0) { diff --git a/CocosDenshion/android/opensl/OpenSLEngine.cpp b/CocosDenshion/android/opensl/OpenSLEngine.cpp index 28d83fe448..0b89738d52 100644 --- a/CocosDenshion/android/opensl/OpenSLEngine.cpp +++ b/CocosDenshion/android/opensl/OpenSLEngine.cpp @@ -331,7 +331,7 @@ void OpenSLEngine::createEngine(void* pHandle) const char* errorInfo = dlerror(); if (errorInfo) { - LOGD(errorInfo); + LOGD("%s", errorInfo); return; } diff --git a/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp b/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp index 134084b462..418be7d1b5 100644 --- a/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp +++ b/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp @@ -38,7 +38,7 @@ bool SimpleAudioEngineOpenSL::initEngine() const char* errorInfo = dlerror(); if (errorInfo) { - LOGD(errorInfo); + LOGD("%s", errorInfo); bRet = false; break; } diff --git a/cocos2dx/platform/android/CCCommon.cpp b/cocos2dx/platform/android/CCCommon.cpp index 7ebfd6998e..2f7d9afaa8 100644 --- a/cocos2dx/platform/android/CCCommon.cpp +++ b/cocos2dx/platform/android/CCCommon.cpp @@ -34,14 +34,11 @@ NS_CC_BEGIN void CCLog(const char * pszFormat, ...) { - char buf[MAX_LEN]; - va_list args; va_start(args, pszFormat); - vsnprintf(buf, MAX_LEN, pszFormat, args); + __android_log_vprint(ANDROID_LOG_DEBUG, "cocos2d-x debug info", pszFormat, args); va_end(args); - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf); } void CCMessageBox(const char * pszMsg, const char * pszTitle) @@ -51,7 +48,7 @@ void CCMessageBox(const char * pszMsg, const char * pszTitle) void CCLuaLog(const char * pszFormat) { - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", pszFormat); + __android_log_write(ANDROID_LOG_DEBUG, "cocos2d-x debug info", pszFormat); } NS_CC_END diff --git a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp index 5340f61d78..7083701f9a 100644 --- a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp +++ b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp @@ -153,7 +153,7 @@ unsigned char* CCFileUtilsAndroid::getFileData(const char* pszFileName, const ch { std::string msg = "Get data from file("; msg.append(pszFileName).append(") failed!"); - CCLOG(msg.c_str()); + CCLOG("%s", msg.c_str()); } return pData;