From: Christian Grothoff Date: Fri, 6 May 2016 15:20:10 +0000 (+0000) Subject: fix compiler warnings X-Git-Tag: initial-import-from-subversion-38251~902 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8e325aefdaab6aae4567762bd639dfa1db3c4f15;p=oweals%2Fgnunet.git fix compiler warnings --- diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index b3ded1bdf..8c8d7223e 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -363,21 +363,28 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) * @param subsystem name of subsystem that created the statistic * @param name the name of the datum * @param value the current value - * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not - * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration + * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not + * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration */ static int -stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer, - const char *subsystem, const char *name, - uint64_t value, int is_persistent) +stats_iterator (void *cls, + const struct GNUNET_TESTBED_Peer *peer, + const char *subsystem, + const char *name, + uint64_t value, + int is_persistent) { static const char *s_sent = "# keepalives sent"; static const char *s_recv = "# keepalives received"; uint32_t i; i = GNUNET_TESTBED_get_index (peer); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", - i, subsystem, name, value); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "STATS PEER %u - %s [%s]: %llu\n", + i, + subsystem, + name, + (unsigned long long) value); if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i) ka_sent = value; @@ -401,7 +408,7 @@ gather_stats_and_exit (void *cls) disconnect_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", - l); + (int) l); if (NULL != ch) { if (NULL != th) @@ -497,7 +504,9 @@ data_task (void *cls) else { i++; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "in %u ms\n", i); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "in %llu ms\n", + (unsigned long long) i); data_job = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, i), &data_task, (void *) i); @@ -535,7 +544,10 @@ tmt_rdy (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "size %u, buf %p, data_sent %u, ack_received %u\n", - size, buf, data_sent, ack_received); + (unsigned int) size, + buf, + data_sent, + ack_received); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ok %u, ok goal %u\n", ok, ok_goal); GNUNET_break (ok >= ok_goal - 2); @@ -559,8 +571,10 @@ tmt_rdy (void *cls, size_t size, void *buf) else data_sent++; counter++; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, " Sent message %d size %u\n", - counter, msg_size); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + " Sent message %u size %u\n", + counter, + (unsigned int) msg_size); if (data_sent < TOTAL_PACKETS && SPEED == test) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n", @@ -751,7 +765,8 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Incoming channel from %s to peer %d\n", - GNUNET_i2s (initiator), (long) cls); + GNUNET_i2s (initiator), + (int) (long) cls); ok++; GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); if ((long) cls == peers_requested - 1) @@ -807,7 +822,8 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel, } else GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Unknown peer! %d\n", i); + "Unknown peer! %d\n", + (int) i); GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); if (NULL != disconnect_task) diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c index a17d8f1ab..d52e06282 100644 --- a/src/cadet/test_cadet_local.c +++ b/src/cadet/test_cadet_local.c @@ -156,7 +156,8 @@ inbound_channel (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received incoming channel on peer %d, port %u\n", - id, port); + (int) id, + (unsigned int) port); if (id != 2L) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index e28f57fa6..59a3e8a7f 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -415,19 +415,22 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) static int -inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, +inbound_notify (void *cls, + const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Core provides inbound data from `%4s' %llu.\n", - GNUNET_i2s (other), ntohs (message->size)); + "Core provides inbound data from `%4s' %u.\n", + GNUNET_i2s (other), + (unsigned int) ntohs (message->size)); total_bytes_recv += ntohs (message->size); return GNUNET_OK; } static int -outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, +outbound_notify (void *cls, + const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c index 6b639e341..0e92d0853 100644 --- a/src/dht/test_dht_monitor.c +++ b/src/dht/test_dht_monitor.c @@ -293,7 +293,8 @@ monitor_put_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u got a PUT message for key %s with %u bytes\n", i, - GNUNET_h2s (key), size); + GNUNET_h2s (key), + (unsigned int) size); monitor_counter++; } diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c index c3a03668c..f8de3a4df 100644 --- a/src/fs/test_fs_test_lib.c +++ b/src/fs/test_fs_test_lib.c @@ -64,8 +64,7 @@ do_stop (void *cls) else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Finished download, shutting down\n", - (unsigned long long) FILESIZE); + "Finished download, shutting down\n"); } if (NULL != fn) { diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 2ff495ac3..02d18c373 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c @@ -91,8 +91,7 @@ do_stop (void *cls) fancy); GNUNET_free (fancy); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Finished download, shutting down\n", - (unsigned long long) FILESIZE); + "Finished download, shutting down\n"); } } diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index 3f6ec2497..3c5120fe7 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c @@ -82,8 +82,7 @@ do_stop (void *cls) fancy); GNUNET_free (fancy); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Finished download, shutting down\n", - (unsigned long long) FILESIZE); + "Finished download, shutting down\n"); } if (NULL != fn) { diff --git a/src/gnsrecord/test_gnsrecord_serialization.c b/src/gnsrecord/test_gnsrecord_serialization.c index 01989b4a4..3edd2bc48 100644 --- a/src/gnsrecord/test_gnsrecord_serialization.c +++ b/src/gnsrecord/test_gnsrecord_serialization.c @@ -56,16 +56,26 @@ run (void *cls, char *const *args, const char *cfgfile, } res = 0; - len = GNUNET_GNSRECORD_records_get_size(rd_count, src); + len = GNUNET_GNSRECORD_records_get_size (rd_count, src); char rd_ser[len]; - GNUNET_assert (len == GNUNET_GNSRECORD_records_serialize(rd_count, src, len, rd_ser)); + GNUNET_assert (len == + GNUNET_GNSRECORD_records_serialize (rd_count, + src, + len, + rd_ser)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Serialized data len: %u\n",len); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Serialized data len: %u\n", + (unsigned int) len); GNUNET_assert (rd_ser != NULL); struct GNUNET_GNSRECORD_Data dst[rd_count]; - GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_records_deserialize (len, rd_ser, rd_count, dst)); + GNUNET_assert (GNUNET_OK == + GNUNET_GNSRECORD_records_deserialize (len, + rd_ser, + rd_count, + dst)); GNUNET_assert (dst != NULL); diff --git a/src/multicast/test_multicast.c b/src/multicast/test_multicast.c index 9e042d61b..db58fe525 100644 --- a/src/multicast/test_multicast.c +++ b/src/multicast/test_multicast.c @@ -201,9 +201,11 @@ tmit_notify (void *cls, size_t *data_size, void *data) uint16_t size = strlen (tmit->data[tmit->n]); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Transmit notify data: %u bytes available, " - "processing fragment %u/%u (size %u).\n", - *data_size, tmit->n + 1, tmit->data_count, size); + "Transmit notify data: %u bytes available, processing fragment %u/%u (size %u).\n", + (unsigned int) *data_size, + tmit->n + 1, + tmit->data_count, + size); if (*data_size < size) { *data_size = 0; @@ -468,9 +470,12 @@ member_recv_message (void *cls, const struct GNUNET_MULTICAST_MessageHeader *msg) { struct MemberClosure *mcls = cls; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test #%u: member_recv_message() %u/%u\n", - test, mcls->n + 1, mcls->msgs_expected); + test, + (unsigned int) (mcls->n + 1), + mcls->msgs_expected); if (++mcls->n != mcls->msgs_expected) return; diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 2582cbf3f..299ed0e09 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c @@ -152,11 +152,15 @@ end () void -state_reset_result (void *cls, int64_t result, - const char *err_msg, uint16_t err_msg_size) +state_reset_result (void *cls, + int64_t result, + const char *err_msg, + uint16_t err_msg_size) { op = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "state_reset_result:\t%d\n", + (int) result); GNUNET_assert (GNUNET_OK == result); op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, diff --git a/src/psycutil/psyc_message.c b/src/psycutil/psyc_message.c index 3dba05b3f..9f0a0c7da 100644 --- a/src/psycutil/psyc_message.c +++ b/src/psycutil/psyc_message.c @@ -267,45 +267,54 @@ GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind, { uint16_t size = ntohs (msg->size); uint16_t type = ntohs (msg->type); - GNUNET_log (kind, "Message of type %d and size %u:\n", type, size); + + GNUNET_log (kind, + "Message of type %d and size %u:\n", + type, + size); switch (type) { case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE: { - struct GNUNET_PSYC_MessageHeader *pmsg - = (struct GNUNET_PSYC_MessageHeader *) msg; - GNUNET_log (kind, "\tID: %" PRIu64 "\tflags: %x" PRIu32 "\n", - GNUNET_ntohll (pmsg->message_id), ntohl (pmsg->flags)); + const struct GNUNET_PSYC_MessageHeader *pmsg + = (const struct GNUNET_PSYC_MessageHeader *) msg; + GNUNET_log (kind, + "\tID: %" PRIu64 "\tflags: %x" PRIu32 "\n", + GNUNET_ntohll (pmsg->message_id), + ntohl (pmsg->flags)); break; } case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD: { - struct GNUNET_PSYC_MessageMethod *meth - = (struct GNUNET_PSYC_MessageMethod *) msg; + const struct GNUNET_PSYC_MessageMethod *meth + = (const struct GNUNET_PSYC_MessageMethod *) msg; GNUNET_log (kind, "\t%.*s\n", (int) (size - sizeof (*meth)), - &meth[1]); + (const char *) &meth[1]); break; } case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER: { - struct GNUNET_PSYC_MessageModifier *mod - = (struct GNUNET_PSYC_MessageModifier *) msg; + const struct GNUNET_PSYC_MessageModifier *mod + = (const struct GNUNET_PSYC_MessageModifier *) msg; uint16_t name_size = ntohs (mod->name_size); char oper = ' ' < mod->oper ? mod->oper : ' '; GNUNET_log (kind, "\t%c%.*s\t%.*s\n", oper, (int) name_size, - &mod[1], + (const char *) &mod[1], (int) (size - sizeof (*mod) - name_size), - ((char *) &mod[1]) + name_size); + ((const char *) &mod[1]) + name_size); break; } case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT: case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA: - GNUNET_log (kind, "\t%.*s\n", size - sizeof (*msg), &msg[1]); + GNUNET_log (kind, + "\t%.*s\n", + (int) (size - sizeof (*msg)), + (const char *) &msg[1]); break; } } @@ -320,7 +329,8 @@ GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind, struct GNUNET_PSYC_TransmitHandle * GNUNET_PSYC_transmit_create (struct GNUNET_CLIENT_MANAGER_Connection *client) { - struct GNUNET_PSYC_TransmitHandle *tmit = GNUNET_malloc (sizeof (*tmit)); + struct GNUNET_PSYC_TransmitHandle *tmit = GNUNET_new (struct GNUNET_PSYC_TransmitHandle); + tmit->client = client; return tmit; } diff --git a/src/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c index 8bf656ed0..fd0c0410b 100644 --- a/src/statistics/test_statistics_api_watch_zero_value.c +++ b/src/statistics/test_statistics_api_watch_zero_value.c @@ -58,8 +58,11 @@ static int watch_1 (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received value `%s' `%s' %llu\n", - subsystem, name, value); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received value `%s' `%s' %llu\n", + subsystem, + name, + (unsigned long long) value); GNUNET_assert (0 == strcmp (name, "test-1")); if ((0 == value) && (3 == ok)) { @@ -88,11 +91,17 @@ watch_1 (void *cls, const char *subsystem, const char *name, uint64_t value, static int -watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value, +watch_2 (void *cls, + const char *subsystem, + const char *name, + uint64_t value, int is_persistent) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received value `%s' `%s' %llu\n", - subsystem, name, value); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received value `%s' `%s' %llu\n", + subsystem, + name, + (unsigned long long) value); GNUNET_assert (0 == strcmp (name, "test-2")); if ((42 == value) && (1 == ok2)) @@ -106,7 +115,9 @@ watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value, } else { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received unexpected value %llu\n", value); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Received unexpected value %llu\n", + (unsigned long long) value); GNUNET_break (0); GNUNET_SCHEDULER_cancel (shutdown_task); @@ -136,7 +147,8 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_STATISTICS_set (h2, "test-2", 42, GNUNET_NO); shutdown_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &force_shutdown, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, + &force_shutdown, NULL); } diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 61ea2035f..be79d5499 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -381,7 +381,7 @@ test_addr_string (void *cls) GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Plugin creates different address length when converting address->string->address: %u != %u\n", (unsigned int) w->address->address_length, - s2a_len); + (unsigned int) s2a_len); } else if (0 != memcmp (s2a, w->address->address, s2a_len)) {