aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-06 08:20:53 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-06 08:20:53 +0200
commit561d9096a28037d65783cf40d4016e39a0cf3a2b (patch)
tree2591bb1ac9bb5d0b47c6d37447e1d40cfc8040a9 /src
parent8eb738e7d6005ffd5e6cbb1ae80316ed0da6e3f9 (diff)
fix misc compiler warnings
Diffstat (limited to 'src')
-rw-r--r--src/conversation/gnunet-conversation-test.c29
-rw-r--r--src/conversation/gnunet-helper-audio-playback.c39
-rw-r--r--src/conversation/gnunet-helper-audio-record.c48
-rw-r--r--src/conversation/gnunet-service-conversation.c18
-rw-r--r--src/conversation/plugin_gnsrecord_conversation.c5
5 files changed, 108 insertions, 31 deletions
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c
index 75605384f3..ac99e4d14e 100644
--- a/src/conversation/gnunet-conversation-test.c
+++ b/src/conversation/gnunet-conversation-test.c
@@ -97,6 +97,7 @@ do_shutdown (void *cls)
{
struct Recording *rec;
+ (void) cls;
if (NULL != switch_task)
GNUNET_SCHEDULER_cancel (switch_task);
if (NULL != microphone)
@@ -123,8 +124,7 @@ do_shutdown (void *cls)
static void
switch_to_speaker (void *cls)
{
- struct Recording *rec;
-
+ (void) cls;
switch_task = NULL;
microphone->disable_microphone (microphone->cls);
if (GNUNET_OK !=
@@ -138,7 +138,7 @@ switch_to_speaker (void *cls)
}
fprintf (stderr,
_("\nWe are now playing your recording back. If you can hear it, your audio settings are working..."));
- for (rec=rec_head; NULL != rec; rec = rec->next)
+ for (struct Recording *rec=rec_head; NULL != rec; rec = rec->next)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Replaying %u bytes\n",
@@ -168,6 +168,7 @@ record (void *cls,
{
struct Recording *rec;
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Recorded %u bytes\n",
(unsigned int) data_size);
@@ -189,9 +190,14 @@ record (void *cls,
* @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) args;
+ (void) cfgfile;
microphone = GNUNET_MICROPHONE_create_from_hardware (cfg);
GNUNET_assert (NULL != microphone);
speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
@@ -225,17 +231,24 @@ run (void *cls, char *const *args, const char *cfgfile,
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *const *argv)
+main (int argc,
+ char *const *argv)
{
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-conversation-test",
- gettext_noop ("help text"), options, &run,
+ GNUNET_PROGRAM_run (argc, argv,
+ "gnunet-conversation-test",
+ gettext_noop ("help text"),
+ options,
+ &run,
NULL)) ? ret : 1;
GNUNET_free ((void*) argv);
return ret;
diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c
index f96878051d..5c13f28777 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -144,17 +144,22 @@ process_header (ogg_packet *op)
OpusDecoder *dec;
struct OpusHeadPacket header;
- if (op->bytes < sizeof (header))
+ if ( ((unsigned int) op->bytes) < sizeof (header))
return NULL;
- GNUNET_memcpy (&header, op->packet, sizeof (header));
+ GNUNET_memcpy (&header,
+ op->packet,
+ sizeof (header));
header.preskip = GNUNET_le16toh (header.preskip);
header.sampling_rate = GNUNET_le32toh (header.sampling_rate);
header.gain = GNUNET_le16toh (header.gain);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Header: v%u, %u-ch, skip %u, %uHz, %u gain\n",
- header.version, header.channels, header.preskip, header.sampling_rate, header.gain);
-
+ header.version,
+ header.channels,
+ header.preskip,
+ header.sampling_rate,
+ header.gain);
channels = header.channels;
preskip = header.preskip;
@@ -333,7 +338,8 @@ audio_write (int64_t maxout)
static void
quit (int ret)
{
- mainloop_api->quit (mainloop_api, ret);
+ mainloop_api->quit (mainloop_api,
+ ret);
exit (ret);
}
@@ -539,6 +545,7 @@ ogg_demux_and_decode ()
}
}
+
/**
* Message callback
*
@@ -555,6 +562,7 @@ stdin_receiver (void *cls,
char *data;
size_t payload_len;
+ (void) cls;
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO:
@@ -585,6 +593,9 @@ stream_write_callback (pa_stream *s,
void *userdata)
{
/* unblock 'main' */
+ (void) userdata;
+ (void) length;
+ (void) s;
if (-1 != ready_pipe[1])
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -603,6 +614,10 @@ exit_signal_callback (pa_mainloop_api *m,
int sig,
void *userdata)
{
+ (void) m;
+ (void) e;
+ (void) sig;
+ (void) userdata;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("gnunet-helper-audio-playback - Got signal, exiting\n"));
quit (1);
@@ -618,6 +633,7 @@ context_state_callback (pa_context *c,
{
int p;
+ (void) userdata;
GNUNET_assert (NULL != c);
switch (pa_context_get_state (c))
{
@@ -730,7 +746,11 @@ ogg_init ()
static void
drain_callback (pa_stream*s, int success, void *userdata)
{
- pa_threaded_mainloop_signal (m, 0);
+ (void) s;
+ (void) success;
+ (void) userdata;
+ pa_threaded_mainloop_signal (m,
+ 0);
}
@@ -745,7 +765,6 @@ int
main (int argc, char *argv[])
{
static unsigned long long toff;
-
char readbuf[MAXLINE];
struct GNUNET_MessageStreamTokenizer *stdin_mst;
char c;
@@ -754,6 +773,8 @@ main (int argc, char *argv[])
int read_pure_ogg = getenv ("GNUNET_READ_PURE_OGG") ? 1 : 0;
#endif
+ (void) argc;
+ (void) argv;
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("gnunet-helper-audio-playback",
"WARNING",
@@ -778,7 +799,9 @@ main (int argc, char *argv[])
#endif
while (1)
{
- ret = read (0, readbuf, sizeof (readbuf));
+ ret = read (STDIN_FILENO,
+ readbuf,
+ sizeof (readbuf));
toff += ret;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received %d bytes of audio data (total: %llu)\n",
diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c
index 9442e9b459..dd8c8f447c 100644
--- a/src/conversation/gnunet-helper-audio-record.c
+++ b/src/conversation/gnunet-helper-audio-record.c
@@ -264,30 +264,36 @@ static int dump_pure_ogg;
static void
quit (int ret)
{
- mainloop_api->quit (mainloop_api, ret);
+ mainloop_api->quit (mainloop_api,
+ ret);
exit (ret);
}
static void
-write_data (const char *ptr, size_t msg_size)
+write_data (const char *ptr,
+ size_t msg_size)
{
ssize_t ret;
size_t off;
off = 0;
while (off < msg_size)
{
- ret = write (1, &ptr[off], msg_size - off);
+ ret = write (STDOUT_FILENO,
+ &ptr[off],
+ msg_size - off);
if (0 >= ret)
{
if (-1 == ret)
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "write");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+ "write");
quit (2);
}
off += ret;
}
}
+
static void
write_page (ogg_page *og)
{
@@ -305,12 +311,15 @@ write_page (ogg_page *og)
toff);
#ifdef DEBUG_RECORD_PURE_OGG
if (dump_pure_ogg)
- write_data ((const char *) &audio_message[1], og->header_len + og->body_len);
+ write_data ((const char *) &audio_message[1],
+ og->header_len + og->body_len);
else
#endif
- write_data ((const char *) audio_message, msg_size);
+ write_data ((const char *) audio_message,
+ msg_size);
}
+
/**
* Creates OPUS packets from PCM data
*/
@@ -340,7 +349,7 @@ packetizer ()
opus_strerror (len));
quit (5);
}
- if (len > UINT16_MAX - sizeof (struct AudioMessage))
+ if (((uint32_t)len) > UINT16_MAX - sizeof (struct AudioMessage))
{
GNUNET_break (0);
continue;
@@ -360,7 +369,9 @@ packetizer ()
while (ogg_stream_flush_fill (&os, &og, PAGE_WATERLINE))
{
- if (og.header_len + og.body_len > UINT16_MAX - sizeof (struct AudioMessage))
+ if ( ((unsigned long long) og.header_len) +
+ ((unsigned long long) og.body_len) >
+ UINT16_MAX - sizeof (struct AudioMessage))
{
GNUNET_assert (0);
continue;
@@ -399,6 +410,7 @@ stream_read_callback (pa_stream * s,
{
const void *data;
+ (void) userdata;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got %u/%d bytes of PCM data\n",
(unsigned int) length,
@@ -449,6 +461,10 @@ exit_signal_callback (pa_mainloop_api * m,
int sig,
void *userdata)
{
+ (void) m;
+ (void) e;
+ (void) sig;
+ (void) userdata;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Got signal, exiting.\n"));
quit (1);
@@ -459,10 +475,11 @@ exit_signal_callback (pa_mainloop_api * m,
* Pulseaudio stream state callback
*/
static void
-stream_state_callback (pa_stream * s, void *userdata)
+stream_state_callback (pa_stream * s,
+ void *userdata)
{
+ (void) userdata;
GNUNET_assert (NULL != s);
-
switch (pa_stream_get_state (s))
{
case PA_STREAM_CREATING:
@@ -522,6 +539,7 @@ static void
context_state_callback (pa_context * c,
void *userdata)
{
+ (void) userdata;
GNUNET_assert (c);
switch (pa_context_get_state (c))
@@ -654,6 +672,7 @@ opus_init ()
OPUS_SET_SIGNAL (CONV_OPUS_SIGNAL));
}
+
static void
ogg_init ()
{
@@ -662,8 +681,8 @@ ogg_init ()
struct OpusCommentsPacket *commentspacket;
size_t commentspacket_len;
- serialno = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 0x7FFFFFFF);
-
+ serialno = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG,
+ 0x7FFFFFFF);
/*Initialize Ogg stream struct*/
if (-1 == ogg_stream_init (&os, serialno))
{
@@ -750,8 +769,11 @@ ogg_init ()
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *argv[])
+main (int argc,
+ char *argv[])
{
+ (void) argc;
+ (void) argv;
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("gnunet-helper-audio-record",
"WARNING",
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index fb4f9fcad5..2d6dd09f66 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -600,6 +600,8 @@ static int
check_client_audio_message (void *cls,
const struct ClientAudioMessage *msg)
{
+ (void) cls;
+ (void) msg;
return GNUNET_OK;
}
@@ -766,6 +768,7 @@ handle_cadet_hangup_message (void *cls,
enum ChannelStatus status;
uint32_t cid;
+ (void) message;
GNUNET_CADET_receive_done (ch->channel);
cid = ch->cid;
status = ch->status;
@@ -811,6 +814,7 @@ handle_cadet_pickup_message (void *cls,
struct GNUNET_MQ_Envelope *env;
struct ClientPhonePickedupMessage *pick;
+ (void) message;
GNUNET_CADET_receive_done (ch->channel);
switch (ch->status)
{
@@ -860,6 +864,7 @@ handle_cadet_suspend_message (void *cls,
struct GNUNET_MQ_Envelope *env;
struct ClientPhoneSuspendMessage *suspend;
+ (void) message;
GNUNET_CADET_receive_done (ch->channel);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Suspending channel CID: %u\n",
@@ -909,6 +914,7 @@ handle_cadet_resume_message (void *cls,
struct GNUNET_MQ_Envelope *env;
struct ClientPhoneResumeMessage *resume;
+ (void) msg;
line = ch->line;
GNUNET_CADET_receive_done (ch->channel);
if (GNUNET_YES != ch->suspended_remote)
@@ -959,6 +965,8 @@ static int
check_cadet_audio_message (void *cls,
const struct CadetAudioMessage *msg)
{
+ (void) cls;
+ (void) msg;
return GNUNET_OK; /* any payload is fine */
}
@@ -1147,6 +1155,7 @@ inbound_channel (void *cls,
struct Line *line = cls;
struct Channel *ch;
+ (void) initiator;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received incoming cadet channel on line %p\n",
line);
@@ -1178,6 +1187,7 @@ client_connect_cb (void *cls,
{
struct Line *line;
+ (void) cls;
line = GNUNET_new (struct Line);
line->client = client;
line->mq = mq;
@@ -1198,9 +1208,10 @@ client_disconnect_cb (void *cls,
void *app_ctx)
{
struct Line *line = app_ctx;
- struct Channel *ch;
struct Channel *chn;
+ (void) cls;
+ (void) client;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client disconnected, closing line\n");
if (NULL != line->port)
@@ -1208,7 +1219,7 @@ client_disconnect_cb (void *cls,
GNUNET_CADET_close_port (line->port);
line->port = NULL;
}
- for (ch = line->channel_head; NULL != ch; ch = chn)
+ for (struct Channel *ch = line->channel_head; NULL != ch; ch = chn)
{
chn = ch->next;
ch->line = NULL;
@@ -1285,6 +1296,7 @@ handle_client_register_message (void *cls,
static void
do_shutdown (void *cls)
{
+ (void) cls;
if (NULL != cadet)
{
GNUNET_CADET_disconnect (cadet);
@@ -1305,6 +1317,8 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SERVICE_Handle *service)
{
+ (void) cls;
+ (void) service;
cfg = c;
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_get_peer_identity (cfg,
diff --git a/src/conversation/plugin_gnsrecord_conversation.c b/src/conversation/plugin_gnsrecord_conversation.c
index dd81ec917c..3fee68782e 100644
--- a/src/conversation/plugin_gnsrecord_conversation.c
+++ b/src/conversation/plugin_gnsrecord_conversation.c
@@ -46,6 +46,7 @@ conversation_value_to_string (void *cls,
{
char *s;
+ (void) cls;
switch (type)
{
case GNUNET_GNSRECORD_TYPE_PHONE:
@@ -103,6 +104,7 @@ conversation_string_to_value (void *cls,
void **data,
size_t *data_size)
{
+ (void) cls;
if (NULL == s)
{
GNUNET_break (0);
@@ -181,6 +183,7 @@ conversation_typename_to_number (void *cls,
{
unsigned int i;
+ (void) cls;
i=0;
while ( (name_map[i].name != NULL) &&
(0 != strcasecmp (gns_typename, name_map[i].name)) )
@@ -202,6 +205,7 @@ conversation_number_to_typename (void *cls,
{
unsigned int i;
+ (void) cls;
i=0;
while ( (name_map[i].name != NULL) &&
(type != name_map[i].number) )
@@ -221,6 +225,7 @@ libgnunet_plugin_gnsrecord_conversation_init (void *cls)
{
struct GNUNET_GNSRECORD_PluginFunctions *api;
+ (void) cls;
api = GNUNET_new (struct GNUNET_GNSRECORD_PluginFunctions);
api->value_to_string = &conversation_value_to_string;
api->string_to_value = &conversation_string_to_value;