Merge pull request #3288 from minggo/ndk-r9-fixes

Fix build with -Werror=format-security (default in Android NDK r9)
This commit is contained in:
minggo 2013-07-26 16:59:28 -07:00
commit 5e8c3a54c1
5 changed files with 6 additions and 9 deletions

View File

@ -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)
{

View File

@ -371,7 +371,7 @@ void OpenSLEngine::createEngine(void* pHandle)
const char* errorInfo = dlerror();
if (errorInfo)
{
LOGD(errorInfo);
LOGD("%s", errorInfo);
return;
}

View File

@ -38,7 +38,7 @@ bool SimpleAudioEngineOpenSL::initEngine()
const char* errorInfo = dlerror();
if (errorInfo)
{
LOGD(errorInfo);
LOGD("%s", errorInfo);
bRet = false;
break;
}

View File

@ -35,14 +35,11 @@ NS_CC_BEGIN
// XXX deprecated
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 log(const char * pszFormat, ...)
@ -64,7 +61,7 @@ void MessageBox(const char * pszMsg, const char * pszTitle)
void LuaLog(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

View File

@ -228,7 +228,7 @@ unsigned char* FileUtilsAndroid::doGetFileData(const char* filename, const char*
{
std::string msg = "Get data from file(";
msg.append(filename).append(") failed!");
CCLOG(msg.c_str());
CCLOG("%s", msg.c_str());
}
return pData;