* @param value value of the option
*/
static void
-print_option (void *cls, const char *section,
+print_option (void *cls,
+ const char *section,
const char *option,
const char *value)
{
+ (void) cls;
+ (void) section;
fprintf (stdout,
- "%s = %s\n", option, value);
+ "%s = %s\n",
+ option,
+ value);
}
print_section_name (void *cls,
const char *section)
{
- fprintf (stdout, "%s\n", section);
+ (void) cls;
+ fprintf (stdout,
+ "%s\n",
+ section);
}
struct GNUNET_CONFIGURATION_Handle *out = NULL;
struct GNUNET_CONFIGURATION_Handle *diff = NULL;
+ (void) cls;
+ (void) args;
if (rewrite)
{
struct GNUNET_CONFIGURATION_Handle *def;
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *const *argv)
+main (int argc,
+ char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('f',
- "filename",
- gettext_noop ("obtain option of value as a filename (with $-expansion)"),
- &is_filename),
+ "filename",
+ gettext_noop ("obtain option of value as a filename (with $-expansion)"),
+ &is_filename),
GNUNET_GETOPT_option_string ('s',
- "section",
- "SECTION",
- gettext_noop ("name of the section to access"),
- §ion),
+ "section",
+ "SECTION",
+ gettext_noop ("name of the section to access"),
+ §ion),
GNUNET_GETOPT_option_string ('o',
- "option",
- "OPTION",
- gettext_noop ("name of the option to access"),
- &option),
+ "option",
+ "OPTION",
+ gettext_noop ("name of the option to access"),
+ &option),
GNUNET_GETOPT_option_string ('V',
- "value",
- "VALUE",
- gettext_noop ("value to set"),
- &value),
+ "value",
+ "VALUE",
+ gettext_noop ("value to set"),
+ &value),
GNUNET_GETOPT_option_flag ('S',
- "list-sections",
- gettext_noop ("print available configuration sections"),
- &list_sections),
+ "list-sections",
+ gettext_noop ("print available configuration sections"),
+ &list_sections),
GNUNET_GETOPT_option_flag ('w',
- "rewrite",
- gettext_noop ("write configuration file that only contains delta to defaults"),
- &rewrite),
+ "rewrite",
+ gettext_noop ("write configuration file that only contains delta to defaults"),
+ &rewrite),
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK !=
uint64_t fs;
unsigned int total_hostkeys;
unsigned int c;
+ ssize_t sret;
- if (GNUNET_YES != GNUNET_DISK_file_test (filename))
+ if (GNUNET_YES !=
+ GNUNET_DISK_file_test (filename))
{
fprintf (stderr,
_("Hostkeys file `%s' not found\n"),
}
/* Check hostkey file size, read entire thing into memory */
- if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
+ if (GNUNET_OK !=
+ GNUNET_DISK_file_size (filename,
+ &fs,
+ GNUNET_YES,
+ GNUNET_YES))
fs = 0;
if (0 == fs)
{
filename);
return;
}
- fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
- GNUNET_DISK_PERM_NONE);
+ fd = GNUNET_DISK_file_open (filename,
+ GNUNET_DISK_OPEN_READ,
+ GNUNET_DISK_PERM_NONE);
if (NULL == fd)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "open",
+ filename);
return;
}
hostkeys_data = GNUNET_malloc (fs);
- if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs))
+ sret = GNUNET_DISK_file_read (fd,
+ hostkeys_data,
+ fs);
+ if ( (sret < 0) ||
+ (fs != (size_t) sret) )
{
fprintf (stderr,
_("Could not read hostkey file: %s\n"),
/**
* Main function that will be run by the scheduler.
*
- * @param cls closure
+ * @param cls closure, NULL
* @param args remaining command-line arguments
* @param cfgfile name of the configuration file used (for saving, can be NULL!)
* @param cfg configuration
*/
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ (void) cls;
+ (void) cfgfile;
+ (void) cfg;
+
if (print_examples_flag)
{
print_examples ();
print_hostname (void *cls,
const char *hostname)
{
+ (void) cls;
if (NULL == hostname)
return;
- FPRINTF (stdout, "%s\n", hostname);
+ FPRINTF (stdout,
+ "%s\n",
+ hostname);
}
* @param addrlen length of the address
*/
static void
-print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen)
+print_sockaddr (void *cls,
+ const struct sockaddr *addr,
+ socklen_t addrlen)
{
+ (void) cls;
if (NULL == addr)
return;
- FPRINTF (stdout, "%s\n", GNUNET_a2s (addr, addrlen));
+ FPRINTF (stdout,
+ "%s\n",
+ GNUNET_a2s (addr,
+ addrlen));
}
* @param cfg configuration
*/
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const struct sockaddr *sa;
struct sockaddr_in v4;
struct sockaddr_in6 v6;
- if (args[0] == NULL)
+ (void) cls;
+ (void) cfgfile;
+ (void) cfg;
+ if (NULL == args[0])
return;
if (! reverse)
{
- GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL);
+ GNUNET_RESOLVER_ip_get (args[0],
+ AF_UNSPEC,
+ GET_TIMEOUT,
+ &print_sockaddr,
+ NULL);
return;
}
/**
* Verify well-formedness of GET-message.
*
- * @param cls closure
+ * @param cls closure, unused
* @param get the actual message
* @return #GNUNET_OK if @a get is well-formed
*/
int direction;
int af;
+ (void) cls;
size = ntohs (get->header.size) - sizeof (*get);
direction = ntohl (get->direction);
if (GNUNET_NO == direction)
/**
* Callback called when a client connects to the service.
*
- * @param cls closure for the service
+ * @param cls closure for the service, unused
* @param c the new client that connected to the service
* @param mq the message queue used to send messages to the client
* @return @a c
struct GNUNET_SERVICE_Client *c,
struct GNUNET_MQ_Handle *mq)
{
+ (void) cls;
+ (void) mq;
+
return c;
}
struct GNUNET_SERVICE_Client *c,
void *internal_cls)
{
+ (void) cls;
+
GNUNET_assert (c == internal_cls);
}
/*
This file is part of GNUnet.
- Copyright (C) 2006-2016 GNUnet e.V.
+ Copyright (C) 2006-2018 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
ssize_t size;
char *lep;
- GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ());
- size = readlink (fn, lnk, sizeof (lnk) - 1);
+ GNUNET_snprintf (fn,
+ sizeof (fn),
+ "/proc/%u/exe",
+ getpid ());
+ size = readlink (fn,
+ lnk,
+ sizeof (lnk) - 1);
if (size <= 0)
{
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR,
+ "readlink",
+ fn);
return NULL;
}
- GNUNET_assert (size < sizeof (lnk));
+ GNUNET_assert ( ((size_t) size) < sizeof (lnk));
lnk[size] = '\0';
while ((lnk[size] != '/') && (size > 0))
size--;
"/%s/libexec/",
current_pd->project_dirname);
/* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */
- if ( (size > strlen (lep)) &&
+ if ( (((size_t) size) > strlen (lep)) &&
(0 == strcmp (lep,
&lnk[size - strlen (lep)])) )
size -= strlen (lep) - 1;
GNUNET_free (lep);
- if ((size < 4) || (lnk[size - 4] != '/'))
+ if ( (size < 4) ||
+ (lnk[size - 4] != '/') )
{
/* not installed in "/bin/" -- binary path probably useless */
return NULL;
if (check_suid)
{
#ifndef MINGW
+ (void) params;
if ( (0 != (statbuf.st_mode & S_ISUID)) &&
(0 == statbuf.st_uid) )
{
struct GNUNET_DISK_FileHandle *control_pipe;
uint64_t pipe_fd;
+ (void) cls;
if (NULL != pch)
{
/* already done, we've been called twice... */
return;
GNUNET_assert (id < size);
GNUNET_assert (table[id]->rc > 0);
- GNUNET_assert ((delta >= 0) || (table[id]->rc >= -delta));
+ GNUNET_assert ( (delta >= 0) ||
+ (table[id]->rc >= (unsigned int) (-delta)) );
table[id]->rc += delta;
if (0 == table[id]->rc)
{
static void
shutdown_task (void *cls)
{
+ (void) cls;
GNUNET_SPEEDUP_stop_ ();
}
/*
This file is part of GNUnet.
- Copyright (C) 2009-2016 GNUnet e.V.
+ Copyright (C) 2009-2018 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
for (unsigned int i = 0;
NULL != loopback[i];
i++)
- if (0 == strcasecmp (loopback[i], hostname))
+ if (0 == strcasecmp (loopback[i],
+ hostname))
{
GNUNET_free (hostname);
return GNUNET_OK;
static void
shutdown_task (void *cls)
{
+ (void) cls;
s_task = NULL;
GNUNET_RESOLVER_disconnect ();
backoff = GNUNET_TIME_UNIT_MILLISECONDS;
mq_error_handler (void *cls,
enum GNUNET_MQ_Error error)
{
+ (void) cls;
GNUNET_MQ_destroy (mq);
mq = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "MQ error, reconnecting\n");
+ "MQ error %d, reconnecting\n",
+ error);
reconnect ();
}
check_response (void *cls,
const struct GNUNET_MessageHeader *msg)
{
+ (void) cls;
+ (void) msg;
+
/* implemented in #handle_response() for now */
return GNUNET_OK;
}
uint16_t size;
char *nret;
+ (void) cls;
GNUNET_assert (NULL != rh);
size = ntohs (msg->size);
if (size == sizeof (struct GNUNET_MessageHeader))
GNUNET_MQ_handler_end ()
};
+ (void) cls;
r_task = NULL;
if (NULL == req_head)
return; /* no work pending */
* @param et the event type to be set in each FdInfo after calling
* @a driver_func on it, or -1 if no updating not desired.
*/
-void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t,
- enum GNUNET_SCHEDULER_EventType et)
+static void
+driver_add_multiple (struct GNUNET_SCHEDULER_Task *t,
+ enum GNUNET_SCHEDULER_EventType et)
{
struct GNUNET_SCHEDULER_FdInfo *fdi;
int success = GNUNET_YES;
- for (int i = 0; i != t->fds_len; ++i)
+ for (unsigned int i = 0; i != t->fds_len; ++i)
{
fdi = &t->fds[i];
- success = scheduler_driver->add (scheduler_driver->cls, t, fdi) && success;
+ success = scheduler_driver->add (scheduler_driver->cls,
+ t,
+ fdi) && success;
if (et != -1)
{
fdi->et = et;
}
-void
+static void
shutdown_cb (void *cls)
{
char c;
const struct GNUNET_DISK_FileHandle *pr;
+ (void) cls;
pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle,
GNUNET_DISK_PIPE_END_READ);
GNUNET_assert (! GNUNET_DISK_handle_invalid (pr));
backtrace_symbols (backtrace_array,
t->num_backtrace_strings);
dump_backtrace (t);
+#else
+ (void) t;
#endif
}
// in fdset must be handled separately
const struct GNUNET_NETWORK_Handle **nhandles;
const struct GNUNET_DISK_FileHandle **fhandles;
- unsigned int nhandles_len, fhandles_len;
- int sock;
+ unsigned int nhandles_len;
+ unsigned int fhandles_len;
+ (void) t;
nhandles = NULL;
fhandles = NULL;
nhandles_len = 0;
fhandles_len = 0;
- for (sock = 0; sock != fdset->nsds; ++sock)
+ for (int sock = 0; sock != fdset->nsds; ++sock)
{
if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock))
{
// FIXME: do we have to remove FdInfos from fds if they are not ready?
tc.fds_len = pos->fds_len;
tc.fds = pos->fds;
- for (int i = 0; i != pos->fds_len; ++i)
+ for (unsigned int i = 0; i != pos->fds_len; ++i)
{
struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i];
if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et))
GNUNET_MQ_impl_send_in_flight (client->mq);
}
client->msg_pos += ret;
- if (left > ret)
+ if (left > (size_t) ret)
{
GNUNET_assert (NULL == client->drop_task);
client->send_task
{
struct GNUNET_SERVICE_Client *client = impl_state;
+ (void) mq;
if (NULL != client->drop_task)
return; /* we're going down right now, do not try to send */
GNUNET_assert (NULL == client->send_task);
{
struct GNUNET_SERVICE_Client *client = impl_state;
+ (void) mq;
GNUNET_assert (0 == client->msg_pos);
client->msg = NULL;
GNUNET_SCHEDULER_cancel (client->send_task);
{
static long long current_offset;
+ (void) cls;
speedup_task = NULL;
current_offset += delta.rel_value_us;
GNUNET_TIME_set_offset (current_offset);
* (if they weren't NULL).
*/
int
-GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
- const char **path_part)
+GNUNET_STRINGS_parse_uri (const char *path,
+ char **scheme_part,
+ const char **path_part)
{
size_t len;
- int i, end;
+ size_t i;
+ int end;
int pp_state = 0;
const char *post_scheme_part = NULL;
len = strlen (path);
switch (pp_state)
{
case 0:
- if (path[i] == ':' && i > 0)
+ if ( (path[i] == ':') && (i > 0) )
{
pp_state += 1;
continue;