Astyled code.

This commit is contained in:
irungentoo 2014-06-15 10:36:57 -04:00
parent a38d962b04
commit 750c75a47d
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
16 changed files with 92 additions and 72 deletions

View File

@ -516,6 +516,7 @@ uint8_t *append_header_to_string (
_convert = htons(_i);
memcpy(_getback_byte, &_convert, sizeof(_convert));
/* for value part do it regulary */
@ -525,6 +526,7 @@ uint8_t *append_header_to_string (
_convert = htons(value_len);
memcpy(dest, &_convert, sizeof(_convert));
dest += 2;

View File

@ -418,6 +418,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallType type, uint8_t *dest )
{
if ( !dest ) return ErrorInternal;
if (cii(call_index, av->msi_session)) return ErrorNoCall;
CallSpecific *call = &av->calls[call_index];
@ -470,6 +471,7 @@ inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **output)
{
if ( !output ) return ErrorInternal;
if (cii(call_index, av->msi_session)) return ErrorNoCall;
uint8_t packet [RTP_PAYLOAD_SIZE];
@ -507,6 +509,7 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
{
if (cii(call_index, av->msi_session)) return ErrorNoCall;
return toxav_send_rtp_payload(av, call_index, TypeVideo, frame, frame_size);
}
@ -567,6 +570,7 @@ inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *d
inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, int16_t *dest )
{
if ( !dest ) return ErrorInternal;
if (cii(call_index, av->msi_session)) return ErrorNoCall;
CallSpecific *call = &av->calls[call_index];
@ -609,6 +613,7 @@ inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, i
inline__ int toxav_send_audio ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
{
if (cii(call_index, av->msi_session)) return ErrorNoCall;
return toxav_send_rtp_payload(av, call_index, TypeAudio, frame, frame_size);
}
@ -628,6 +633,7 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
const int16_t *frame, int frame_size)
{
if (cii(call_index, av->msi_session)) return ErrorNoCall;
int32_t rc = opus_encode(av->calls[call_index].cs->audio_encoder, frame, frame_size, dest, dest_max);
if (rc < 0) {
@ -649,7 +655,8 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
*/
int toxav_get_peer_transmission_type ( ToxAv *av, int32_t call_index, int peer )
{
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer )
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
|| av->msi_session->calls[call_index]->peer_count <= peer )
return ErrorInternal;
return av->msi_session->calls[call_index]->type_peer[peer];
@ -667,7 +674,8 @@ int toxav_get_peer_id ( ToxAv *av, int32_t call_index, int peer )
{
assert(av->msi_session);
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer )
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
|| av->msi_session->calls[call_index]->peer_count <= peer )
return ErrorInternal;
return av->msi_session->calls[call_index]->peers[peer];

View File

@ -959,7 +959,8 @@ static int get_chat_num(Messenger *m, Group_Chat *chat)
return -1;
}
static void group_message_function(Group_Chat *chat, int peer_number, const uint8_t *message, uint16_t length, void *userdata)
static void group_message_function(Group_Chat *chat, int peer_number, const uint8_t *message, uint16_t length,
void *userdata)
{
Messenger *m = userdata;
int i = get_chat_num(m, chat);
@ -975,7 +976,8 @@ static void group_message_function(Group_Chat *chat, int peer_number, const uint
(*m->group_message)(m, i, peer_number, message_terminated, length, m->group_message_userdata);
}
static void group_action_function(Group_Chat *chat, int peer_number, const uint8_t *action, uint16_t length, void *userdata)
static void group_action_function(Group_Chat *chat, int peer_number, const uint8_t *action, uint16_t length,
void *userdata)
{
Messenger *m = userdata;
int i = get_chat_num(m, chat);

View File

@ -315,8 +315,8 @@ static int entry_heard_store(Client_entry *entry, const IPPTs *ippts)
}
/* maps Assoc callback signature to id_closest() */
static int assoc_id_closest(const Assoc *assoc, void *callback_data, const uint8_t *client_id, const uint8_t *client_id1,
const uint8_t *client_id2)
static int assoc_id_closest(const Assoc *assoc, void *callback_data, const uint8_t *client_id,
const uint8_t *client_id1, const uint8_t *client_id2)
{
return id_closest(client_id, client_id1, client_id2);
}

View File

@ -35,7 +35,8 @@ typedef uint64_t (*Assoc_distance_absolute_callback)(const Assoc *assoc, void *c
/* Central entry point for new associations: add a new candidate to the cache
* returns 1 if entry is stored, 2 if existing entry was updated, 0 else */
uint8_t Assoc_add_entry(Assoc *assoc, const uint8_t *id, const IPPTs *ippts_send, const IP_Port *ipp_recv, uint8_t used);
uint8_t Assoc_add_entry(Assoc *assoc, const uint8_t *id, const IPPTs *ippts_send, const IP_Port *ipp_recv,
uint8_t used);
/*****************************************************************************/

View File

@ -35,7 +35,8 @@
* return 0 if it sent the friend request directly to the friend.
* return the number of peers it was routed through if it did not send it directly.
*/
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length)
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data,
uint32_t length)
{
if (1 + sizeof(nospam_num) + length > ONION_CLIENT_MAX_DATA_SIZE || length == 0)
return -1;

View File

@ -51,7 +51,8 @@ typedef struct {
* data is the data in the request and length is the length.
* Maximum length of data is MAX_FRIEND_REQUEST_DATA_SIZE.
*/
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length);
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data,
uint32_t length);
/* Set and get the nospam variable used to prevent one type of friend request spam. */
void set_nospam(Friend_Requests *fr, uint32_t num);
uint32_t get_nospam(const Friend_Requests *fr);

