From b295bab058477187423d62a38b18e2833aaef0cc Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 25 Jul 2002 17:51:42 +0000 Subject: [PATCH] 2002-07-25 Marcus Brinkmann MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Makefile.am (libgpgme_la_LDADD): Add @LIBOBJS@ for vasprintf and fopencookie. * vasprintf.c: Update to more recent libiberty version. * debug.h: Replace #elsif with #elif. Submitted by St�phane Corth�sy: * util.h (vasprintf): Correct prototype. * encrypt-sign.c: Include . (encrypt_sign_status_handler): Change type of ENCRYPT_INFO_LEN to size_t. * ath-pthread.c: Include , not . * ath-pth.c: Likewise. --- gpgme/ChangeLog | 15 +++++++++++++++ gpgme/Makefile.am | 1 + gpgme/ath-pth.c | 2 +- gpgme/ath-pthread.c | 2 +- gpgme/debug.h | 2 +- gpgme/encrypt-sign.c | 5 ++++- gpgme/util.h | 2 +- gpgme/vasprintf.c | 27 +++++++++++++++++++++++---- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index a23e9d1..1a92046 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,18 @@ +2002-07-25 Marcus Brinkmann + + * Makefile.am (libgpgme_la_LDADD): Add @LIBOBJS@ for vasprintf and + fopencookie. + * vasprintf.c: Update to more recent libiberty version. + * debug.h: Replace #elsif with #elif. + + Submitted by Stéphane Corthésy: + * util.h (vasprintf): Correct prototype. + * encrypt-sign.c: Include . + (encrypt_sign_status_handler): Change type of ENCRYPT_INFO_LEN to + size_t. + * ath-pthread.c: Include , not . + * ath-pth.c: Likewise. + 2002-07-25 Marcus Brinkmann * wait.c (fdt_global): Make static. Reported by Stéphane diff --git a/gpgme/Makefile.am b/gpgme/Makefile.am index 382e452..6f196ba 100644 --- a/gpgme/Makefile.am +++ b/gpgme/Makefile.am @@ -82,6 +82,7 @@ libgpgme_la_SOURCES = \ ${system_components} \ debug.c debug.h \ gpgme.c version.c errors.c +libgpgme_la_LDADD = @LIBOBJS@ errors.c : gpgme.h $(srcdir)/mkerrors < $(srcdir)/gpgme.h > errors.c diff --git a/gpgme/ath-pth.c b/gpgme/ath-pth.c index cac414c..73c3894 100644 --- a/gpgme/ath-pth.c +++ b/gpgme/ath-pth.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include +#include #include #include diff --git a/gpgme/ath-pthread.c b/gpgme/ath-pthread.c index ec250d8..6c74efd 100644 --- a/gpgme/ath-pthread.c +++ b/gpgme/ath-pthread.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include +#include #include #include diff --git a/gpgme/debug.h b/gpgme/debug.h index bdeaebc..4bc42cf 100644 --- a/gpgme/debug.h +++ b/gpgme/debug.h @@ -51,7 +51,7 @@ void _gpgme_debug_end (void **helper); #define DEBUG_END(hlp, fmt, arg...) \ _gpgme_debug_add (&(hlp), fmt , ##arg); \ _gpgme_debug_end (&(hlp)) -#elsif 0 +#elif 0 /* Only works in C99. */ #define DEBUG0(fmt) \ _gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__)) diff --git a/gpgme/encrypt-sign.c b/gpgme/encrypt-sign.c index e7e36d7..60673ec 100644 --- a/gpgme/encrypt-sign.c +++ b/gpgme/encrypt-sign.c @@ -19,7 +19,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#ifdef HAVE_CONFIG_H #include +#endif +#include #include #include #include @@ -34,7 +37,7 @@ static void encrypt_sign_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args) { char *encrypt_info = 0; - int encrypt_info_len; + size_t encrypt_info_len; _gpgme_encrypt_status_handler (ctx, code, args); diff --git a/gpgme/util.h b/gpgme/util.h index d6c193c..4213a97 100644 --- a/gpgme/util.h +++ b/gpgme/util.h @@ -77,7 +77,7 @@ const char *_gpgme_get_gpgsm_path (void); #ifdef HAVE_CONFIG_H #if !HAVE_VASPRINTF #include -int vasprintf (char **result, const char *format, va_list *args); +int vasprintf (char **result, const char *format, va_list args); int asprintf (char **result, const char *format, ...); #endif diff --git a/gpgme/vasprintf.c b/gpgme/vasprintf.c index dbef4eb..9e39966 100644 --- a/gpgme/vasprintf.c +++ b/gpgme/vasprintf.c @@ -30,8 +30,13 @@ Boston, MA 02111-1307, USA. */ int global_total_width; #endif -int -vasprintf (char **result, const char *format, va_list *args) +static int int_vasprintf (char **, const char *, va_list *); + +static int +int_vasprintf (result, format, args) + char **result; + const char *format; + va_list *args; { const char *p = format; /* Add one to make sure that it is never zero, which might cause malloc @@ -54,7 +59,7 @@ vasprintf (char **result, const char *format, va_list *args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, (char**)&p, 10); + total_width += strtoul (p, (char **) &p, 10); if (*p == '.') { ++p; @@ -64,7 +69,7 @@ vasprintf (char **result, const char *format, va_list *args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, (char**)&p, 10); + total_width += strtoul (p, (char **) &p, 10); } while (strchr ("hlL", *p)) ++p; @@ -99,6 +104,7 @@ vasprintf (char **result, const char *format, va_list *args) (void) va_arg (ap, char *); break; } + p++; } } #ifdef TEST @@ -111,6 +117,19 @@ vasprintf (char **result, const char *format, va_list *args) return 0; } +int +vasprintf (result, format, args) + char **result; + const char *format; +#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) + _BSD_VA_LIST_ args; +#else + va_list args; +#endif +{ + return int_vasprintf (result, format, &args); +} + int asprintf (char **buf, const char *fmt, ...) -- 2.26.2