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
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;
@ -104,6 +104,9 @@ main (int argc, char *argv[])
char *cipher_2_asc = make_filename ("cipher-2.asc");
char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
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 *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);

View File

@ -57,7 +57,7 @@ flush_data (gpgme_data_t dh)
gpgme_error_t
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;
fputs ("[-- Response --]\n", stdout);
@ -120,6 +120,9 @@ main (int argc, char **argv)
const char *pattern = "Alpha";
char *agent_info;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
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;
(void)buffer;
parms->bytes_received += size;
return size;
@ -70,6 +72,11 @@ static void
progress_cb (void *opaque, const char *what, int type, int current, int total)
{
/* 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
secret key but that the recipient is also set correctly. */
int
main (int argc, char *argv[])
main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@
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))
{
@ -217,6 +217,9 @@ main (int argc, char *argv[])
char *pubkey_1_asc = make_filename ("pubkey-1.asc");
char *seckey_1_asc = make_filename ("seckey-1.asc");
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -92,7 +92,8 @@ static const char double_plaintext_sig[] =
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_signature_t sig;
@ -209,6 +210,9 @@ main (int argc, char *argv[])
gpgme_data_t sig, text;
gpgme_verify_result_t result;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,9 +36,11 @@
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)
{
(void)fpr;
if (result->considered != total)
{
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
main (int argc, char **argv)
main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;

View File

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

View File

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

View File

@ -52,7 +52,7 @@ static const char test_sig1[] =
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_signature_t sig;
@ -135,7 +135,7 @@ show_auditlog (gpgme_ctx_t ctx)
int
main (int argc, char **argv)
main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;

View File

@ -46,6 +46,9 @@
static gpgme_error_t
data_cb (void *opaque, const void *data, size_t datalen)
{
(void)opaque;
(void)data;
printf ("DATA_CB: datalen=%d\n", (int)datalen);
return 0;
}
@ -58,6 +61,8 @@ inq_cb (void *opaque, const char *name, const char *args,
gpgme_data_t data;
gpgme_error_t err;
(void)opaque;
if (name)
{
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
status_cb (void *opaque, const char *status, const char *args)
{
(void)opaque;
printf ("STATUS_CB: status=`%s' args=`%s'\n", status, args);
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_new_signature_t sig;
(void)type;
for (invkey = result->invalid_signers; invkey; invkey = invkey->next)
printf ("Signing key `%s' not used: %s <%s>\n",
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;
/* round_t round = *((round_t *) cb_value); */
(void)cb_value;
if (!buffer && !count && !nread)
{
/* Rewind requested. */
@ -190,8 +192,9 @@ write_test (round_t round, gpgme_data_t data)
}
}
int
main (int argc, char **argv)
main (void)
{
round_t round = TEST_INITIALIZER;
char *text_filename = make_filename ("t-data-1.txt");