2002-09-02 Marcus Brinkmann <marcus@g10code.de>
+ * 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.
/* 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);
}
+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 */)
}
-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)