[git] GPGME - branch, master, updated. gpgme-1.6.0-348-g51f9acb

by Werner Koch cvs at cvs.gnupg.org
Tue Sep 13 21:02:41 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  51f9acbca935c5287d9a28205037b0923e9a65f5 (commit)
       via  686a065f639ef006e33c164e282d787bcd169754 (commit)
       via  3009e6162eaa39adaaf45f06fc4f88c7153360ee (commit)
       via  4a200146b602349eebb4eac2e102357748d7ba5b (commit)
       via  9064eebdc05e7149c2c8cc899fbd7874622fb769 (commit)
       via  4491ef0a9a15d3b307d1ade37ff620ef9fcb2478 (commit)
       via  3972f476e00f27d41a0aeabcb66600905b6737bd (commit)
       via  0510591c36591816a6ff3f87a04451001b7ed46f (commit)
      from  00c501d296da287bec2fd6a0e3912abfbde90a98 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 51f9acbca935c5287d9a28205037b0923e9a65f5
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:59:07 2016 +0200

    core: Use const char * where appropriate.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/engine-assuan.c b/src/engine-assuan.c
index 1f48173..5f0ea06 100644
--- a/src/engine-assuan.c
+++ b/src/engine-assuan.c
@@ -359,7 +359,7 @@ llass_set_locale (void *engine, int category, const char *value)
   gpgme_error_t err;
   engine_llass_t llass = engine;
   char *optstr;
-  char *catstr;
+  const char *catstr;
 
   if (!llass->opt.gpg_agent)
     return 0;
diff --git a/src/engine-g13.c b/src/engine-g13.c
index ce98b1b..7f225eb 100644
--- a/src/engine-g13.c
+++ b/src/engine-g13.c
@@ -356,7 +356,7 @@ g13_set_locale (void *engine, int category, const char *value)
   engine_g13_t g13 = engine;
   gpgme_error_t err;
   char *optstr;
-  char *catstr;
+  const char *catstr;
 
   /* FIXME: If value is NULL, we need to reset the option to default.
      But we can't do this.  So we error out here.  G13 needs support
@@ -405,7 +405,7 @@ g13_set_locale (void *engine, int category, const char *value)
 
 #if USE_DESCRIPTOR_PASSING
 static gpgme_error_t
-g13_assuan_simple_command (assuan_context_t ctx, char *cmd,
+g13_assuan_simple_command (assuan_context_t ctx, const char *cmd,
 			   engine_status_handler_t status_fnc,
 			   void *status_fnc_value)
 {
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 7270e36..f22d8b4 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1574,6 +1574,8 @@ gpg_passwd (void *engine, gpgme_key_t key, unsigned int flags)
   engine_gpg_t gpg = engine;
   gpgme_error_t err;
 
+  (void)flags;
+
   if (!key || !key->subkeys || !key->subkeys->fpr)
     return gpg_error (GPG_ERR_INV_CERT_OBJ);
 
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index 1cf5046..0610c7a 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -517,7 +517,7 @@ gpgsm_set_locale (void *engine, int category, const char *value)
   engine_gpgsm_t gpgsm = engine;
   gpgme_error_t err;
   char *optstr;
-  char *catstr;
+  const char *catstr;
 
   /* FIXME: If value is NULL, we need to reset the option to default.
      But we can't do this.  So we error out here.  GPGSM needs support
@@ -565,7 +565,7 @@ gpgsm_set_locale (void *engine, int category, const char *value)
 
 
 static gpgme_error_t
-gpgsm_assuan_simple_command (engine_gpgsm_t gpgsm, char *cmd,
+gpgsm_assuan_simple_command (engine_gpgsm_t gpgsm, const char *cmd,
 			     engine_status_handler_t status_fnc,
 			     void *status_fnc_value)
 {
@@ -674,7 +674,7 @@ gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt)
 {
   gpg_error_t err = 0;
   char line[COMMANDLINELEN];
-  char *which;
+  const char *which;
   iocb_data_t *iocb_data;
 #if USE_DESCRIPTOR_PASSING
   int dir;
@@ -1480,6 +1480,7 @@ gpgsm_genkey (void *engine,
     }
 
   (void)userid;
+  (void)algo;
   (void)expires;
   (void)key;
   (void)flags;
@@ -2017,6 +2018,8 @@ gpgsm_passwd (void *engine, gpgme_key_t key, unsigned int flags)
   gpgme_error_t err;
   char *line;
 
+  (void)flags;
+
   if (!key || !key->subkeys || !key->subkeys->fpr)
     return gpg_error (GPG_ERR_INV_CERT_OBJ);
 
diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c
index 215dbe3..2817527 100644
--- a/src/engine-uiserver.c
+++ b/src/engine-uiserver.c
@@ -251,6 +251,7 @@ uiserver_new (void **engine, const char *file_name, const char *home_dir,
   char *dft_ttytype = NULL;
   char *optstr;
 
+  (void)home_dir;
   (void)version; /* Not yet used.  */
 
   uiserver = calloc (1, sizeof *uiserver);
@@ -400,7 +401,7 @@ uiserver_set_locale (void *engine, int category, const char *value)
   engine_uiserver_t uiserver = engine;
   gpgme_error_t err;
   char *optstr;
