diff options
author | Marcus Brinkmann <[email protected]> | 2001-11-15 21:32:09 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2001-11-15 21:32:09 +0000 |
commit | 9144124a610015d3ef17e59828cdcca84d18ab39 (patch) | |
tree | c9480a66c2b25b52ae2bf28b6f8cb198d9363cc4 /gpgme/encrypt.c | |
parent | 2001-11-11 Marcus Brinkmann <[email protected]> (diff) | |
download | gpgme-9144124a610015d3ef17e59828cdcca84d18ab39.tar.gz gpgme-9144124a610015d3ef17e59828cdcca84d18ab39.zip |
2001-11-15 Marcus Brinkmann <[email protected]>
* verify.c (_gpgme_release_verify_result): Rename RES to RESULT.
Rename R2 to NEXT_RESULT.
(intersect_stati): Rename RES to RESULT.
(gpgme_get_sig_status): Likewise. Do not check return_type, but
the member verify of result.
(gpgme_get_sig_key): Likewise.
* sign.c (_gpgme_release_sign_result): Rename RES to RESULT. If
RESULT is zero, return.
(sign_status_handler, command_handler): Do not check return_type,
but the member sign of result.
(gpgme_op_sign): Likewise. Drop assertion.
* encrypt.c (_gpgme_release_encrypt_result): Rename RES to RESULT.
If RESULT is zero, return.
(encrypt_status_handler): Do not check return_type, but the member
encrypt of result.
(gpgme_op_encrypt): Likewise. Drop assertion.
* decrypt.c (_gpgme_release_decrypt_result): Rename RES to RESULT.
(create_result_struct): Do not set result_type.
(command_handler, decrypt_status_handler): Do not check
return_type, but the member decrypt of result.
(gpgme_op_decrypt): Likewise. Drop assertion.
* context.h (enum ResultType): Removed.
(struct gpgme_context_s): Remove member result_type.
(struct result): Replaces union result.
* gpgme.c: Include string.h.
(_gpgme_release_result): Release all members of c->result, which
is now a struct. Zero out all members of the struct afterwards.
Diffstat (limited to '')
-rw-r--r-- | gpgme/encrypt.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/gpgme/encrypt.c b/gpgme/encrypt.c index 3dc7eb03..2179443e 100644 --- a/gpgme/encrypt.c +++ b/gpgme/encrypt.c @@ -36,22 +36,21 @@ return; /* oops */ \ } while (0) - - -struct encrypt_result_s { - int no_recipients; - GpgmeData xmlinfo; +struct encrypt_result_s +{ + int no_recipients; + GpgmeData xmlinfo; }; - void -_gpgme_release_encrypt_result (EncryptResult res) +_gpgme_release_encrypt_result (EncryptResult result) { - gpgme_data_release (res->xmlinfo); - xfree (res); + if (!result) + return; + gpgme_data_release (result->xmlinfo); + xfree (result); } - /* * Parse the args and save the information * in an XML structure. @@ -99,20 +98,19 @@ append_xml_encinfo (GpgmeData *rdh, char *args) static void -encrypt_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args ) +encrypt_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args) { - if ( ctx->out_of_core ) - return; - if ( ctx->result_type == RESULT_TYPE_NONE ) { - assert ( !ctx->result.encrypt ); - ctx->result.encrypt = xtrycalloc ( 1, sizeof *ctx->result.encrypt ); - if ( !ctx->result.encrypt ) { + if (ctx->out_of_core) + return; + if (!ctx->result.encrypt) + { + ctx->result.encrypt = xtrycalloc (1, sizeof *ctx->result.encrypt); + if (!ctx->result.encrypt) + { ctx->out_of_core = 1; return; - } - ctx->result_type = RESULT_TYPE_ENCRYPT; - } - assert ( ctx->result_type == RESULT_TYPE_ENCRYPT ); + } + } switch (code) { case STATUS_EOF: @@ -230,12 +228,11 @@ gpgme_op_encrypt ( GpgmeCtx c, GpgmeRecipients recp, int err = gpgme_op_encrypt_start ( c, recp, in, out ); if ( !err ) { gpgme_wait (c, 1); - if ( c->result_type != RESULT_TYPE_ENCRYPT ) + if (!c->result.encrypt) err = mk_error (General_Error); - else if ( c->out_of_core ) + else if (c->out_of_core) err = mk_error (Out_Of_Core); else { - assert ( c->result.encrypt ); if (c->result.encrypt->no_recipients) err = mk_error (No_Recipients); } |