version 1.1, 2015/04/20 18:19:55
|
version 1.2, 2015/09/25 20:24:20
|
|
|
| |
#include <string.h> | #include <string.h> |
#include <pal/once.h> | #include <pal/once.h> |
|
#include <pal/intsafe.h> |
#include <locale.h> | #include <locale.h> |
| |
char* FixupFormat( | char* FixupFormat( |
|
|
| |
while ((r = vsnprintf(p, n, fmt, ap)) == -1) | while ((r = vsnprintf(p, n, fmt, ap)) == -1) |
{ | { |
n *= 2; |
if (SizeTMult(n, 2, &n) != S_OK) |
|
return -1; |
| |
if (p == buf) | if (p == buf) |
p = (char*)SystemMalloc(n); | p = (char*)SystemMalloc(n); |
|
|
| |
if (n > size) | if (n > size) |
{ | { |
start = (wchar_t*)SystemMalloc(n * sizeof(wchar_t)); |
size_t allocSize; |
|
if (SizeTMult(n, sizeof(wchar_t), &allocSize) != S_OK) |
|
return NULL; |
|
|
|
start = (wchar_t*)SystemMalloc(allocSize); |
| |
if (!start) | if (!start) |
return NULL; | return NULL; |