From 7ad717f6ba00046a26a99d015d701a178ca30630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Thu, 2 Feb 2023 09:59:01 +0100 Subject: [PATCH] core: Make usage of input size hint compatible with gpgtar * src/engine-gpg.c (add_input_size_hint): Use add_gpg_arg_with_value to add the --input-size-hint option. -- GnuPG-bug-id: 6342 --- src/engine-gpg.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/engine-gpg.c b/src/engine-gpg.c index e766f08e..9419f089 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1799,7 +1799,6 @@ start (engine_gpg_t gpg) static gpgme_error_t add_input_size_hint (engine_gpg_t gpg, gpgme_data_t data) { - gpgme_error_t err; gpgme_off_t value = _gpgme_data_get_size_hint (data); char numbuf[50]; /* Large enough for even 2^128 in base-10. */ char *p; @@ -1807,20 +1806,16 @@ add_input_size_hint (engine_gpg_t gpg, gpgme_data_t data) if (!value || !have_gpg_version (gpg, "2.1.15")) return 0; - err = add_arg (gpg, "--input-size-hint"); - if (!err) + p = numbuf + sizeof numbuf; + *--p = 0; + do { - p = numbuf + sizeof numbuf; - *--p = 0; - do - { - *--p = '0' + (value % 10); - value /= 10; - } - while (value); - err = add_arg (gpg, p); + *--p = '0' + (value % 10); + value /= 10; } - return err; + while (value); + + return add_gpg_arg_with_value (gpg, "--input-size-hint=", p, 0); }