View File

@ -175,8 +175,8 @@ static int add_closepeer(Group_Chat *chat, const uint8_t *client_id, IP_Port ip_
return -1;
}
static int send_groupchatpacket(const Group_Chat *chat, IP_Port ip_port, const uint8_t *public_key, const uint8_t *data, uint32_t length,
uint8_t request_id)
static int send_groupchatpacket(const Group_Chat *chat, IP_Port ip_port, const uint8_t *public_key, const uint8_t *data,
uint32_t length, uint8_t request_id)
{
if (id_equal(chat->self_public_key, public_key))
return -1;
@ -718,7 +718,8 @@ uint32_t group_numpeers(const Group_Chat *chat)
return chat->numpeers;
}
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length)
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[],
uint16_t length)
{
uint32_t i;

View File

@ -172,7 +172,8 @@ uint32_t group_numpeers(const Group_Chat *chat);
*
* returns the number of peers.
*/
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length);
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[],
uint16_t length);
/* Kill a group chat
*

View File

@ -815,7 +815,8 @@ static uint16_t get_nonce_uint16(uint8_t *nonce)
* return -1 on failure.
* return length of data on success.
*/
static int handle_data_packet(Net_Crypto *c, int crypt_connection_id, uint8_t *data, const uint8_t *packet, uint16_t length)
static int handle_data_packet(Net_Crypto *c, int crypt_connection_id, uint8_t *data, const uint8_t *packet,
uint16_t length)
{
if (length <= (1 + sizeof(uint16_t) + crypto_box_MACBYTES) || length > MAX_CRYPTO_PACKET_SIZE)
return -1;

View File

@ -112,7 +112,8 @@ int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, con
*
* Format: function(void *object, IP_Port dest, uint8_t *data, uint32_t length)
*/
void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t), void *object);
void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t),
void *object);
Onion *new_onion(DHT *dht);

View File

@ -179,8 +179,8 @@ static int cmp_entry(const void *a, const void *b)
* return -1 if failure
* return position if added
*/
static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, const uint8_t *public_key, const uint8_t *data_public_key,
const uint8_t *ret)
static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, const uint8_t *public_key,
const uint8_t *data_public_key, const uint8_t *ret)
{
int pos = in_entries(onion_a, public_key);

View File

@ -164,7 +164,8 @@ static int new_sendback(Onion_Client *onion_c, uint32_t num, uint8_t *public_key
* return ~0 on failure
* return num (see new_sendback(...)) on success
*/
static uint32_t check_sendback(Onion_Client *onion_c, const uint8_t *sendback, uint8_t *ret_pubkey, IP_Port *ret_ip_port)
static uint32_t check_sendback(Onion_Client *onion_c, const uint8_t *sendback, uint8_t *ret_pubkey,
IP_Port *ret_ip_port)
{
uint64_t sback;
memcpy(&sback, sendback, sizeof(uint64_t));