Silence more warnings about unused vars and args.

* dirmngr/cdblib.c (cdb_init) [W32]: Remove unused var.
* dirmngr/dirmngr-client.c (start_dirmngr): s/int/assuan_fd_t/.
* dirmngr/dirmngr.c (w32_service_control): Mark unused args.
(call_real_main): New.
(main) [W32]: Use new function to match prototype.
(real_main) [W32]: Mark unused vars.
(handle_signal) [W32]: Do not build the function at all.
(handle_connections) [W32]: Do not define signo.
* dirmngr/ldap-wrapper-ce.c (outstream_reader_cb): Remove used vars.
* g10/tdbio.c (ftruncate) [DOSISH]: Define only if not yet defined.
This commit is contained in:
Werner Koch 2014-03-07 09:46:44 +01:00
parent 35266076e3
commit 4387ecb11c
5 changed files with 27 additions and 15 deletions

View File

@ -115,9 +115,10 @@ cdb_init(struct cdb *cdbp, int fd)
{ {
struct stat st; struct stat st;
unsigned char *mem; unsigned char *mem;
unsigned fsize;
#ifdef _WIN32 #ifdef _WIN32
HANDLE hFile, hMapping; HANDLE hFile, hMapping;
#else
unsigned int fsize;
#endif #endif
/* get file size */ /* get file size */
@ -128,7 +129,6 @@ cdb_init(struct cdb *cdbp, int fd)
gpg_err_set_errno (EPROTO); gpg_err_set_errno (EPROTO);
return -1; return -1;
} }
fsize = (unsigned)(st.st_size & 0xffffffffu);
/* memory-map file */ /* memory-map file */
#ifdef _WIN32 #ifdef _WIN32
# ifdef __MINGW32CE__ # ifdef __MINGW32CE__
@ -145,11 +145,12 @@ cdb_init(struct cdb *cdbp, int fd)
if (!mem) if (!mem)
return -1; return -1;
cdbp->cdb_mapping = hMapping; cdbp->cdb_mapping = hMapping;
#else #else /*!_WIN32*/
fsize = (unsigned int)(st.st_size & 0xffffffffu);
mem = (unsigned char*)mmap(NULL, fsize, PROT_READ, MAP_SHARED, fd, 0); mem = (unsigned char*)mmap(NULL, fsize, PROT_READ, MAP_SHARED, fd, 0);
if (mem == MAP_FAILED) if (mem == MAP_FAILED)
return -1; return -1;
#endif /* _WIN32 */ #endif /*!_WIN32*/
cdbp->cdb_fd = fd; cdbp->cdb_fd = fd;
cdbp->cdb_fsize = st.st_size; cdbp->cdb_fsize = st.st_size;

View File

