@@ -82,7 +82,7 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||||
ANDROID_LOG_ERROR | ANDROID_LOG_ERROR | ||||
}; | }; | ||||
String buf = String::Printf(fmt, ap); | |||||
String buf = String::VPrintf(fmt, ap); | |||||
__android_log_print(prio[type], "LOL", "[%d] %s", (int)gettid(), &buf[0]); | __android_log_print(prio[type], "LOL", "[%d] %s", (int)gettid(), &buf[0]); | ||||
#else | #else | ||||
@@ -95,8 +95,12 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||||
}; | }; | ||||
# if defined _WIN32 | # if defined _WIN32 | ||||
String buf = String(prefix[type]) + ": " + String::Printf(fmt, ap); | |||||
OutputDebugString(&buf[0]); | |||||
String buf = String(prefix[type]) + ": " + String::VPrintf(fmt, ap); | |||||
Array<WCHAR> widechar; | |||||
widechar.Resize(buf.Count() + 1); | |||||
MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.Count() + 1, widechar.Data(), widechar.Count()); | |||||
OutputDebugStringW(widechar.Data()); | |||||
# else | # else | ||||
fprintf(stderr, "%s: ", prefix[type]); | fprintf(stderr, "%s: ", prefix[type]); | ||||
vfprintf(stderr, fmt, ap); | vfprintf(stderr, fmt, ap); | ||||
@@ -47,7 +47,7 @@ String String::VPrintf(char const *format, va_list ap) | |||||
String ret; | String ret; | ||||
va_list ap2; | va_list ap2; | ||||
#if !defined _MSC_VER | |||||
#if defined va_copy || !defined _MSC_VER | |||||
/* Visual Studio 2010 does not support va_copy. */ | /* Visual Studio 2010 does not support va_copy. */ | ||||
va_copy(ap2, ap); | va_copy(ap2, ap); | ||||
#else | #else | ||||
@@ -57,7 +57,11 @@ String String::VPrintf(char const *format, va_list ap) | |||||
/* vsnprintf() tells us how many character we need, and we need to | /* vsnprintf() tells us how many character we need, and we need to | ||||
* add one for the terminating null byte. */ | * add one for the terminating null byte. */ | ||||
size_t needed = vsnprintf(nullptr, 0, format, ap2) + 1; | size_t needed = vsnprintf(nullptr, 0, format, ap2) + 1; | ||||
#if defined va_copy || !defined _MSC_VER | |||||
/* do not call va_end() if va_copy() wasn’t called. */ | |||||
va_end(ap2); | va_end(ap2); | ||||
#endif | |||||
((Super &)ret).Reserve(needed); | ((Super &)ret).Reserve(needed); | ||||
ret.m_count = needed; | ret.m_count = needed; | ||||