tests: Mark lots of unused vars and fix const mismatches.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-09-13 20:48:06 +02:00
parent 4491ef0a9a
commit 9064eebdc0
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
36 changed files with 289 additions and 216 deletions

View File

@ -37,7 +37,7 @@
static void static void
check_verify_result (gpgme_verify_result_t result, unsigned int summary, check_verify_result (gpgme_verify_result_t result, unsigned int summary,
char *fpr, gpgme_error_t status) const char *fpr, gpgme_error_t status)
{ {
gpgme_signature_t sig; gpgme_signature_t sig;
@ -104,6 +104,9 @@ main (int argc, char *argv[])
char *cipher_2_asc = make_filename ("cipher-2.asc"); char *cipher_2_asc = make_filename ("cipher-2.asc");
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -46,6 +46,9 @@ main (int argc, char *argv[])
char *cipher_1_asc = make_filename ("cipher-1.asc"); char *cipher_1_asc = make_filename ("cipher-1.asc");
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -57,7 +57,7 @@ flush_data (gpgme_data_t dh)
gpgme_error_t gpgme_error_t
edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd) edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
{ {
char *result = NULL; const char *result = NULL;
gpgme_data_t out = (gpgme_data_t) opaque; gpgme_data_t out = (gpgme_data_t) opaque;
fputs ("[-- Response --]\n", stdout); fputs ("[-- Response --]\n", stdout);
@ -120,6 +120,9 @@ main (int argc, char **argv)
const char *pattern = "Alpha"; const char *pattern = "Alpha";
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -60,6 +60,8 @@ write_cb (void *handle, const void *buffer, size_t size)
{ {
struct cb_parms *parms = handle; struct cb_parms *parms = handle;
(void)buffer;
parms->bytes_received += size; parms->bytes_received += size;
return size; return size;
@ -70,6 +72,11 @@ static void
progress_cb (void *opaque, const char *what, int type, int current, int total) progress_cb (void *opaque, const char *what, int type, int current, int total)
{ {
/* This is just a dummy. */ /* This is just a dummy. */
(void)opaque;
(void)what;
(void)type;
(void)current;
(void)total;
} }

View File

@ -34,7 +34,7 @@
that an encrypted message can be decrypted without the that an encrypted message can be decrypted without the
secret key but that the recipient is also set correctly. */ secret key but that the recipient is also set correctly. */
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -94,6 +94,9 @@ main (int argc, char **argv)
gpgme_sign_result_t sign_result; gpgme_sign_result_t sign_result;
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -47,6 +47,9 @@ main (int argc, char *argv[])
char *p; char *p;
size_t len; size_t len;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -43,6 +43,9 @@ main (int argc, char *argv[])
gpgme_key_t key[3] = { NULL, NULL, NULL }; gpgme_key_t key[3] = { NULL, NULL, NULL };
gpgme_encrypt_result_t result; gpgme_encrypt_result_t result;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -168,7 +168,7 @@ struct gpgme_io_cbs io_cbs =
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -44,6 +44,9 @@ main (int argc, char **argv)
const char *pattern[] = { "Alpha", "Bob", NULL }; const char *pattern[] = { "Alpha", "Bob", NULL };
gpgme_key_t keyarray[3]; gpgme_key_t keyarray[3];
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -37,7 +37,7 @@
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -40,6 +40,8 @@ static int progress_called;
static void static void
progress (void *self, const char *what, int type, int current, int total) progress (void *self, const char *what, int type, int current, int total)
{ {
(void)self;
if (!strcmp (what, "primegen") && !current && !total if (!strcmp (what, "primegen") && !current && !total
&& (type == '.' || type == '+' || type == '!' && (type == '.' || type == '+' || type == '!'
|| type == '^' || type == '<' || type == '>')) || type == '^' || type == '<' || type == '>'))
@ -75,6 +77,9 @@ main (int argc, char **argv)
"</GnupgKeyParms>\n"; "</GnupgKeyParms>\n";
gpgme_genkey_result_t result; gpgme_genkey_result_t result;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -172,7 +172,7 @@ dump_opt (gpgme_conf_opt_t opt)
{ {
if (opt->argname) if (opt->argname)
{ {
char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : ""; const char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : "";
if (opt->flags & GPGME_CONF_OPTIONAL) if (opt->flags & GPGME_CONF_OPTIONAL)
{ {
@ -251,7 +251,7 @@ dump_comp (gpgme_conf_comp_t comp)
int int
main (int argc, char **argv) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -36,7 +36,7 @@
void void
check_result (gpgme_import_result_t result, char *fpr, int secret) check_result (gpgme_import_result_t result, const char *fpr, int secret)
{ {
if (result->considered != 1 && (secret && result->considered != 3)) if (result->considered != 1 && (secret && result->considered != 3))
{ {
@ -217,6 +217,9 @@ main (int argc, char *argv[])
char *pubkey_1_asc = make_filename ("pubkey-1.asc"); char *pubkey_1_asc = make_filename ("pubkey-1.asc");
char *seckey_1_asc = make_filename ("seckey-1.asc"); char *seckey_1_asc = make_filename ("seckey-1.asc");
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -36,20 +36,20 @@
struct struct
{ {
char *fpr; const char *fpr;
char *sec_keyid; const char *sec_keyid;
struct struct
{ {
char *name; const char *name;
char *comment; const char *comment;
char *email; const char *email;
struct struct
{ {
gpgme_pubkey_algo_t algo; gpgme_pubkey_algo_t algo;
char *keyid; const char *keyid;
char *name; const char *name;
char *comment; const char *comment;
char *email; const char *email;
unsigned int sig_class; unsigned int sig_class;
int exportable; int exportable;
} sig; } sig;
@ -72,7 +72,7 @@ keys[] =
int int
main (int argc, char **argv) main (void)
{ {
gpgme_error_t err; gpgme_error_t err;
gpgme_ctx_t ctx; gpgme_ctx_t ctx;

View File

@ -36,13 +36,13 @@
struct key_info_s struct key_info_s
{ {
char *fpr; const char *fpr;
char *sec_keyid; const char *sec_keyid;
struct struct
{ {
char *name; const char *name;
char *comment; const char *comment;
char *email; const char *email;
} uid[3]; } uid[3];
int n_subkeys; int n_subkeys;
void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key); void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key);
@ -132,6 +132,9 @@ main (int argc, char **argv)
int n; int n;
gpgme_subkey_t subkey; gpgme_subkey_t subkey;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -135,6 +135,9 @@ main (int argc, char *argv[])
int i; int i;
gpgme_engine_info_t engine_info; gpgme_engine_info_t engine_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_get_engine_info (&engine_info); err = gpgme_get_engine_info (&engine_info);

View File

@ -91,6 +91,9 @@ main (int argc, char **argv)
gpgme_sign_result_t result; gpgme_sign_result_t result;
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -103,6 +103,9 @@ main (int argc, char *argv[])
gpgme_sign_result_t result; gpgme_sign_result_t result;
char *agent_info; char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -140,15 +140,17 @@ thread_two (void *name)
} }
int int
main (int argc, char *argv[]) main (void)
{ {
pthread_t tone; pthread_t tone;
pthread_t ttwo; pthread_t ttwo;
char arg_A[] = "A";
char arg_B[] = "B";
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
pthread_create (&tone, NULL, thread_one, "A"); pthread_create (&tone, NULL, thread_one, arg_A);
pthread_create (&ttwo, NULL, thread_two, "B"); pthread_create (&ttwo, NULL, thread_two, arg_B);
pthread_join (tone, NULL); pthread_join (tone, NULL);
pthread_join (ttwo, NULL); pthread_join (ttwo, NULL);

View File

@ -41,6 +41,9 @@ main (int argc, char *argv[])
gpgme_error_t err; gpgme_error_t err;
gpgme_trust_item_t item; gpgme_trust_item_t item;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -92,7 +92,8 @@ static const char double_plaintext_sig[] =
static void static void
check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr, check_result (gpgme_verify_result_t result, unsigned int summary,
const char *fpr,
gpgme_error_t status, int notation) gpgme_error_t status, int notation)
{ {
gpgme_signature_t sig; gpgme_signature_t sig;
@ -209,6 +210,9 @@ main (int argc, char *argv[])
gpgme_data_t sig, text; gpgme_data_t sig, text;
gpgme_verify_result_t result; gpgme_verify_result_t result;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);

View File

@ -39,7 +39,7 @@
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -49,7 +49,7 @@ static const char test_cip1[] =
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -34,7 +34,7 @@
#include "t-support.h" #include "t-support.h"
int int
main (int argc, char **argv) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -35,7 +35,7 @@
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -40,6 +40,8 @@ static int progress_called;
static void static void
progress (void *self, const char *what, int type, int current, int total) progress (void *self, const char *what, int type, int current, int total)
{ {
(void)self;
if (!strcmp (what, "primegen") && !current && !total if (!strcmp (what, "primegen") && !current && !total
&& (type == '.' || type == '+' || type == '!' && (type == '.' || type == '+' || type == '!'
|| type == '^' || type == '<' || type == '>')) || type == '^' || type == '<' || type == '>'))
@ -58,7 +60,7 @@ progress (void *self, const char *what, int type, int current, int total)
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -36,9 +36,11 @@
void void
check_result (gpgme_import_result_t result, char *fpr, int total, check_result (gpgme_import_result_t result, const char *fpr, int total,
int total_stat) int total_stat)
{ {
(void)fpr;
if (result->considered != total) if (result->considered != total)
{ {
fprintf (stderr, "Unexpected number of considered keys %i\n", fprintf (stderr, "Unexpected number of considered keys %i\n",
@ -136,7 +138,7 @@ check_result (gpgme_import_result_t result, char *fpr, int total,
int int
main (int argc, char **argv) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -36,15 +36,15 @@
struct struct
{ {
char *fpr; const char *fpr;
int secret; int secret;
long timestamp; long timestamp;
long expires; long expires;
char *issuer_serial; const char *issuer_serial;
char *issuer_name; const char *issuer_name;
char *chain_id; const char *chain_id;
char *uid; const char *uid;
char *email; const char *email;
gpgme_validity_t validity; gpgme_validity_t validity;
unsigned int key_length; unsigned int key_length;
} }
@ -81,7 +81,7 @@ keys[] =
int int
main (int argc, char **argv) main (void)
{ {
gpgme_error_t err; gpgme_error_t err;
gpgme_ctx_t ctx; gpgme_ctx_t ctx;

View File

@ -81,7 +81,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
int int
main (int argc, char *argv[]) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -52,7 +52,7 @@ static const char test_sig1[] =
static void static void
check_result (gpgme_verify_result_t result, int summary, char *fpr, check_result (gpgme_verify_result_t result, int summary, const char *fpr,
gpgme_error_t status, gpgme_validity_t validity) gpgme_error_t status, gpgme_validity_t validity)
{ {
gpgme_signature_t sig; gpgme_signature_t sig;
@ -135,7 +135,7 @@ show_auditlog (gpgme_ctx_t ctx)
int int
main (int argc, char **argv) main (void)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;

View File

@ -46,6 +46,9 @@
static gpgme_error_t static gpgme_error_t
data_cb (void *opaque, const void *data, size_t datalen) data_cb (void *opaque, const void *data, size_t datalen)
{ {
(void)opaque;
(void)data;
printf ("DATA_CB: datalen=%d\n", (int)datalen); printf ("DATA_CB: datalen=%d\n", (int)datalen);
return 0; return 0;
} }
@ -58,6 +61,8 @@ inq_cb (void *opaque, const char *name, const char *args,
gpgme_data_t data; gpgme_data_t data;
gpgme_error_t err; gpgme_error_t err;
(void)opaque;
if (name) if (name)
{ {
printf ("INQ_CB: name=`%s' args=`%s'\n", name, args); printf ("INQ_CB: name=`%s' args=`%s'\n", name, args);
@ -91,6 +96,8 @@ inq_cb (void *opaque, const char *name, const char *args,
static gpgme_error_t static gpgme_error_t
status_cb (void *opaque, const char *status, const char *args) status_cb (void *opaque, const char *status, const char *args)
{ {
(void)opaque;
printf ("STATUS_CB: status=`%s' args=`%s'\n", status, args); printf ("STATUS_CB: status=`%s' args=`%s'\n", status, args);
return 0; return 0;
} }

View File

@ -51,6 +51,8 @@ print_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
gpgme_invalid_key_t invkey; gpgme_invalid_key_t invkey;
gpgme_new_signature_t sig; gpgme_new_signature_t sig;
(void)type;
for (invkey = result->invalid_signers; invkey; invkey = invkey->next) for (invkey = result->invalid_signers; invkey; invkey = invkey->next)
printf ("Signing key `%s' not used: %s <%s>\n", printf ("Signing key `%s' not used: %s <%s>\n",
nonnull (invkey->fpr), nonnull (invkey->fpr),

View File

@ -86,6 +86,8 @@ read_cb (void *cb_value, char *buffer, size_t count, size_t *nread)
unsigned int amount = strlen (text) - off; unsigned int amount = strlen (text) - off;
/* round_t round = *((round_t *) cb_value); */ /* round_t round = *((round_t *) cb_value); */
(void)cb_value;
if (!buffer && !count && !nread) if (!buffer && !count && !nread)
{ {
/* Rewind requested. */ /* Rewind requested. */
@ -190,8 +192,9 @@ write_test (round_t round, gpgme_data_t data)
} }
} }
int int
main (int argc, char **argv) main (void)
{ {
round_t round = TEST_INITIALIZER; round_t round = TEST_INITIALIZER;
char *text_filename = make_filename ("t-data-1.txt"); char *text_filename = make_filename ("t-data-1.txt");