@ -459,7 +459,7 @@ start_dirmngr (int only_daemon)
{ {
const char *pgmname; const char *pgmname;
const char *argv[3]; const char *argv[3];
int no_close_list[3]; assuan_fd_t no_close_list[3];
int i; int i;
if (only_daemon) if (only_daemon)
@ -486,7 +486,7 @@ start_dirmngr (int only_daemon)
if (log_get_fd () != -1) if (log_get_fd () != -1)
no_close_list[i++] = assuan_fd_from_posix_fd (log_get_fd ()); no_close_list[i++] = assuan_fd_from_posix_fd (log_get_fd ());
no_close_list[i++] = assuan_fd_from_posix_fd (es_fileno (es_stderr)); no_close_list[i++] = assuan_fd_from_posix_fd (es_fileno (es_stderr));
no_close_list[i] = -1; no_close_list[i] = ASSUAN_INVALID_FD;
/* Connect to the agent and perform initial handshaking. */ /* Connect to the agent and perform initial handshaking. */
rc = assuan_pipe_connect (ctx, opt.dirmngr_program, argv, rc = assuan_pipe_connect (ctx, opt.dirmngr_program, argv,

View File

@ -510,6 +510,10 @@ DWORD WINAPI
w32_service_control (DWORD control, DWORD event_type, LPVOID event_data, w32_service_control (DWORD control, DWORD event_type, LPVOID event_data,
LPVOID context) LPVOID context)
{ {
(void)event_type;
(void)event_data;
(void)context;
/* event_type and event_data are not used here. */ /* event_type and event_data are not used here. */
switch (control) switch (control)
{ {
@ -1016,6 +1020,9 @@ main (int argc, char **argv)
existing scripts which might use this to detect a successful existing scripts which might use this to detect a successful
start of the dirmngr. */ start of the dirmngr. */
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
(void)csh_style;
(void)nodetach;
pid = getpid (); pid = getpid ();
es_printf ("set %s=%s;%lu;1\n", es_printf ("set %s=%s;%lu;1\n",
DIRMNGR_INFO_NAME, socket_name, (ulong) pid); DIRMNGR_INFO_NAME, socket_name, (ulong) pid);
@ -1275,6 +1282,12 @@ main (int argc, char **argv)
#ifdef USE_W32_SERVICE #ifdef USE_W32_SERVICE
static void WINAPI
call_real_main (DWORD argc, LPSTR *argv)
{
real_main (argc, argv);
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@ -1295,8 +1308,7 @@ main (int argc, char *argv[])
{ {
SERVICE_TABLE_ENTRY DispatchTable [] = SERVICE_TABLE_ENTRY DispatchTable [] =
{ {
/* Ignore warning. */ { "DirMngr", &call_real_main },
{ "DirMngr", &real_main },
{ NULL, NULL } { NULL, NULL }
}; };
@ -1609,12 +1621,12 @@ dirmngr_sighup_action (void)
/* The signal handler. */ /* The signal handler. */
#ifndef HAVE_W32_SYSTEM
static void static void
handle_signal (int signo) handle_signal (int signo)
{ {
switch (signo) switch (signo)
{ {
#ifndef HAVE_W32_SYSTEM
case SIGHUP: case SIGHUP:
dirmngr_sighup_action (); dirmngr_sighup_action ();
break; break;
@ -1649,11 +1661,12 @@ handle_signal (int signo)
cleanup (); cleanup ();
dirmngr_exit (0); dirmngr_exit (0);
break; break;
#endif
default: default:
log_info (_("signal %d received - no action defined\n"), signo); log_info (_("signal %d received - no action defined\n"), signo);
} }
} }
#endif /*!HAVE_W32_SYSTEM*/
/* This is the worker for the ticker. It is called every few seconds /* This is the worker for the ticker. It is called every few seconds
@ -1739,7 +1752,9 @@ static void
handle_connections (assuan_fd_t listen_fd) handle_connections (assuan_fd_t listen_fd)
{ {
npth_attr_t tattr; npth_attr_t tattr;
#ifndef HAVE_W32_SYSTEM
int signo; int signo;
#endif
struct sockaddr_un paddr; struct sockaddr_un paddr;
socklen_t plen = sizeof( paddr ); socklen_t plen = sizeof( paddr );
gnupg_fd_t fd; gnupg_fd_t fd;

View File

@ -279,8 +279,6 @@ outstream_reader_cb (void *cb_value, char *buffer, size_t count,
size_t *r_nread) size_t *r_nread)
{ {
struct outstream_cookie_s *cookie = cb_value; struct outstream_cookie_s *cookie = cb_value;
char *dst;
const char *src;
size_t nread = 0; size_t nread = 0;
int was_full = 0; int was_full = 0;
@ -288,7 +286,6 @@ outstream_reader_cb (void *cb_value, char *buffer, size_t count,
return gpg_error (GPG_ERR_NOT_SUPPORTED); /* Rewind is not supported. */ return gpg_error (GPG_ERR_NOT_SUPPORTED); /* Rewind is not supported. */
*r_nread = 0; *r_nread = 0;
dst = buffer;
while (BUFFER_EMPTY(cookie)) while (BUFFER_EMPTY(cookie))
{ {
@ -302,7 +299,6 @@ outstream_reader_cb (void *cb_value, char *buffer, size_t count,
if (BUFFER_FULL(cookie)) if (BUFFER_FULL(cookie))
was_full = 1; was_full = 1;
src = cookie->buffer + cookie->buffer_pos;
nread = buffer_get_data (cookie, buffer, count); nread = buffer_get_data (cookie, buffer, count);
if (was_full) if (was_full)

View File

@ -38,7 +38,7 @@
#include "trustdb.h" #include "trustdb.h"
#include "tdbio.h" #include "tdbio.h"
#if defined(HAVE_DOSISH_SYSTEM) #if defined(HAVE_DOSISH_SYSTEM) && !defined(ftruncate)
#define ftruncate chsize #define ftruncate chsize
#endif #endif