summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-01-04 16:46:18 +0100
committerChristian Grothoff <christian@grothoff.org>2018-01-04 16:46:18 +0100
commite20eca334a33b8340524a8fa6ad1d6b606e1dd0c (patch)
treee79ce20f787cae4aea7403d2e9c9b8fb2546ad1f
parent056ca89d207cd1865a90fe3fcd430a4381097da5 (diff)
fix timeout of test_service, misc signed/unsigned and unused argument issues
-rw-r--r--po/POTFILES.in120
-rw-r--r--src/util/bio.c69
-rw-r--r--src/util/client.c3
-rw-r--r--src/util/common_allocation.c27
-rw-r--r--src/util/configuration.c38
-rw-r--r--src/util/container_bloomfilter.c60
-rw-r--r--src/util/test_service.c27
7 files changed, 225 insertions, 119 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2fcb74c09..6ceb95cbd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,21 +4,13 @@ src/arm/arm_monitor_api.c
src/arm/gnunet-arm.c
src/arm/gnunet-service-arm.c
src/arm/mockup-service.c
-src/ats-tests/ats-testing-experiment.c
-src/ats-tests/ats-testing-log.c
-src/ats-tests/ats-testing-preferences.c
-src/ats-tests/ats-testing-traffic.c
-src/ats-tests/ats-testing.c
-src/ats-tests/gnunet-ats-sim.c
-src/ats-tests/gnunet-solver-eval.c
-src/ats-tool/gnunet-ats.c
src/ats/ats_api_connectivity.c
src/ats/ats_api_performance.c
src/ats/ats_api_scanner.c
src/ats/ats_api_scheduling.c
src/ats/gnunet-ats-solver-eval.c
-src/ats/gnunet-service-ats.c
src/ats/gnunet-service-ats_addresses.c
+src/ats/gnunet-service-ats.c
src/ats/gnunet-service-ats_connectivity.c
src/ats/gnunet-service-ats_normalization.c
src/ats/gnunet-service-ats_performance.c
@@ -29,6 +21,14 @@ src/ats/gnunet-service-ats_scheduling.c
src/ats/plugin_ats_mlp.c
src/ats/plugin_ats_proportional.c
src/ats/plugin_ats_ril.c
+src/ats-tests/ats-testing.c
+src/ats-tests/ats-testing-experiment.c
+src/ats-tests/ats-testing-log.c
+src/ats-tests/ats-testing-preferences.c
+src/ats-tests/ats-testing-traffic.c
+src/ats-tests/gnunet-ats-sim.c
+src/ats-tests/gnunet-solver-eval.c
+src/ats-tool/gnunet-ats.c
src/auction/gnunet-auction-create.c
src/auction/gnunet-auction-info.c
src/auction/gnunet-auction-join.c
@@ -40,8 +40,8 @@ src/block/plugin_block_test.c
src/cadet/cadet_api.c
src/cadet/cadet_test_lib.c
src/cadet/desirability_table.c
-src/cadet/gnunet-cadet-profiler.c
src/cadet/gnunet-cadet.c
+src/cadet/gnunet-cadet-profiler.c
src/cadet/gnunet-service-cadet.c
src/cadet/gnunet-service-cadet_channel.c
src/cadet/gnunet-service-cadet_connection.c
@@ -57,15 +57,15 @@ src/consensus/gnunet-service-consensus.c
src/consensus/plugin_block_consensus.c
src/conversation/conversation_api.c
src/conversation/conversation_api_call.c
-src/conversation/gnunet-conversation-test.c
src/conversation/gnunet-conversation.c
-src/conversation/gnunet-helper-audio-playback-gst.c
+src/conversation/gnunet-conversation-test.c
+src/conversation/gnunet_gst.c
+src/conversation/gnunet_gst_test.c
src/conversation/gnunet-helper-audio-playback.c
-src/conversation/gnunet-helper-audio-record-gst.c
+src/conversation/gnunet-helper-audio-playback-gst.c
src/conversation/gnunet-helper-audio-record.c
+src/conversation/gnunet-helper-audio-record-gst.c
src/conversation/gnunet-service-conversation.c
-src/conversation/gnunet_gst.c
-src/conversation/gnunet_gst_test.c
src/conversation/microphone.c
src/conversation/plugin_gnsrecord_conversation.c
src/conversation/speaker.c
@@ -102,6 +102,7 @@ src/dht/dht_api.c
src/dht/dht_test_lib.c
src/dht/gnunet-dht-get.c
src/dht/gnunet-dht-monitor.c
+src/dht/gnunet_dht_profiler.c
src/dht/gnunet-dht-put.c
src/dht/gnunet-service-dht.c
src/dht/gnunet-service-dht_clients.c
@@ -110,7 +111,6 @@ src/dht/gnunet-service-dht_hello.c
src/dht/gnunet-service-dht_neighbours.c
src/dht/gnunet-service-dht_nse.c
src/dht/gnunet-service-dht_routing.c
-src/dht/gnunet_dht_profiler.c
src/dht/plugin_block_dht.c
src/dns/dns_api.c
src/dns/dnsparser.c
@@ -125,8 +125,8 @@ src/dv/gnunet-dv.c
src/dv/gnunet-service-dv.c
src/dv/plugin_transport_dv.c
src/exit/gnunet-daemon-exit.c
-src/exit/gnunet-helper-exit-windows.c
src/exit/gnunet-helper-exit.c
+src/exit/gnunet-helper-exit-windows.c
src/fragmentation/defragmentation.c
src/fragmentation/fragmentation.c
src/fs/fs_api.c
@@ -151,8 +151,8 @@ src/fs/gnunet-auto-share.c
src/fs/gnunet-daemon-fsprofiler.c
src/fs/gnunet-directory.c
src/fs/gnunet-download.c
-src/fs/gnunet-fs-profiler.c
src/fs/gnunet-fs.c
+src/fs/gnunet-fs-profiler.c
src/fs/gnunet-helper-fs-publish.c
src/fs/gnunet-publish.c
src/fs/gnunet-search.c
@@ -170,10 +170,10 @@ src/fs/plugin_block_fs.c
src/gns/gns_api.c
src/gns/gnunet-bcd.c
src/gns/gnunet-dns2gns.c
+src/gns/gnunet-gns.c
src/gns/gnunet-gns-helper-service-w32.c
src/gns/gnunet-gns-import.c
src/gns/gnunet-gns-proxy.c
-src/gns/gnunet-gns.c
src/gns/gnunet-service-gns.c
src/gns/gnunet-service-gns_interceptor.c
src/gns/gnunet-service-gns_resolver.c
@@ -182,15 +182,15 @@ src/gns/nss/nss_gns_query.c
src/gns/plugin_block_gns.c
src/gns/plugin_gnsrecord_gns.c
src/gns/plugin_rest_gns.c
-src/gns/w32nsp-install.c
-src/gns/w32nsp-resolve.c
-src/gns/w32nsp-uninstall.c
-src/gns/w32nsp.c
src/gnsrecord/gnsrecord.c
src/gnsrecord/gnsrecord_crypto.c
src/gnsrecord/gnsrecord_misc.c
src/gnsrecord/gnsrecord_serialization.c
src/gnsrecord/plugin_gnsrecord_dns.c
+src/gns/w32nsp.c
+src/gns/w32nsp-install.c
+src/gns/w32nsp-resolve.c
+src/gns/w32nsp-uninstall.c
src/hello/address.c
src/hello/gnunet-hello.c
src/hello/hello.c
@@ -199,6 +199,11 @@ src/hostlist/gnunet-daemon-hostlist_client.c
src/hostlist/gnunet-daemon-hostlist_server.c
src/identity-attribute/identity_attribute.c
src/identity-attribute/plugin_identity_attribute_gnuid.c
+src/identity/gnunet-identity.c
+src/identity/gnunet-service-identity.c
+src/identity/identity_api.c
+src/identity/identity_api_lookup.c
+src/identity/plugin_rest_identity.c
src/identity-provider/gnunet-idp.c
src/identity-provider/gnunet-service-identity-provider.c
src/identity-provider/identity_provider_api.c
@@ -206,20 +211,15 @@ src/identity-provider/jwt.c
src/identity-provider/plugin_gnsrecord_identity_provider.c
src/identity-provider/plugin_identity_provider_sqlite.c
src/identity-provider/plugin_rest_identity_provider.c
-src/identity/gnunet-identity.c
-src/identity/gnunet-service-identity.c
-src/identity/identity_api.c
-src/identity/identity_api_lookup.c
-src/identity/plugin_rest_identity.c
-src/json/json.c
-src/json/json_generator.c
-src/json/json_helper.c
-src/json/json_mhd.c
src/jsonapi/jsonapi.c
src/jsonapi/jsonapi_document.c
src/jsonapi/jsonapi_error.c
src/jsonapi/jsonapi_relationship.c
src/jsonapi/jsonapi_resource.c
+src/json/json.c
+src/json/json_generator.c
+src/json/json_helper.c
+src/json/json_mhd.c
src/multicast/gnunet-multicast.c
src/multicast/gnunet-service-multicast.c
src/multicast/multicast_api.c
@@ -233,8 +233,8 @@ src/namecache/namecache_api.c
src/namecache/plugin_namecache_flat.c
src/namecache/plugin_namecache_postgres.c
src/namecache/plugin_namecache_sqlite.c
-src/namestore/gnunet-namestore-fcfsd.c
src/namestore/gnunet-namestore.c
+src/namestore/gnunet-namestore-fcfsd.c
src/namestore/gnunet-service-namestore.c
src/namestore/namestore_api.c
src/namestore/namestore_api_monitor.c
@@ -249,10 +249,10 @@ src/nat-auto/gnunet-service-nat-auto.c
src/nat-auto/gnunet-service-nat-auto_legacy.c
src/nat-auto/nat_auto_api.c
src/nat-auto/nat_auto_api_test.c
-src/nat/gnunet-helper-nat-client-windows.c
src/nat/gnunet-helper-nat-client.c
-src/nat/gnunet-helper-nat-server-windows.c
+src/nat/gnunet-helper-nat-client-windows.c
src/nat/gnunet-helper-nat-server.c
+src/nat/gnunet-helper-nat-server-windows.c
src/nat/gnunet-nat.c
src/nat/gnunet-service-nat.c
src/nat/gnunet-service-nat_externalip.c
@@ -261,15 +261,15 @@ src/nat/gnunet-service-nat_mini.c
src/nat/gnunet-service-nat_stun.c
src/nat/nat_api.c
src/nat/nat_api_stun.c
-src/nse/gnunet-nse-profiler.c
src/nse/gnunet-nse.c
+src/nse/gnunet-nse-profiler.c
src/nse/gnunet-service-nse.c
src/nse/nse_api.c
-src/peerinfo-tool/gnunet-peerinfo.c
-src/peerinfo-tool/gnunet-peerinfo_plugins.c
src/peerinfo/gnunet-service-peerinfo.c
src/peerinfo/peerinfo_api.c
src/peerinfo/peerinfo_api_notify.c
+src/peerinfo-tool/gnunet-peerinfo.c
+src/peerinfo-tool/gnunet-peerinfo_plugins.c
src/peerstore/gnunet-peerstore.c
src/peerstore/gnunet-service-peerstore.c
src/peerstore/peerstore_api.c
@@ -320,13 +320,13 @@ src/rps/gnunet-service-rps_custommap.c
src/rps/gnunet-service-rps_sampler.c
src/rps/gnunet-service-rps_sampler_elem.c
src/rps/gnunet-service-rps_view.c
-src/rps/rps-test_util.c
src/rps/rps_api.c
+src/rps/rps-test_util.c
src/scalarproduct/gnunet-scalarproduct.c
-src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
-src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
src/scalarproduct/gnunet-service-scalarproduct_alice.c
src/scalarproduct/gnunet-service-scalarproduct_bob.c
+src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
src/scalarproduct/scalarproduct_api.c
src/secretsharing/gnunet-secretsharing-profiler.c
src/secretsharing/gnunet-service-secretsharing.c
@@ -353,16 +353,15 @@ src/statistics/gnunet-statistics.c
src/statistics/statistics_api.c
src/template/gnunet-service-template.c
src/template/gnunet-template.c
-src/testbed-logger/gnunet-service-testbed-logger.c
-src/testbed-logger/testbed_logger_api.c
src/testbed/generate-underlay-topology.c
src/testbed/gnunet-daemon-latency-logger.c
src/testbed/gnunet-daemon-testbed-blacklist.c
src/testbed/gnunet-daemon-testbed-underlay.c
src/testbed/gnunet-helper-testbed.c
+src/testbed/gnunet_mpi_test.c
src/testbed/gnunet-service-test-barriers.c
-src/testbed/gnunet-service-testbed.c
src/testbed/gnunet-service-testbed_barriers.c
+src/testbed/gnunet-service-testbed.c
src/testbed/gnunet-service-testbed_cache.c
src/testbed/gnunet-service-testbed_connectionpool.c
src/testbed/gnunet-service-testbed_cpustatus.c
@@ -370,19 +369,20 @@ src/testbed/gnunet-service-testbed_links.c
src/testbed/gnunet-service-testbed_meminfo.c
src/testbed/gnunet-service-testbed_oc.c
src/testbed/gnunet-service-testbed_peers.c
-src/testbed/gnunet-testbed-profiler.c
-src/testbed/gnunet_mpi_test.c
src/testbed/gnunet_testbed_mpi_spawn.c
-src/testbed/testbed_api.c
+src/testbed/gnunet-testbed-profiler.c
+src/testbed-logger/gnunet-service-testbed-logger.c
+src/testbed-logger/testbed_logger_api.c
src/testbed/testbed_api_barriers.c
+src/testbed/testbed_api.c
src/testbed/testbed_api_hosts.c
src/testbed/testbed_api_operations.c
src/testbed/testbed_api_peers.c
src/testbed/testbed_api_sd.c
src/testbed/testbed_api_services.c
src/testbed/testbed_api_statistics.c
-src/testbed/testbed_api_test.c
src/testbed/testbed_api_testbed.c
+src/testbed/testbed_api_test.c
src/testbed/testbed_api_topology.c
src/testbed/testbed_api_underlay.c
src/testing/gnunet-testing.c
@@ -391,39 +391,34 @@ src/testing/testing.c
src/topology/friends.c
src/topology/gnunet-daemon-topology.c
src/transport/gnunet-helper-transport-bluetooth.c
-src/transport/gnunet-helper-transport-wlan-dummy.c
src/transport/gnunet-helper-transport-wlan.c
-src/transport/gnunet-service-transport.c
+src/transport/gnunet-helper-transport-wlan-dummy.c
src/transport/gnunet-service-transport_ats.c
+src/transport/gnunet-service-transport.c
src/transport/gnunet-service-transport_hello.c
src/transport/gnunet-service-transport_manipulation.c
src/transport/gnunet-service-transport_neighbours.c
src/transport/gnunet-service-transport_plugins.c
src/transport/gnunet-service-transport_validation.c
+src/transport/gnunet-transport.c
src/transport/gnunet-transport-certificate-creation.c
src/transport/gnunet-transport-profiler.c
src/transport/gnunet-transport-wlan-receiver.c
src/transport/gnunet-transport-wlan-sender.c
-src/transport/gnunet-transport.c
src/transport/plugin_transport_http_client.c
src/transport/plugin_transport_http_common.c
src/transport/plugin_transport_http_server.c
src/transport/plugin_transport_smtp.c
src/transport/plugin_transport_tcp.c
src/transport/plugin_transport_template.c
-src/transport/plugin_transport_udp.c
src/transport/plugin_transport_udp_broadcasting.c
+src/transport/plugin_transport_udp.c
src/transport/plugin_transport_unix.c
src/transport/plugin_transport_wlan.c
src/transport/tcp_connection_legacy.c
src/transport/tcp_server_legacy.c
src/transport/tcp_server_mst_legacy.c
src/transport/tcp_service_legacy.c
-src/transport/transport-testing-filenames.c
-src/transport/transport-testing-loggers.c
-src/transport/transport-testing-main.c
-src/transport/transport-testing-send.c
-src/transport/transport-testing.c
src/transport/transport_api_address_to_string.c
src/transport/transport_api_blacklist.c
src/transport/transport_api_core.c
@@ -432,6 +427,11 @@ src/transport/transport_api_manipulation.c
src/transport/transport_api_monitor_peers.c
src/transport/transport_api_monitor_plugins.c
src/transport/transport_api_offer_hello.c
+src/transport/transport-testing.c
+src/transport/transport-testing-filenames.c
+src/transport/transport-testing-loggers.c
+src/transport/transport-testing-main.c
+src/transport/transport-testing-send.c
src/tun/regex.c
src/tun/tun.c
src/util/bandwidth.c
@@ -445,8 +445,8 @@ src/util/configuration_loader.c
src/util/container_bloomfilter.c
src/util/container_heap.c
src/util/container_meta_data.c
-src/util/container_multihashmap.c
src/util/container_multihashmap32.c
+src/util/container_multihashmap.c
src/util/container_multipeermap.c
src/util/container_multishortmap.c
src/util/crypto_abe.c
@@ -466,8 +466,8 @@ src/util/crypto_symmetric.c
src/util/disk.c
src/util/getopt.c
src/util/getopt_helpers.c
-src/util/gnunet-config-diff.c
src/util/gnunet-config.c
+src/util/gnunet-config-diff.c
src/util/gnunet-ecc.c
src/util/gnunet-helper-w32-console.c
src/util/gnunet-resolver.c
@@ -498,8 +498,8 @@ src/util/time.c
src/util/w32cat.c
src/util/win.c
src/util/winproc.c
-src/vpn/gnunet-helper-vpn-windows.c
src/vpn/gnunet-helper-vpn.c
+src/vpn/gnunet-helper-vpn-windows.c
src/vpn/gnunet-service-vpn.c
src/vpn/gnunet-vpn.c
src/vpn/vpn_api.c
diff --git a/src/util/bio.c b/src/util/bio.c
index 08e30dc01..816917a22 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -162,15 +162,19 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
{
if (min > len - pos)
min = len - pos;
- GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min);
+ GNUNET_memcpy (&dst[pos],
+ &h->buffer[h->pos],
+ min);
h->pos += min;
pos += min;
}
if (pos == len)
return GNUNET_OK; /* done! */
- GNUNET_assert (h->have == h->pos);
+ GNUNET_assert (((off_t) h->have) == h->pos);
/* fill buffer */
- ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size);
+ ret = GNUNET_DISK_file_read (h->fd,
+ h->buffer,
+ h->size);
if (-1 == ret)
{
GNUNET_asprintf (&h->emsg,
@@ -287,7 +291,9 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
char *buf;
struct GNUNET_CONTAINER_MetaData *meta;
- if (GNUNET_BIO_read_int32 (h, (int32_t *) & size) != GNUNET_OK)
+ if (GNUNET_OK !=
+ GNUNET_BIO_read_int32 (h,
+ (int32_t *) & size))
return GNUNET_SYSERR;
if (size == 0)
{
@@ -298,20 +304,29 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
{
GNUNET_asprintf (&h->emsg,
_("Serialized metadata `%s' larger than allowed (%u>%u)"),
- what, size, MAX_META_DATA);
+ what,
+ size,
+ MAX_META_DATA);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size);
- if (GNUNET_OK != GNUNET_BIO_read (h, what, buf, size))
+ if (GNUNET_OK !=
+ GNUNET_BIO_read (h,
+ what,
+ buf,
+ size))
{
GNUNET_free (buf);
return GNUNET_SYSERR;
}
- meta = GNUNET_CONTAINER_meta_data_deserialize (buf, size);
- if (meta == NULL)
+ meta = GNUNET_CONTAINER_meta_data_deserialize (buf,
+ size);
+ if (NULL == meta)
{
GNUNET_free (buf);
- GNUNET_asprintf (&h->emsg, _("Metadata `%s' failed to deserialize"), what);
+ GNUNET_asprintf (&h->emsg,
+ _("Metadata `%s' failed to deserialize"),
+ what);
return GNUNET_SYSERR;
}
GNUNET_free (buf);
@@ -330,12 +345,19 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
- int line, int32_t * i)
+GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h,
+ const char *file,
+ int line,
+ int32_t * i)
{
int32_t big;
- if (GNUNET_OK != GNUNET_BIO_read_fn (h, file, line, &big, sizeof (int32_t)))
+ if (GNUNET_OK !=
+ GNUNET_BIO_read_fn (h,
+ file,
+ line,
+ &big,
+ sizeof (int32_t)))
return GNUNET_SYSERR;
*i = ntohl (big);
return GNUNET_OK;
@@ -359,7 +381,12 @@ GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h,
{
int64_t big;
- if (GNUNET_OK != GNUNET_BIO_read_fn (h, file, line, &big, sizeof (int64_t)))
+ if (GNUNET_OK !=
+ GNUNET_BIO_read_fn (h,
+ file,
+ line,
+ &big,
+ sizeof (int64_t)))
return GNUNET_SYSERR;
*i = GNUNET_ntohll (big);
return GNUNET_OK;
@@ -432,7 +459,8 @@ GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h)
int ret;
ret = GNUNET_SYSERR;
- if ( (NULL != h->fd) && (GNUNET_OK == (ret = GNUNET_BIO_flush (h))) )
+ if ( (NULL != h->fd) &&
+ (GNUNET_OK == (ret = GNUNET_BIO_flush (h))) )
GNUNET_DISK_file_close (h->fd);
GNUNET_free (h);
return ret;
@@ -451,8 +479,10 @@ GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h)
{
ssize_t ret;
- ret = GNUNET_DISK_file_write (h->fd, h->buffer, h->have);
- if (ret != h->have)
+ ret = GNUNET_DISK_file_write (h->fd,
+ h->buffer,
+ h->have);
+ if (ret != (ssize_t) h->have)
{
GNUNET_DISK_file_close (h->fd);
h->fd = NULL;
@@ -472,7 +502,8 @@ GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h)
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
+GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h,
+ const void *buffer,
size_t n)
{
const char *src = buffer;
@@ -488,7 +519,9 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
min = h->size - h->have;
if (min > n - pos)
min = n - pos;
- GNUNET_memcpy (&h->buffer[h->have], &src[pos], min);
+ GNUNET_memcpy (&h->buffer[h->have],
+ &src[pos],
+ min);
pos += min;
h->have += min;
if (pos == n)
diff --git a/src/util/client.c b/src/util/client.c
index e5bf7e176..7a718fc8d 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -377,6 +377,7 @@ connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq,
{
struct ClientState *cstate = impl_state;
+ (void) mq;
if (GNUNET_SYSERR == cstate->in_destroy)
{
/* defer destruction */
@@ -814,6 +815,7 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq,
{
struct ClientState *cstate = impl_state;
+ (void) mq;
/* only one message at a time allowed */
GNUNET_assert (NULL == cstate->msg);
GNUNET_assert (NULL == cstate->send_task);
@@ -845,6 +847,7 @@ connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq,
{
struct ClientState *cstate = impl_state;
+ (void) mq;
GNUNET_assert (NULL != cstate->msg);
GNUNET_assert (0 == cstate->msg_off);
cstate->msg = NULL;
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 737584815..be2538c3f 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -100,8 +100,11 @@ GNUNET_xmalloc_ (size_t size,
* @return allocated memory, never NULL
*/
void **
-GNUNET_xnew_array_2d_ (size_t n, size_t m, size_t elementSize,
- const char *filename, int linenumber)
+GNUNET_xnew_array_2d_ (size_t n,
+ size_t m,
+ size_t elementSize,
+ const char *filename,
+ int linenumber)
{
/* use char pointer internally to avoid void pointer arithmetic warnings */
char **ret = GNUNET_xmalloc_ (n * sizeof (void *) + /* 1. dim header */
@@ -218,6 +221,8 @@ GNUNET_xmalloc_unchecked_ (size_t size,
{
void *result;
+ (void) filename;
+ (void) linenumber;
#ifdef W32_MEM_LIMIT
size += sizeof (size_t);
if (mem_used + size > W32_MEM_LIMIT)
@@ -256,6 +261,9 @@ GNUNET_xrealloc_ (void *ptr,
const char *filename,
int linenumber)
{
+ (void) filename;
+ (void) linenumber;
+
#ifdef W32_MEM_LIMIT
n += sizeof (size_t);
ptr = &((size_t *) ptr)[-1];
@@ -264,7 +272,8 @@ GNUNET_xrealloc_ (void *ptr,
ptr = realloc (ptr, n);
if ((NULL == ptr) && (n > 0))
{
- LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
+ "realloc");
GNUNET_assert (0);
}
#ifdef W32_MEM_LIMIT
@@ -501,9 +510,13 @@ GNUNET_snprintf (char *buf,
va_list args;
va_start (args, format);
- ret = VSNPRINTF (buf, size, format, args);
+ ret = VSNPRINTF (buf,
+ size,
+ format,
+ args);
va_end (args);
- GNUNET_assert (ret < size);
+ GNUNET_assert ( (ret >= 0) &&
+ (((size_t) ret) < size) );
return ret;
}
@@ -523,7 +536,9 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
msize = ntohs (msg->size);
GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
ret = GNUNET_malloc (msize);
- GNUNET_memcpy (ret, msg, msize);
+ GNUNET_memcpy (ret,
+ msg,
+ msize);
return ret;
}
diff --git a/src/util/configuration.c b/src/util/configuration.c
index f63903b4e..7f1d98902 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -324,6 +324,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
char *endsep;
int dirty;
int ret;
+ ssize_t sret;
fn = GNUNET_STRINGS_filename_expand (filename);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -333,7 +334,10 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
return GNUNET_SYSERR;
dirty = cfg->dirty; /* back up value! */
if (GNUNET_SYSERR ==
- GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES))
+ GNUNET_DISK_file_size (fn,
+ &fs64,
+ GNUNET_YES,
+ GNUNET_YES))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Error while determining the file size of `%s'\n",
@@ -349,7 +353,11 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
}
fs = fs64;
mem = GNUNET_malloc (fs);
- if (fs != GNUNET_DISK_fn_read (fn, mem, fs))
+ sret = GNUNET_DISK_fn_read (fn,
+ mem,
+ fs);
+ if ( (sret < 0) ||
+ (fs != (size_t) sret) )
{
LOG (GNUNET_ERROR_TYPE_WARNING,
_("Error while reading file `%s'\n"),
@@ -495,6 +503,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
char *fn;
char *cfg_buf;
size_t size;
+ ssize_t sret;
fn = GNUNET_STRINGS_filename_expand (filename);
if (fn == NULL)
@@ -505,11 +514,13 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
return GNUNET_SYSERR;
}
cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size);
- if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE
- | GNUNET_DISK_PERM_GROUP_READ
- | GNUNET_DISK_PERM_GROUP_WRITE))
+ sret = GNUNET_DISK_fn_write (fn, cfg_buf, size,
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE
+ | GNUNET_DISK_PERM_GROUP_READ
+ | GNUNET_DISK_PERM_GROUP_WRITE);
+ if ( (sret < 0) ||
+ (size != (size_t) sret) )
{
GNUNET_free (fn);
GNUNET_free (cfg_buf);
@@ -858,13 +869,20 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
*/
void
GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *section, const char *option,
+ const char *section,
+ const char *option,
unsigned long long number)
{
char s[64];
- GNUNET_snprintf (s, 64, "%llu", number);
- GNUNET_CONFIGURATION_set_value_string (cfg, section, option, s);
+ GNUNET_snprintf (s,
+ 64,
+ "%llu",
+ number);
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ section,
+ option,
+ s);
}
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index aedca232d..95c05b9d7 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2011, 2012 GNUnet e.V.
+ Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2011, 2012, 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
@@ -513,10 +513,11 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
GNUNET_free (bf);
return NULL;
}
- if (fsize == 0)
+ if (0 == fsize)
{
/* found existing empty file, just overwrite */
- if (GNUNET_OK != make_empty_file (bf->fh, size * 4LL))
+ if (GNUNET_OK !=
+ make_empty_file (bf->fh, size * 4LL))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"write");
@@ -525,7 +526,7 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
return NULL;
}
}
- else if (fsize != size * 4LL)
+ else if (fsize != ((off_t) size) * 4LL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Size of file on disk is incorrect for this Bloom filter (want %llu, have %llu)\n"),
@@ -563,9 +564,9 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
bf->filename = GNUNET_strdup (filename);
/* Alloc block */
bf->bitArray = GNUNET_malloc_large (size);
- if (bf->bitArray == NULL)
+ if (NULL == bf->bitArray)
{
- if (bf->fh != NULL)
+ if (NULL != bf->fh)
GNUNET_DISK_file_close (bf->fh);
GNUNET_free (bf->filename);
GNUNET_free (bf);
@@ -578,14 +579,18 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
/* Read from the file what bits we can */
rbuff = GNUNET_malloc (BUFFSIZE);
pos = 0;
- while (pos < size * 8LL)
+ while (pos < ((off_t) size) * 8LL)
{
int res;
- res = GNUNET_DISK_file_read (bf->fh, rbuff, BUFFSIZE);
+ res = GNUNET_DISK_file_read (bf->fh,
+ rbuff,
+ BUFFSIZE);
if (res == -1)
{
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "read", bf->filename);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
+ "read",
+ bf->filename);
GNUNET_free (rbuff);
GNUNET_free (bf->filename);
GNUNET_DISK_file_close (bf->fh);
@@ -713,11 +718,11 @@ GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf)
*
* @param e the element
* @param bf the filter
- * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not
+ * @return #GNUNET_YES if the element is in the filter, #GNUNET_NO if not
*/
int
-GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
- *bf, const struct GNUNET_HashCode * e)
+GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter *bf,
+ const struct GNUNET_HashCode * e)
{
int res;
@@ -757,7 +762,8 @@ GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
*/
int
GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
- const char *data, size_t size)
+ const char *data,
+ size_t size)
{
unsigned int i;
unsigned int n;
@@ -791,8 +797,7 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
*/
int
GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
- const struct GNUNET_CONTAINER_BloomFilter
- *to_or)
+ const struct GNUNET_CONTAINER_BloomFilter *to_or)
{
unsigned int i;
unsigned int n;
@@ -828,13 +833,16 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
*/
void
GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
- const struct GNUNET_HashCode * e)
+ const struct GNUNET_HashCode *e)
{
if (NULL == bf)
return;
- if (bf->filename == NULL)
+ if (NULL == bf->filename)
return;
- iterateBits (bf, &decrementBitCallback, bf, e);
+ iterateBits (bf,
+ &decrementBitCallback,
+ bf,
+ e);
}
/**
@@ -851,7 +859,8 @@ GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
void
GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
GNUNET_CONTAINER_HashCodeIterator iterator,
- void *iterator_cls, size_t size,
+ void *iterator_cls,
+ size_t size,
unsigned int k)
{
struct GNUNET_HashCode hc;
@@ -862,13 +871,16 @@ GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
while (i < size)
i *= 2;
size = i; /* make sure it's a power of 2 */
-
+ bf->addressesPerElement = k;
bf->bitArraySize = size;
bf->bitArray = GNUNET_malloc (size);
- if (bf->filename != NULL)
- make_empty_file (bf->fh, bf->bitArraySize * 4LL);
- while (GNUNET_YES == iterator (iterator_cls, &hc))
- GNUNET_CONTAINER_bloomfilter_add (bf, &hc);
+ if (NULL != bf->filename)
+ make_empty_file (bf->fh,
+ bf->bitArraySize * 4LL);
+ while (GNUNET_YES == iterator (iterator_cls,
+ &hc))
+ GNUNET_CONTAINER_bloomfilter_add (bf,
+ &hc);
}
/* end of container_bloomfilter.c */
diff --git a/src/util/test_service.c b/src/util/test_service.c
index 1567c97ce..3ffacb0a9 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -30,10 +30,17 @@
*/
#define MY_TYPE 256
+#define TIMEOUT GNUNET_TIME_UNIT_SECONDS
+
static int global_ret = 1;
static struct GNUNET_MQ_Handle *mq;
+/**
+ * Timeout task.
+ */
+static struct GNUNET_SCHEDULER_Task *tt;
+
static void
handle_recv (void *cls,
@@ -86,10 +93,24 @@ disconnect_cb (void *cls,
{
GNUNET_SCHEDULER_shutdown ();
global_ret = 0;
+ if (NULL != tt)
+ {
+ GNUNET_SCHEDULER_cancel (tt);
+ tt = NULL;
+ }
}
}
+static void
+timeout_task (void *cls)
+{
+ tt = NULL;
+ global_ret = 33;
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
/**
* Initialization function of the service. Starts
* a client to connect to the service.
@@ -106,7 +127,11 @@ service_init (void *cls,
const char *service_name = cls;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *msg;
-
+
+ GNUNET_assert (NULL == tt);
+ tt = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &timeout_task,
+ NULL);
mq = GNUNET_CLIENT_connect (cfg,
service_name,
NULL,