-  char *catstr;
+  const char *catstr;
 
   /* FIXME: If value is NULL, we need to reset the option to default.
      But we can't do this.  So we error out here.  UISERVER needs support
@@ -459,7 +460,7 @@ uiserver_set_protocol (void *engine, gpgme_protocol_t protocol)
 
 
 static gpgme_error_t
-uiserver_assuan_simple_command (engine_uiserver_t uiserver, char *cmd,
+uiserver_assuan_simple_command (engine_uiserver_t uiserver, const char *cmd,
                                 engine_status_handler_t status_fnc,
                                 void *status_fnc_value)
 {
@@ -534,7 +535,7 @@ uiserver_set_fd (engine_uiserver_t uiserver, fd_type_t fd_type, const char *opt)
 {
   gpg_error_t err = 0;
   char line[COMMANDLINELEN];
-  char *which;
+  const char *which;
   iocb_data_t *iocb_data;
   int dir;
 
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index 80d7d72..fb158f1 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -202,7 +202,7 @@ peek_membuf (membuf_t *mb, size_t *len)
 

 /* SUPPORT.  */
 FILE *log_stream;
-char *program_name = "gpgme-tool";
+char program_name[] = "gpgme-tool";
 
 #define spacep(p)   (*(p) == ' ' || *(p) == '\t')
 
@@ -308,7 +308,7 @@ struct result_xml_state
 
 #define MAX_TAGS 20
   int next_tag;
-  char *tag[MAX_TAGS];
+  const char *tag[MAX_TAGS];
   int had_data[MAX_TAGS];
 };
 
@@ -492,7 +492,8 @@ result_xml_tag_end (struct result_xml_state *state)
 
 
 gpg_error_t
