diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index c8753b89..f2bf8b33 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,40 @@ 2003-05-27 Marcus Brinkmann + * encrypt.c (gpgme_op_encrypt_result): Use intermediate variable + HOOK to avoid compiler warning. Don't ask, you don't want to know. + (_gpgme_encrypt_status_handler): Likewise. + (_gpgme_op_encrypt_init_result): Likewise. + * decrypt.c (gpgme_op_decrypt_result): Likewise. + (_gpgme_decrypt_status_handler): Likewise. + (_gpgme_op_decrypt_init_result): Likewise. + * verify.c (gpgme_op_verify_result): Likewise. + (_gpgme_verify_status_handler): Likewise. + (_gpgme_op_verify_init_result): Likewise. + * edit.c (edit_status_handler): Likewise. + (command_handler): Likewise. + (edit_start): Likewise. + * genkey.c (gpgme_op_genkey_result): Likewise. + (genkey_status_handler): Likewise. + (genkey_start): Likewise. + * import.c (gpgme_op_import_result): Likewise. + (import_status_handler): Likewise. + (_gpgme_op_import_start): Likewise. + * trustlist.c (gpgme_op_trustlist_next): Likewise. + (_gpgme_op_trustlist_event_cb): Likewise. + (gpgme_op_trustlist_start): Likewise. + * keylist.c (gpgme_op_keylist_result): Likewise. + (keylist_colon_handler): Likewise. + (keylist_status_handler): Likewise. + (_gpgme_op_keylist_event_cb): Likewise. + (gpgme_op_keylist_start): Likewise. + (gpgme_op_keylist_ext_start): Likewise. + (gpgme_op_keylist_next): Likewise. + * passphrase.c (_gpgme_passphrase_status_handler): Likewise. + (_gpgme_passphrase_command_handler_internal): Likewise. + * sign.c (gpgme_op_sign_result): Likewise. + (_gpgme_sign_status_handler): Likewise. + (_gpgme_op_sign_init_result): Likewise. + * passphrase.c (_gpgme_passphrase_command_handler_internal): Fix access to pointer type. diff --git a/gpgme/decrypt.c b/gpgme/decrypt.c index a1d83101..ec98ccd0 100644 --- a/gpgme/decrypt.c +++ b/gpgme/decrypt.c @@ -52,10 +52,12 @@ release_op_data (void *hook) gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -69,13 +71,15 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_passphrase_status_handler (priv, code, args); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -148,9 +152,10 @@ decrypt_status_handler (void *priv, gpgme_status_code_t code, char *args) gpgme_error_t _gpgme_op_decrypt_init_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; - return _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, (void **) &opd, + return _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook, sizeof (*opd), release_op_data); } diff --git a/gpgme/edit.c b/gpgme/edit.c index 7df5f939..023bbe07 100644 --- a/gpgme/edit.c +++ b/gpgme/edit.c @@ -39,12 +39,24 @@ static gpgme_error_t edit_status_handler (void *priv, gpgme_status_code_t status, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; + gpgme_error_t err; + void *hook; op_data_t opd; - return _gpgme_passphrase_status_handler (priv, status, args) - || _gpgme_progress_status_handler (priv, status, args) - || _gpgme_op_data_lookup (ctx, OPDATA_EDIT, (void **) &opd, -1, NULL) - || (*opd->fnc) (opd->fnc_value, status, args, -1); + err = _gpgme_passphrase_status_handler (priv, status, args); + if (err) + return err; + + err = _gpgme_progress_status_handler (priv, status, args); + if (err) + return err; + + err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, -1, NULL); + opd = hook; + if (err) + return err; + + return (*opd->fnc) (opd->fnc_value, status, args, -1); } @@ -54,7 +66,6 @@ command_handler (void *priv, gpgme_status_code_t status, const char *args, { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; - op_data_t opd; int processed = 0; if (ctx->passphrase_cb) @@ -67,7 +78,11 @@ command_handler (void *priv, gpgme_status_code_t status, const char *args, if (!processed) { - err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, (void **) &opd, -1, NULL); + void *hook; + op_data_t opd; + + err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -82,6 +97,7 @@ edit_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out) { gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_op_reset (ctx, synchronous); @@ -91,8 +107,8 @@ edit_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, if (!fnc || !out) return GPGME_Invalid_Value; - err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, (void **) &opd, - sizeof (*opd), NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL); + opd = hook; if (err) return err; diff --git a/gpgme/encrypt.c b/gpgme/encrypt.c index b98f55a5..485158a4 100644 --- a/gpgme/encrypt.c +++ b/gpgme/encrypt.c @@ -59,10 +59,13 @@ release_op_data (void *hook) gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL); + opd = hook; + if (err || !opd) return NULL; @@ -76,10 +79,11 @@ _gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code, { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; - err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, (void **) &opd, - -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -129,12 +133,15 @@ gpgme_error_t _gpgme_op_encrypt_init_result (gpgme_ctx_t ctx) { gpgme_error_t err; + void *hook; op_data_t opd; - err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, (void **) &opd, - sizeof (*opd), release_op_data); + err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, sizeof (*opd), + release_op_data); + opd = hook; if (err) return err; + opd->lastp = &opd->result.invalid_recipients; return 0; } diff --git a/gpgme/genkey.c b/gpgme/genkey.c index 980cd4ef..0d5c52f9 100644 --- a/gpgme/genkey.c +++ b/gpgme/genkey.c @@ -53,10 +53,12 @@ release_op_data (void *hook) gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -69,6 +71,7 @@ genkey_status_handler (void *priv, gpgme_status_code_t code, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; /* Pipe the status code through the progress status handler. */ @@ -76,8 +79,8 @@ genkey_status_handler (void *priv, gpgme_status_code_t code, char *args) if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, (void **) &opd, - -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -150,13 +153,15 @@ genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms, gpgme_data_t pubkey, gpgme_data_t seckey) { gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_op_reset (ctx, synchronous); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; diff --git a/gpgme/import.c b/gpgme/import.c index 8d95aff6..ea245a3d 100644 --- a/gpgme/import.c +++ b/gpgme/import.c @@ -60,10 +60,12 @@ release_op_data (void *hook) gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -179,10 +181,11 @@ import_status_handler (void *priv, gpgme_status_code_t code, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; - err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, (void **) &opd, - -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -213,14 +216,16 @@ static gpgme_error_t _gpgme_op_import_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t keydata) { gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_op_reset (ctx, synchronous); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; opd->lastp = &opd->result.imports; diff --git a/gpgme/keylist.c b/gpgme/keylist.c index 6edadee7..0d2c6017 100644 --- a/gpgme/keylist.c +++ b/gpgme/keylist.c @@ -76,10 +76,12 @@ release_op_data (void *hook) gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -92,9 +94,11 @@ keylist_status_handler (void *priv, gpgme_status_code_t code, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -352,6 +356,7 @@ keylist_colon_handler (void *priv, char *line) #define NR_FIELDS 13 char *field[NR_FIELDS]; int fields = 0; + void *hook; op_data_t opd; gpgme_error_t err; gpgme_key_t key; @@ -361,7 +366,8 @@ keylist_colon_handler (void *priv, char *line) DEBUG3 ("keylist_colon_handler ctx = %p, key = %p, line = %s\n", ctx, key, line ? line : "(null)"); - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -666,12 +672,14 @@ _gpgme_op_keylist_event_cb (void *data, gpgme_event_io_t type, void *type_data) gpgme_error_t err; gpgme_ctx_t ctx = (gpgme_ctx_t) data; gpgme_key_t key = (gpgme_key_t) type_data; + void *hook; op_data_t opd; struct key_queue_item_s *q, *q2; assert (type == GPGME_EVENT_NEXT_KEY); - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); + opd = hook; if (err) return; @@ -704,14 +712,16 @@ gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, int secret_only) { gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_op_reset (ctx, 2); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; @@ -735,14 +745,16 @@ gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, const char *pattern[], int secret_only, int reserved) { gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_op_reset (ctx, 2); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; @@ -763,6 +775,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) { gpgme_error_t err; struct key_queue_item_s *queue_item; + void *hook; op_data_t opd; if (!ctx || !r_key) @@ -771,7 +784,8 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) if (!ctx) return GPGME_Invalid_Value; - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); + opd = hook; if (err) return err; diff --git a/gpgme/passphrase.c b/gpgme/passphrase.c index f30dd762..e852e5cb 100644 --- a/gpgme/passphrase.c +++ b/gpgme/passphrase.c @@ -58,13 +58,15 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code, { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; if (!ctx->passphrase_cb) return 0; - err = _gpgme_op_data_lookup (ctx, OPDATA_PASSPHRASE, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_PASSPHRASE, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; @@ -121,12 +123,14 @@ _gpgme_passphrase_command_handler_internal (void *priv, { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; assert (ctx->passphrase_cb); - err = _gpgme_op_data_lookup (ctx, OPDATA_PASSPHRASE, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_PASSPHRASE, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; diff --git a/gpgme/sign.c b/gpgme/sign.c index 2478be8f..ce02c031 100644 --- a/gpgme/sign.c +++ b/gpgme/sign.c @@ -72,10 +72,12 @@ release_op_data (void *hook) gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -187,13 +189,15 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; err = _gpgme_passphrase_status_handler (priv, code, args); if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -239,10 +243,12 @@ gpgme_error_t _gpgme_op_sign_init_result (gpgme_ctx_t ctx) { gpgme_error_t err; + void *hook; op_data_t opd; - err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, sizeof (*opd), release_op_data); + opd = hook; if (err) return err; opd->last_signer_p = &opd->result.invalid_signers; diff --git a/gpgme/trustlist.c b/gpgme/trustlist.c index ddec1b2a..a5a29158 100644 --- a/gpgme/trustlist.c +++ b/gpgme/trustlist.c @@ -126,14 +126,15 @@ _gpgme_op_trustlist_event_cb (void *data, gpgme_event_io_t type, { gpgme_ctx_t ctx = (gpgme_ctx_t) data; gpgme_error_t err; + void *hook; op_data_t opd; gpgme_trust_item_t item = (gpgme_trust_item_t) type_data; struct trust_queue_item_s *q, *q2; assert (type == GPGME_EVENT_NEXT_TRUSTITEM); - err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, (void **) &opd, - -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, &hook, -1, NULL); + opd = hook; if (err) return; @@ -165,6 +166,7 @@ gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx, const char *pattern, int max_level) { gpgme_error_t err = 0; + void *hook; op_data_t opd; if (!pattern || !*pattern) @@ -174,8 +176,9 @@ gpgme_op_trustlist_start (gpgme_ctx_t ctx, const char *pattern, int max_level) if (err) return err; - err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, (void **) &opd, + err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, &hook, sizeof (*opd), NULL); + opd = hook; if (err) return err; @@ -194,6 +197,7 @@ gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) { gpgme_error_t err; + void *hook; op_data_t opd; struct trust_queue_item_s *q; @@ -203,8 +207,8 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) if (!ctx) return GPGME_Invalid_Value; - err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, (void **) &opd, - -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, &hook, -1, NULL); + opd = hook; if (err) return err; diff --git a/gpgme/verify.c b/gpgme/verify.c index e8c8a784..b84e5b47 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -72,10 +72,12 @@ release_op_data (void *hook) gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; gpgme_error_t err; - err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL); + opd = hook; if (err || !opd) return NULL; @@ -448,10 +450,12 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) { gpgme_ctx_t ctx = (gpgme_ctx_t) priv; gpgme_error_t err; + void *hook; op_data_t opd; gpgme_signature_t sig; - err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, (void **) &opd, -1, NULL); + err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL); + opd = hook; if (err) return err; @@ -521,9 +525,10 @@ verify_status_handler (void *priv, gpgme_status_code_t code, char *args) gpgme_error_t _gpgme_op_verify_init_result (gpgme_ctx_t ctx) { + void *hook; op_data_t opd; - return _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, (void **) &opd, + return _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, sizeof (*opd), release_op_data); }