diff options
author | Werner Koch <wk@gnupg.org> | 2008-10-20 15:53:23 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-10-20 15:53:23 +0200 |
commit | 0a5f7424660e404e5fd0361b9331d154acf01d6c (patch) | |
tree | b84fb5a994045e12eb326441d8c924094bd915cd /common | |
parent | Fix a bug in estream_snprintf. Found by a failed t-gettime under Windows. (diff) | |
download | gnupg2-0a5f7424660e404e5fd0361b9331d154acf01d6c.tar.xz gnupg2-0a5f7424660e404e5fd0361b9331d154acf01d6c.zip |
Marked all unused args on non-W32 platforms.
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 21 | ||||
-rw-r--r-- | common/asshelp.c | 2 | ||||
-rw-r--r-- | common/audit.c | 4 | ||||
-rw-r--r-- | common/estream.c | 35 | ||||
-rw-r--r-- | common/exechelp.c | 6 | ||||
-rw-r--r-- | common/http.c | 2 | ||||
-rw-r--r-- | common/iobuf.c | 30 | ||||
-rw-r--r-- | common/localename.c | 1 | ||||
-rw-r--r-- | common/signal.c | 1 | ||||
-rw-r--r-- | common/sysutils.c | 2 | ||||
-rw-r--r-- | common/t-convert.c | 2 | ||||
-rw-r--r-- | common/t-sexputil.c | 4 |
12 files changed, 89 insertions, 21 deletions
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 <wk@g10code.com> + + + * 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 <wk@g10code.com> * 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; |