From: Marcus Brinkmann Date: Sun, 1 Sep 2002 23:08:50 +0000 (+0000) Subject: 2002-09-02 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~829 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5fe72c3ad18a54d4a654a352670e4c7385b1bc74;p=gpgme.git 2002-09-02 Marcus Brinkmann * conversion.c (_gpgme_decode_c_string): Fix off by one error in last change. * rungpg.c (_gpgme_append_gpg_args_from_signers): Move before _gpgme_op_edit so its prototype is known early on. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 65af2a4..9497373 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,9 @@ 2002-09-02 Marcus Brinkmann + * conversion.c (_gpgme_decode_c_string): Fix off by one error in last change. + * rungpg.c (_gpgme_append_gpg_args_from_signers): Move before + _gpgme_op_edit so its prototype is known early on. + * conversion.c: New file. * util.h: Add prototypes for _gpgme_decode_c_string and _gpgme_hextobyte. diff --git a/trunk/gpgme/conversion.c b/trunk/gpgme/conversion.c index 4029db8..9e1737f 100644 --- a/trunk/gpgme/conversion.c +++ b/trunk/gpgme/conversion.c @@ -58,7 +58,7 @@ _gpgme_decode_c_string (const char *src, char **destp) /* We can malloc a buffer of the same length, because the converted string will never be larger. */ - dest = xtrymalloc (strlen (src)); + dest = xtrymalloc (strlen (src) + 1); if (!dest) return mk_error (Out_Of_Core); diff --git a/trunk/gpgme/rungpg.c b/trunk/gpgme/rungpg.c index e0a4e21..f67f68f 100644 --- a/trunk/gpgme/rungpg.c +++ b/trunk/gpgme/rungpg.c @@ -1439,6 +1439,32 @@ _gpgme_gpg_op_delete (GpgObject gpg, GpgmeKey key, int allow_secret) } +static GpgmeError +_gpgme_append_gpg_args_from_signers (GpgObject gpg, + GpgmeCtx ctx /* FIXME */) +{ + GpgmeError err = 0; + int i; + GpgmeKey key; + + for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) + { + const char *s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, + NULL, 0); + if (s) + { + if (!err) + err = _gpgme_gpg_add_arg (gpg, "-u"); + if (!err) + err = _gpgme_gpg_add_arg (gpg, s); + } + gpgme_key_unref (key); + if (err) break; + } + return err; +} + + GpgmeError _gpgme_gpg_op_edit (GpgObject gpg, GpgmeKey key, GpgmeData out, GpgmeCtx ctx /* FIXME */) @@ -1487,32 +1513,6 @@ _gpgme_append_gpg_args_from_recipients (GpgObject gpg, } -static GpgmeError -_gpgme_append_gpg_args_from_signers (GpgObject gpg, - GpgmeCtx ctx /* FIXME */) -{ - GpgmeError err = 0; - int i; - GpgmeKey key; - - for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) - { - const char *s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, - NULL, 0); - if (s) - { - if (!err) - err = _gpgme_gpg_add_arg (gpg, "-u"); - if (!err) - err = _gpgme_gpg_add_arg (gpg, s); - } - gpgme_key_unref (key); - if (err) break; - } - return err; -} - - GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp, GpgmeData plain, GpgmeData ciph, int use_armor)