2010-11-17 Marcus Brinkmann <mb@g10code.com>

* vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM]: Just use a
        fixed size buffer, as va_copy is not easy to fake.
This commit is contained in:
Marcus Brinkmann 2010-11-17 02:11:05 +00:00
parent f8e4d353fa
commit f1527436c4
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-11-17 Marcus Brinkmann <mb@g10code.com>
* vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM]: Just use a
fixed size buffer, as va_copy is not easy to fake.
2010-11-15 Marcus Brinkmann <mb@g10code.com> 2010-11-15 Marcus Brinkmann <mb@g10code.com>
* w32-ce.h (strcasecmp, strdup) [_MSC_VER]: Define. * w32-ce.h (strcasecmp, strdup) [_MSC_VER]: Define.

View File

@ -51,6 +51,19 @@ int_vasprintf (result, format, args)
const char *format; const char *format;
va_list *args; va_list *args;
{ {
#ifdef HAVE_W32CE_SYSTEM
/* No va_copy and the replacement above doesn't work. */
#define MAX_STRLEN 256
*result = malloc (MAX_STRLEN);
if (*result != NULL)
{
int res = _vsnprintf (*result, MAX_STRLEN, format, *args);
(*result)[MAX_STRLEN - 1] = '\0';
return res;
}
else
return 0;
#else
const char *p = format; const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc /* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */ to return NULL. */
@ -133,6 +146,7 @@ int_vasprintf (result, format, args)
return vsprintf (*result, format, *args); return vsprintf (*result, format, *args);
else else
return 0; return 0;
#endif
} }
int int