[svn] assuan - r400 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Wed Nov 17 17:49:53 CET 2010


Author: marcus
Date: 2010-11-17 17:49:53 +0100 (Wed, 17 Nov 2010)
New Revision: 400

Modified:
   trunk/src/ChangeLog
   trunk/src/vasprintf.c
Log:
2010-11-17  Marcus Brinkmann  <mb at g10code.com>

        * vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM && _MSC_VER]:
        Just use a fixed size buffer, as va_copy is not easy to fake.




Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-11-17 02:08:13 UTC (rev 399)
+++ trunk/src/ChangeLog	2010-11-17 16:49:53 UTC (rev 400)
@@ -1,5 +1,8 @@
 2010-11-17  Marcus Brinkmann  <mb at g10code.com>
 
+	* vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM && _MSC_VER]:
+	Just use a fixed size buffer, as va_copy is not easy to fake.
+
 	* gpgcedev.c (struct pipeimpl_s): Add member monitor_rvid.
 	(struct monitor_s, monitor_t): New types.
 	(monitor_table, monitor_table_size): New static variables.

Modified: trunk/src/vasprintf.c
===================================================================
--- trunk/src/vasprintf.c	2010-11-17 02:08:13 UTC (rev 399)
+++ trunk/src/vasprintf.c	2010-11-17 16:49:53 UTC (rev 400)
@@ -51,6 +51,19 @@
      const char *format;
      va_list *args;
 {
+#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
+  /* 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 @@
     return vsprintf (*result, format, *args);
   else
     return 0;
+#endif
 }
 
 





More information about the Gnupg-commits mailing list