From 61c39c60565b386e0e12ea669556b030e8cd7180 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 6 Oct 2013 20:55:28 +0000 Subject: -remove trailing whitespace --- src/conversation/conversation.h | 8 +-- src/conversation/conversation_api.c | 56 ++++++++++---------- src/conversation/gnunet-conversation-test.c | 12 ++--- src/conversation/gnunet-conversation.c | 58 ++++++++++---------- src/conversation/gnunet-helper-audio-playback.c | 54 +++++++++---------- src/conversation/gnunet-helper-audio-record.c | 64 +++++++++++----------- src/conversation/gnunet-service-conversation.c | 70 ++++++++++++------------- src/conversation/microphone.c | 16 +++--- src/conversation/speaker.c | 18 +++---- src/conversation/test_conversation_api.c | 2 +- 10 files changed, 179 insertions(+), 179 deletions(-) (limited to 'src/conversation') diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h index 685d98d16..4b42277a5 100644 --- a/src/conversation/conversation.h +++ b/src/conversation/conversation.h @@ -116,7 +116,7 @@ struct ClientPhonePickupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -132,7 +132,7 @@ struct ClientPhoneHangupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -190,7 +190,7 @@ struct ClientPhonePickedupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -233,7 +233,7 @@ struct MeshPhoneRingMessage /** * When does the signature expire? - */ + */ struct GNUNET_TIME_AbsoluteNBO expiration_time; /** diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 11eb2b7e7..6e1cbe3fb 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c @@ -1,17 +1,17 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -75,7 +75,7 @@ struct GNUNET_CONVERSATION_Phone * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Handle to talk with CONVERSATION service. */ @@ -103,7 +103,7 @@ struct GNUNET_CONVERSATION_Phone /** * Connection to NAMESTORE (for reverse lookup). - */ + */ struct GNUNET_NAMESTORE_Handle *ns; /** @@ -119,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone /** * This phone's record. */ - struct GNUNET_CONVERSATION_PhoneRecord my_record; + struct GNUNET_CONVERSATION_PhoneRecord my_record; /** * My GNS zone. @@ -316,7 +316,7 @@ handle_phone_audio_message (void *cls, /** - * We encountered an error talking with the conversation service. + * We encountered an error talking with the conversation service. * * @param cls the `struct GNUNET_CONVERSATION_Phone` * @param error details about the error @@ -326,7 +326,7 @@ phone_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_CONVERSATION_Phone *phone = cls; - + GNUNET_break (0); FPRINTF (stderr, _("Internal error %d\n"), @@ -346,15 +346,15 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone) static struct GNUNET_MQ_MessageHandler handlers[] = { { &handle_phone_ring, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, sizeof (struct ClientPhoneRingMessage) }, { &handle_phone_hangup, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 0 }, { &handle_phone_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, - 0 }, - { NULL, 0, 0 } + 0 }, + { NULL, 0, 0 } }; struct GNUNET_MQ_Envelope *e; struct ClientPhoneRegisterMessage *reg; @@ -408,7 +408,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned long long line; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, + GNUNET_CONFIGURATION_get_value_number (cfg, "CONVERSATION", "LINE", &line)) @@ -478,7 +478,7 @@ transmit_phone_audio (void *cls, struct ClientAudioMessage *am; GNUNET_assert (PS_ACTIVE == phone->state); - e = GNUNET_MQ_msg_extra (am, + e = GNUNET_MQ_msg_extra (am, data_size, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); memcpy (&am[1], data, data_size); @@ -487,7 +487,7 @@ transmit_phone_audio (void *cls, /** - * Picks up a (ringing) phone. This will connect the speaker + * Picks up a (ringing) phone. This will connect the speaker * to the microphone of the other party, and vice versa. * * @param phone phone to pick up @@ -630,7 +630,7 @@ struct GNUNET_CONVERSATION_Call * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Handle to talk with CONVERSATION service. */ @@ -655,7 +655,7 @@ struct GNUNET_CONVERSATION_Call * Our microphone. */ struct GNUNET_MICROPHONE_Handle *mic; - + /** * Function to call with events. */ @@ -673,7 +673,7 @@ struct GNUNET_CONVERSATION_Call /** * Connection to GNS (can be NULL). - */ + */ struct GNUNET_GNS_Handle *gns; /** @@ -754,7 +754,7 @@ transmit_call_audio (void *cls, struct ClientAudioMessage *am; GNUNET_assert (CS_ACTIVE == call->state); - e = GNUNET_MQ_msg_extra (am, + e = GNUNET_MQ_msg_extra (am, data_size, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); memcpy (&am[1], data, data_size); @@ -782,7 +782,7 @@ handle_call_picked_up (void *cls, metadata = (const char *) &am[1]; if ( (0 == size) || ('\0' != metadata[size - 1]) ) - metadata = NULL; + metadata = NULL; switch (call->state) { case CS_LOOKUP: @@ -830,7 +830,7 @@ handle_call_hangup (void *cls, reason = (const char *) &am[1]; if ( (0 == size) || ('\0' != reason[size - 1]) ) - reason = NULL; + reason = NULL; switch (call->state) { case CS_LOOKUP: @@ -900,7 +900,7 @@ handle_call_audio_message (void *cls, * @param rd_count number of records in @a rd * @param rd the records in reply */ -static void +static void handle_gns_response (void *cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -919,7 +919,7 @@ handle_gns_response (void *cls, { GNUNET_break_op (0); continue; - } + } memcpy (&call->phone_record, rd[i].data, rd[i].data_size); @@ -942,7 +942,7 @@ handle_gns_response (void *cls, /** - * We encountered an error talking with the conversation service. + * We encountered an error talking with the conversation service. * * @param cls the `struct GNUNET_CONVERSATION_Call` * @param error details about the error @@ -972,18 +972,18 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) static struct GNUNET_MQ_MessageHandler handlers[] = { { &handle_call_busy, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, sizeof (struct ClientPhoneBusyMessage) }, { &handle_call_picked_up, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, 0 }, { &handle_call_hangup, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 0 }, { &handle_call_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, - 0 }, - { NULL, 0, 0 } + 0 }, + { NULL, 0, 0 } }; struct GNUNET_CRYPTO_EccPublicSignKey my_zone; @@ -1013,7 +1013,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) call->state = CS_LOOKUP; GNUNET_IDENTITY_ego_get_public_key (call->caller_id, &my_zone); - call->gns_lookup = GNUNET_GNS_lookup (call->gns, + call->gns_lookup = GNUNET_GNS_lookup (call->gns, call->callee, &my_zone, GNUNET_NAMESTORE_TYPE_PHONE, diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c index 1f44ca1fc..cc831a3ab 100644 --- a/src/conversation/gnunet-conversation-test.c +++ b/src/conversation/gnunet-conversation-test.c @@ -25,8 +25,8 @@ */ #include "platform.h" #include "gnunet_util_lib.h" -#include "gnunet_speaker_lib.h" -#include "gnunet_microphone_lib.h" +#include "gnunet_speaker_lib.h" +#include "gnunet_microphone_lib.h" /** * How long do we record before we replay? @@ -117,7 +117,7 @@ do_shutdown (void *cls, rec); GNUNET_free (rec); } - fprintf (stderr, + fprintf (stderr, _("\nEnd of transmission. Have a GNU day.\n")); } @@ -145,7 +145,7 @@ switch_to_speaker (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - fprintf (stderr, + 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) { @@ -170,7 +170,7 @@ switch_to_speaker (void *cls, * @param data_size number of bytes in @a data * @param data audio data to play */ -static void +static void record (void *cls, size_t data_size, const void *data) @@ -211,7 +211,7 @@ run (void *cls, char *const *args, const char *cfgfile, st = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); - fprintf (stderr, + fprintf (stderr, _("We will now be recording you for %s. After that time, the recording will be played back to you..."), GNUNET_STRINGS_relative_time_to_string (TIMEOUT, GNUNET_YES)); if (GNUNET_OK != diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index ad91d3007..113c10098 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c @@ -1,17 +1,17 @@ /* This file is part of GNUnet. (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -173,7 +173,7 @@ phone_event_handler (void *cls, ...) { va_list va; - + va_start (va, code); switch (code) { @@ -268,7 +268,7 @@ call_event_handler (void *cls, ...) { va_list va; - + va_start (va, code); switch (code) { @@ -338,7 +338,7 @@ struct VoipCommand * Command the user needs to enter. */ const char *command; - + /** * Function to call on command. */ @@ -380,8 +380,8 @@ do_quit (const char *args) static void do_unknown (const char *msg) { - FPRINTF (stderr, - _("Unknown command `%s'\n"), + FPRINTF (stderr, + _("Unknown command `%s'\n"), msg); } @@ -403,7 +403,7 @@ do_call (const char *arg) } switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: FPRINTF (stderr, _("Ego `%s' not available\n"), ego_name); @@ -470,7 +470,7 @@ do_accept (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: case CS_LISTEN: case CS_ERROR: FPRINTF (stderr, @@ -497,7 +497,7 @@ do_accept (const char *args) return; } GNUNET_assert (NULL != phone); - GNUNET_CONVERSATION_phone_pick_up (phone, + GNUNET_CONVERSATION_phone_pick_up (phone, args, speaker, mic); @@ -536,7 +536,7 @@ do_status (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: FPRINTF (stdout, _("We are currently trying to locate the private key for the ego `%s'.\n"), ego_name); @@ -586,7 +586,7 @@ do_reject (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: case CS_LISTEN: case CS_ERROR: FPRINTF (stderr, @@ -604,7 +604,7 @@ do_reject (const char *args) if (NULL == call) { GNUNET_assert (NULL != phone); - GNUNET_CONVERSATION_phone_hang_up (phone, + GNUNET_CONVERSATION_phone_hang_up (phone, args); state = CS_LISTEN; } @@ -621,9 +621,9 @@ do_reject (const char *args) * List of supported commands. */ static struct VoipCommand commands[] = { - {"/address", &do_address, + {"/address", &do_address, gettext_noop ("Use `/address' to find out which address this phone should have in GNS")}, - {"/call", &do_call, + {"/call", &do_call, gettext_noop ("Use `/call USER.gnu' to call USER")}, {"/accept", &do_accept, gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")}, @@ -631,11 +631,11 @@ static struct VoipCommand commands[] = { gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")}, {"/status", &do_status, gettext_noop ("Use `/status' to print status information")}, - {"/quit", &do_quit, + {"/quit", &do_quit, gettext_noop ("Use `/quit' to terminate gnunet-conversation")}, {"/help", &do_help, gettext_noop ("Use `/help command' to get help for a specific command")}, - {"", &do_unknown, + {"", &do_unknown, NULL}, {NULL, NULL, NULL}, }; @@ -650,8 +650,8 @@ static void do_help (const char *args) { unsigned int i; - - i = 0; + + i = 0; while ( (NULL != args) && (0 != strlen (args)) && (commands[i].Action != &do_help)) @@ -659,7 +659,7 @@ do_help (const char *args) if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1)) { - FPRINTF (stdout, + FPRINTF (stdout, "%s\n", gettext (commands[i].helptext)); return; @@ -667,13 +667,13 @@ do_help (const char *args) i++; } i = 0; - FPRINTF (stdout, - "%s", + FPRINTF (stdout, + "%s", "Available commands:\n"); while (commands[i].Action != &do_help) { - FPRINTF (stdout, - "%s\n", + FPRINTF (stdout, + "%s\n", gettext (commands[i].command)); i++; } @@ -710,7 +710,7 @@ do_stop_task (void *cls, { GNUNET_SCHEDULER_cancel (handle_cmd_task); handle_cmd_task = GNUNET_SCHEDULER_NO_TASK; - } + } if (NULL != id) { GNUNET_IDENTITY_disconnect (id); @@ -799,7 +799,7 @@ identity_cb (void *cls, ego_name)) return; if (NULL == ego) - { + { if (verbose) FPRINTF (stdout, _("Our ego `%s' was deleted!\n"), @@ -826,7 +826,7 @@ identity_cb (void *cls, */ static void run (void *cls, - char *const *args, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -851,7 +851,7 @@ run (void *cls, } -/** +/** * The main function to conversation. * * @param argc number of arguments from the command line diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c index c0ef217cd..97abd4430 100644 --- a/src/conversation/gnunet-helper-audio-playback.c +++ b/src/conversation/gnunet-helper-audio-playback.c @@ -102,7 +102,7 @@ static int ready_pipe[2]; * Message callback */ static int -stdin_receiver (void *cls, +stdin_receiver (void *cls, void *client, const struct GNUNET_MessageHeader *msg) { @@ -113,7 +113,7 @@ stdin_receiver (void *cls, { case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO: audio = (struct AudioMessage *) msg; - + ret = opus_decode_float (dec, (const unsigned char *) &audio[1], ntohs (audio->header.size) - sizeof (struct AudioMessage), @@ -132,12 +132,12 @@ stdin_receiver (void *cls, if (pa_stream_write (stream_out, pcm_buffer, pcm_length, NULL, 0, PA_SEEK_RELATIVE) < 0) - { + { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_stream_write() failed: %s\n"), pa_strerror (pa_context_errno (context))); return GNUNET_OK; - } + } break; default: break; @@ -161,8 +161,8 @@ quit (int ret) * Callback when data is there for playback */ static void -stream_write_callback (pa_stream * s, - size_t length, +stream_write_callback (pa_stream * s, + size_t length, void *userdata) { /* unblock 'main' */ @@ -192,7 +192,7 @@ exit_signal_callback (pa_mainloop_api * m, pa_signal_event * e, int sig, * Pulseaudio stream state callback */ static void -context_state_callback (pa_context * c, +context_state_callback (pa_context * c, void *userdata) { int p; @@ -203,7 +203,7 @@ context_state_callback (pa_context * c, case PA_CONTEXT_CONNECTING: case PA_CONTEXT_AUTHORIZING: case PA_CONTEXT_SETTING_NAME: - break; + break; case PA_CONTEXT_READY: { GNUNET_assert (!stream_out); @@ -216,12 +216,12 @@ context_state_callback (pa_context * c, _("pa_stream_new() failed: %s\n"), pa_strerror (pa_context_errno (c))); goto fail; - } - pa_stream_set_write_callback (stream_out, + } + pa_stream_set_write_callback (stream_out, &stream_write_callback, NULL); if ((p = - pa_stream_connect_playback (stream_out, NULL, + pa_stream_connect_playback (stream_out, NULL, NULL, PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL)) < 0) @@ -232,19 +232,19 @@ context_state_callback (pa_context * c, goto fail; } break; - } + } case PA_CONTEXT_TERMINATED: quit (0); break; - + case PA_CONTEXT_FAILED: default: - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Connection failure: %s\n"), pa_strerror (pa_context_errno (c))); goto fail; - } - return; + } + return; fail: quit (1); } @@ -260,13 +260,13 @@ pa_init () if (!pa_sample_spec_valid (&sample_spec)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Wrong Spec\n")); - } - /* set up threaded playback mainloop */ + } + /* set up threaded playback mainloop */ if (!(m = pa_threaded_mainloop_new ())) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_new() failed.\n")); } mainloop_api = pa_threaded_mainloop_get_api (m); @@ -280,9 +280,9 @@ pa_init () /* connect to the main pulseaudio context */ if (!(context = pa_context_new (mainloop_api, "GNUnet VoIP"))) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_new() failed.\n")); - } + } pa_context_set_state_callback (context, context_state_callback, NULL); if (pa_context_connect (context, NULL, 0, NULL) < 0) @@ -290,10 +290,10 @@ pa_init () GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_connect() failed: %s\n"), pa_strerror (pa_context_errno (context))); - } + } if (pa_threaded_mainloop_start (m) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_run() failed.\n")); } } @@ -354,7 +354,7 @@ main (int argc, char *argv[]) ready_pipe[1] = -1; while (1) { - ret = read (0, readbuf, sizeof (readbuf)); + ret = read (0, readbuf, sizeof (readbuf)); toff += ret; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %d bytes of audio data (total: %llu)\n", @@ -363,10 +363,10 @@ main (int argc, char *argv[]) if (0 > ret) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Read error from STDIN: %s\n"), + _("Read error from STDIN: %s\n"), strerror (errno)); break; - } + } if (0 == ret) break; GNUNET_SERVER_mst_receive (stdin_mst, NULL, diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c index 54c9b7909..5e42de2b5 100644 --- a/src/conversation/gnunet-helper-audio-record.c +++ b/src/conversation/gnunet-helper-audio-record.c @@ -92,7 +92,7 @@ static unsigned char *opus_data; static float *pcm_buffer; /** - * Length of the pcm data needed for one OPUS frame + * Length of the pcm data needed for one OPUS frame */ static int pcm_length; @@ -151,7 +151,7 @@ packetizer () size_t off; ssize_t ret; int len; // FIXME: int? - size_t msg_size; + size_t msg_size; while (transmit_buffer_length >= transmit_buffer_index + pcm_length) { @@ -195,9 +195,9 @@ packetizer () if (0 != new_size) { nbuf = pa_xmalloc (new_size); - memmove (nbuf, + memmove (nbuf, &transmit_buffer[transmit_buffer_index], - new_size); + new_size); pa_xfree (transmit_buffer); transmit_buffer = nbuf; } @@ -207,7 +207,7 @@ packetizer () transmit_buffer = NULL; } transmit_buffer_index = 0; - transmit_buffer_length = new_size; + transmit_buffer_length = new_size; } @@ -216,7 +216,7 @@ packetizer () */ static void stream_read_callback (pa_stream * s, - size_t length, + size_t length, void *userdata) { const void *data; @@ -233,7 +233,7 @@ stream_read_callback (pa_stream * s, if (pa_stream_peek (s, (const void **) &data, &length) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_stream_peek() failed: %s\n"), pa_strerror (pa_context_errno (context))); quit (1); @@ -243,9 +243,9 @@ stream_read_callback (pa_stream * s, GNUNET_assert (length > 0); if (NULL != transmit_buffer) { - transmit_buffer = pa_xrealloc (transmit_buffer, + transmit_buffer = pa_xrealloc (transmit_buffer, transmit_buffer_length + length); - memcpy (&transmit_buffer[transmit_buffer_length], + memcpy (&transmit_buffer[transmit_buffer_length], data, length); transmit_buffer_length += length; @@ -266,12 +266,12 @@ stream_read_callback (pa_stream * s, * Exit callback for SIGTERM and SIGINT */ static void -exit_signal_callback (pa_mainloop_api * m, - pa_signal_event * e, +exit_signal_callback (pa_mainloop_api * m, + pa_signal_event * e, int sig, void *userdata) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Got signal, exiting.\n")); quit (1); } @@ -289,17 +289,17 @@ stream_state_callback (pa_stream * s, void *userdata) { case PA_STREAM_CREATING: case PA_STREAM_TERMINATED: - break; + break; case PA_STREAM_READY: { const pa_buffer_attr *a; char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Stream successfully created.\n")); - + if (!(a = pa_stream_get_buffer_attr (s))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -313,24 +313,24 @@ stream_state_callback (pa_stream * s, void *userdata) GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Buffer metrics: maxlength=%u, fragsize=%u\n"), a->maxlength, a->fragsize); - } + } GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Using sample spec '%s', channel map '%s'.\n"), pa_sample_spec_snprint (sst, sizeof (sst), pa_stream_get_sample_spec (s)), pa_channel_map_snprint (cmt, sizeof (cmt), pa_stream_get_channel_map (s))); - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to device %s (%u, %ssuspended).\n"), pa_stream_get_device_name (s), pa_stream_get_device_index (s), pa_stream_is_suspended (s) ? "" : "not "); - } + } break; case PA_STREAM_FAILED: default: - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Stream error: %s\n"), pa_strerror (pa_context_errno (pa_stream_get_context (s)))); quit (1); @@ -357,9 +357,9 @@ context_state_callback (pa_context * c, { int r; pa_buffer_attr na; - - GNUNET_assert (!stream_in); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + + GNUNET_assert (!stream_in); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connection established.\n")); if (! (stream_in = pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL))) @@ -374,7 +374,7 @@ context_state_callback (pa_context * c, memset (&na, 0, sizeof (na)); na.maxlength = UINT32_MAX; na.fragsize = pcm_length; - if ((r = pa_stream_connect_record (stream_in, NULL, &na, + if ((r = pa_stream_connect_record (stream_in, NULL, &na, PA_STREAM_ADJUST_LATENCY)) < 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -382,12 +382,12 @@ context_state_callback (pa_context * c, pa_strerror (pa_context_errno (c))); goto fail; } - + break; - } + } case PA_CONTEXT_TERMINATED: quit (0); - break; + break; case PA_CONTEXT_FAILED: default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -413,13 +413,13 @@ pa_init () if (!pa_sample_spec_valid (&sample_spec)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong Spec\n")); } /* set up main record loop */ if (!(m = pa_mainloop_new ())) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_new() failed.\n")); } mainloop_api = pa_mainloop_get_api (m); @@ -434,9 +434,9 @@ pa_init () if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP"))) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_new() failed.\n")); - } + } pa_context_set_state_callback (context, &context_state_callback, NULL); if (pa_context_connect (context, NULL, 0, NULL) < 0) { @@ -446,7 +446,7 @@ pa_init () } if (pa_mainloop_run (m, &i) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_run() failed.\n")); } } @@ -466,7 +466,7 @@ opus_init () pcm_buffer = pa_xmalloc (pcm_length); opus_data = GNUNET_malloc (max_payload_bytes); enc = opus_encoder_create (SAMPLING_RATE, - channels, + channels, OPUS_APPLICATION_VOIP, &err); opus_encoder_ctl (enc, diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 85bbc0481..d19be5318 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -1,17 +1,17 @@ /* This file is part of GNUnet. (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -105,7 +105,7 @@ struct Line * Handle for the reliable tunnel (contol data) */ struct GNUNET_MESH_Tunnel *tunnel_reliable; - + /** * Handle for unreliable tunnel (audio data) */ @@ -153,7 +153,7 @@ struct Line /** * Current status of this line. - */ + */ enum LineStatus status; }; @@ -374,7 +374,7 @@ mq_done_finish_caller_shutdown (void *cls) case LS_CALLER_SHUTDOWN: destroy_line_mesh_tunnels (line); break; - } + } } @@ -536,7 +536,7 @@ transmit_line_audio (void *cls, { struct Line *line = cls; struct MeshAudioMessage *mam = buf; - + line->unreliable_mth = NULL; if ( (NULL == buf) || (size < sizeof (struct MeshAudioMessage) + line->audio_size) ) @@ -553,7 +553,7 @@ transmit_line_audio (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %u bytes of audio data via mesh\n", line->audio_size); - return sizeof (struct MeshAudioMessage) + line->audio_size; + return sizeof (struct MeshAudioMessage) + line->audio_size; } @@ -610,7 +610,7 @@ handle_client_audio_message (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, _("Mesh audio channel not ready; audio data dropped\n")); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } if (NULL != line->unreliable_mth) @@ -632,7 +632,7 @@ handle_client_audio_message (void *cls, line->unreliable_mth = GNUNET_MESH_notify_transmit_ready (line->tunnel_unreliable, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, - sizeof (struct MeshAudioMessage) + sizeof (struct MeshAudioMessage) + line->audio_size, &transmit_line_audio, line); @@ -641,7 +641,7 @@ handle_client_audio_message (void *cls, /** - * We are done signalling shutdown to the other peer. + * We are done signalling shutdown to the other peer. * Destroy the tunnel. * * @param cls the `struct GNUNET_MESH_tunnel` to destroy @@ -650,7 +650,7 @@ static void mq_done_destroy_tunnel (void *cls) { struct GNUNET_MESH_Tunnel *tunnel = cls; - + GNUNET_MESH_tunnel_destroy (tunnel); } @@ -675,7 +675,7 @@ handle_mesh_ring_message (void *cls, struct GNUNET_MQ_Envelope *e; struct MeshPhoneBusyMessage *busy; struct ClientPhoneRingMessage cring; - + msg = (const struct MeshPhoneRingMessage *) message; if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 + sizeof (struct GNUNET_TIME_AbsoluteNBO) + @@ -690,11 +690,11 @@ handle_mesh_ring_message (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - for (line = lines_head; NULL != line; line = line->next) + for (line = lines_head; NULL != line; line = line->next) if ( (line->local_line == ntohl (msg->remote_line)) && (LS_CALLEE_LISTEN == line->status) ) break; - if (NULL == line) + if (NULL == line) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("No available phone for incoming call on line %u, sending BUSY signal\n"), @@ -748,7 +748,7 @@ handle_mesh_hangup_message (void *cls, size_t len = ntohs (message->size) - sizeof (struct MeshPhoneHangupMessage); char buf[len + sizeof (struct ClientPhoneHangupMessage)]; struct ClientPhoneHangupMessage *hup; - + msg = (const struct MeshPhoneHangupMessage *) message; len = ntohs (msg->header.size) - sizeof (struct MeshPhoneHangupMessage); reason = (const char *) &msg[1]; @@ -831,7 +831,7 @@ handle_mesh_pickup_message (void *cls, size_t len = ntohs (message->size) - sizeof (struct MeshPhonePickupMessage); char buf[len + sizeof (struct ClientPhonePickupMessage)]; struct ClientPhonePickupMessage *pick; - + msg = (const struct MeshPhonePickupMessage *) message; len = ntohs (msg->header.size) - sizeof (struct MeshPhonePickupMessage); metadata = (const char *) &msg[1]; @@ -895,7 +895,7 @@ handle_mesh_pickup_message (void *cls, if (NULL == line->tunnel_unreliable) { GNUNET_break (0); - } + } return GNUNET_OK; } @@ -988,7 +988,7 @@ handle_mesh_audio_message (void *cls, char buf[msize + sizeof (struct ClientAudioMessage)]; struct ClientAudioMessage *cam; const union GNUNET_MESH_TunnelInfo *info; - + msg = (const struct MeshAudioMessage *) message; if (NULL == line) { @@ -1014,7 +1014,7 @@ handle_mesh_audio_message (void *cls, "Received AUDIO data for non-existing line %u, dropping.\n", ntohl (msg->remote_line)); return GNUNET_SYSERR; - } + } line->tunnel_unreliable = tunnel; *tunnel_ctx = line; } @@ -1047,11 +1047,11 @@ handle_mesh_audio_message (void *cls, static void * inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel, - const struct GNUNET_PeerIdentity *initiator, + const struct GNUNET_PeerIdentity *initiator, uint32_t port) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Received incoming tunnel on port %u\n"), + _("Received incoming tunnel on port %u\n"), (unsigned int) port); return NULL; } @@ -1131,7 +1131,7 @@ inbound_end (void *cls, * @param client identification of the client */ static void -handle_client_disconnect (void *cls, +handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) { struct Line *line; @@ -1155,7 +1155,7 @@ handle_client_disconnect (void *cls, /** * Shutdown nicely - * + * * @param cls closure, NULL * @param tc the task context */ @@ -1184,7 +1184,7 @@ do_shutdown (void *cls, * @param c configuration */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -1210,23 +1210,23 @@ run (void *cls, {&handle_mesh_ring_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING, sizeof (struct MeshPhoneRingMessage)}, - {&handle_mesh_hangup_message, + {&handle_mesh_hangup_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP, 0}, - {&handle_mesh_pickup_message, + {&handle_mesh_pickup_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP, 0}, - {&handle_mesh_busy_message, + {&handle_mesh_busy_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY, sizeof (struct MeshPhoneBusyMessage)}, {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO, 0}, {NULL, 0, 0} }; - static uint32_t ports[] = { + static uint32_t ports[] = { GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, - 0 + 0 }; cfg = c; @@ -1236,8 +1236,8 @@ run (void *cls, mesh = GNUNET_MESH_connect (cfg, NULL, &inbound_tunnel, - &inbound_end, - mesh_handlers, + &inbound_end, + mesh_handlers, ports); if (NULL == mesh) @@ -1249,7 +1249,7 @@ run (void *cls, nc = GNUNET_SERVER_notification_context_create (server, 16); GNUNET_SERVER_add_handlers (server, server_handlers); GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); } @@ -1263,12 +1263,12 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, +main (int argc, char *const *argv) { return (GNUNET_OK == GNUNET_SERVICE_run (argc, argv, - "conversation", + "conversation", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; } diff --git a/src/conversation/microphone.c b/src/conversation/microphone.c index 2c399c74d..bc6044120 100644 --- a/src/conversation/microphone.c +++ b/src/conversation/microphone.c @@ -1,17 +1,17 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -101,8 +101,8 @@ enable (void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls) { - struct Microphone *mic = cls; - static char * const record_helper_argv[] = + struct Microphone *mic = cls; + static char * const record_helper_argv[] = { "gnunet-helper-audio-record", NULL @@ -113,14 +113,14 @@ enable (void *cls, mic->record_helper = GNUNET_HELPER_start (GNUNET_NO, "gnunet-helper-audio-record", record_helper_argv, - &process_record_messages, - NULL, mic); + &process_record_messages, + NULL, mic); if (NULL == mic->record_helper) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not start record audio helper\n")); return GNUNET_SYSERR; - } + } return GNUNET_OK; } diff --git a/src/conversation/speaker.c b/src/conversation/speaker.c index d67346f1f..0f8661834 100644 --- a/src/conversation/speaker.c +++ b/src/conversation/speaker.c @@ -1,17 +1,17 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -57,17 +57,17 @@ struct Speaker static int enable (void *cls) { - struct Speaker *spe = cls; - static char *playback_helper_argv[] = + struct Speaker *spe = cls; + static char *playback_helper_argv[] = { "gnunet-helper-audio-playback", NULL }; - + spe->playback_helper = GNUNET_HELPER_start (GNUNET_NO, "gnunet-helper-audio-playback", playback_helper_argv, - NULL, + NULL, NULL, spe); if (NULL == spe->playback_helper) { @@ -143,8 +143,8 @@ play (void *cls, am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); memcpy (&am[1], data, data_size); (void) GNUNET_HELPER_send (spe->playback_helper, - &am->header, - GNUNET_NO, + &am->header, + GNUNET_NO, NULL, NULL); } diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c index af2ff75e4..d18616721 100644 --- a/src/conversation/test_conversation_api.c +++ b/src/conversation/test_conversation_api.c @@ -76,7 +76,7 @@ check () int main (int argc, char *argv[]) { - GNUNET_log_setup ("test_conversation_api", + GNUNET_log_setup ("test_conversation_api", "WARNING", NULL); return check (); -- cgit v1.2.3