From 0a5f7424660e404e5fd0361b9331d154acf01d6c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 20 Oct 2008 13:53:23 +0000 Subject: [PATCH] Marked all unused args on non-W32 platforms. --- ChangeLog | 4 + agent/ChangeLog | 17 +++ agent/call-pinentry.c | 6 + agent/call-scd.c | 2 + agent/command-ssh.c | 15 +++ agent/command.c | 18 ++- agent/findkey.c | 2 + agent/genkey.c | 2 + agent/protect-tool.c | 2 + agent/t-protect.c | 3 + autogen.sh | 4 +- common/ChangeLog | 21 ++++ common/asshelp.c | 2 + common/audit.c | 4 +- common/estream.c | 35 ++++-- common/exechelp.c | 6 +- common/http.c | 2 + common/iobuf.c | 30 +++-- common/localename.c | 1 + common/signal.c | 1 + common/sysutils.c | 2 + common/t-convert.c | 2 + common/t-sexputil.c | 4 +- g10/ChangeLog | 44 +++++++ g10/build-packet.c | 26 ++-- g10/call-agent.c | 10 +- g10/card-util.c | 4 +- g10/cpr.c | 2 + g10/getkey.c | 4 +- g10/gpg.c | 2 + g10/gpgv.c | 248 ++++++++++++++++++++++++++++---------- g10/import.c | 31 ++++- g10/keydb.c | 4 +- g10/keyedit.c | 2 + g10/keygen.c | 69 ++++++----- g10/keyring.c | 6 +- g10/misc.c | 16 ++- g10/parse-packet.c | 85 +++++++------ g10/passphrase.c | 4 + g10/server.c | 39 +++++- g10/tdbdump.c | 31 ++--- g10/trustdb.c | 17 ++- g10/verify.c | 3 + jnlib/ChangeLog | 10 ++ jnlib/argparse.c | 5 + jnlib/dotlock.c | 5 +- jnlib/stringhelp.c | 8 +- jnlib/t-stringhelp.c | 3 + jnlib/w32-afunix.c | 2 + kbx/ChangeLog | 11 ++ kbx/kbxutil.c | 2 + kbx/keybox-blob.c | 3 +- kbx/keybox-dump.c | 2 + kbx/keybox-search.c | 2 + kbx/keybox-update.c | 9 +- keyserver/ChangeLog | 5 + keyserver/curl-shim.c | 3 + scd/ChangeLog | 18 +++ scd/apdu.c | 14 +++ scd/app-nks.c | 4 + scd/app-openpgp.c | 5 + scd/app.c | 2 + scd/ccid-driver.c | 2 +- scd/command.c | 6 + scd/pcsc-wrapper.c | 17 ++- scd/scdaemon.c | 2 +- sm/ChangeLog | 18 +++ sm/call-agent.c | 2 + sm/call-dirmngr.c | 6 + sm/certchain.c | 2 + sm/certlist.c | 2 + sm/gpgsm.c | 2 + sm/import.c | 4 +- sm/keydb.c | 6 + sm/keylist.c | 6 + sm/qualified.c | 2 + sm/server.c | 10 ++ tests/ChangeLog | 6 + tests/asschk.c | 14 +++ tools/ChangeLog | 10 ++ tools/gpg-connect-agent.c | 2 + tools/gpgparsemail.c | 10 ++ tools/gpgsplit.c | 11 +- tools/no-libgcrypt.c | 3 +- 84 files changed, 864 insertions(+), 224 deletions(-) diff --git a/ChangeLog b/ChangeLog index ddfbd309d..65832360f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-10-20 Werner Koch + + * + 2008-10-17 Werner Koch * configure.ac: Use more warning options with modern GCCs. diff --git a/agent/ChangeLog b/agent/ChangeLog index f3f5131d3..1a063aae8 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,20 @@ +2008-10-20 Werner Koch + + * command.c (cmd_geteventcounter): Mark unused arg. + (cmd_listtrusted, cmd_pksign, cmd_pkdecrypt, cmd_genkey): Ditto. + (cmd_updatestartuptty, post_cmd_notify): Ditto. + * command-ssh.c (add_control_entry) + (ssh_handler_request_identities, ssh_handler_remove_identity) + (ssh_handler_remove_all_identities, ssh_handler_lock) + (ssh_handler_unlock): Ditto. + * call-pinentry.c (pinentry_active_p, popup_message_thread) + (agent_popup_message_stop): Ditto. + * findkey.c (agent_public_key_from_file): Ditto. + * genkey.c (check_passphrase_pattern): Ditto. + * call-scd.c (atfork_cb): Ditto. + * protect-tool.c (import_p12_cert_cb): Ditto. + * t-protect.c (main): Ditto. + 2008-10-17 Werner Koch * call-scd.c (start_scd) [W32]: Use snprintf again because we now diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index ea18d43dd..86792d8d7 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -410,6 +410,8 @@ start_pinentry (ctrl_t ctrl) int pinentry_active_p (ctrl_t ctrl, int waitseconds) { + (void)ctrl; + if (waitseconds > 0) { pth_event_t evt; @@ -935,6 +937,8 @@ agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn) static void * popup_message_thread (void *arg) { + (void)arg; + /* We use the --one-button hack instead of the MESSAGE command to allow the use of old Pinentries. Those old Pinentries will then show an additional Cancel button but that is mostly a visual @@ -1008,6 +1012,8 @@ agent_popup_message_stop (ctrl_t ctrl) int rc; pid_t pid; + (void)ctrl; + if (!popup_tid || !entry_ctx) { log_debug ("agent_popup_message_stop called with no active popup\n"); diff --git a/agent/call-scd.c b/agent/call-scd.c index fce132004..48998da70 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -191,6 +191,8 @@ unlock_scd (ctrl_t ctrl, int rc) static void atfork_cb (void *opaque, int where) { + (void)opaque; + if (!where) gcry_control (GCRYCTL_TERM_SECMEM); } diff --git a/agent/command-ssh.c b/agent/command-ssh.c index 527b9e2aa..c262cade7 100644 --- a/agent/command-ssh.c +++ b/agent/command-ssh.c @@ -782,6 +782,8 @@ add_control_entry (ctrl_t ctrl, const char *hexgrip, int ttl) FILE *fp; int disabled; + (void)ctrl; + err = open_control_file (&fp, 1); if (err) return err; @@ -1782,6 +1784,8 @@ ssh_handler_request_identities (ctrl_t ctrl, char *cardsn; gpg_error_t ret_err; + (void)request; + /* Prepare buffer stream. */ key_directory = NULL; @@ -2541,6 +2545,8 @@ ssh_handler_remove_identity (ctrl_t ctrl, gpg_error_t ret_err; gpg_error_t err; + (void)ctrl; + /* Receive key. */ key_blob = NULL; @@ -2590,6 +2596,9 @@ ssh_handler_remove_all_identities (ctrl_t ctrl, { gpg_error_t ret_err; gpg_error_t err; + + (void)ctrl; + (void)request; err = ssh_identities_remove_all (); @@ -2632,6 +2641,9 @@ ssh_handler_lock (ctrl_t ctrl, estream_t request, estream_t response) { gpg_error_t ret_err; gpg_error_t err; + + (void)ctrl; + (void)request; err = ssh_lock (); @@ -2650,6 +2662,9 @@ ssh_handler_unlock (ctrl_t ctrl, estream_t request, estream_t response) gpg_error_t ret_err; gpg_error_t err; + (void)ctrl; + (void)request; + err = ssh_unlock (); if (! err) diff --git a/agent/command.c b/agent/command.c index 066494101..f5787621c 100644 --- a/agent/command.c +++ b/agent/command.c @@ -357,6 +357,8 @@ cmd_geteventcounter (assuan_context_t ctx, char *line) char key_counter[25]; char card_counter[25]; + (void)line; + snprintf (any_counter, sizeof any_counter, "%u", eventcounter.any); snprintf (key_counter, sizeof key_counter, "%u", eventcounter.key); snprintf (card_counter, sizeof card_counter, "%u", eventcounter.card); @@ -436,7 +438,11 @@ cmd_istrusted (assuan_context_t ctx, char *line) static int cmd_listtrusted (assuan_context_t ctx, char *line) { - int rc = agent_listtrusted (ctx); + int rc; + + (void)line; + + rc = agent_listtrusted (ctx); if (rc) log_error ("command listtrusted failed: %s\n", gpg_strerror (rc)); return rc; @@ -652,6 +658,8 @@ cmd_pksign (assuan_context_t ctx, char *line) ctrl_t ctrl = assuan_get_pointer (ctx); membuf_t outbuf; + (void)line; + if (opt.ignore_cache_for_signing) cache_mode = CACHE_MODE_IGNORE; else if (!ctrl->server_local->use_cache_for_signing) @@ -685,6 +693,8 @@ cmd_pkdecrypt (assuan_context_t ctx, char *line) size_t valuelen; membuf_t outbuf; + (void)line; + /* First inquire the data to decrypt */ rc = assuan_inquire (ctx, "CIPHERTEXT", &value, &valuelen, MAXLEN_CIPHERTEXT); @@ -731,6 +741,8 @@ cmd_genkey (assuan_context_t ctx, char *line) size_t valuelen; membuf_t outbuf; + (void)line; + /* First inquire the parameters */ rc = assuan_inquire (ctx, "KEYPARAM", &value, &valuelen, MAXLEN_KEYPARAM); if (rc) @@ -1312,6 +1324,8 @@ cmd_updatestartuptty (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); + (void)line; + xfree (opt.startup_display); opt.startup_display = NULL; xfree (opt.startup_ttyname); opt.startup_ttyname = NULL; xfree (opt.startup_ttytype); opt.startup_ttytype = NULL; @@ -1505,6 +1519,8 @@ static void post_cmd_notify (assuan_context_t ctx, int err) { ctrl_t ctrl = assuan_get_pointer (ctx); + + (void)err; /* Switch off any I/O monitor controlled logging pausing. */ ctrl->server_local->pause_io_logging = 0; diff --git a/agent/findkey.c b/agent/findkey.c index 183af2c5e..ddcd26267 100644 --- a/agent/findkey.c +++ b/agent/findkey.c @@ -669,6 +669,8 @@ agent_public_key_from_file (ctrl_t ctrl, const char *elems; gcry_mpi_t *array; + (void)ctrl; + *result = NULL; rc = read_key_file (grip, &s_skey); diff --git a/agent/genkey.c b/agent/genkey.c index efebbfa7e..cbddb85d3 100644 --- a/agent/genkey.c +++ b/agent/genkey.c @@ -99,6 +99,8 @@ check_passphrase_pattern (ctrl_t ctrl, const char *pw) pid_t pid; int result, i; + (void)ctrl; + infp = gnupg_tmpfile (); if (!infp) { diff --git a/agent/protect-tool.c b/agent/protect-tool.c index 910ba036d..288dbe83b 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -630,6 +630,8 @@ import_p12_cert_cb (void *opaque, const unsigned char *cert, size_t certlen) struct b64state state; gpg_error_t err, err2; + (void)opaque; + err = b64enc_start (&state, stdout, "CERTIFICATE"); if (!err) err = b64enc_write (&state, cert, certlen); diff --git a/agent/t-protect.c b/agent/t-protect.c index aadbe6adc..0e29cafe2 100644 --- a/agent/t-protect.c +++ b/agent/t-protect.c @@ -294,6 +294,9 @@ test_agent_get_shadow_info (void) int main (int argc, char **argv) { + (void)argc; + (void)argv; + gcry_control (GCRYCTL_DISABLE_SECMEM); test_agent_protect (); diff --git a/autogen.sh b/autogen.sh index 7548603e5..31caf240f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -208,4 +208,6 @@ $AUTOMAKE --gnu; echo "Running autoconf${FORCE} ..." $AUTOCONF${FORCE} -echo "You may now run \"./configure --sysconfdir=/etc --enable-maintainer-mode && make\"." +echo "You may now run: + ./configure --sysconfdir=/etc --enable-maintainer-mode && make +" diff --git a/common/ChangeLog b/common/ChangeLog index 00ed52ad2..9e3c450d9 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,24 @@ +2008-10-20 Werner Koch + + + * http.c (http_register_tls_callback) [!HTTP_USE_GNUTLS]: Mark + unused arg. + * localename.c (do_nl_locale_name): Ditto. + * audit.c (event2str): Silent gcc warning. + * sysutils.c (translate_sys2libc_fd): Mark unused arg. + (translate_sys2libc_fd_int): Ditto. + * iobuf.c (translate_file_handle): Ditto. + * asshelp.c (send_one_option): Ditto. + * exechelp.c (gnupg_spawn_process): Ditto. + * signal.c (got_usr_signal): Ditto + * estream.c (es_func_fd_create) [!W32]: Ditto. + (es_func_fp_create) [!W32]: Ditto. + (es_write_hexstring): Ditto. + (dummy_mutex_call_void, dummy_mutex_call_int) [HAVE_PTH]: New. + (ESTREAM_MUTEX_LOCK, ESTREAM_MUTEX_UNLOCK, ESTREAM_MUTEX_TRYLOCK) + (ESTREAM_MUTEX_INITIALIZE) [HAVE_PTH]: Use dummy calls so to mark + unused arg. + 2008-10-19 Werner Koch * estream-printf.c (estream_vsnprintf): Fix return value. diff --git a/common/asshelp.c b/common/asshelp.c index 99da71a22..6663241ae 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -42,6 +42,8 @@ send_one_option (assuan_context_t ctx, gpg_err_source_t errsource, gpg_error_t err; char *optstr; + (void)errsource; + if (!value || !*value) err = 0; /* Avoid sending empty strings. */ else if (asprintf (&optstr, "OPTION %s=%s", name, value ) < 0) diff --git a/common/audit.c b/common/audit.c index 706012ebe..3e1970d8c 100644 --- a/common/audit.c +++ b/common/audit.c @@ -115,7 +115,9 @@ clear_helptags (audit_ctx_t ctx) static const char * event2str (audit_event_t event) { - int idx = eventstr_msgidxof (event); + /* We need the cast so that compiler does not complain about an + always true comparison (>= 0) for an unsigned value. */ + int idx = eventstr_msgidxof ((int)event); if (idx == -1) return "Unknown event"; else diff --git a/common/estream.c b/common/estream.c index 254fab93a..ee6c51af8 100644 --- a/common/estream.c +++ b/common/estream.c @@ -114,11 +114,25 @@ typedef pth_mutex_t estream_mutex_t; #else typedef void *estream_mutex_t; + +static inline void +dummy_mutex_call_void (estream_mutex_t mutex) +{ + (void)mutex; +} + +static inline int +dummy_mutex_call_int (estream_mutex_t mutex) +{ + (void)mutex; + return 0; +} + # define ESTREAM_MUTEX_INITIALIZER NULL -# define ESTREAM_MUTEX_LOCK(mutex) (void) 0 -# define ESTREAM_MUTEX_UNLOCK(mutex) (void) 0 -# define ESTREAM_MUTEX_TRYLOCK(mutex) 0 -# define ESTREAM_MUTEX_INITIALIZE(mutex) (void) 0 +# define ESTREAM_MUTEX_LOCK(mutex) dummy_mutex_call_void ((mutex)) +# define ESTREAM_MUTEX_UNLOCK(mutex) dummy_mutex_call_void ((mutex)) +# define ESTREAM_MUTEX_TRYLOCK(mutex) dummy_mutex_call_int ((mutex)) +# define ESTREAM_MUTEX_INITIALIZE(mutex) dummy_mutex_call_void ((mutex)) #endif /* Primitive system I/O. */ @@ -183,11 +197,7 @@ struct estream_list }; static estream_list_t estream_list; -#ifdef HAVE_PTH -/* Note that we can't use a static initialization with W32Pth, thus we - do it in es_init. */ static estream_mutex_t estream_list_lock; -#endif #define ESTREAM_LIST_LOCK ESTREAM_MUTEX_LOCK (estream_list_lock) #define ESTREAM_LIST_UNLOCK ESTREAM_MUTEX_UNLOCK (estream_list_lock) @@ -620,6 +630,8 @@ es_func_fd_create (void **cookie, int fd, unsigned int modeflags, int no_close) /* Make sure it is in binary mode if requested. */ if ( (modeflags & O_BINARY) ) setmode (fd, O_BINARY); +#else + (void)modeflags; #endif fd_cookie->fd = fd; fd_cookie->no_close = no_close; @@ -721,7 +733,8 @@ typedef struct estream_cookie_fp /* Create function for fd objects. */ static int -es_func_fp_create (void **cookie, FILE *fp, unsigned int modeflags, int no_close) +es_func_fp_create (void **cookie, FILE *fp, + unsigned int modeflags, int no_close) { estream_cookie_fp_t fp_cookie; int err; @@ -735,6 +748,8 @@ es_func_fp_create (void **cookie, FILE *fp, unsigned int modeflags, int no_close /* Make sure it is in binary mode if requested. */ if ( (modeflags & O_BINARY) ) setmode (fileno (fp), O_BINARY); +#else + (void)modeflags; #endif fp_cookie->fp = fp; fp_cookie->no_close = no_close; @@ -3145,6 +3160,8 @@ es_write_hexstring (estream_t ES__RESTRICT stream, const unsigned char *s; size_t count = 0; + (void)reserved; + #define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) if (!length) diff --git a/common/exechelp.c b/common/exechelp.c index dcbbe90b0..2246c78ea 100644 --- a/common/exechelp.c +++ b/common/exechelp.c @@ -351,6 +351,8 @@ gnupg_spawn_process (const char *pgmname, const char *argv[], char *cmdline; int fd, fdout, rp[2]; + (void)preexec; + /* Setup return values. */ *statusfile = NULL; *pid = (pid_t)(-1); @@ -452,6 +454,8 @@ gnupg_spawn_process (const char *pgmname, const char *argv[], gpg_error_t err; int fd, fdout, rp[2]; + (void)flags; /* Currently not used. */ + *statusfile = NULL; *pid = (pid_t)(-1); fflush (infile); @@ -767,7 +771,7 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[], to pass the GPG_AGENT_INFO variable to gpg-agent. As the default on windows is to use a standard socket, this does not really matter. */ - + (void)envp; if (access (pgmname, X_OK)) return gpg_error_from_syserror (); diff --git a/common/http.c b/common/http.c index 4dda27a2c..96e2a9e0b 100644 --- a/common/http.c +++ b/common/http.c @@ -304,6 +304,8 @@ http_register_tls_callback ( gpg_error_t (*cb) (http_t, void *, int) ) { #ifdef HTTP_USE_GNUTLS tls_callback = (gpg_error_t (*) (http_t, gnutls_session_t, int))cb; +#else + (void)cb; #endif } diff --git a/common/iobuf.c b/common/iobuf.c index abe2b5be5..6c493b512 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -412,14 +412,20 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf, size_t nbytes = 0; int rc = 0; + (void)chain; /* Not used. */ + #ifdef FILE_FILTER_USES_STDIO if (control == IOBUFCTRL_UNDERFLOW) { - assert (size); /* need a buffer */ + assert (size); /* We need a buffer. */ if (feof (f)) - { /* On terminals you could easiely read as many EOFs as you call */ - rc = -1; /* fread() or fgetc() repeatly. Every call will block until you press */ - *ret_len = 0; /* CTRL-D. So we catch this case before we call fread() again. */ + { + /* On terminals you could easily read as many EOFs as you + call fread() or fgetc() repeatly. Every call will block + until you press CTRL-D. So we catch this case before we + call fread() again. */ + rc = -1; + *ret_len = 0; } else { @@ -427,7 +433,7 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf, nbytes = fread (buf, 1, size, f); if (feof (f) && !nbytes) { - rc = -1; /* okay: we can return EOF now. */ + rc = -1; /* Okay: we can return EOF now. */ } else if (ferror (f) && errno != EPIPE) { @@ -469,13 +475,13 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf, fclose (f); } f = NULL; - xfree (a); /* we can free our context now */ + xfree (a); /* We can free our context now. */ } #else /* !stdio implementation */ if (control == IOBUFCTRL_UNDERFLOW) { - assert (size); /* need a buffer */ + assert (size); /* We need a buffer. */ if (a->eof_seen) { rc = -1; @@ -620,9 +626,9 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf, } f = INVALID_FP; #endif - xfree (a); /* we can free our context now */ + xfree (a); /* We can free our context now. */ } -#endif /* !stdio implementation */ +#endif /* !stdio implementation. */ return rc; } @@ -639,6 +645,8 @@ sock_filter (void *opaque, int control, iobuf_t chain, byte * buf, size_t nbytes = 0; int rc = 0; + (void)chain; + if (control == IOBUFCTRL_UNDERFLOW) { assert (size); /* need a buffer */ @@ -2408,6 +2416,8 @@ translate_file_handle (int fd, int for_write) # else { int x; + + (void)for_write; if (fd == 0) x = (int) GetStdHandle (STD_INPUT_HANDLE); @@ -2425,6 +2435,8 @@ translate_file_handle (int fd, int for_write) fd = x; } # endif +#else + (void)for_write; #endif return fd; } diff --git a/common/localename.c b/common/localename.c index 68b93bc81..cb7fcc2f7 100644 --- a/common/localename.c +++ b/common/localename.c @@ -65,6 +65,7 @@ do_nl_locale_name (int category, const char *categoryname) /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. On some systems this can be done by the 'setlocale' function itself. */ # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL + (void)categoryname; retval = setlocale (category, NULL); # else /* Setting of LC_ALL overwrites all other. */ diff --git a/common/signal.c b/common/signal.c index f48dc6ee5..98859a43d 100644 --- a/common/signal.c +++ b/common/signal.c @@ -146,6 +146,7 @@ got_fatal_signal (int sig) static RETSIGTYPE got_usr_signal (int sig) { + (void)sig; caught_sigusr1 = 1; } #endif /*!HAVE_DOSISH_SYSTEM*/ diff --git a/common/sysutils.c b/common/sysutils.c index 5e550b43a..0f1857ee3 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -299,6 +299,7 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write) log_error ("failed to translate osfhandle %p\n", (void *) fd); return x; #else /*!HAVE_W32_SYSTEM */ + (void)for_write; return fd; #endif } @@ -314,6 +315,7 @@ translate_sys2libc_fd_int (int fd, int for_write) return translate_sys2libc_fd ((void*)fd, for_write); #else + (void)for_write; return fd; #endif } diff --git a/common/t-convert.c b/common/t-convert.c index caf743f1f..4b04f3a32 100644 --- a/common/t-convert.c +++ b/common/t-convert.c @@ -447,6 +447,8 @@ test_hex2str (void) int main (int argc, char **argv) { + (void)argc; + (void)argv; test_hex2bin (); test_hexcolon2bin (); diff --git a/common/t-sexputil.c b/common/t-sexputil.c index 097dc9878..26a6ace4b 100644 --- a/common/t-sexputil.c +++ b/common/t-sexputil.c @@ -74,7 +74,9 @@ test_hash_algo_from_sigval (void) int main (int argc, char **argv) { - + (void)argc; + (void)argv; + test_hash_algo_from_sigval (); return 0; diff --git a/g10/ChangeLog b/g10/ChangeLog index a65425cce..b9a984913 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,47 @@ +2008-10-20 Werner Koch + + * gpgv.c: Mark all args of the stub fucntions as unused. + + * card-util.c (generate_card_keys): Remove unused arg SERIALNO and + adjust caller. + + * build-packet.c (write_sign_packet_header): Mark unused arg. + * gpg.c (gpg_init_default_ctrl, gpg_deinit_default_ctrl): Ditto. + * getkey.c (skip_unusable): Ditto. + (write_version): Ditto. + * keydb.c (keydb_locate_writable): Ditto. + * keyring.c (update_offset_hash_table): Ditto. + (keyring_lock): Ditto. + * misc.c (register_secured_file): Ditto. + (unregister_secured_file): Ditto. + (is_secured_file): Ditto. + (is_secured_filename): Ditto. + * parse-packet.c (parse_marker): Ditto. + (parse_key, parse_attribute): Ditto. + (parse_trust, parse_compressed, parse_mdc, parse_gpg_control): Ditto. + * cpr.c (progress_cb): Ditto. + * passphrase.c (passphrase_clear_cache): Ditto. + (ask_passphrase): Ditto. + * keyedit.c (keyedit_completion): Ditto. + * import.c (import_revoke_cert): Ditto. + (chk_self_sigs, delete_inv_parts, append_uid): Ditto. + (merge_sigs, merge_keysigs, append_key): Ditto. + * trustdb.c (list_trust_path): Ditto. + (enum_cert_paths, enum_cert_paths_print): Ditto. + * tdbdump.c (list_trustdb): Ditto. + * keygen.c (keygen_upd_std_prefs): Ditto. + (genhelp_factors): Ditto. + * call-agent.c (agent_scd_setattr): Ditto. + (agent_scd_writekey, agent_scd_change_pin, agent_scd_genkey): Ditto. + (agent_clear_pin_cache): Ditto. + + * server.c (option_handler): Mark non yet used arg. + (input_notify, output_notify): Ditto. + (cmd_recipient, cmd_signer, cmd_encrypt, cmd_decrypt, cmd_verify) + (cmd_sign, cmd_import, cmd_export, cmd_delkeys, do_listkeys) + (cmd_genkey): Ditto. + * verify.c (gpg_verify): Ditto. + 2008-10-17 Werner Koch * main.h (idea_cipher_warn): Use do while construct in place of an diff --git a/g10/build-packet.c b/g10/build-packet.c index c9ba9d8d1..37922d90c 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -1241,14 +1241,16 @@ write_header( IOBUF out, int ctb, u32 len ) static int -write_sign_packet_header( IOBUF out, int ctb, u32 len ) +write_sign_packet_header (IOBUF out, int ctb, u32 len) { - /* work around a bug in the pgp read function for signature packets, - * which are not correctly coded and silently assume at some - * point 2 byte length headers.*/ - iobuf_put(out, 0x89 ); - iobuf_put(out, len >> 8 ); - return iobuf_put(out, len ) == -1 ? -1:0; + (void)ctb; + + /* Work around a bug in the pgp read function for signature packets, + which are not correctly coded and silently assume at some point 2 + byte length headers.*/ + iobuf_put (out, 0x89 ); + iobuf_put (out, len >> 8 ); + return iobuf_put (out, len) == -1 ? -1:0; } /**************** @@ -1350,9 +1352,11 @@ write_new_header( IOBUF out, int ctb, u32 len, int hdrlen ) } static int -write_version( IOBUF out, int ctb ) +write_version (IOBUF out, int ctb) { - if( iobuf_put( out, 3 ) ) - return -1; - return 0; + (void)ctb; + + if (iobuf_put (out, 3)) + return -1; + return 0; } diff --git a/g10/call-agent.c b/g10/call-agent.c index 29d75a59e..15c17b038 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -418,6 +418,8 @@ agent_scd_setattr (const char *name, char line[ASSUAN_LINELENGTH]; char *p; + (void)serialno; + if (!*name || !valuelen) return gpg_error (GPG_ERR_INV_VALUE); @@ -532,6 +534,8 @@ agent_scd_writekey (int keyno, const char *serialno, char line[ASSUAN_LINELENGTH]; struct writekey_parm_s parms; + (void)serialno; + rc = start_agent (); if (rc) return rc; @@ -616,6 +620,8 @@ agent_scd_genkey (struct agent_card_genkey_s *info, int keyno, int force, char line[ASSUAN_LINELENGTH]; gnupg_isotime_t tbuf; + (void)serialno; + rc = start_agent (); if (rc) return rc; @@ -775,6 +781,8 @@ agent_scd_change_pin (int chvno, const char *serialno) char line[ASSUAN_LINELENGTH]; const char *reset = ""; + (void)serialno; + if (chvno >= 100) reset = "--reset"; chvno %= 100; @@ -816,7 +824,7 @@ agent_scd_checkpin (const char *serialno) void agent_clear_pin_cache (const char *sn) { - + (void)sn; } diff --git a/g10/card-util.c b/g10/card-util.c index afde4cb68..e25427f51 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -1127,7 +1127,7 @@ replace_existing_key_p (struct agent_card_info_s *info, int keyno) static void -generate_card_keys (const char *serialno) +generate_card_keys (void) { struct agent_card_info_s info; int forced_chv1; @@ -1674,7 +1674,7 @@ card_edit (strlist_t commands) break; case cmdGENERATE: - generate_card_keys (serialnobuf); + generate_card_keys (); break; case cmdPASSWD: diff --git a/g10/cpr.c b/g10/cpr.c index 83f0ccb4d..a1e904e07 100644 --- a/g10/cpr.c +++ b/g10/cpr.c @@ -48,6 +48,8 @@ progress_cb (void *ctx, const char *what, int printchar, { char buf[50]; + (void)ctx; + if ( printchar == '\n' && !strcmp (what, "primegen") ) snprintf (buf, sizeof buf -1, "%.20s X 100 100", what ); else diff --git a/g10/getkey.c b/g10/getkey.c index 65d373b81..3b25b735d 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -760,10 +760,12 @@ classify_user_id( const char *name, KEYDB_SEARCH_DESC *desc ) static int -skip_unusable(void *dummy,u32 *keyid,PKT_user_id *uid) +skip_unusable (void *dummy, u32 *keyid, PKT_user_id *uid) { int unusable=0; KBNODE keyblock; + + (void)dummy; keyblock=get_pubkeyblock(keyid); if(!keyblock) diff --git a/g10/gpg.c b/g10/gpg.c index 9dd17906d..834936566 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -1766,6 +1766,7 @@ encode_s2k_iterations(int iterations) static void gpg_init_default_ctrl (ctrl_t ctrl) { + (void)ctrl; } @@ -1774,6 +1775,7 @@ gpg_init_default_ctrl (ctrl_t ctrl) static void gpg_deinit_default_ctrl (ctrl_t ctrl) { + (void)ctrl; } diff --git a/g10/gpgv.c b/g10/gpgv.c index 9b1fe2aed..b81ae6000 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -200,12 +200,21 @@ g10_exit( int rc ) int check_signatures_trust( PKT_signature *sig ) { - return 0; + (void)sig; + return 0; } void -read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck, - byte *marginals,byte *completes,byte *cert_depth) {} +read_trust_options(byte *trust_model, ulong *created, ulong *nextcheck, + byte *marginals, byte *completes, byte *cert_depth) +{ + (void)trust_model; + (void)created; + (void)nextcheck; + (void)marginals; + (void)completes; + (void)cert_depth; +} /* Stub: * We don't have the trustdb , so we have to provide some stub functions @@ -215,46 +224,58 @@ read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck, int cache_disabled_value(PKT_public_key *pk) { + (void)pk; return 0; } void -check_trustdb_stale(void) {} +check_trustdb_stale(void) +{ +} int get_validity_info (PKT_public_key *pk, PKT_user_id *uid) { - return '?'; + (void)pk; + (void)uid; + return '?'; } unsigned int get_validity (PKT_public_key *pk, PKT_user_id *uid) { + (void)pk; + (void)uid; return 0; } const char * trust_value_to_string (unsigned int value) { + (void)value; return "err"; } const char * -uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid) +uid_trust_string_fixed (PKT_public_key *key, PKT_user_id *uid) { + (void)key; + (void)uid; return "err"; } int get_ownertrust_info (PKT_public_key *pk) { - return '?'; + (void)pk; + return '?'; } unsigned int get_ownertrust (PKT_public_key *pk) { - return TRUST_UNKNOWN; + (void)pk; + return TRUST_UNKNOWN; } @@ -264,122 +285,217 @@ get_ownertrust (PKT_public_key *pk) */ struct keyserver_spec * -keyserver_match(struct keyserver_spec *spec) { return NULL; } - -int -keyserver_import_keyid( u32 *keyid, void *dummy ) +keyserver_match (struct keyserver_spec *spec) { - return -1; + (void)spec; + return NULL; } int -keyserver_import_cert(const char *name) { return -1; } - -int -keyserver_import_pka(const char *name,unsigned char *fpr) { return -1; } - -int -keyserver_import_name(const char *name,struct keyserver_spec *spec) +keyserver_import_keyid (u32 *keyid, void *dummy) { + (void)keyid; + (void)dummy; return -1; } int -keyserver_import_ldap(const char *name) { return -1; } +keyserver_import_cert (const char *name) +{ + (void)name; + return -1; +} + +int +keyserver_import_pka (const char *name,unsigned char *fpr) +{ + (void)name; + (void)fpr; + return -1; +} + +int +keyserver_import_name (const char *name,struct keyserver_spec *spec) +{ + (void)name; + (void)spec; + return -1; +} + +int +keyserver_import_ldap (const char *name) +{ + (void)name; + return -1; +} /* Stub: * No encryption here but mainproc links to these functions. */ int -get_session_key( PKT_pubkey_enc *k, DEK *dek ) +get_session_key (PKT_pubkey_enc *k, DEK *dek) { - return G10ERR_GENERAL; + (void)k; + (void)dek; + return G10ERR_GENERAL; } + /* Stub: */ int -get_override_session_key( DEK *dek, const char *string ) +get_override_session_key (DEK *dek, const char *string) { - return G10ERR_GENERAL; + (void)dek; + (void)string; + return G10ERR_GENERAL; } + /* Stub: */ int -decrypt_data( void *procctx, PKT_encrypted *ed, DEK *dek ) +decrypt_data (void *procctx, PKT_encrypted *ed, DEK *dek) { - return G10ERR_GENERAL; + (void)procctx; + (void)ed; + (void)dek; + return G10ERR_GENERAL; } /* Stub: - * No interactive commnds, so we don't need the helptexts + * No interactive commands, so we don't need the helptexts */ void -display_online_help( const char *keyword ) +display_online_help (const char *keyword) { + (void)keyword; } /* Stub: * We don't use secret keys, but getkey.c links to this */ int -check_secret_key( PKT_secret_key *sk, int n ) +check_secret_key (PKT_secret_key *sk, int n) { - return G10ERR_GENERAL; + (void)sk; + (void)n; + return G10ERR_GENERAL; } /* Stub: * No secret key, so no passphrase needed */ DEK * -passphrase_to_dek( u32 *keyid, int pubkey_algo, - int cipher_algo, STRING2KEY *s2k, int mode, +passphrase_to_dek (u32 *keyid, int pubkey_algo, + int cipher_algo, STRING2KEY *s2k, int mode, const char *tmp, int *canceled) { + (void)keyid; + (void)pubkey_algo; + (void)cipher_algo; + (void)s2k; + (void)mode; + (void)tmp; + if (canceled) *canceled = 0; return NULL; } -struct keyserver_spec *parse_preferred_keyserver(PKT_signature *sig) {return NULL;} -struct keyserver_spec *parse_keyserver_uri(const char *uri,int require_scheme, - const char *configname, - unsigned int configlineno) +struct keyserver_spec * +parse_preferred_keyserver(PKT_signature *sig) { + (void)sig; return NULL; } -void free_keyserver_spec(struct keyserver_spec *keyserver) {} +struct keyserver_spec * +parse_keyserver_uri (const char *uri, int require_scheme, + const char *configname, unsigned int configlineno) +{ + (void)uri; + (void)require_scheme; + (void)configname; + (void)configlineno; + return NULL; +} + +void +free_keyserver_spec (struct keyserver_spec *keyserver) +{ + (void)keyserver; +} /* Stubs to avoid linking to photoid.c */ -void show_photos(const struct user_attribute *attrs,int count,PKT_public_key *pk) {} -int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len) {return 0;} -char *image_type_to_string(byte type,int string) {return NULL;} +void +show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk) +{ + (void)attrs; + (void)count; + (void)pk; +} + +int +parse_image_header (const struct user_attribute *attr, byte *type, u32 *len) +{ + (void)attr; + (void)type; + (void)len; + return 0; +} + +char * +image_type_to_string (byte type, int string) +{ + (void)type; + (void)string; + return NULL; +} #ifdef ENABLE_CARD_SUPPORT -int agent_scd_getattr (const char *name, struct agent_card_info_s *info) {return 0;} +int +agent_scd_getattr (const char *name, struct agent_card_info_s *info) +{ + (void)name; + (void)info; + return 0; +} #endif /* ENABLE_CARD_SUPPORT */ -/* Stubs to void linking to ../cipher/cipher.c */ -const char *cipher_algo_to_string( int algo ) { return "?";} -void disable_cipher_algo( int algo ) {} -int check_cipher_algo( int algo ) { return -1;} -unsigned int cipher_get_keylen( int algo ) { return 0; } -unsigned int cipher_get_blocksize( int algo ) {return 0;} -gcry_cipher_hd_t cipher_open( int algo, int mode, int secure ) { return NULL;} -void cipher_close( gcry_cipher_hd_t c ) {} -int cipher_setkey( gcry_cipher_hd_t c, byte *key, unsigned keylen ) { return -1;} -void cipher_setiv( gcry_cipher_hd_t c, const byte *iv, unsigned ivlen ){} -void cipher_encrypt( gcry_cipher_hd_t c, byte *outbuf, - byte *inbuf, unsigned nbytes ) {} -void cipher_decrypt( gcry_cipher_hd_t c, byte *outbuf, - byte *inbuf, unsigned nbytes ) {} -void cipher_sync( gcry_cipher_hd_t c ) {} - - - /* We do not do any locking, so use these stubs here */ -void disable_dotlock(void) {} -DOTLOCK create_dotlock( const char *file_to_lock ) { return NULL; } -void destroy_dotlock (DOTLOCK h) {} -int make_dotlock( DOTLOCK h, long timeout ) { return 0;} -int release_dotlock( DOTLOCK h ) {return 0;} -void remove_lockfiles(void) {} +void +disable_dotlock (void) +{ +} + +DOTLOCK +create_dotlock (const char *file_to_lock) +{ + (void)file_to_lock; + return NULL; +} + +void +destroy_dotlock (DOTLOCK h) +{ + (void)h; +} + +int +make_dotlock (DOTLOCK h, long timeout) +{ + (void)h; + (void)timeout; + return 0; +} + +int +release_dotlock (DOTLOCK h) +{ + (void)h; + return 0; +} + +void +remove_lockfiles (void) +{ +} + diff --git a/g10/import.c b/g10/import.c index 3614285c9..88eb24e57 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1238,6 +1238,8 @@ import_revoke_cert( const char *fname, KBNODE node, struct stats_s *stats ) u32 keyid[2]; int rc = 0; + (void)fname; + assert( !node->next ); assert( node->pkt->pkttype == PKT_SIGNATURE ); assert( node->pkt->pkt.signature->sig_class == 0x20 ); @@ -1365,6 +1367,9 @@ chk_self_sigs( const char *fname, KBNODE keyblock, u32 bsdate=0,rsdate=0; KBNODE bsnode=NULL,rsnode=NULL; + (void)fname; + (void)pk; + for( n=keyblock; (n = find_next_kbnode(n, 0)); ) { if(n->pkt->pkttype==PKT_PUBLIC_SUBKEY) { @@ -1537,6 +1542,8 @@ delete_inv_parts( const char *fname, KBNODE keyblock, KBNODE node; int nvalid=0, uid_seen=0, subkey_seen=0; + (void)fname; + for(node=keyblock->next; node; node = node->next ) { if( node->pkt->pkttype == PKT_USER_ID ) { uid_seen = 1; @@ -2047,11 +2054,14 @@ merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, * append the userid starting with NODE and all signatures to KEYBLOCK. */ static int -append_uid( KBNODE keyblock, KBNODE node, int *n_sigs, - const char *fname, u32 *keyid ) +append_uid (KBNODE keyblock, KBNODE node, int *n_sigs, + const char *fname, u32 *keyid ) { KBNODE n, n_where=NULL; + (void)fname; + (void)keyid; + assert(node->pkt->pkttype == PKT_USER_ID ); /* find the position */ @@ -2099,6 +2109,9 @@ merge_sigs( KBNODE dst, KBNODE src, int *n_sigs, KBNODE n, n2; int found=0; + (void)fname; + (void)keyid; + assert(dst->pkt->pkttype == PKT_USER_ID ); assert(src->pkt->pkttype == PKT_USER_ID ); @@ -2134,12 +2147,15 @@ merge_sigs( KBNODE dst, KBNODE src, int *n_sigs, * Merge the sigs from SRC onto DST. SRC and DST are both a PKT_xxx_SUBKEY. */ static int -merge_keysigs( KBNODE dst, KBNODE src, int *n_sigs, - const char *fname, u32 *keyid ) +merge_keysigs (KBNODE dst, KBNODE src, int *n_sigs, + const char *fname, u32 *keyid) { KBNODE n, n2; int found=0; + (void)fname; + (void)keyid; + assert( dst->pkt->pkttype == PKT_PUBLIC_SUBKEY || dst->pkt->pkttype == PKT_SECRET_SUBKEY ); @@ -2187,11 +2203,14 @@ merge_keysigs( KBNODE dst, KBNODE src, int *n_sigs, * Mark all new and copied packets by setting flag bit 0. */ static int -append_key( KBNODE keyblock, KBNODE node, int *n_sigs, - const char *fname, u32 *keyid ) +append_key (KBNODE keyblock, KBNODE node, int *n_sigs, + const char *fname, u32 *keyid) { KBNODE n; + (void)fname; + (void)keyid; + assert( node->pkt->pkttype == PKT_PUBLIC_SUBKEY || node->pkt->pkttype == PKT_SECRET_SUBKEY ); diff --git a/g10/keydb.c b/g10/keydb.c index 3360f6307..28595061a 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -644,7 +644,9 @@ int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved) { int rc; - + + (void)reserved; + if (!hd) return G10ERR_INV_ARG; diff --git a/g10/keyedit.c b/g10/keyedit.c index a1fa78fa0..cbb9d79bc 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1494,6 +1494,8 @@ keyedit_completion(const char *text, int start, int end) /* If we are at the start of a line, we try and command-complete. If not, just do nothing for now. */ + (void)end; + if(start==0) return rl_completion_matches(text,command_generator); diff --git a/g10/keygen.c b/g10/keygen.c index a056e5320..675acf603 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -631,42 +631,45 @@ add_keyserver_modify (PKT_signature *sig,int enabled) xfree (buf); } + int -keygen_upd_std_prefs( PKT_signature *sig, void *opaque ) +keygen_upd_std_prefs (PKT_signature *sig, void *opaque) { - if (!prefs_initialized) - keygen_set_std_prefs (NULL, 0); + (void)opaque; + + if (!prefs_initialized) + keygen_set_std_prefs (NULL, 0); + + if (nsym_prefs) + build_sig_subpkt (sig, SIGSUBPKT_PREF_SYM, sym_prefs, nsym_prefs); + else + { + delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_SYM); + delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_SYM); + } + + if (nhash_prefs) + build_sig_subpkt (sig, SIGSUBPKT_PREF_HASH, hash_prefs, nhash_prefs); + else + { + delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_HASH); + delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_HASH); + } - if (nsym_prefs) - build_sig_subpkt (sig, SIGSUBPKT_PREF_SYM, sym_prefs, nsym_prefs); - else - { - delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_SYM); - delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_SYM); - } + if (nzip_prefs) + build_sig_subpkt (sig, SIGSUBPKT_PREF_COMPR, zip_prefs, nzip_prefs); + else + { + delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_COMPR); + delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_COMPR); + } + + /* Make sure that the MDC feature flag is set if needed. */ + add_feature_mdc (sig,mdc_available); + add_keyserver_modify (sig,ks_modify); + keygen_add_keyserver_url(sig,NULL); - if (nhash_prefs) - build_sig_subpkt (sig, SIGSUBPKT_PREF_HASH, hash_prefs, nhash_prefs); - else - { - delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_HASH); - delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_HASH); - } - - if (nzip_prefs) - build_sig_subpkt (sig, SIGSUBPKT_PREF_COMPR, zip_prefs, nzip_prefs); - else - { - delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_COMPR); - delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PREF_COMPR); - } - - /* Make sure that the MDC feature flag is set if needed */ - add_feature_mdc (sig,mdc_available); - add_keyserver_modify (sig,ks_modify); - keygen_add_keyserver_url(sig,NULL); - - return 0; + return 0; } @@ -1102,6 +1105,8 @@ genhelp_protect (DEK *dek, STRING2KEY *s2k, PKT_secret_key *sk) static void genhelp_factors (gcry_sexp_t misc_key_info, KBNODE sec_root) { + (void)misc_key_info; + (void)sec_root; #if 0 /* Not used anymore */ size_t n; char *buf; diff --git a/g10/keyring.c b/g10/keyring.c index 937502ab2..ca2513198 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -158,6 +158,8 @@ update_offset_hash_table (OffsetHashTable tbl, u32 *kid, off_t off) { struct off_item *k; + (void)off; + for (k = tbl[(kid[1] & 0x07ff)]; k; k = k->next) { if (k->kid[0] == kid[0] && k->kid[1] == kid[1]) @@ -288,7 +290,7 @@ keyring_get_resource_name (KEYRING_HANDLE hd) /* - * Lock the keyring with the given handle, or unlok if yes is false. + * Lock the keyring with the given handle, or unlock if YES is false. * We ignore the handle and lock all registered files. */ int @@ -297,6 +299,8 @@ keyring_lock (KEYRING_HANDLE hd, int yes) KR_NAME kr; int rc = 0; + (void)hd; + if (yes) { /* first make sure the lock handles are created */ for (kr=kr_names; kr; kr = kr->next) { diff --git a/g10/misc.c b/g10/misc.c index a9d4f0547..cbaee08b5 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -121,7 +121,9 @@ register_secured_file (const char *fname) sf->dev = buf.st_dev; sf->next = secured_files; secured_files = sf; -#endif /*ENABLE_SELINUX_HACKS*/ +#else /*!ENABLE_SELINUX_HACKS*/ + (void)fname; +#endif /*!ENABLE_SELINUX_HACKS*/ } /* Remove a file registered as secure. */ @@ -152,7 +154,9 @@ unregister_secured_file (const char *fname) return; } } -#endif /*ENABLE_SELINUX_HACKS*/ +#else /*!ENABLE_SELINUX_HACKS*/ + (void)fname; +#endif /*!ENABLE_SELINUX_HACKS*/ } /* Return true if FD is corresponds to a secured file. Using -1 for @@ -182,7 +186,9 @@ is_secured_file (int fd) if (sf->ino == buf.st_ino && sf->dev == buf.st_dev) return 1; /* Yes. */ } -#endif /*ENABLE_SELINUX_HACKS*/ +#else /*!ENABLE_SELINUX_HACKS*/ + (void)fd; +#endif /*!ENABLE_SELINUX_HACKS*/ return 0; /* No. */ } @@ -217,7 +223,9 @@ is_secured_filename (const char *fname) if (sf->ino == buf.st_ino && sf->dev == buf.st_dev) return 1; /* Yes. */ } -#endif /*ENABLE_SELINUX_HACKS*/ +#else /*!ENABLE_SELINUX_HACKS*/ + (void)fname; +#endif /*!ENABLE_SELINUX_HACKS*/ return 0; /* No. */ } diff --git a/g10/parse-packet.c b/g10/parse-packet.c index a15038d92..57f94cd85 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -702,6 +702,8 @@ read_rest( IOBUF inp, size_t pktlen, int partial ) static int parse_marker( IOBUF inp, int pkttype, unsigned long pktlen ) { + (void)pkttype; + if(pktlen!=3) goto fail; @@ -1661,8 +1663,8 @@ read_protected_v3_mpi (IOBUF inp, unsigned long *length) static int -parse_key( IOBUF inp, int pkttype, unsigned long pktlen, - byte *hdr, int hdrlen, PACKET *pkt ) +parse_key (IOBUF inp, int pkttype, unsigned long pktlen, + byte *hdr, int hdrlen, PACKET *pkt) { int i, version, algorithm; unsigned n; @@ -1671,6 +1673,8 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen, int is_v4=0; int rc=0; + (void)hdr; + version = iobuf_get_noeof(inp); pktlen--; if( pkttype == PKT_PUBLIC_SUBKEY && version == '#' ) { /* early versions of G10 use old PGP comments packets; @@ -2170,6 +2174,8 @@ parse_attribute( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) { byte *p; + (void)pkttype; + #define EXTRA_UID_NAME_SPACE 71 packet->pkt.user_id = xmalloc_clear(sizeof *packet->pkt.user_id + EXTRA_UID_NAME_SPACE); @@ -2237,6 +2243,8 @@ parse_trust( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt ) { int c; + (void)pkttype; + if (pktlen) { c = iobuf_get_noeof(inp); @@ -2332,20 +2340,22 @@ static int parse_compressed( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt, int new_ctb ) { - PKT_compressed *zd; + PKT_compressed *zd; + + /* PKTLEN is here 0, but data follows (this should be the last + object in a file or the compress algorithm should know the + length). */ + (void)pkttype; + (void)pktlen; - /* pktlen is here 0, but data follows - * (this should be the last object in a file or - * the compress algorithm should know the length) - */ - zd = pkt->pkt.compressed = xmalloc(sizeof *pkt->pkt.compressed ); - zd->algorithm = iobuf_get_noeof(inp); - zd->len = 0; /* not used */ - zd->new_ctb = new_ctb; - zd->buf = inp; - if( list_mode ) - fprintf (listfp, ":compressed packet: algo=%d\n", zd->algorithm); - return 0; + zd = pkt->pkt.compressed = xmalloc (sizeof *pkt->pkt.compressed); + zd->algorithm = iobuf_get_noeof(inp); + zd->len = 0; /* not used */ + zd->new_ctb = new_ctb; + zd->buf = inp; + if (list_mode) + fprintf (listfp, ":compressed packet: algo=%d\n", zd->algorithm); + return 0; } @@ -2412,27 +2422,30 @@ parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen, the MDC checking is done right after the encryption in decrypt_data. */ static int -parse_mdc( IOBUF inp, int pkttype, unsigned long pktlen, - PACKET *pkt, int new_ctb ) +parse_mdc (IOBUF inp, int pkttype, unsigned long pktlen, + PACKET *pkt, int new_ctb) { - int rc = 0; - PKT_mdc *mdc; - byte *p; + int rc = 0; + PKT_mdc *mdc; + byte *p; - mdc = pkt->pkt.mdc = xmalloc(sizeof *pkt->pkt.mdc ); - if( list_mode ) - fprintf (listfp, ":mdc packet: length=%lu\n", pktlen); - if( !new_ctb || pktlen != 20 ) { - log_error("mdc_packet with invalid encoding\n"); - rc = gpg_error (GPG_ERR_INV_PACKET); - goto leave; + (void)pkttype; + + mdc = pkt->pkt.mdc = xmalloc(sizeof *pkt->pkt.mdc ); + if (list_mode) + fprintf (listfp, ":mdc packet: length=%lu\n", pktlen); + if (!new_ctb || pktlen != 20) + { + log_error("mdc_packet with invalid encoding\n"); + rc = gpg_error (GPG_ERR_INV_PACKET); + goto leave; } - p = mdc->hash; - for( ; pktlen; pktlen--, p++ ) - *p = iobuf_get_noeof(inp); - - leave: - return rc; + p = mdc->hash; + for (; pktlen; pktlen--, p++) + *p = iobuf_get_noeof(inp); + + leave: + return rc; } @@ -2448,14 +2461,16 @@ parse_mdc( IOBUF inp, int pkttype, unsigned long pktlen, */ static int -parse_gpg_control( IOBUF inp, int pkttype, - unsigned long pktlen, PACKET *packet, int partial ) +parse_gpg_control (IOBUF inp, int pkttype, unsigned long pktlen, + PACKET *packet, int partial) { byte *p; const byte *sesmark; size_t sesmarklen; int i; + (void)pkttype; + if ( list_mode ) fprintf (listfp, ":packet 63: length %lu ", pktlen); diff --git a/g10/passphrase.c b/g10/passphrase.c index 8703580dc..15129661f 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -398,6 +398,8 @@ void passphrase_clear_cache ( u32 *keyid, const char *cacheid, int algo ) { int rc; + + (void)algo; if (!cacheid) { @@ -441,6 +443,8 @@ ask_passphrase (const char *description, const char *cacheid, int *canceled) { char *pw = NULL; + + (void)promptid; if (canceled) *canceled = 0; diff --git a/g10/server.c b/g10/server.c index 6ca7dfa8b..d0e801bd5 100644 --- a/g10/server.c +++ b/g10/server.c @@ -69,6 +69,9 @@ option_handler (assuan_context_t ctx, const char *key, const char *value) { /* ctrl_t ctrl = assuan_get_pointer (ctx); */ + (void)ctx; + (void)value; + /* Fixme: Implement the tty and locale args. */ if (!strcmp (key, "display")) { @@ -120,6 +123,8 @@ input_notify (assuan_context_t ctx, const char *line) { /* ctrl_t ctrl = assuan_get_pointer (ctx); */ + (void)ctx; + if (strstr (line, "--armor")) ; /* FIXME */ else if (strstr (line, "--base64")) @@ -127,7 +132,9 @@ input_notify (assuan_context_t ctx, const char *line) else if (strstr (line, "--binary")) ; else - ; /* FIXME (autodetect encoding) */ + { + /* FIXME (autodetect encoding) */ + } } @@ -136,11 +143,15 @@ static void output_notify (assuan_context_t ctx, const char *line) { /* ctrl_t ctrl = assuan_get_pointer (ctx); */ + + (void)ctx; if (strstr (line, "--armor")) ; /* FIXME */ else if (strstr (line, "--base64")) - ; /* FIXME */ + { + /* FIXME */ + } } @@ -160,6 +171,8 @@ output_notify (assuan_context_t ctx, const char *line) static int cmd_recipient (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -183,6 +196,8 @@ cmd_recipient (assuan_context_t ctx, char *line) static int cmd_signer (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -204,6 +219,8 @@ cmd_signer (assuan_context_t ctx, char *line) static int cmd_encrypt (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -216,6 +233,8 @@ cmd_encrypt (assuan_context_t ctx, char *line) static int cmd_decrypt (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -239,6 +258,8 @@ cmd_verify (assuan_context_t ctx, char *line) gnupg_fd_t out_fd = assuan_get_output_fd (ctx); FILE *out_fp = NULL; + (void)line; + if (fd == GNUPG_INVALID_FD) return gpg_error (GPG_ERR_ASS_NO_INPUT); @@ -278,6 +299,8 @@ cmd_verify (assuan_context_t ctx, char *line) static int cmd_sign (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -290,6 +313,8 @@ cmd_sign (assuan_context_t ctx, char *line) static int cmd_import (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -308,6 +333,8 @@ cmd_import (assuan_context_t ctx, char *line) static int cmd_export (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -320,6 +347,8 @@ cmd_export (assuan_context_t ctx, char *line) static int cmd_delkeys (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -355,6 +384,10 @@ cmd_message (assuan_context_t ctx, char *line) static int do_listkeys (assuan_context_t ctx, char *line, int mode) { + (void)ctx; + (void)line; + (void)mode; + return gpg_error (GPG_ERR_NOT_SUPPORTED); } @@ -382,6 +415,8 @@ cmd_listsecretkeys (assuan_context_t ctx, char *line) static int cmd_genkey (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_SUPPORTED); } diff --git a/g10/tdbdump.c b/g10/tdbdump.c index 5e7b685e2..4c3b888cb 100644 --- a/g10/tdbdump.c +++ b/g10/tdbdump.c @@ -67,20 +67,23 @@ write_record( TRUSTREC *rec ) void list_trustdb( const char *username ) { - TRUSTREC rec; - - init_trustdb(); - /* for now we ignore the user ID */ - if (1) { - ulong recnum; - int i; - - printf("TrustDB: %s\n", tdbio_get_dbname() ); - for(i=9+strlen(tdbio_get_dbname()); i > 0; i-- ) - putchar('-'); - putchar('\n'); - for(recnum=0; !tdbio_read_record( recnum, &rec, 0); recnum++ ) - tdbio_dump_record( &rec, stdout ); + TRUSTREC rec; + + (void)username; + + init_trustdb(); + /* For now we ignore the user ID. */ + if (1) + { + ulong recnum; + int i; + + printf("TrustDB: %s\n", tdbio_get_dbname() ); + for(i=9+strlen(tdbio_get_dbname()); i > 0; i-- ) + putchar('-'); + putchar('\n'); + for(recnum=0; !tdbio_read_record( recnum, &rec, 0); recnum++ ) + tdbio_dump_record( &rec, stdout ); } } diff --git a/g10/trustdb.c b/g10/trustdb.c index ff218ad80..265b8830d 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1213,6 +1213,7 @@ get_validity_counts (PKT_public_key *pk, PKT_user_id *uid) void list_trust_path( const char *username ) { + (void)username; } /**************** @@ -1237,7 +1238,11 @@ int enum_cert_paths( void **context, ulong *lid, unsigned *ownertrust, unsigned *validity ) { - return -1; + (void)context; + (void)lid; + (void)ownertrust; + (void)validity; + return -1; } @@ -1245,10 +1250,13 @@ enum_cert_paths( void **context, ulong *lid, * Print the current path */ void -enum_cert_paths_print( void **context, FILE *fp, - int refresh, ulong selected_lid ) +enum_cert_paths_print (void **context, FILE *fp, + int refresh, ulong selected_lid) { - return; + (void)context; + (void)fp; + (void)refresh; + (void)selected_lid; } @@ -2006,6 +2014,7 @@ validate_one_keyblock (KBNODE kb, struct key_item *klist, static int search_skipfnc (void *opaque, u32 *kid, PKT_user_id *dummy) { + (void)dummy; return test_key_hash_table ((KeyHashTable)opaque, kid); } diff --git a/g10/verify.c b/g10/verify.c index 702547ea2..484fd9c76 100644 --- a/g10/verify.c +++ b/g10/verify.c @@ -238,6 +238,9 @@ gpg_verify (ctrl_t ctrl, int sig_fd, int data_fd, FILE *out_fp) armor_filter_context_t *afx = NULL; progress_filter_context_t *pfx = new_progress_context (); + (void)ctrl; + (void)out_fp; + fp = iobuf_fdopen (sig_fd, "rb"); if (fp && is_secured_file (sig_fd)) { diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog index c8ea2efa7..5da8927ff 100644 --- a/jnlib/ChangeLog +++ b/jnlib/ChangeLog @@ -1,3 +1,13 @@ +2008-10-20 Werner Koch + + * w32-afunix.c (_w32_sock_connect): Mark ADDRLEN as unused. + + * dotlock.c (release_dotlock): Do not mix declaration and code. + + * stringhelp.c (make_basename): Silent gcc warning about unused arg. + * argparse.c (store_alias): Ditto. + (find_long_option): + 2008-10-15 Werner Koch * logging.c (do_logv) [W32]: Flush the log stream. diff --git a/jnlib/argparse.c b/jnlib/argparse.c index 120b09eb8..5813b9b82 100644 --- a/jnlib/argparse.c +++ b/jnlib/argparse.c @@ -229,6 +229,9 @@ store_alias( ARGPARSE_ARGS *arg, char *name, char *value ) * and fix the probelms IRIX has with (ALIAS_DEV)arg.. * used as lvalue */ + (void)arg; + (void)name; + (void)value; #if 0 ALIAS_DEF a = jnlib_xmalloc( sizeof *a ); a->name = name; @@ -507,6 +510,8 @@ find_long_option( ARGPARSE_ARGS *arg, int i; size_t n; + (void)arg; + /* Would be better if we can do a binary search, but it is not possible to reorder our option table because we would mess up our help strings - What we can do is: Build a nice option diff --git a/jnlib/dotlock.c b/jnlib/dotlock.c index 66ab258ea..53a43244d 100644 --- a/jnlib/dotlock.c +++ b/jnlib/dotlock.c @@ -516,6 +516,10 @@ make_dotlock ( DOTLOCK h, long timeout ) int release_dotlock( DOTLOCK h ) { +#ifndef HAVE_DOSISH_SYSTEM + int pid, same_node; +#endif + /* To avoid atexit race conditions we first check whether there are any locks left. It might happen that another atexit handler tries to release the lock while the atexit handler of this module @@ -540,7 +544,6 @@ release_dotlock( DOTLOCK h ) return -1; } #else - int pid, same_node; pid = read_lockfile (h, &same_node); if ( pid == -1 ) diff --git a/jnlib/stringhelp.c b/jnlib/stringhelp.c index 50e869cea..b13d8b001 100644 --- a/jnlib/stringhelp.c +++ b/jnlib/stringhelp.c @@ -237,11 +237,12 @@ length_sans_trailing_ws (const unsigned char *line, size_t len) char * make_basename(const char *filepath, const char *inputpath) { - char *p; - #ifdef __riscos__ return riscos_make_basename(filepath, inputpath); -#endif +#else + char *p; + + (void)inputpath; /* Only required for riscos. */ if ( !(p=strrchr(filepath, '/')) ) #ifdef HAVE_DRIVE_LETTERS @@ -253,6 +254,7 @@ make_basename(const char *filepath, const char *inputpath) } return jnlib_xstrdup(p+1); +#endif } diff --git a/jnlib/t-stringhelp.c b/jnlib/t-stringhelp.c index 12331d241..f6590230e 100644 --- a/jnlib/t-stringhelp.c +++ b/jnlib/t-stringhelp.c @@ -121,6 +121,9 @@ test_compare_filenames (void) int main (int argc, char **argv) { + (void)argc; + (void)argv; + test_percent_escape (); test_compare_filenames (); diff --git a/jnlib/w32-afunix.c b/jnlib/w32-afunix.c index 0b03c74b2..63653941e 100644 --- a/jnlib/w32-afunix.c +++ b/jnlib/w32-afunix.c @@ -103,6 +103,8 @@ _w32_sock_connect (int sockfd, struct sockaddr *addr, int addrlen) unsigned short port; char nonce[16]; int ret; + + (void)addrlen; unaddr = (struct sockaddr_un *)addr; if (read_port_and_nonce (unaddr->sun_path, &port, nonce)) diff --git a/kbx/ChangeLog b/kbx/ChangeLog index c814d107e..269b8ddfa 100644 --- a/kbx/ChangeLog +++ b/kbx/ChangeLog @@ -1,3 +1,14 @@ +2008-10-20 Werner Koch + + * keybox-update.c (blob_filecopy): Remove unused arg n_packets. + (keybox_insert_cert): Adjust for that. + (keybox_update_cert): Mark unused args. + (keybox_set_flags): Ditto. + * keybox-blob.c (create_blob_trailer): Ditto. + * keybox-search.c (keybox_get_flags): Ditto. + * keybox-dump.c (_keybox_dump_find_dups): Ditto. + * kbxutil.c (my_gcry_logger): Ditto. + 2008-05-06 Werner Koch * keybox-file.c (_keybox_read_blob2): Return GPG_ERR_TOO_SHORT if diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c index cadc06775..afc4b79e4 100644 --- a/kbx/kbxutil.c +++ b/kbx/kbxutil.c @@ -133,6 +133,8 @@ my_strusage( int level ) static void my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr) { + (void)dummy; + /* Map the log levels. */ switch (level) { diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c index 6f89a43f9..64e534f9f 100644 --- a/kbx/keybox-blob.c +++ b/kbx/keybox-blob.c @@ -637,7 +637,8 @@ create_blob_header (KEYBOXBLOB blob, int blobtype, int as_ephemeral) static int create_blob_trailer (KEYBOXBLOB blob) { - return 0; + (void)blob; + return 0; } diff --git a/kbx/keybox-dump.c b/kbx/keybox-dump.c index fe68bf1fc..b671089a0 100644 --- a/kbx/keybox-dump.c +++ b/kbx/keybox-dump.c @@ -579,6 +579,8 @@ _keybox_dump_find_dups (const char *filename, int print_them, FILE *outfp) struct dupitem_s *dupitems; size_t dupitems_size, dupitems_count, lastn, n; char fprbuf[3*20+1]; + + (void)print_them; memset (zerodigest, 0, sizeof zerodigest); diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c index 153186b4f..927399d48 100644 --- a/kbx/keybox-search.c +++ b/kbx/keybox-search.c @@ -1015,6 +1015,8 @@ keybox_get_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int *value) size_t length; gpg_err_code_t ec; + (void)idx; /* Not yet used. */ + if (!hd) return gpg_error (GPG_ERR_INV_VALUE); if (!hd->found.blob) diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c index 03009618b..c29e31666 100644 --- a/kbx/keybox-update.c +++ b/kbx/keybox-update.c @@ -209,7 +209,7 @@ rename_tmp_file (const char *bakfname, const char *tmpfname, */ static int blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob, - int secret, off_t start_offset, unsigned int n_packets ) + int secret, off_t start_offset) { FILE *fp, *newfp; int rc=0; @@ -392,7 +392,7 @@ keybox_insert_cert (KEYBOX_HANDLE hd, ksba_cert_t cert, rc = _keybox_create_x509_blob (&blob, cert, sha1_digest, hd->ephemeral); if (!rc) { - rc = blob_filecopy (1, fname, blob, hd->secret, 0, 0 ); + rc = blob_filecopy (1, fname, blob, hd->secret, 0); _keybox_release_blob (blob); /* if (!rc && !hd->secret && kb_offtbl) */ /* { */ @@ -406,6 +406,9 @@ int keybox_update_cert (KEYBOX_HANDLE hd, ksba_cert_t cert, unsigned char *sha1_digest) { + (void)hd; + (void)cert; + (void)sha1_digest; return -1; } @@ -426,6 +429,8 @@ keybox_set_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int value) const unsigned char *buffer; size_t length; + (void)idx; /* Not yet used. */ + if (!hd) return gpg_error (GPG_ERR_INV_VALUE); if (!hd->found.blob) diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 05919363c..0530d36f8 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,8 @@ +2008-10-20 Werner Koch + + * curl-shim.c (curl_global_init): Mark usused arg. + (curl_version_info): Ditto. + 2008-08-29 Werner Koch * gpgkeys_kdns.c: Changed copyright notice to the FSF. diff --git a/keyserver/curl-shim.c b/keyserver/curl-shim.c index dfa3d1e3c..0c8bfdc9b 100644 --- a/keyserver/curl-shim.c +++ b/keyserver/curl-shim.c @@ -78,6 +78,7 @@ handle_error(CURL *curl,CURLcode err,const char *str) CURLcode curl_global_init(long flags) { + (void)flags; return CURLE_OK; } @@ -340,6 +341,8 @@ curl_version_info(int type) static curl_version_info_data data; static const char *protocols[]={"http",NULL}; + (void)type; + data.protocols=protocols; return &data; diff --git a/scd/ChangeLog b/scd/ChangeLog index 05dcb105d..04a945d0f 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,21 @@ +2008-10-20 Werner Koch + + * pcsc-wrapper.c (read_32): Use provided arg and not stdin. Is + called with stdin, though. + (handle_close): Mark unused arg. + (handle_status, handle_reset): Ditto. + + * ccid-driver.c (ccid_check_card_presence): Mark not yet used arg. + + * scdaemon.c (scd_deinit_default_ctrl): Mark unused arg. + * command.c (cmd_unlock, cmd_restart, cmd_disconnect): Ditto. + * apdu.c (ct_get_status): Ditto. + (ct_send_apdu, pcsc_send_apdu_wrapped) + (apdu_open_remote_reader): Ditto. + * app.c (select_application): Ditto. + * app-openpgp.c (do_writecert, do_change_pin, do_writekey): Ditto. + * app-nks.c (do_change_pin, do_check_pin): Ditto. + 2008-10-16 Werner Koch * command.c (cmd_disconnect): New dummy command. diff --git a/scd/apdu.c b/scd/apdu.c index 274d27b6e..d02736a51 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -542,6 +542,7 @@ reset_ct_reader (int slot) static int ct_get_status (int slot, unsigned int *status) { + (void)slot; /* The status we returned is wrong but we don't care becuase ctAPI is not anymore required. */ *status = APDU_CARD_USABLE|APDU_CARD_PRESENT|APDU_CARD_ACTIVE; @@ -559,6 +560,8 @@ ct_send_apdu (int slot, unsigned char *apdu, size_t apdulen, unsigned char dad[1], sad[1]; unsigned short ctbuflen; + (void)pininfo; + /* If we don't have an ATR, we need to reset the reader first. */ if (!reader_table[slot].atrlen && (rc = reset_ct_reader (slot))) @@ -1020,6 +1023,8 @@ pcsc_send_apdu_wrapped (int slot, unsigned char *apdu, size_t apdulen, unsigned char msgbuf[9]; int sw = SW_HOST_CARD_IO_ERROR; + (void)pininfo; + if (!reader_table[slot].atrlen && (err = reset_pcsc_reader (slot))) return err; @@ -2472,6 +2477,15 @@ apdu_open_remote_reader (const char *portstr, writefnc, writefnc_value, closefnc, closefnc_value); #else + (void)portstr; + (void)cookie; + (void)length; + (void)readfnc; + (void)readfnc_value; + (void)writefnc; + (void)writefnc_value; + (void)closefnc; + (void)closefnc_value; #ifdef _WIN32 errno = ENOENT; #else diff --git a/scd/app-nks.c b/scd/app-nks.c index 848e76448..ac28ba258 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -530,6 +530,9 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, const char *oldpin; size_t oldpinlen; + (void)ctrl; + (void)chvnostr; + if ((flags & APP_CHANGE_FLAG_RESET)) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); @@ -573,6 +576,7 @@ do_check_pin (app_t app, const char *keyidstr, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg) { + (void)keyidstr; return verify_pin (app, pincb, pincb_arg); } diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index ca17024a5..def42195f 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1777,6 +1777,7 @@ do_writecert (app_t app, ctrl_t ctrl, void *pincb_arg, const unsigned char *certdata, size_t certdatalen) { + (void)ctrl; #if GNUPG_MAJOR_VERSION > 1 if (strcmp (certidstr, "OPENPGP.3")) return gpg_error (GPG_ERR_INV_ID); @@ -1808,6 +1809,8 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, int reset_mode = !!(flags & APP_CHANGE_FLAG_RESET); int set_resetcode = 0; + (void)ctrl; + if (reset_mode && chvno == 3) { rc = gpg_error (GPG_ERR_INV_ID); @@ -2201,6 +2204,8 @@ do_writekey (app_t app, ctrl_t ctrl, unsigned char fprbuf[20]; u32 created_at = 0; + (void)ctrl; + if (!strcmp (keyid, "OPENPGP.1")) keyno = 0; else if (!strcmp (keyid, "OPENPGP.2")) diff --git a/scd/app.c b/scd/app.c index d2732beb6..0c8ddfbdd 100644 --- a/scd/app.c +++ b/scd/app.c @@ -220,6 +220,8 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app) unsigned char *result = NULL; size_t resultlen; + (void)ctrl; + *r_app = NULL; err = lock_reader (slot); diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index 52a397927..b2c39cd6d 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -1353,7 +1353,7 @@ ccid_close_reader (ccid_driver_t handle) int ccid_check_card_presence (ccid_driver_t handle) { - + (void)handle; /* Not yet implemented. */ return -1; } diff --git a/scd/command.c b/scd/command.c index 4c55e6167..b835aac73 100644 --- a/scd/command.c +++ b/scd/command.c @@ -1502,6 +1502,8 @@ cmd_unlock (assuan_context_t ctx, char *line) ctrl_t ctrl = assuan_get_pointer (ctx); int rc = 0; + (void)line; + if (locked_session) { if (locked_session != ctrl->server_local) @@ -1624,6 +1626,8 @@ cmd_restart (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); + (void)line; + if (ctrl->app_ctx) { release_application (ctrl->app_ctx); @@ -1646,6 +1650,8 @@ cmd_restart (assuan_context_t ctx, char *line) static int cmd_disconnect (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; return gpg_error (GPG_ERR_NOT_IMPLEMENTED); } diff --git a/scd/pcsc-wrapper.c b/scd/pcsc-wrapper.c index b913cdc12..a7b219822 100644 --- a/scd/pcsc-wrapper.c +++ b/scd/pcsc-wrapper.c @@ -243,10 +243,10 @@ read_32 (FILE *fp) { int c1, c2, c3, c4; - c1 = getc (stdin); - c2 = getc (stdin); - c3 = getc (stdin); - c4 = getc (stdin); + c1 = getc (fp); + c2 = getc (fp); + c3 = getc (fp); + c4 = getc (fp); if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF) { fprintf (stderr, PGM ": premature EOF while parsing request\n"); @@ -518,6 +518,9 @@ handle_open (unsigned char *argbuf, size_t arglen) static void handle_close (unsigned char *argbuf, size_t arglen) { + (void)argbuf; + (void)arglen; + if (!driver_is_open) { fprintf (stderr, PGM ": PC/SC has not yet been opened\n"); @@ -546,6 +549,9 @@ handle_status (unsigned char *argbuf, size_t arglen) int status; unsigned char buf[20]; + (void)argbuf; + (void)arglen; + if (!driver_is_open) { fprintf (stderr, PGM ": PC/SC has not yet been opened\n"); @@ -614,6 +620,9 @@ handle_reset (unsigned char *argbuf, size_t arglen) unsigned long nreader, atrlen; unsigned long card_state, card_protocol; + (void)argbuf; + (void)arglen; + if (!driver_is_open) { fprintf (stderr, PGM ": PC/SC has not yet been opened\n"); diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 0366703b7..b65f47e46 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -825,7 +825,7 @@ scd_init_default_ctrl (ctrl_t ctrl) static void scd_deinit_default_ctrl (ctrl_t ctrl) { - + (void)ctrl; } diff --git a/sm/ChangeLog b/sm/ChangeLog index 796724354..2404c72f5 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,21 @@ +2008-10-20 Werner Koch + + * keydb.c (keydb_locate_writable): Mark unused arg. + (keydb_search_kid): Ditto. + (keydb_clear_some_cert_flags): Ditto. + * server.c (cmd_encrypt): Ditto. + (cmd_decrypt, cmd_verify, cmd_import, cmd_genkey): Ditto. + * call-agent.c (gpgsm_scd_pksign): Ditto. + * call-dirmngr.c (release_dirmngr, release_dirmngr2) + (run_command_cb): Ditto. + * certlist.c (gpgsm_add_cert_to_certlist): Ditto. + * certchain.c (find_up_dirmngr): Ditto. + * keylist.c (print_key_data): Ditto. + (list_cert_raw, list_cert_std): Ditto. + * qualified.c (gpgsm_is_in_qualified_list): Ditto. + + * gpgsm.c (set_binary) [!W32]: Mark unused arg. + 2008-10-17 Werner Koch * call-dirmngr.c (start_dirmngr, start_dirmngr2): Reset the lock diff --git a/sm/call-agent.c b/sm/call-agent.c index d1dad6d07..bca44d2d6 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -232,6 +232,8 @@ gpgsm_scd_pksign (ctrl_t ctrl, const char *keyid, const char *desc, unsigned char *sigbuf; size_t sigbuflen; + (void)desc; + *r_buf = NULL; switch(digestalgo) diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c index 4d0977a4a..20017dd9e 100644 --- a/sm/call-dirmngr.c +++ b/sm/call-dirmngr.c @@ -339,6 +339,8 @@ start_dirmngr (ctrl_t ctrl) static void release_dirmngr (ctrl_t ctrl) { + (void)ctrl; + if (!dirmngr_ctx_locked) log_error ("WARNING: trying to release a non-locked dirmngr ctx\n"); dirmngr_ctx_locked = 0; @@ -363,6 +365,8 @@ start_dirmngr2 (ctrl_t ctrl) static void release_dirmngr2 (ctrl_t ctrl) { + (void)ctrl; + if (!dirmngr2_ctx_locked) log_error ("WARNING: trying to release a non-locked dirmngr2 ctx\n"); dirmngr2_ctx_locked = 0; @@ -859,6 +863,8 @@ gpgsm_dirmngr_lookup (ctrl_t ctrl, strlist_t names, int cache_only, static int run_command_cb (void *opaque, const void *buffer, size_t length) { + (void)opaque; + if (buffer) { if ( fwrite (buffer, length, 1, stdout) != 1 ) diff --git a/sm/certchain.c b/sm/certchain.c index 03b020e33..2d81dbf6c 100644 --- a/sm/certchain.c +++ b/sm/certchain.c @@ -539,6 +539,8 @@ find_up_dirmngr (ctrl_t ctrl, KEYDB_HANDLE kh, strlist_t names = NULL; int count = 0; char *pattern; + + (void)kh; if (opt.verbose) log_info (_("looking up issuer from the Dirmngr cache\n")); diff --git a/sm/certlist.c b/sm/certlist.c index 2b717ef8b..4137437a6 100644 --- a/sm/certlist.c +++ b/sm/certlist.c @@ -272,6 +272,8 @@ int gpgsm_add_cert_to_certlist (ctrl_t ctrl, ksba_cert_t cert, certlist_t *listaddr, int is_encrypt_to) { + (void)ctrl; + if (!is_cert_in_certlist (cert, *listaddr)) { certlist_t cl = xtrycalloc (1, sizeof *cl); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 3b8bf915b..f9034328d 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -693,6 +693,8 @@ set_binary (FILE *fp) { #ifdef HAVE_DOSISH_SYSTEM setmode (fileno (fp), O_BINARY); +#else + (void)fp; #endif } diff --git a/sm/import.c b/sm/import.c index 3045c89d5..03e84ec44 100644 --- a/sm/import.c +++ b/sm/import.c @@ -597,7 +597,9 @@ parse_p12 (ctrl_t ctrl, ksba_reader_t reader, stats->secret_dups++; } else if ( !strcmp (p, "bad-passphrase")) - ; + { + + } } else { diff --git a/sm/keydb.c b/sm/keydb.c index a6efcc4cd..26f195cbb 100644 --- a/sm/keydb.c +++ b/sm/keydb.c @@ -803,6 +803,8 @@ int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved) { int rc; + + (void)reserved; if (!hd) return gpg_error (GPG_ERR_INV_VALUE); @@ -942,6 +944,8 @@ int keydb_search_kid (KEYDB_HANDLE hd, u32 *kid) { KEYDB_SEARCH_DESC desc; + + (void)kid; memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_LONG_KID; @@ -1447,6 +1451,8 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names) strlist_t sl; int rc=0; unsigned int old_value, value; + + (void)ctrl; hd = keydb_new (0); if (!hd) diff --git a/sm/keylist.c b/sm/keylist.c index 014147e69..2af474948 100644 --- a/sm/keylist.c +++ b/sm/keylist.c @@ -229,6 +229,9 @@ print_key_data (ksba_cert_t cert, estream_t fp) putchar(':'); putchar('\n'); } +#else + (void)cert; + (void)fp; #endif } @@ -649,6 +652,8 @@ list_cert_raw (ctrl_t ctrl, KEYDB_HANDLE hd, unsigned int reason; const unsigned char *cert_der = NULL; + (void)have_secret; + es_fprintf (fp, " ID: 0x%08lX\n", gpgsm_get_short_fingerprint (cert)); @@ -1017,6 +1022,7 @@ list_cert_std (ctrl_t ctrl, ksba_cert_t cert, estream_t fp, int have_secret, const char *oid; const unsigned char *cert_der = NULL; + (void)have_secret; es_fprintf (fp, " ID: 0x%08lX\n", gpgsm_get_short_fingerprint (cert)); diff --git a/sm/qualified.c b/sm/qualified.c index d90272804..d0db481b6 100644 --- a/sm/qualified.c +++ b/sm/qualified.c @@ -151,6 +151,8 @@ gpgsm_is_in_qualified_list (ctrl_t ctrl, ksba_cert_t cert, char *country) char mycountry[3]; int lnr = 0; + (void)ctrl; + if (country) *country = 0; diff --git a/sm/server.c b/sm/server.c index cd2b9f69a..9b0a04f18 100644 --- a/sm/server.c +++ b/sm/server.c @@ -465,6 +465,8 @@ cmd_encrypt (assuan_context_t ctx, char *line) FILE *out_fp; int rc; + (void)line; + inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); if (inp_fd == -1) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); @@ -519,6 +521,8 @@ cmd_decrypt (assuan_context_t ctx, char *line) FILE *out_fp; int rc; + (void)line; + inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); if (inp_fd == -1) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); @@ -562,6 +566,8 @@ cmd_verify (assuan_context_t ctx, char *line) int out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1); FILE *out_fp = NULL; + (void)line; + if (fd == -1) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); @@ -643,6 +649,8 @@ cmd_import (assuan_context_t ctx, char *line) int rc; int fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); + (void)line; + if (fd == -1) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); @@ -922,6 +930,8 @@ cmd_genkey (assuan_context_t ctx, char *line) int rc; estream_t in_stream; + (void)line; + inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); if (inp_fd == -1) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); diff --git a/tests/ChangeLog b/tests/ChangeLog index 305303776..973235f32 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2008-10-20 Werner Koch + + * asschk.c (cmd_echo): Mark unused arg. + (cmd_send, cmd_expect_ok, cmd_expect_err, cmd_pipeserver) + (cmd_quit_if, cmd_fail_if): Ditto. + 2008-09-29 Werner Koch * Makefile.am (TESTS): Remove tests. diff --git a/tests/asschk.c b/tests/asschk.c index 176fcac6f..c4a50acb3 100644 --- a/tests/asschk.c +++ b/tests/asschk.c @@ -673,6 +673,7 @@ cmd_let (const char *assign_to, char *arg) static void cmd_echo (const char *assign_to, char *arg) { + (void)assign_to; if (!opt_no_echo) printf ("%s\n", arg); } @@ -680,6 +681,7 @@ cmd_echo (const char *assign_to, char *arg) static void cmd_send (const char *assign_to, char *arg) { + (void)assign_to; if (opt_verbose) fprintf (stderr, "sending `%s'\n", arg); write_assuan (server_send_fd, arg); @@ -706,6 +708,9 @@ handle_status_line (char *arg) static void cmd_expect_ok (const char *assign_to, char *arg) { + (void)assign_to; + (void)arg; + if (opt_verbose) fprintf (stderr, "expecting OK\n"); do @@ -724,6 +729,9 @@ cmd_expect_ok (const char *assign_to, char *arg) static void cmd_expect_err (const char *assign_to, char *arg) { + (void)assign_to; + (void)arg; + if (opt_verbose) fprintf (stderr, "expecting ERR\n"); do @@ -795,6 +803,8 @@ cmd_createfile (const char *assign_to, char *arg) static void cmd_pipeserver (const char *assign_to, char *arg) { + (void)assign_to; + if (!*arg) die ("syntax error: servername missing"); @@ -805,6 +815,8 @@ cmd_pipeserver (const char *assign_to, char *arg) static void cmd_quit_if(const char *assign_to, char *arg) { + (void)assign_to; + if (eval_boolean (arg)) exit (0); } @@ -812,6 +824,8 @@ cmd_quit_if(const char *assign_to, char *arg) static void cmd_fail_if(const char *assign_to, char *arg) { + (void)assign_to; + if (eval_boolean (arg)) exit (1); } diff --git a/tools/ChangeLog b/tools/ChangeLog index b8c90d08e..7ab7dd82a 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,13 @@ +2008-10-20 Werner Koch + + * gpgsplit.c (write_part): Remove unused arg FNAME. Change caller. + (do_split): Ditto. + + * no-libgcrypt.c (gcry_control): Mark unused arg. + * gpg-connect-agent.c (do_recvfd): Ditto. + * gpgparsemail.c (mime_signed_begin, mime_encrypted_begin): Ditto. + (pkcs7_begin): Ditto. + 2008-10-01 Werner Koch * gpg-connect-agent.c (main): New command datafile. diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index d48e3512b..774abfad4 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -913,6 +913,8 @@ do_sendfd (assuan_context_t ctx, char *line) static void do_recvfd (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; log_info ("This command has not yet been implemented\n"); } diff --git a/tools/gpgparsemail.c b/tools/gpgparsemail.c index 525c604ba..6265efc93 100644 --- a/tools/gpgparsemail.c +++ b/tools/gpgparsemail.c @@ -349,6 +349,9 @@ mime_signed_begin (struct parse_info_s *info, rfc822parse_t msg, rfc822parse_field_t field_ctx) { const char *s; + + (void)msg; + s = rfc822parse_query_parameter (field_ctx, "protocol", 1); if (s) { @@ -391,6 +394,10 @@ mime_encrypted_begin (struct parse_info_s *info, rfc822parse_t msg, rfc822parse_field_t field_ctx) { const char *s; + + (void)info; + (void)msg; + s = rfc822parse_query_parameter (field_ctx, "protocol", 0); if (s) printf ("h encrypted.protocol: %s\n", s); @@ -403,6 +410,9 @@ pkcs7_begin (struct parse_info_s *info, rfc822parse_t msg, rfc822parse_field_t field_ctx) { const char *s; + + (void)msg; + s = rfc822parse_query_parameter (field_ctx, "name", 0); if (s) printf ("h pkcs7.name: %s\n", s); diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c index bb8ea0a0c..0d7faa061 100644 --- a/tools/gpgsplit.c +++ b/tools/gpgsplit.c @@ -526,8 +526,8 @@ handle_bzip2(int algo,FILE *fpin,FILE *fpout) /* hdr must point to a buffer large enough to hold all header bytes */ static int -write_part ( const char *fname, FILE *fpin, unsigned long pktlen, - int pkttype, int partial, unsigned char *hdr, size_t hdrlen) +write_part (FILE *fpin, unsigned long pktlen, + int pkttype, int partial, unsigned char *hdr, size_t hdrlen) { FILE *fpout; int c, first; @@ -770,7 +770,7 @@ write_part ( const char *fname, FILE *fpin, unsigned long pktlen, static int -do_split (const char *fname, FILE *fp) +do_split (FILE *fp) { int c, ctb, pkttype; unsigned long pktlen = 0; @@ -848,8 +848,7 @@ do_split (const char *fname, FILE *fp) } } - return write_part (fname, fp, pktlen, pkttype, partial, - header, header_idx); + return write_part (fp, pktlen, pkttype, partial, header, header_idx); } @@ -870,7 +869,7 @@ split_packets (const char *fname) return; } - while ( !(rc = do_split (fname, fp)) ) + while ( !(rc = do_split (fp)) ) ; if ( rc > 0 ) ; /* error already handled */ diff --git a/tools/no-libgcrypt.c b/tools/no-libgcrypt.c index 009fd95a5..3428e57ee 100644 --- a/tools/no-libgcrypt.c +++ b/tools/no-libgcrypt.c @@ -113,8 +113,9 @@ gcry_free (void *a) /* We need this dummy because exechelp.c uses gcry_control to terminate the secure memeory. */ gcry_error_t -gcry_control (enum gcry_ctl_cmds CMD, ...) +gcry_control (enum gcry_ctl_cmds cmd, ...) { + (void)cmd; return 0; }