diff options
| author | Werner Koch <[email protected]> | 2016-09-13 18:48:06 +0000 | 
|---|---|---|
| committer | Werner Koch <[email protected]> | 2016-09-13 18:48:06 +0000 | 
| commit | 9064eebdc05e7149c2c8cc899fbd7874622fb769 (patch) | |
| tree | e5bffc999f3c38f13cde215945ae8683a5e0c891 | |
| parent | tests: Use gpgme_io_write in passhrase callbacks. (diff) | |
| download | gpgme-9064eebdc05e7149c2c8cc899fbd7874622fb769.tar.gz gpgme-9064eebdc05e7149c2c8cc899fbd7874622fb769.zip | |
tests: Mark lots of unused vars and fix const mismatches.
Signed-off-by: Werner Koch <[email protected]>
36 files changed, 289 insertions, 216 deletions
| diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c index 823655fc..b774cfdd 100644 --- a/tests/gpg/t-decrypt-verify.c +++ b/tests/gpg/t-decrypt-verify.c @@ -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); diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c index b085e048..92fadd68 100644 --- a/tests/gpg/t-decrypt.c +++ b/tests/gpg/t-decrypt.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -36,7 +36,7 @@  #include "t-support.h" -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); @@ -61,7 +64,7 @@ main (int argc, char *argv[])    err = gpgme_data_new (&out);    fail_if_err (err); -   +    err = gpgme_op_decrypt (ctx, in, out);    fail_if_err (err);    result = gpgme_op_decrypt_result (ctx); @@ -72,7 +75,7 @@ main (int argc, char *argv[])        exit (1);      }    print_data (out); -    +    gpgme_data_release (in);    gpgme_data_release (out);    gpgme_release (ctx); diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c index 545db738..8b5f7cb6 100644 --- a/tests/gpg/t-edit.c +++ b/tests/gpg/t-edit.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -43,7 +43,7 @@ flush_data (gpgme_data_t dh)  {    char buf[100];    int ret; -   +    ret = gpgme_data_seek (dh, 0, SEEK_SET);    if (ret)      fail_if_err (gpgme_error_from_errno (errno)); @@ -57,11 +57,11 @@ 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); -  flush_data (out);  +  flush_data (out);    fprintf (stdout, "[-- Code: %i, %s --]\n", status, args); @@ -70,7 +70,7 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)        if (!strcmp (args, "keyedit.prompt"))  	{  	  static int step = 0; -	   +  	  switch (step)  	    {  	    case 0: @@ -110,7 +110,7 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)  } -int  +int  main (int argc, char **argv)  {    gpgme_ctx_t ctx; @@ -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); diff --git a/tests/gpg/t-encrypt-large.c b/tests/gpg/t-encrypt-large.c index 6cc6138c..8d78a049 100644 --- a/tests/gpg/t-encrypt-large.c +++ b/tests/gpg/t-encrypt-large.c @@ -2,17 +2,17 @@     Copyright (C) 2005 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -50,7 +50,7 @@ read_cb (void *handle, void *buffer, size_t size)    for (; size && parms->bytes_to_send; size--, parms->bytes_to_send--)      *p++ = rand (); -       +    return (p - (char*)buffer);  } @@ -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,13 +72,18 @@ 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;  } -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -94,7 +101,7 @@ main (int argc, char *argv[])      nbytes = 100000;    init_gpgme (GPGME_PROTOCOL_OpenPGP); -     +    memset (&cbs, 0, sizeof cbs);    cbs.read = read_cb;    cbs.write = write_cb; @@ -131,7 +138,7 @@ main (int argc, char *argv[])  	       result->invalid_recipients->fpr);        exit (1);      } -  printf ("plaintext=%u bytes, ciphertext=%u bytes\n",  +  printf ("plaintext=%u bytes, ciphertext=%u bytes\n",            (unsigned int)nbytes, (unsigned int)parms.bytes_received);    gpgme_key_unref (key[0]); diff --git a/tests/gpg/t-encrypt-mixed.c b/tests/gpg/t-encrypt-mixed.c index 488b1cea..afe5ba29 100644 --- a/tests/gpg/t-encrypt-mixed.c +++ b/tests/gpg/t-encrypt-mixed.c @@ -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; diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c index 1e1262f3..41d16a0a 100644 --- a/tests/gpg/t-encrypt-sign.c +++ b/tests/gpg/t-encrypt-sign.c @@ -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); diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c index 42dc3ca4..8e5e7ff4 100644 --- a/tests/gpg/t-encrypt-sym.c +++ b/tests/gpg/t-encrypt-sym.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -36,7 +36,7 @@  #include "t-support.h" -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); diff --git a/tests/gpg/t-encrypt.c b/tests/gpg/t-encrypt.c index 09474fef..6eafc00c 100644 --- a/tests/gpg/t-encrypt.c +++ b/tests/gpg/t-encrypt.c @@ -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); diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c index cb1e57c6..74af35fd 100644 --- a/tests/gpg/t-eventloop.c +++ b/tests/gpg/t-eventloop.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -167,8 +167,8 @@ struct gpgme_io_cbs io_cbs =    }; -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -214,7 +214,7 @@ main (int argc, char *argv[])    fputs ("Begin Result:\n", stdout);    print_data (out);    fputs ("End Result.\n", stdout); -    +    gpgme_key_unref (key[0]);    gpgme_key_unref (key[1]);    gpgme_data_release (in); diff --git a/tests/gpg/t-export.c b/tests/gpg/t-export.c index 85cff234..eaed829a 100644 --- a/tests/gpg/t-export.c +++ b/tests/gpg/t-export.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -35,7 +35,7 @@  #include "t-support.h" -int  +int  main (int argc, char **argv)  {    gpgme_ctx_t ctx; @@ -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); @@ -60,7 +63,7 @@ main (int argc, char **argv)    fputs ("Begin Result:\n", stdout);    print_data (out);    fputs ("End Result.\n", stdout); -    +    gpgme_data_release (out);    /* Again. Now using a key array.  */ @@ -84,11 +87,11 @@ main (int argc, char **argv)    fputs ("Begin Result:\n", stdout);    print_data (out);    fputs ("End Result.\n", stdout); -    +    gpgme_data_release (out);    gpgme_release (ctx); -    +    return 0;  } diff --git a/tests/gpg/t-file-name.c b/tests/gpg/t-file-name.c index dad4bd98..3c2a796b 100644 --- a/tests/gpg/t-file-name.c +++ b/tests/gpg/t-file-name.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -36,8 +36,8 @@  #define TESTNAME "abcde12345" -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -47,7 +47,7 @@ main (int argc, char *argv[])    char *agent_info;    init_gpgme (GPGME_PROTOCOL_OpenPGP); -     +    err = gpgme_new (&ctx);    fail_if_err (err);    gpgme_set_armor (ctx, 1); diff --git a/tests/gpg/t-genkey.c b/tests/gpg/t-genkey.c index 407824f6..f0127f78 100644 --- a/tests/gpg/t-genkey.c +++ b/tests/gpg/t-genkey.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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 == '>')) @@ -57,7 +59,7 @@ progress (void *self, const char *what, int type, int current, int total)  } -int  +int  main (int argc, char **argv)  {    gpgme_ctx_t ctx; @@ -75,13 +77,16 @@ 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);    fail_if_err (err);    gpgme_set_progress_cb (ctx, progress, NULL); -   +    err = gpgme_op_genkey (ctx, parms, NULL, NULL);    fail_if_err (err); diff --git a/tests/gpg/t-gpgconf.c b/tests/gpg/t-gpgconf.c index 8e487b7a..55033bfa 100644 --- a/tests/gpg/t-gpgconf.c +++ b/tests/gpg/t-gpgconf.c @@ -7,12 +7,12 @@     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -172,8 +172,8 @@ 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)  	    {  	      printf ("%c%c --%s [%s%s] %s", level, runtime, opt->name, opt->argname, more, @@ -187,7 +187,7 @@ dump_opt (gpgme_conf_opt_t opt)  	}        else  	printf ("%c%c --%s%s", level, runtime, opt->name, spaces (opt->name, 5)); -       +        if (opt->description)  	printf ("%s", opt->description);        printf ("\n"); @@ -250,8 +250,8 @@ dump_comp (gpgme_conf_comp_t comp)  } -int  -main (int argc, char **argv) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -302,13 +302,13 @@ main (int argc, char **argv)  	opt = comp->options;  	while (opt && strcmp (opt->name, "verbose"))  	  opt = opt->next; -	 +  	/* Allow for the verbose option not to be there.  */  	if (opt)  	  {  	    err = gpgme_conf_opt_change (opt, 0, arg);  	    fail_if_err (err); -	     +  	    err = gpgme_op_conf_save (ctx, comp);  	    fail_if_err (err);  	  } diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c index 41cfd233..89a58159 100644 --- a/tests/gpg/t-import.c +++ b/tests/gpg/t-import.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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))      { @@ -207,7 +207,7 @@ check_result (gpgme_import_result_t result, char *fpr, int secret)  } -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); diff --git a/tests/gpg/t-keylist-sig.c b/tests/gpg/t-keylist-sig.c index ec306249..fdec7ca2 100644 --- a/tests/gpg/t-keylist-sig.c +++ b/tests/gpg/t-keylist-sig.c @@ -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; diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c index 67844cb0..6ee023ca 100644 --- a/tests/gpg/t-keylist.c +++ b/tests/gpg/t-keylist.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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); @@ -121,7 +121,7 @@ struct key_info_s keys[] =    }; -int  +int  main (int argc, char **argv)  {    gpgme_error_t err; @@ -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); @@ -139,7 +142,7 @@ main (int argc, char **argv)    err = gpgme_op_keylist_start (ctx, NULL, 0);    fail_if_err (err); -     +    while (!(err = gpgme_op_keylist_next (ctx, &key)))      {        if (!keys[i].fpr) @@ -223,7 +226,7 @@ main (int argc, char **argv)  	  exit (1);  	} -      for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next)  +      for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next)          n++;        if (!n || n-1 != keys[i].n_subkeys)  	{ @@ -583,7 +586,7 @@ check_whisky (struct key_info_s *keyinfo, gpgme_key_t key)  {    const char *name = keyinfo->uid[0].name;    gpgme_subkey_t sub1, sub2; -   +    sub1 = key->subkeys->next->next;    sub2 = sub1->next; diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c index 98d50952..aee7551f 100644 --- a/tests/gpg/t-sig-notation.c +++ b/tests/gpg/t-sig-notation.c @@ -2,17 +2,17 @@     Copyright (C) 2005 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -44,14 +44,14 @@ static struct {    const char *value;    gpgme_sig_notation_flags_t flags;    int seen; -} expected_notations[] = {  +} expected_notations[] = {    { "laughing@me",      "Just Squeeze Me",      GPGME_SIG_NOTATION_HUMAN_READABLE },    { "[email protected]",      "pgpmime",      GPGME_SIG_NOTATION_HUMAN_READABLE | GPGME_SIG_NOTATION_CRITICAL }, -  { NULL,  +  { NULL,      "http://www.gnu.org/policy/",      0 }  }; @@ -61,7 +61,7 @@ check_result (gpgme_verify_result_t result)  {    int i;    gpgme_sig_notation_t r; -   +    gpgme_signature_t sig;    sig = result->signatures; @@ -74,7 +74,7 @@ check_result (gpgme_verify_result_t result)    for (i=0; i < DIM(expected_notations); i++ )      expected_notations[i].seen = 0; -   +    for (r = result->signatures->notations; r; r = r->next)      {        int any = 0; @@ -124,7 +124,7 @@ check_result (gpgme_verify_result_t result)  } -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); @@ -172,7 +175,7 @@ main (int argc, char *argv[])  				    expected_notations[i].flags);        fail_if_err (err);      } -   +    err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL);    fail_if_err (err); diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c index bdd3323b..66f54eaf 100644 --- a/tests/gpg/t-sign.c +++ b/tests/gpg/t-sign.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -82,7 +82,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)  } -int  +int  main (int argc, char **argv)  {    gpgme_ctx_t ctx; @@ -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); @@ -102,7 +105,7 @@ main (int argc, char **argv)    gpgme_set_textmode (ctx, 1);    gpgme_set_armor (ctx, 1); -   +  #if 0    {      gpgme_key_t akey; @@ -126,8 +129,8 @@ main (int argc, char **argv)    check_result (result, GPGME_SIG_MODE_NORMAL);    print_data (out);    gpgme_data_release (out); -     -  /* Now a detached signature.  */  + +  /* Now a detached signature.  */    gpgme_data_seek (in, 0, SEEK_SET);    err = gpgme_data_new (&out);    fail_if_err (err); diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c index c75c1d43..b1eb1913 100644 --- a/tests/gpg/t-signers.c +++ b/tests/gpg/t-signers.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -93,7 +93,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)  } -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); @@ -141,7 +144,7 @@ main (int argc, char *argv[])    check_result (result, GPGME_SIG_MODE_NORMAL);    print_data (out);    gpgme_data_release (out); -   +    /* Now a detached signature.  */    gpgme_data_seek (in, 0, SEEK_SET);    err = gpgme_data_new (&out); @@ -152,7 +155,7 @@ main (int argc, char *argv[])    check_result (result, GPGME_SIG_MODE_DETACH);    print_data (out);    gpgme_data_release (out); -     +    /* And finally a cleartext signature.  */    gpgme_data_seek (in, 0, SEEK_SET);    err = gpgme_data_new (&out); @@ -161,10 +164,10 @@ main (int argc, char *argv[])    fail_if_err (err);    result = gpgme_op_sign_result (ctx);    check_result (result, GPGME_SIG_MODE_CLEAR); -  print_data (out);   +  print_data (out);    gpgme_data_release (out);    gpgme_data_seek (in, 0, SEEK_SET); -       +    gpgme_data_release (in);    gpgme_release (ctx); diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index 7a0b9f9b..db69dd0e 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -61,7 +61,7 @@ print_data (gpgme_data_t dh)  #define BUF_SIZE 512    char buf[BUF_SIZE + 1];    int ret; -   +    ret = gpgme_data_seek (dh, 0, SEEK_SET);    if (ret)      fail_if_err (gpgme_err_code_from_errno (errno)); @@ -107,7 +107,7 @@ make_filename (const char *fname)    if (!srcdir)      srcdir = ".";    buf = malloc (strlen(srcdir) + strlen(fname) + 2); -  if (!buf)  +  if (!buf)      exit (8);    strcpy (buf, srcdir);    strcat (buf, "/"); diff --git a/tests/gpg/t-thread1.c b/tests/gpg/t-thread1.c index 0d4b2deb..2f9ee5dc 100644 --- a/tests/gpg/t-thread1.c +++ b/tests/gpg/t-thread1.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -68,7 +68,7 @@ thread_one (void *name)        err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",  			   &key[1], 0);        fail_if_err (err); -       +        err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);        fail_if_err (err);        result = gpgme_op_encrypt_result (ctx); @@ -119,7 +119,7 @@ thread_two (void *name)        err = gpgme_data_new (&out);        fail_if_err (err); -       +        err = gpgme_op_decrypt (ctx, in, out);        fail_if_err (err);        result = gpgme_op_decrypt_result (ctx); @@ -130,7 +130,7 @@ thread_two (void *name)  	  exit (1);  	}        printf ("Decrypt %s %i\n", (char *) name, i); -    +        gpgme_data_release (in);        gpgme_data_release (out);        gpgme_release (ctx); @@ -139,16 +139,18 @@ thread_two (void *name)    return NULL;  } -int  -main (int argc, char *argv[]) +int +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); diff --git a/tests/gpg/t-trustlist.c b/tests/gpg/t-trustlist.c index 5d245188..eeab85e9 100644 --- a/tests/gpg/t-trustlist.c +++ b/tests/gpg/t-trustlist.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -34,13 +34,16 @@  #include "t-support.h" -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx;    gpgme_error_t err;    gpgme_trust_item_t item; +  (void)argc; +  (void)argv; +    init_gpgme (GPGME_PROTOCOL_OpenPGP);    err = gpgme_new (&ctx); diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c index dceabac5..9842d3af 100644 --- a/tests/gpg/t-verify.c +++ b/tests/gpg/t-verify.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -77,7 +77,7 @@ static const char test_sig2[] =  "-----END PGP MESSAGE-----\n";  /* A message with a prepended but unsigned plaintext packet. */ -static const char double_plaintext_sig[] =  +static const char double_plaintext_sig[] =  "-----BEGIN PGP MESSAGE-----\n"  "\n"  "rDRiCmZvb2Jhci50eHRF4pxNVGhpcyBpcyBteSBzbmVha3kgcGxhaW50ZXh0IG1l\n" @@ -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; @@ -135,7 +136,7 @@ check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr,            " das waren Umlaute und jetzt ein prozent%-Zeichen" },          { "foobar.1",  	  "this is a notation data with 2 lines" }, -        { NULL,  +        { NULL,  	  "http://www.gu.org/policy/" }        };        int i; @@ -201,7 +202,7 @@ check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr,  } -int  +int  main (int argc, char *argv[])  {    gpgme_ctx_t ctx; @@ -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); diff --git a/tests/gpg/t-wait.c b/tests/gpg/t-wait.c index e58adade..352b9bfb 100644 --- a/tests/gpg/t-wait.c +++ b/tests/gpg/t-wait.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -38,8 +38,8 @@  #include "t-support.h" -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c index 654c7e12..658809c7 100644 --- a/tests/gpgsm/t-decrypt.c +++ b/tests/gpgsm/t-decrypt.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -48,8 +48,8 @@ static const char test_cip1[] =  "-----END CMS OBJECT-----\n"; -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -78,7 +78,7 @@ main (int argc, char *argv[])        exit (1);      }    print_data (out); -    +    gpgme_data_release (in);    gpgme_data_release (out);    gpgme_release (ctx); diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c index 45c772b8..50c7a339 100644 --- a/tests/gpgsm/t-encrypt.c +++ b/tests/gpgsm/t-encrypt.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -33,8 +33,8 @@  #include "t-support.h" -int  -main (int argc, char **argv) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -54,7 +54,7 @@ main (int argc, char **argv)    err = gpgme_data_new (&out);    fail_if_err (err); -     +    err = gpgme_get_key (ctx, "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",  		       &key[0], 0);    fail_if_err (err); diff --git a/tests/gpgsm/t-export.c b/tests/gpgsm/t-export.c index d8856f27..120df6b5 100644 --- a/tests/gpgsm/t-export.c +++ b/tests/gpgsm/t-export.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -34,15 +34,15 @@  #include "t-support.h" -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err;    gpgme_data_t out;    const char *pattern1[] = { "DFN Top Level Certification Authority", NULL };    const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", -                             "DFN Server Certification Authority",  +                             "DFN Server Certification Authority",                               NULL };    init_gpgme (GPGME_PROTOCOL_CMS); diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c index 9de9d547..fb05034f 100644 --- a/tests/gpgsm/t-genkey.c +++ b/tests/gpgsm/t-genkey.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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 == '>')) @@ -57,8 +59,8 @@ progress (void *self, const char *what, int type, int current, int total)  } -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -83,7 +85,7 @@ main (int argc, char *argv[])    gpgme_set_armor (ctx, 1);    gpgme_set_progress_cb (ctx, progress, NULL); -   +    err = gpgme_op_genkey (ctx, parms, certreq, NULL);    fail_if_err (err); diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c index adfebaaa..a8dfccaa 100644 --- a/tests/gpgsm/t-import.c +++ b/tests/gpgsm/t-import.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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", @@ -118,14 +120,14 @@ check_result (gpgme_import_result_t result, char *fpr, int total,  	       result->not_imported);        exit (1);      } -   +    {      int n;      gpgme_import_status_t r;      for (n=0, r=result->imports; r; r=r->next)        n++; -       +      if (n != total_stat)      {        fprintf (stderr, "Unexpected number of status reports\n"); @@ -135,8 +137,8 @@ check_result (gpgme_import_result_t result, char *fpr, int total,  } -int  -main (int argc, char **argv) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -149,7 +151,7 @@ main (int argc, char **argv)    err = gpgme_new (&ctx);    fail_if_err (err); -   +    gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);    err = gpgme_data_new_from_file (&in, cert_1, 1); diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c index 5204ab2e..314109c8 100644 --- a/tests/gpgsm/t-keylist.c +++ b/tests/gpgsm/t-keylist.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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;  } @@ -80,8 +80,8 @@ keys[] =    }; -int  -main (int argc, char **argv) +int +main (void)  {    gpgme_error_t err;    gpgme_ctx_t ctx; @@ -97,7 +97,7 @@ main (int argc, char **argv)    err = gpgme_op_keylist_start (ctx, NULL, 0);    fail_if_err (err); -     +    while (!(err = gpgme_op_keylist_next (ctx, &key)))      {        if (!keys[i].fpr) diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c index dc2d841e..d4e143dd 100644 --- a/tests/gpgsm/t-sign.c +++ b/tests/gpgsm/t-sign.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -80,8 +80,8 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)  } -int  -main (int argc, char *argv[]) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -109,8 +109,8 @@ main (int argc, char *argv[])    check_result (result, GPGME_SIG_MODE_NORMAL);    print_data (out);    gpgme_data_release (out); -     -  /* Now a detached signature.  */  + +  /* Now a detached signature.  */    gpgme_data_seek (in, 0, SEEK_SET);    err = gpgme_data_new (&out);    fail_if_err (err); diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h index ae3ad1f6..c3074db1 100644 --- a/tests/gpgsm/t-support.h +++ b/tests/gpgsm/t-support.h @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -47,7 +47,7 @@ print_data (gpgme_data_t dh)  #define BUF_SIZE 512    char buf[BUF_SIZE + 1];    int ret; -   +    ret = gpgme_data_seek (dh, 0, SEEK_SET);    if (ret)      fail_if_err (gpgme_error_from_errno (errno)); @@ -93,7 +93,7 @@ make_filename (const char *fname)    if (!srcdir)      srcdir = ".";    buf = malloc (strlen(srcdir) + strlen(fname) + 2); -  if (!buf)  +  if (!buf)      exit (8);    strcpy (buf, srcdir);    strcat (buf, "/"); diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c index 901b46fb..004a125e 100644 --- a/tests/gpgsm/t-verify.c +++ b/tests/gpgsm/t-verify.c @@ -3,17 +3,17 @@     Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH     This file is part of GPGME. -  +     GPGME is free software; you can redistribute it and/or modify it     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -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; @@ -134,8 +134,8 @@ show_auditlog (gpgme_ctx_t ctx) -int  -main (int argc, char **argv) +int +main (void)  {    gpgme_ctx_t ctx;    gpgme_error_t err; @@ -147,7 +147,7 @@ main (int argc, char **argv)    err = gpgme_new (&ctx);    fail_if_err (err);    gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); -   +    /* Checking a valid message.  */    err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0);    fail_if_err (err); @@ -179,6 +179,6 @@ main (int argc, char **argv)    gpgme_data_release (text);    gpgme_data_release (sig); -  gpgme_release (ctx);   +  gpgme_release (ctx);    return got_errors? 1 : 0;  } diff --git a/tests/opassuan/t-command.c b/tests/opassuan/t-command.c index 87f82024..9c791eee 100644 --- a/tests/opassuan/t-command.c +++ b/tests/opassuan/t-command.c @@ -7,12 +7,12 @@     under the terms of the GNU Lesser General Public License as     published by the Free Software Foundation; either version 2.1 of     the License, or (at your option) any later version. -    +     GPGME is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     Lesser General Public License for more details. -    +     You should have received a copy of the GNU Lesser General Public     License along with this program; if not, see <http://www.gnu.org/licenses/>.   */ @@ -46,9 +46,12 @@  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; -}      +}  static gpgme_error_t @@ -58,12 +61,14 @@ 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);        /* There shall be no data object.  */        assert (!*r_data); -       +        err = gpgme_data_new (&data);        fail_if_err (err);        *r_data = data; @@ -85,19 +90,21 @@ inq_cb (void *opaque, const char *name, const char *args,    return 0; -}      +}  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; -}      +} -int  +int  main (int argc, char **argv)  {    gpgme_error_t err; @@ -118,7 +125,7 @@ main (int argc, char **argv)        argv++;      }    command = argc? *argv : "NOP"; -   +    err = gpgme_new (&ctx);    fail_if_err (err); diff --git a/tests/run-sign.c b/tests/run-sign.c index c59c3563..70853ed6 100644 --- a/tests/run-sign.c +++ b/tests/run-sign.c @@ -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), diff --git a/tests/t-data.c b/tests/t-data.c index 178675c9..fe2d59ed 100644 --- a/tests/t-data.c +++ b/tests/t-data.c @@ -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"); | 
