From: Marcus Brinkmann Date: Wed, 17 Nov 2010 02:11:05 +0000 (+0000) Subject: 2010-11-17 Marcus Brinkmann X-Git-Tag: gpgme-1.3.1~27 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f1527436c422614b6761730e43ea26e35814f8a3;p=gpgme.git 2010-11-17 Marcus Brinkmann * vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM]: Just use a fixed size buffer, as va_copy is not easy to fake. --- diff --git a/src/ChangeLog b/src/ChangeLog index 2a547be..2215329 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-17 Marcus Brinkmann + + * 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 * w32-ce.h (strcasecmp, strdup) [_MSC_VER]: Define. diff --git a/src/vasprintf.c b/src/vasprintf.c index 77113a3..03d38ff 100644 --- a/src/vasprintf.c +++ b/src/vasprintf.c @@ -51,6 +51,19 @@ int_vasprintf (result, format, args) const char *format; 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; /* Add one to make sure that it is never zero, which might cause malloc to return NULL. */ @@ -133,6 +146,7 @@ int_vasprintf (result, format, args) return vsprintf (*result, format, *args); else return 0; +#endif } int