-result_add_error (struct result_xml_state *state, char *name, gpg_error_t err)
+result_add_error (struct result_xml_state *state,
+                  const char *name, gpg_error_t err)
 {
   char code[20];
   char msg[1024];
@@ -508,7 +509,7 @@ result_add_error (struct result_xml_state *state, char *name, gpg_error_t err)
 
 gpg_error_t
 result_add_pubkey_algo (struct result_xml_state *state,
-			char *name, gpgme_pubkey_algo_t algo)
+			const char *name, gpgme_pubkey_algo_t algo)
 {
   char code[20];
   char msg[80];
@@ -524,10 +525,11 @@ result_add_pubkey_algo (struct result_xml_state *state,
 
 gpg_error_t
 result_add_hash_algo (struct result_xml_state *state,
-			 char *name, gpgme_hash_algo_t algo)
+                      const char *name, gpgme_hash_algo_t algo)
 {
   char code[20];
   char msg[80];
+
   snprintf (code, sizeof (code) - 1, "0x%x", algo);
   snprintf (msg, sizeof (msg) - 1, "%s",
 	    gpgme_hash_algo_name (algo));
@@ -539,7 +541,8 @@ result_add_hash_algo (struct result_xml_state *state,
 
 
 gpg_error_t
-result_add_keyid (struct result_xml_state *state, char *name, char *keyid)
+result_add_keyid (struct result_xml_state *state,
+                  const char *name, const char *keyid)
 {
   result_xml_tag_start (state, name, NULL);
   result_xml_tag_data (state, keyid);
@@ -549,7 +552,8 @@ result_add_keyid (struct result_xml_state *state, char *name, char *keyid)
 
 
 gpg_error_t
-result_add_fpr (struct result_xml_state *state, char *name, char *fpr)
+result_add_fpr (struct result_xml_state *state,
+                const char *name, const char *fpr)
 {
   result_xml_tag_start (state, name, NULL);
   result_xml_tag_data (state, fpr);
@@ -559,7 +563,7 @@ result_add_fpr (struct result_xml_state *state, char *name, char *fpr)
 
 
 gpg_error_t
-result_add_timestamp (struct result_xml_state *state, char *name,
+result_add_timestamp (struct result_xml_state *state, const char *name,
 		      unsigned int timestamp)
 {
   char code[20];
@@ -572,10 +576,10 @@ result_add_timestamp (struct result_xml_state *state, char *name,
 
 
 gpg_error_t
-result_add_sig_mode (struct result_xml_state *state, char *name,
+result_add_sig_mode (struct result_xml_state *state, const char *name,
 		     gpgme_sig_mode_t sig_mode)
 {
-  char *mode;
+  const char *mode;
   char code[20];
 
   snprintf (code, sizeof (code) - 1, "%i", sig_mode);
@@ -602,7 +606,7 @@ result_add_sig_mode (struct result_xml_state *state, char *name,
 
 
 gpg_error_t
-result_add_protocol (struct result_xml_state *state, char *name,
+result_add_protocol (struct result_xml_state *state, const char *name,
 		     gpgme_protocol_t protocol)
 {
   const char *str;
@@ -620,7 +624,7 @@ result_add_protocol (struct result_xml_state *state, char *name,
 
 
 gpg_error_t
-result_add_validity (struct result_xml_state *state, char *name,
+result_add_validity (struct result_xml_state *state, const char *name,
 		     gpgme_validity_t validity)
 {
   const char *str;
@@ -657,7 +661,7 @@ result_add_validity (struct result_xml_state *state, char *name,
 
 gpg_error_t
 result_add_value (struct result_xml_state *state,
-		  char *name, unsigned int val)
+		  const char *name, unsigned int val)
 {
   char code[20];
 
@@ -670,7 +674,7 @@ result_add_value (struct result_xml_state *state,
 
 gpg_error_t
 result_add_string (struct result_xml_state *state,
-		   char *name, char *str)
+		   const char *name, const char *str)
 {
   if (!str)
     str = "";
diff --git a/src/posix-io.c b/src/posix-io.c
index 258e8ea..c0b2f4f 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -282,7 +282,7 @@ _gpgme_io_set_nonblocking (int fd)
 static long int
 get_max_fds (void)
 {
-  char *source = NULL;
+  const char *source = NULL;
   long int fds = -1;
   int rc;
 
diff --git a/src/version.c b/src/version.c
index a9bf7b8..8bc898f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -196,7 +196,7 @@ _gpgme_compare_versions (const char *my_version,
 const char *
 gpgme_check_version (const char *req_version)
 {
-  char *result;
+  const char *result;
   do_subsystem_inits ();
 
   /* Catch-22: We need to get at least the debug subsystem ready

commit 686a065f639ef006e33c164e282d787bcd169754
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:57:15 2016 +0200

    core: Cast away the common const problem with spawn and argv.
    
    * src/dirinfo.c (read_gpgconf_dirs): Use a cast to assignd to ARGV.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/dirinfo.c b/src/dirinfo.c
index ecb1c0c..b24a8a0 100644
--- a/src/dirinfo.c
+++ b/src/dirinfo.c
@@ -193,7 +193,7 @@ read_gpgconf_dirs (const char *pgmname, int components)
   char *mark = NULL;
 
   argv[0] = (char *)pgmname;
-  argv[1] = components? "--list-components" : "--list-dirs";
+  argv[1] = (char*)(components? "--list-components" : "--list-dirs");
   argv[2] = NULL;
 
   if (_gpgme_io_pipe (rp, 1) < 0)
diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index d5e7e2b..015ef00 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -200,7 +200,7 @@ gpgconf_config_release (gpgme_conf_comp_t conf)
    allow for quite a long "group" line, which is usually the longest
    line (mine is currently ~3k).  */
 static gpgme_error_t
-gpgconf_read (void *engine, char *arg1, char *arg2,
+gpgconf_read (void *engine, const char *arg1, char *arg2,
 	      gpgme_error_t (*cb) (void *hook, char *line),
 	      void *hook)
 {
@@ -217,7 +217,7 @@ gpgconf_read (void *engine, char *arg1, char *arg2,
   int nread;
   char *mark = NULL;
 
-  argv[1] = arg1;
+  argv[1] = (char*)arg1;
   argv[2] = arg2;
 
 
@@ -678,14 +678,14 @@ _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
 /* FIXME: Major problem: We don't get errors from gpgconf.  */
 
 static gpgme_error_t
-gpgconf_write (void *engine, char *arg1, char *arg2, gpgme_data_t conf)
+gpgconf_write (void *engine, const char *arg1, char *arg2, gpgme_data_t conf)
 {
   struct engine_gpgconf *gpgconf = engine;
   gpgme_error_t err = 0;
 #define BUFLEN 1024
   char buf[BUFLEN];
   int buflen = 0;
-  char *argv[] = { NULL /* file_name */, arg1, arg2, 0 };
+  char *argv[] = { NULL /* file_name */, (char*)arg1, arg2, 0 };
   int rp[2];
   struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} };
   int status;

commit 3009e6162eaa39adaaf45f06fc4f88c7153360ee
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:54:55 2016 +0200

    core: Fix condition-always-true warning in trace macro.
    
    * src/data-compat.c (old_user_read): Cast AMT.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/data-compat.c b/src/data-compat.c
index ec80172..5c7d543 100644
--- a/src/data-compat.c
+++ b/src/data-compat.c
@@ -187,7 +187,7 @@ old_user_read (gpgme_data_t dh, void *buffer, size_t size)
 				 buffer, size, &amt);
   if (err)
     return TRACE_SYSRES (gpgme_error_to_errno (err));
-  return TRACE_SYSRES (amt);
+  return TRACE_SYSRES ((gpgme_ssize_t)amt);
 }
 
 

commit 4a200146b602349eebb4eac2e102357748d7ba5b
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:53:14 2016 +0200

    core: Mark unused function args.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/assuan-support.c b/src/assuan-support.c
index 745d2aa..2cfdc35 100644
--- a/src/assuan-support.c
+++ b/src/assuan-support.c
@@ -26,6 +26,10 @@ int
 _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook,
 		      unsigned int cat, const char *msg)
 {
+  (void)ctx;
+  (void)hook;
+  (void)cat;
+
   if (msg == NULL)
     return 1;
 
@@ -49,6 +53,8 @@ my_pipe (assuan_context_t ctx, assuan_fd_t fds[2], int inherit_idx)
   int res;
   int gfds[2];
 
+  (void)ctx;
+
   res = _gpgme_io_pipe (gfds, inherit_idx);
 
   /* For now... */
@@ -64,6 +70,7 @@ my_pipe (assuan_context_t ctx, assuan_fd_t fds[2], int inherit_idx)
 static int
 my_close (assuan_context_t ctx, assuan_fd_t fd)
 {
+  (void)ctx;
   return _gpgme_io_close ((int) fd);
 }
 
@@ -71,6 +78,7 @@ my_close (assuan_context_t ctx, assuan_fd_t fd)
 static gpgme_ssize_t
 my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
 {
+  (void)ctx;
   return _gpgme_io_read ((int) fd, buffer, size);
 }
 
@@ -78,6 +86,7 @@ my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
 static gpgme_ssize_t
 my_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size)
 {
+  (void)ctx;
   return _gpgme_io_write ((int) fd, buffer, size);
 }
 
@@ -86,6 +95,7 @@ static int
 my_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg,
 	    int flags)
 {
+  (void)ctx;
 #ifdef HAVE_W32_SYSTEM
   gpg_err_set_errno (ENOSYS);
   return -1;
@@ -100,6 +110,7 @@ static int
 my_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg,
 	    int flags)
 {
+  (void)ctx;
 #ifdef HAVE_W32_SYSTEM
   gpg_err_set_errno (ENOSYS);
   return -1;
@@ -124,6 +135,9 @@ my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
   struct spawn_fd_item_s *fd_items;
   int i;
 
+  (void)ctx;
+  (void)flags;
+
   assert (name);
 
   if (! name)
@@ -194,6 +208,7 @@ static pid_t
 my_waitpid (assuan_context_t ctx, pid_t pid,
 	    int nowait, int *status, int options)
 {
+  (void)ctx;
 #ifdef HAVE_W32_SYSTEM
   CloseHandle ((HANDLE) pid);
 #else
@@ -226,6 +241,7 @@ my_socketpair (assuan_context_t ctx, int namespace, int style,
 static int
 my_socket (assuan_context_t ctx, int namespace, int style, int protocol)
 {
+  (void)ctx;
   return _gpgme_io_socket (namespace, style, protocol);
 }
 
@@ -234,6 +250,7 @@ static int
 my_connect (assuan_context_t ctx, int sock, struct sockaddr *addr,
 	    socklen_t length)
 {
+  (void)ctx;
   return _gpgme_io_connect (sock, addr, length);
 }
 
diff --git a/src/data-identify.c b/src/data-identify.c
index 1edfb9b..a5da7f5 100644
--- a/src/data-identify.c
+++ b/src/data-identify.c
@@ -489,6 +489,8 @@ gpgme_data_identify (gpgme_data_t dh, int reserved)
   int n;
   gpgme_off_t off;
 
+  (void)reserved;
+
   /* Check whether we can seek the data object.  */
   off = gpgme_data_seek (dh, 0, SEEK_CUR);
   if (off == (gpgme_off_t)(-1))
diff --git a/src/delete.c b/src/delete.c
index d7fdf50..fc99aac 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -33,6 +33,8 @@
 static gpgme_error_t
 delete_status_handler (void *priv, gpgme_status_code_t code, char *args)
 {
+  (void)priv;
+
   if (code == GPGME_STATUS_DELETE_PROBLEM)
     {
       enum delete_problem
diff --git a/src/engine-assuan.c b/src/engine-assuan.c
index c4a84a3..1f48173 100644
--- a/src/engine-assuan.c
+++ b/src/engine-assuan.c
@@ -131,6 +131,7 @@ llass_get_home_dir (void)
 static char *
 llass_get_version (const char *file_name)
 {
+  (void)file_name;
   return NULL;
 }
 
diff --git a/src/engine-g13.c b/src/engine-g13.c
index afb085d..ce98b1b 100644
--- a/src/engine-g13.c
+++ b/src/engine-g13.c
@@ -413,6 +413,9 @@ g13_assuan_simple_command (assuan_context_t ctx, char *cmd,
   char *line;
   size_t linelen;
 
+  (void)status_fnc;
+  (void)status_fnc_value;
+
   err = assuan_write_line (ctx, cmd);
   if (err)
     return err;
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index c528d05..7270e36 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -2540,6 +2540,8 @@ gpg_keylist (void *engine, const char *pattern, int secret_only,
   engine_gpg_t gpg = engine;
   gpgme_error_t err;
 
+  (void)engine_flags;
+
   err = gpg_keylist_build_options (gpg, secret_only, mode);
 
   if (!err && pattern && *pattern)
@@ -2559,6 +2561,8 @@ gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
   engine_gpg_t gpg = engine;
   gpgme_error_t err;
 
+  (void)engine_flags;
+
   if (reserved)
     return gpg_error (GPG_ERR_INV_VALUE);
 
@@ -2585,6 +2589,8 @@ gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
   engine_gpg_t gpg = engine;
   gpgme_error_t err;
 
+  (void)include_certs;
+
   if (mode == GPGME_SIG_MODE_CLEAR)
     err = add_arg (gpg, "--clearsign");
   else
diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index 2e25d76..d5e7e2b 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -912,6 +912,8 @@ gpgconf_conf_save (void *engine, gpgme_conf_comp_t comp)
 static void
 gpgconf_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
 {
+  (void)engine;
+  (void)io_cbs;
   /* Nothing to do.  */
 }
 
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index 81e8fab..1cf5046 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -185,6 +185,8 @@ close_notify_handler (int fd, void *opaque)
 static gpgme_error_t
 default_inq_cb (engine_gpgsm_t gpgsm, const char *line)
 {
+  (void)gpgsm;
+
   if (!strncmp (line, "PINENTRY_LAUNCHED", 17) && (line[17]==' '||!line[17]))
     {
       _gpgme_allow_set_foreground_window ((pid_t)strtoul (line+17, NULL, 10));
@@ -660,6 +662,9 @@ gpgsm_clear_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type)
       _gpgme_io_close (gpgsm->message_cb.fd);
       break;
     }
+#else
+  (void)gpgsm;
+  (void)fd_type;
 #endif
 }
 
@@ -1133,6 +1138,8 @@ gpgsm_delete (void *engine, gpgme_key_t key, int allow_secret)
   char *line;
   int length = 8;	/* "DELKEYS " */
 
+  (void)allow_secret;
+
   if (!fpr)
     return gpg_error (GPG_ERR_INV_VALUE);
 
@@ -1816,6 +1823,8 @@ gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
   int i;
   gpgme_key_t key;
 
+  (void)use_textmode;
+
   if (!gpgsm)
     return gpg_error (GPG_ERR_INV_VALUE);
 
diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c
index 2ed7825..215dbe3 100644
--- a/src/engine-uiserver.c
+++ b/src/engine-uiserver.c
@@ -187,6 +187,8 @@ close_notify_handler (int fd, void *opaque)
 static gpgme_error_t
 default_inq_cb (engine_uiserver_t uiserver, const char *line)
 {
+  (void)uiserver;
+
   if (!strncmp (line, "PINENTRY_LAUNCHED", 17) && (line[17]==' '||!line[17]))
     {
       _gpgme_allow_set_foreground_window ((pid_t)strtoul (line+17, NULL, 10));
@@ -1151,6 +1153,9 @@ uiserver_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
   char *cmd;
   gpgme_key_t key;
 
+  (void)use_textmode;
+  (void)include_certs;
+
   if (!uiserver || !in || !out)
     return gpg_error (GPG_ERR_INV_VALUE);
   if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT)
diff --git a/src/getauditlog.c b/src/getauditlog.c
index 3bb4138..e2ba25e 100644
--- a/src/getauditlog.c
+++ b/src/getauditlog.c
@@ -31,6 +31,9 @@
 static gpgme_error_t
 getauditlog_status_handler (void *priv, gpgme_status_code_t code, char *args)
 {
+  (void)priv;
+  (void)code;
+  (void)args;
   return 0;
 }
 
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index ec85039..80d7d72 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -1809,6 +1809,8 @@ server_passphrase_cb (void *opaque, const char *uid_hint, const char *info,
   unsigned char *buf = NULL;
   size_t buflen = 0;
 
+  (void)was_bad;
+
   if (server && server->assuan_ctx)
     {
       if (uid_hint)
@@ -1983,6 +1985,9 @@ static gpg_error_t
 reset_notify (assuan_context_t ctx, char *line)
 {
   struct server *server = assuan_get_pointer (ctx);
+
+  (void)line;
+
   server_reset_fds (server);
   gt_reset (server->gt);
   return 0;
@@ -2306,6 +2311,8 @@ cmd_signers_clear (assuan_context_t ctx, char *line)
 {
   struct server *server = assuan_get_pointer (ctx);
 
+  (void)line;
+
   return gt_signers_clear (server->gt);
 }
 
@@ -2322,6 +2329,8 @@ _cmd_decrypt_verify (assuan_context_t ctx, char *line, int verify)
   gpgme_data_t inp_data;
   gpgme_data_t out_data;
 
+  (void)line;
+
   inp_fd = server->input_fd;
   inp_fn = server->input_filename;
   if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
@@ -2548,6 +2557,8 @@ cmd_verify (assuan_context_t ctx, char *line)
   gpgme_data_t msg_data = NULL;
   gpgme_data_t out_data = NULL;
 
+  (void)line;
+
   inp_fd = server->input_fd;
   inp_fn = server->input_filename;
   if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
@@ -2723,6 +2734,8 @@ cmd_genkey (assuan_context_t ctx, char *line)
   gpgme_data_t parms_data = NULL;
   const char *parms;
 
+  (void)line;
+
   inp_fd = server->input_fd;
   inp_fn = server->input_filename;
   if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
@@ -3038,6 +3051,9 @@ static gpg_error_t
 cmd_result (assuan_context_t ctx, char *line)
 {
   struct server *server = assuan_get_pointer (ctx);
+
+  (void)line;
+
   return gt_result (server->gt, GT_RESULT_ALL);
 }
 
@@ -3093,6 +3109,8 @@ cmd_identify (assuan_context_t ctx, char *line)
   char *inp_fn;
   gpgme_data_t inp_data;
 
+  (void)line;
+
   inp_fd = server->input_fd;
   inp_fn = server->input_filename;
   if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
diff --git a/src/keylist.c b/src/keylist.c
index f7912e6..8a0c5a3 100644
--- a/src/keylist.c
+++ b/src/keylist.c
@@ -122,6 +122,8 @@ keylist_status_handler (void *priv, gpgme_status_code_t code, char *args)
   void *hook;
   op_data_t opd;
 
+  (void)args;
+
   err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL);
   opd = hook;
   if (err)
diff --git a/src/op-support.c b/src/op-support.c
index a74405e..9f10cd3 100644
--- a/src/op-support.c
+++ b/src/op-support.c
@@ -213,6 +213,8 @@ _gpgme_parse_inv_recp (char *args, int for_signing,
   char *tail;
   long int reason;
 
+  (void)for_signing;
+
   inv_key = calloc (1, sizeof (*inv_key));
   if (!inv_key)
     return gpg_error_from_syserror ();
diff --git a/src/posix-util.c b/src/posix-util.c
index 0fce5c2..889c6aa 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -145,6 +145,8 @@ _gpgme_get_gpgconf_path (void)
 int
 _gpgme_get_conf_int (const char *key, int *value)
 {
+  (void)key;
+  (void)value;
   return 0;
 }
 
diff --git a/src/trustlist.c b/src/trustlist.c
index d456780..c85ef87 100644
--- a/src/trustlist.c
+++ b/src/trustlist.c
@@ -52,6 +52,9 @@ typedef struct
 static gpgme_error_t
 trustlist_status_handler (void *priv, gpgme_status_code_t code, char *args)
 {
+  (void)priv;
+  (void)code;
+  (void)args;
   return 0;
 }
 
diff --git a/src/verify.c b/src/verify.c
index 5ac937d..6bdbe66 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -1264,6 +1264,8 @@ gpgme_get_sig_ulong_attr (gpgme_ctx_t ctx, int idx,
   gpgme_verify_result_t result;
   gpgme_signature_t sig;
 
+  (void)whatidx;
+
   result = gpgme_op_verify_result (ctx);
   sig = result->signatures;
 
diff --git a/src/version.c b/src/version.c
index e2f1c35..a9bf7b8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -307,7 +307,7 @@ _gpgme_get_program_version (const char *const file_name)
   char *mark = NULL;
   int rp[2];
   int nread;
-  char *argv[] = {NULL /* file_name */, "--version", 0};
+  char *argv[] = {NULL /* file_name */, (char*)"--version", 0};
   struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0},
 				   {-1, -1} };
   int status;
diff --git a/src/vfs-create.c b/src/vfs-create.c
index 48931b9..a01d4da 100644
--- a/src/vfs-create.c
+++ b/src/vfs-create.c
@@ -118,6 +118,8 @@ _gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[],
   char *container_file_esc = NULL;
   int i;
 
+  (void)flags;
+
   /* We want to encourage people to check error values, so not getting
      them is discouraged here.  Also makes our code easier.  */
   if (! op_err)
diff --git a/src/vfs-mount.c b/src/vfs-mount.c
index b9b1b4d..5d2f2a9 100644
--- a/src/vfs-mount.c
+++ b/src/vfs-mount.c
@@ -173,6 +173,8 @@ _gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
   char *cmd;
   char *container_file_esc = NULL;
 
+  (void)flags;
+
   /* We want to encourage people to check error values, so not getting
      them is discouraged here.  Also makes our code easier.  */
   if (! op_err)
diff --git a/src/wait-user.c b/src/wait-user.c
index ba28761..c7bc80f 100644
--- a/src/wait-user.c
+++ b/src/wait-user.c
@@ -46,6 +46,8 @@ _gpgme_user_io_cb_handler (void *data, int fd)
   struct tag *tag = (struct tag *) data;
   gpgme_ctx_t ctx;
 
+  (void)fd;
+
   assert (data);
   ctx = tag->ctx;
   assert (ctx);

commit 9064eebdc05e7149c2c8cc899fbd7874622fb769
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:48:06 2016 +0200

    tests: Mark lots of unused vars and fix const mismatches.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c
index 823655f..b774cfd 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 b085e04..92fadd6 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 545db73..8b5f7cb 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 6cc6138..8d78a04 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 488b1ce..afe5ba2 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 1e1262f..41d16a0 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 42dc3ca..8e5e7ff 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 09474fe..6eafc00 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 cb1e57c..74af35f 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 85cff23..eaed829 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 dad4bd9..3c2a796 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 407824f..f0127f7 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 8e487b7..55033bf 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 41cfd23..89a5815 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 ec30624..fdec7ca 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 67844cb..6ee023c 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 98d5095..aee7551 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 at me",
     "Just Squeeze Me",
     GPGME_SIG_NOTATION_HUMAN_READABLE },
   { "preferred-email-encoding at pgp.com",
     "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 bdd3323..66f54ea 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 c75c1d4..b1eb191 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 7a0b9f9..db69dd0 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 0d4b2de..2f9ee5d 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 5d24518..eeab85e 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 dceabac..9842d3a 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 e58adad..352b9bf 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 654c7e1..658809c 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 45c772b..50c7a33 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 d8856f2..120df6b 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 9de9d54..fb05034 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 adfebaa..a8dfcca 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 5204ab2..314109c 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 dc2d841..d4e143d 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 ae3ad1f..c3074db 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 901b46f..004a125 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 87f8202..9c791ee 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 c59c356..70853ed 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 178675c..fe2d59e 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");

commit 4491ef0a9a15d3b307d1ade37ff620ef9fcb2478
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:46:41 2016 +0200

    tests: Use gpgme_io_write in passhrase callbacks.
    
    * tests/gpg/t-support.h (passphrase_cb): Use gpgme_io_write.
    * tests/gpgsm/t-support.h (passphrase_cb): Ditto.
    * tests/run-support.h (passphrase_cb): Ditto.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h
index 6a18b5c..7a0b9f9 100644
--- a/tests/gpg/t-support.h
+++ b/tests/gpg/t-support.h
@@ -76,27 +76,25 @@ gpgme_error_t
 passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
 	       int last_was_bad, int fd)
 {
-#ifdef HAVE_W32_SYSTEM
-  DWORD written;
-  WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
-#else
   int res;
-  char *pass = "abc\n";
+  char pass[] = "abc\n";
   int passlen = strlen (pass);
   int off = 0;
 
+  (void)opaque;
+  (void)uid_hint;
+  (void)passphrase_info;
+  (void)last_was_bad;
+
   do
     {
-      res = write (fd, &pass[off], passlen - off);
+      res = gpgme_io_write (fd, &pass[off], passlen - off);
       if (res > 0)
 	off += res;
     }
   while (res > 0 && off != passlen);
 
   return off == passlen ? 0 : gpgme_error_from_errno (errno);
-#endif
-
-  return 0;
 }
 
 
diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h
index cc1a7db..ae3ad1f 100644
--- a/tests/gpgsm/t-support.h
+++ b/tests/gpgsm/t-support.h
@@ -63,13 +63,18 @@ passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
 	       int last_was_bad, int fd)
 {
   int res;
-  char *pass = "abc\n";
+  char pass[] = "abc\n";
   int passlen = strlen (pass);
   int off = 0;
 
+  (void)opaque;
+  (void)uid_hint;
+  (void)passphrase_info;
+  (void)last_was_bad;
+
   do
     {
-      res = write (fd, &pass[off], passlen - off);
+      res = gpgme_io_write (fd, &pass[off], passlen - off);
       if (res > 0)
 	off += res;
     }
diff --git a/tests/run-support.h b/tests/run-support.h
index b1aea4b..e4a4f70 100644
--- a/tests/run-support.h
+++ b/tests/run-support.h
@@ -75,27 +75,25 @@ gpgme_error_t
 passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
 	       int last_was_bad, int fd)
 {
-#ifdef HAVE_W32_SYSTEM
-  DWORD written;
-  WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
-#else
   int res;
-  char *pass = "abc\n";
+  char pass[] = "abc\n";
   int passlen = strlen (pass);
   int off = 0;
 
+  (void)opaque;
+  (void)uid_hint;
+  (void)passphrase_info;
+  (void)last_was_bad;
+
   do
     {
-      res = write (fd, &pass[off], passlen - off);
+      res = gpgme_io_write (fd, &pass[off], passlen - off);
       if (res > 0)
 	off += res;
     }
   while (res > 0 && off != passlen);
 
   return off == passlen ? 0 : gpgme_error_from_errno (errno);
-#endif
-
-  return 0;
 }
 
 

commit 3972f476e00f27d41a0aeabcb66600905b6737bd
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:44:59 2016 +0200

    core: Do not pass const char* to functions taking a char*.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/argparse.c b/src/argparse.c
index b6abf86..003334f 100644
--- a/src/argparse.c
+++ b/src/argparse.c
@@ -895,6 +895,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
   char **argv;
   char *s, *s2;
   int i;
+  char string_with_x[] = "x";
 
   initialize( arg, NULL, NULL );
   argc = *arg->argc;
@@ -1106,7 +1107,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
 		    argc--; argv++; idx++; /* Skip one.  */
                   }
               }
-	    s = "x"; /* This is so that !s[1] yields false.  */
+	    s = string_with_x; /* This is so that !s[1] yields false.  */
           }
 	else
           {
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 289578b..c528d05 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1081,7 +1081,11 @@ read_status (engine_gpg_t gpg)
         err = gpg->status.mon_cb (gpg->status.mon_cb_value,
                                   GPGME_STATUS_EOF, "");
       if (gpg->status.fnc)
-        err = gpg->status.fnc (gpg->status.fnc_value, GPGME_STATUS_EOF, "");
+        {
+          char emptystring[1] = {0};
+          err = gpg->status.fnc (gpg->status.fnc_value,
+                                 GPGME_STATUS_EOF, emptystring);
+        }
 
       return err;
     }
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index 3f3230b..81e8fab 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -818,8 +818,11 @@ status_handler (void *opaque, int fd)
 	       && (line[2] == '\0' || line[2] == ' '))
 	{
 	  if (gpgsm->status.fnc)
-	    err = gpgsm->status.fnc (gpgsm->status.fnc_value,
-				     GPGME_STATUS_EOF, "");
+            {
+              char emptystring[1] = {0};
+              err = gpgsm->status.fnc (gpgsm->status.fnc_value,
+                                       GPGME_STATUS_EOF, emptystring);
+            }
 
 	  if (!err && gpgsm->colon.fnc && gpgsm->colon.any)
             {
diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c
index de12f2b..2ed7825 100644
--- a/src/engine-uiserver.c
+++ b/src/engine-uiserver.c
@@ -669,8 +669,11 @@ status_handler (void *opaque, int fd)
 	       && (line[2] == '\0' || line[2] == ' '))
 	{
 	  if (uiserver->status.fnc)
-	    err = uiserver->status.fnc (uiserver->status.fnc_value,
-				     GPGME_STATUS_EOF, "");
+            {
+              char emptystring[1] = {0};
+              err = uiserver->status.fnc (uiserver->status.fnc_value,
+                                          GPGME_STATUS_EOF, emptystring);
+            }
 
 	  if (!err && uiserver->colon.fnc && uiserver->colon.any)
             {
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index 5ad5b25..ec85039 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -337,13 +337,14 @@ result_xml_indent (struct result_xml_state *state)
 
 
 gpg_error_t
-result_xml_tag_start (struct result_xml_state *state, char *name, ...)
+result_xml_tag_start (struct result_xml_state *state, const char *name, ...)
 {
   result_xml_write_cb_t cb = state->cb;
   void *hook = state->hook;
   va_list ap;
   char *attr;
   char *attr_val;
+  char string_null[] = "(null)";
 
   va_start (ap, name);
 
@@ -374,7 +375,7 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...)
 
       attr_val = va_arg (ap, char *);
       if (attr_val == NULL)
-	attr_val = "(null)";
+	attr_val = string_null;
 
       (*cb) (hook, " ", 1);
       (*cb) (hook, attr, strlen (attr));

commit 0510591c36591816a6ff3f87a04451001b7ed46f
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 13 20:41:16 2016 +0200

    build: Use more compiler warnings
    
    * configure.ac: Add useful compiler warnings.
    --
    
    It is strange that this seems to be the only GnuPG package which does
    not use modern warning.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/configure.ac b/configure.ac
index 744b52a..bac7908 100644
--- a/configure.ac
+++ b/configure.ac
@@ -512,6 +512,35 @@ AM_SUBST_NOTMAKE(API__SSIZE_T)
 # Checks for compiler features.
 if test "$GCC" = yes; then
     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
+    if test "$USE_MAINTAINER_MODE" = "yes"; then
+        CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
+
+        # If -Wno-missing-field-initializers is supported we can enable a
+        # a bunch of really useful warnings.
+        AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
+        _gcc_cflags_save=$CFLAGS
+        CFLAGS="-Wno-missing-field-initializers"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
+        AC_MSG_RESULT($_gcc_wopt)
+        CFLAGS=$_gcc_cflags_save;
+        if test x"$_gcc_wopt" = xyes ; then
+          CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
+          CFLAGS="$CFLAGS -Wwrite-strings"
+          CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+          CFLAGS="$CFLAGS -Wno-missing-field-initializers"
+          CFLAGS="$CFLAGS -Wno-sign-compare"
+        fi
+
+        AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
+        _gcc_cflags_save=$CFLAGS
+        CFLAGS="-Wpointer-arith"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
+        AC_MSG_RESULT($_gcc_wopt)
+        CFLAGS=$_gcc_cflags_save;
+        if test x"$_gcc_wopt" = xyes ; then
+          CFLAGS="$CFLAGS -Wpointer-arith"
+        fi
+    fi
     if test "$have_w32_system" = yes; then
        CFLAGS="$CFLAGS -mms-bitfields"
     fi

-----------------------------------------------------------------------

Summary of changes:
 configure.ac                 | 29 +++++++++++++++++++++++
 src/argparse.c               |  3 ++-
 src/assuan-support.c         | 17 ++++++++++++++
 src/data-compat.c            |  2 +-
 src/data-identify.c          |  2 ++
 src/delete.c                 |  2 ++
 src/dirinfo.c                |  2 +-
 src/engine-assuan.c          |  3 ++-
 src/engine-g13.c             |  7 ++++--
 src/engine-gpg.c             | 14 ++++++++++-
 src/engine-gpgconf.c         | 10 ++++----
 src/engine-gpgsm.c           | 25 ++++++++++++++++----
 src/engine-uiserver.c        | 19 +++++++++++----
 src/getauditlog.c            |  3 +++
 src/gpgme-tool.c             | 55 +++++++++++++++++++++++++++++++-------------
 src/keylist.c                |  2 ++
 src/op-support.c             |  2 ++
 src/posix-io.c               |  2 +-
 src/posix-util.c             |  2 ++
 src/trustlist.c              |  3 +++
 src/verify.c                 |  2 ++
 src/version.c                |  4 ++--
 src/vfs-create.c             |  2 ++
 src/vfs-mount.c              |  2 ++
 src/wait-user.c              |  2 ++
 tests/gpg/t-decrypt-verify.c |  5 +++-
 tests/gpg/t-decrypt.c        | 15 +++++++-----
 tests/gpg/t-edit.c           | 19 ++++++++-------
 tests/gpg/t-encrypt-large.c  | 21 +++++++++++------
 tests/gpg/t-encrypt-mixed.c  |  2 +-
 tests/gpg/t-encrypt-sign.c   |  3 +++
 tests/gpg/t-encrypt-sym.c    | 11 +++++----
 tests/gpg/t-encrypt.c        |  3 +++
 tests/gpg/t-eventloop.c      | 12 +++++-----
 tests/gpg/t-export.c         | 17 ++++++++------
 tests/gpg/t-file-name.c      | 12 +++++-----
 tests/gpg/t-genkey.c         | 15 ++++++++----
 tests/gpg/t-gpgconf.c        | 18 +++++++--------
 tests/gpg/t-import.c         | 13 +++++++----
 tests/gpg/t-keylist-sig.c    | 20 ++++++++--------
 tests/gpg/t-keylist.c        | 27 ++++++++++++----------
 tests/gpg/t-sig-notation.c   | 21 +++++++++--------
 tests/gpg/t-sign.c           | 17 ++++++++------
 tests/gpg/t-signers.c        | 19 ++++++++-------
 tests/gpg/t-support.h        | 26 ++++++++++-----------
 tests/gpg/t-thread1.c        | 22 ++++++++++--------
 tests/gpg/t-trustlist.c      | 11 +++++----
 tests/gpg/t-verify.c         | 18 +++++++++------
 tests/gpg/t-wait.c           | 10 ++++----
 tests/gpgsm/t-decrypt.c      | 12 +++++-----
 tests/gpgsm/t-encrypt.c      | 12 +++++-----
 tests/gpgsm/t-export.c       | 12 +++++-----
 tests/gpgsm/t-genkey.c       | 14 ++++++-----
 tests/gpgsm/t-import.c       | 20 ++++++++--------
 tests/gpgsm/t-keylist.c      | 24 +++++++++----------
 tests/gpgsm/t-sign.c         | 14 +++++------
 tests/gpgsm/t-support.h      | 19 +++++++++------
 tests/gpgsm/t-verify.c       | 16 ++++++-------
 tests/opassuan/t-command.c   | 23 +++++++++++-------
 tests/run-sign.c             |  2 ++
 tests/run-support.h          | 16 ++++++-------
 tests/t-data.c               |  5 +++-
 62 files changed, 486 insertions(+), 276 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list