Compilation error fixes, since CCLog has been renamed to 'log', all platforms should implement it.

This commit is contained in:
James Chen 2013-07-24 10:14:42 +08:00
parent 1f37d4d00a
commit 7bc6abfac7
7 changed files with 121 additions and 0 deletions

View File

@ -32,6 +32,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char buf[MAX_LEN];
@ -44,6 +45,18 @@ void CCLog(const char * pszFormat, ...)
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf);
}
void log(const char * pszFormat, ...)
{
char buf[MAX_LEN];
va_list args;
va_start(args, pszFormat);
vsnprintf(buf, MAX_LEN, pszFormat, args);
va_end(args);
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
showDialogJNI(pszMsg, pszTitle);

View File

@ -28,6 +28,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char buf[MAX_LEN];
@ -40,6 +41,18 @@ void CCLog(const char * pszFormat, ...)
fprintf(stderr, "cocos2d-x debug info %s\n", buf);
}
void log(const char * pszFormat, ...)
{
char buf[MAX_LEN];
va_list args;
va_start(args, pszFormat);
vsnprintf(buf, MAX_LEN, pszFormat, args);
va_end(args);
fprintf(stderr, "cocos2d-x debug info %s\n", buf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
// MessageBoxA(NULL, pszMsg, pszTitle, MB_OK);

View File

@ -31,6 +31,19 @@
NS_CC_BEGIN
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
printf("Cocos2d: ");
char szBuf[kMaxLogLen+1] = {0};
va_list ap;
va_start(ap, pszFormat);
vsnprintf(szBuf, kMaxLogLen, pszFormat, ap);
va_end(ap);
printf("%s", szBuf);
printf("\n");
}
void log(const char * pszFormat, ...)
{
printf("Cocos2d: ");

View File

@ -28,6 +28,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
@ -48,6 +49,26 @@ void CCLog(const char * pszFormat, ...)
fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf);
}
void log(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
va_list ap;
va_start(ap, pszFormat);
vsnprintf(szBuf, MAX_LEN, pszFormat, ap);
va_end(ap);
// Strip any trailing newlines from log message.
size_t len = strlen(szBuf);
while (len && szBuf[len-1] == '\n')
{
szBuf[len-1] = '\0';
len--;
}
fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
CCLog("%s: %s", pszTitle, pszMsg);

View File

@ -29,6 +29,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
@ -49,6 +50,26 @@ void CCLog(const char * pszFormat, ...)
fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf);
}
void log(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
va_list ap;
va_start(ap, pszFormat);
vsnprintf( szBuf, MAX_LEN, pszFormat, ap);
va_end(ap);
// Strip any trailing newlines from log message.
size_t len = strlen(szBuf);
while (len && szBuf[len-1] == '\n')
{
szBuf[len-1] = '\0';
len--;
}
fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
CCLog("%s: %s", pszTitle, pszMsg);

View File

@ -31,6 +31,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
@ -51,6 +52,26 @@ void CCLog(const char * pszFormat, ...)
AppLog("cocos2d-x debug info [%s]\n", szBuf);
}
void log(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
va_list ap;
va_start(ap, pszFormat);
vsnprintf(szBuf, MAX_LEN, pszFormat, ap);
va_end(ap);
// Strip any trailing newlines from log message.
size_t len = strlen(szBuf);
while (len && szBuf[len-1] == '\n')
{
szBuf[len-1] = '\0';
len--;
}
AppLog("cocos2d-x debug info [%s]\n", szBuf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
CCLog("%s: %s", pszTitle, pszMsg);

View File

@ -28,6 +28,7 @@ NS_CC_BEGIN
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
@ -46,6 +47,24 @@ void CCLog(const char * pszFormat, ...)
printf("%s\n", szBuf);
}
void log(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
va_list ap;
va_start(ap, pszFormat);
vsnprintf_s(szBuf, MAX_LEN, MAX_LEN, pszFormat, ap);
va_end(ap);
WCHAR wszBuf[MAX_LEN] = {0};
MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf));
OutputDebugStringW(wszBuf);
OutputDebugStringA("\n");
WideCharToMultiByte(CP_ACP, 0, wszBuf, sizeof(wszBuf), szBuf, sizeof(szBuf), NULL, FALSE);
printf("%s\n", szBuf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)
{
MessageBoxA(NULL, pszMsg, pszTitle, MB_OK);