1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Marked all unused args on non-W32 platforms.

This commit is contained in:
Werner Koch 2008-10-20 13:53:23 +00:00
parent e1f4154d75
commit 0a5f742466
84 changed files with 864 additions and 224 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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 ();

View file

@ -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
}

View file

@ -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;
}

View file

@ -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. */

View file

@ -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*/

View file

@ -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
}

View file

@ -447,6 +447,8 @@ test_hex2str (void)
int
main (int argc, char **argv)
{
(void)argc;
(void)argv;
test_hex2bin ();
test_hexcolon2bin ();

View file

@ -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;