From 1f09f4f7716db5939ec1c9a278b5661616dd72d6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 15 May 2012 00:49:26 +0000 Subject: -help seaspider some more --- src/arm/gnunet-service-arm.c | 2 +- src/ats/gnunet-service-ats_addresses_mlp.c | 2 +- src/exit/gnunet-daemon-exit.c | 2 +- src/fs/fs_uri.c | 3 ++- src/fs/gnunet-download.c | 3 ++- src/fs/gnunet-pseudonym.c | 3 ++- src/hostlist/hostlist-server.c | 2 +- src/integration-tests/connection_watchdog.c | 2 +- src/mesh/gnunet-service-mesh.c | 6 +----- src/mesh/mesh_api.c | 21 +-------------------- src/transport/plugin_transport_smtp.c | 6 ++---- src/transport/plugin_transport_udp.c | 8 +++----- src/util/common_logging.c | 13 +++++++------ src/util/container_slist.c | 3 ++- src/util/disk.c | 3 ++- src/util/getopt.c | 15 ++++++--------- src/util/network.c | 24 ++++++++++++++++-------- src/util/os_priority.c | 9 +++++++-- src/util/program.c | 6 +++--- src/util/pseudonym.c | 3 ++- src/util/server.c | 2 +- 21 files changed, 64 insertions(+), 74 deletions(-) diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 45650188f..ce9104334 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -494,7 +494,7 @@ static void create_listen_socket (struct sockaddr *sa, socklen_t addr_len, struct ServiceList *sl) { - const static int on = 1; + static int on = 1; struct GNUNET_NETWORK_Handle *sock; struct ServiceListeningInfo *sli; diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index d4c2c177a..532fadadf 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c @@ -1126,7 +1126,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, double D; double R; double U; - long long unsigned int tmp; + unsigned long long tmp; unsigned int b_min; unsigned int n_min; struct GNUNET_TIME_Relative i_exec; diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 861742ee8..e58611cc6 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -284,7 +284,7 @@ static struct GNUNET_CONTAINER_Heap *connections_heap; /** * If there are at least this many connections, old ones will be removed */ -static long long unsigned int max_connections; +static unsigned long long max_connections; /** * This hashmaps saves interesting things about the configured UDP services diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index dc6d195ca..0c2d64cac 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -1377,7 +1377,8 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_FS_Uri *uri) { char *ret; - char *name, *unique_name; + char *name; + char *unique_name; if (uri->type != sks) return NULL; diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index ff10c39c6..5a66aea27 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c @@ -90,7 +90,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void * progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) { - char *s, *s2; + char *s; + char *s2; char *t; switch (info->status) diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index 247a5a0d8..38826d1de 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c @@ -109,7 +109,8 @@ pseudo_printer (void *cls, const GNUNET_HashCode * pseudonym, const char *name, const char *unique_name, const struct GNUNET_CONTAINER_MetaData *md, int rating) { - char *id, *unique_id; + char *id; + char *unique_id; int getinfo_result; /* While we get a name from the caller, it might be NULL. diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index af46110ca..66263e1a3 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -481,7 +481,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle) struct GNUNET_NETWORK_FDSet *wws; struct GNUNET_NETWORK_FDSet *wes; int max; - unsigned MHD_LONG_LONG timeout; + MHD_LONG_LONG timeout; int haveto; struct GNUNET_TIME_Relative tv; diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c index 00da55eee..709ca4eeb 100644 --- a/src/integration-tests/connection_watchdog.c +++ b/src/integration-tests/connection_watchdog.c @@ -971,7 +971,7 @@ init () char *pos; char *secname; int counter; - long long unsigned int port; + unsigned long long port; have_tcp = GNUNET_NO; have_udp = GNUNET_NO; diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 31e0dc901..aa9ae888c 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -623,7 +623,7 @@ announce_application (void *cls, const GNUNET_HashCode * key, void *value) { /* FIXME are hashes in multihash map equal on all aquitectures? */ /* FIXME: keep return value of 'put' to possibly cancel!? */ - GNUNET_DHT_put (dht_handle, key, 10U, + GNUNET_DHT_put (dht_handle, key, 10, GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity), @@ -692,12 +692,8 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (char *) &my_full_id, /* Data itself */ GNUNET_TIME_absolute_get_forever (), /* Data expiration */ GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */ -#if MESH_DEBUG_DHT - &mesh_debug, "DHT_put for id completed"); -#else NULL, /* Continuation */ NULL); /* Continuation closure */ -#endif announce_id_task = GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, &announce_id, cls); } diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 7332d0c3d..de931db7c 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -28,14 +28,6 @@ * - SEND FUNCTIONS * - API CALL DEFINITIONS */ -#ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ -} -#endif -#endif - #include "platform.h" #include "gnunet_common.h" #include "gnunet_client_lib.h" @@ -45,13 +37,8 @@ extern "C" #include "mesh.h" #include "mesh_protocol.h" -#define MESH_API_DEBUG GNUNET_YES - -#if MESH_API_DEBUG #define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__) -#else -#define LOG(kind,...) -#endif + /******************************************************************************/ /************************ DATA STRUCTURES ****************************/ @@ -1717,9 +1704,3 @@ GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel) } -#if 0 /* keep Emacsens' auto-indent happy */ -{ -#endif -#ifdef __cplusplus -} -#endif diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c index b589e1177..609b11596 100644 --- a/src/transport/plugin_transport_smtp.c +++ b/src/transport/plugin_transport_smtp.c @@ -774,7 +774,7 @@ api_associate (GNUNET_TSession * tsession) * frequency limits to SMTP in the future!). */ static int -api_test_would_try (GNUNET_TSession * tsession, const unsigned int size, +api_test_would_try (GNUNET_TSession * tsession, unsigned int size, int important) { return GNUNET_OK; /* we always try... */ @@ -785,10 +785,8 @@ api_test_would_try (GNUNET_TSession * tsession, const unsigned int size, * returns the smtp transport API. */ GNUNET_TransportAPI * -inittransport_smtp (GNUNET_CoreAPIForTransport * core) +inittransport_smtp (struct GNUNET_CoreAPIForTransport * core) { - - unsigned long long mtu; struct sigaction sa; diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index ae710c73c..76fd1a6cd 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -1760,8 +1760,6 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock) ssize_t sent; size_t slen; struct GNUNET_TIME_Absolute max; - struct GNUNET_TIME_Absolute ; - struct UDPMessageWrapper *udpw = NULL; if (sock == plugin->sockv4) @@ -1859,9 +1857,9 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock) * have a valid global IPv6 address assigned */ LOG (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, - _("UDP could not message to `%s': `%s'\n, " \ - "Please check your network configuration and disable IPv6 if your\n" \ - "connection does not have a global IPv6 address"), + _("UDP could not message to `%s': `%s'. " + "Please check your network configuration and disable IPv6 if your " + "connection does not have a global IPv6 address\n"), GNUNET_a2s (sa, slen), STRERROR (errno)); } diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 995f2e88a..2c0fd57a8 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -530,6 +530,8 @@ parse_all_definitions () gnunet_force_log_parsed = GNUNET_YES; } #endif + + /** * Setup logging. * @@ -569,17 +571,16 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) if (NULL == fn) return GNUNET_SYSERR; dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn)); - altlog_fd = OPEN (fn, O_APPEND | #if WINDOWS + altlog_fd = OPEN (fn, O_APPEND | O_BINARY | -#endif O_WRONLY | O_CREAT, -#if WINDOWS - _S_IREAD | _S_IWRITE + _S_IREAD | _S_IWRITE); #else - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH + altlog_fd = OPEN (fn, O_APPEND | + O_WRONLY | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); #endif - ); if (altlog_fd != -1) { int dup_return; diff --git a/src/util/container_slist.c b/src/util/container_slist.c index 950c4245e..6b5832583 100644 --- a/src/util/container_slist.c +++ b/src/util/container_slist.c @@ -268,6 +268,7 @@ GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, return GNUNET_NO; } +typedef int (*Comparator)(const void *, size_t, const void *, size_t); /** * Check if a list contains a certain element @@ -283,7 +284,7 @@ GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, void * GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l, const void *buf, size_t len, - int (*compare)(const void *, const size_t, const void *, const size_t)) + Comparator compare) { struct GNUNET_CONTAINER_SList_Elem *e; diff --git a/src/util/disk.c b/src/util/disk.c index 847dad457..cba0d4467 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -270,7 +270,8 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset, } #ifdef MINGW - LARGE_INTEGER li, new_pos; + LARGE_INTEGER li; + LARGE_INTEGER new_pos; BOOL b; static DWORD t[] = {[GNUNET_DISK_SEEK_SET] = FILE_BEGIN, diff --git a/src/util/getopt.c b/src/util/getopt.c index 169949821..572e534c5 100644 --- a/src/util/getopt.c +++ b/src/util/getopt.c @@ -202,9 +202,8 @@ char * getenv (); static char * -my_index (str, chr) - const char *str; - int chr; +my_index (const char *str, + int chr) { while (*str) { @@ -294,8 +293,7 @@ exchange (char **); #endif static void -exchange (argv) - char **argv; +exchange (char **argv) { int bottom = first_nonopt; int middle = last_nonopt; @@ -381,10 +379,9 @@ static const char * _getopt_initialize (int, char *const *, const char *); #endif static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; +_getopt_initialize (int argc, + char *const *argv, + const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 * is the program name); the sequence of previously skipped diff --git a/src/util/network.c b/src/util/network.c index 54abcaba1..9323389ee 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -508,15 +508,16 @@ GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle * error = ioctl (desc->fd, FIONREAD, &pending); if (error == 0) + return (ssize_t) pending; + return GNUNET_NO; #else u_long pending; error = ioctlsocket (desc->fd, FIONREAD, &pending); if (error != SOCKET_ERROR) + return (ssize_t) pending; + return GNUNET_NO; #endif - return pending; - else - return GNUNET_NO; } @@ -1079,7 +1080,6 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, const struct GNUNET_TIME_Relative timeout) { int nfds = 0; - #ifdef MINGW int handles = 0; int ex_handles = 0; @@ -1090,7 +1090,9 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, int retcode = 0; DWORD ms_total = 0; - int nsock = 0, nhandles = 0, nSockEvents = 0; + int nsock = 0; + int nhandles = 0; + int nSockEvents = 0; static HANDLE hEventRead = 0; static HANDLE hEventWrite = 0; @@ -1106,12 +1108,18 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, DWORD newretcode = 0; int returnedpos = 0; - struct GNUNET_CONTAINER_SList *handles_read, *handles_write, *handles_except; + struct GNUNET_CONTAINER_SList *handles_read; + struct GNUNET_CONTAINER_SList *handles_write; + struct GNUNET_CONTAINER_SList *handles_except; - fd_set aread, awrite, aexcept; + fd_set aread; + fd_set awrite; + fd_set except; #if DEBUG_NETWORK - fd_set bread, bwrite, bexcept; + fd_set bread; + fd_set bwrite; + fd_set bexcept; #endif /* TODO: Make this growable */ diff --git a/src/util/os_priority.c b/src/util/os_priority.c index f374ca56d..9def6ca54 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -649,10 +649,15 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, static char * CreateCustomEnvTable (char **vars) { - char *win32_env_table, *ptr, **var_ptr, *result, *result_ptr; + char *win32_env_table; + char *ptr; + char **var_ptr; + char *result; + char *result_ptr; size_t tablesize = 0; size_t items_count = 0; - size_t n_found = 0, n_var; + size_t n_found = 0; + size_t n_var; char *index = NULL; size_t c; size_t var_len; diff --git a/src/util/program.c b/src/util/program.c index bfa58dc65..b6d0c78c6 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -95,10 +95,10 @@ program_main (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param a2 second command line option */ static int -cmd_sorter (__const void *a1, __const void *a2) +cmd_sorter (const void *a1, const void *a2) { - __const struct GNUNET_GETOPT_CommandLineOption *c1 = a1; - __const struct GNUNET_GETOPT_CommandLineOption *c2 = a2; + const struct GNUNET_GETOPT_CommandLineOption *c1 = a1; + const struct GNUNET_GETOPT_CommandLineOption *c2 = a2; if (toupper ((unsigned char) c1->shortName) > toupper ((unsigned char) c2->shortName)) diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c index d2efdc98f..016573845 100644 --- a/src/util/pseudonym.c +++ b/src/util/pseudonym.c @@ -539,7 +539,8 @@ list_pseudonym_helper (void *cls, const char *fullname) int32_t rating; struct GNUNET_CONTAINER_MetaData *meta; const char *fn; - char *str, *name_unique; + char *str; + char *name_unique; if (strlen (fullname) < sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)) return GNUNET_OK; diff --git a/src/util/server.c b/src/util/server.c index 6226dea6d..f707d1bf3 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -391,7 +391,7 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static struct GNUNET_NETWORK_Handle * open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen) { - const static int on = 1; + static int on = 1; struct GNUNET_NETWORK_Handle *sock; uint16_t port; int eno; -- cgit v1.2.3