summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
Diffstat (limited to 'toxav')
-rw-r--r--toxav/msi.c18
-rw-r--r--toxav/rtp.c20
2 files changed, 19 insertions, 19 deletions
diff --git a/toxav/msi.c b/toxav/msi.c
index 136daf93..072cb6fa 100644
--- a/toxav/msi.c
+++ b/toxav/msi.c
@@ -783,18 +783,18 @@ int send_error ( MSISession *session, MSICall *call, MSICallError errid, uint32_
783 */ 783 */
784void add_peer( MSICall *call, int peer_id ) 784void add_peer( MSICall *call, int peer_id )
785{ 785{
786 uint32_t* peers = !call->peers ? peers = calloc(sizeof(uint32_t), 1) : 786 uint32_t *peers = !call->peers ? peers = calloc(sizeof(uint32_t), 1) :
787 realloc( call->peers, sizeof(uint32_t) * call->peer_count); 787 realloc( call->peers, sizeof(uint32_t) * call->peer_count);
788 788
789 if (!peers) { 789 if (!peers) {
790 LOGGER_WARNING("Allocation failed! Program might misbehave!"); 790 LOGGER_WARNING("Allocation failed! Program might misbehave!");
791 return; 791 return;
792 } 792 }
793 793
794 call->peer_count ++; 794 call->peer_count ++;
795 call->peers = peers; 795 call->peers = peers;
796 call->peers[call->peer_count - 1] = peer_id; 796 call->peers[call->peer_count - 1] = peer_id;
797 797
798 LOGGER_DEBUG("Added peer: %d", peer_id); 798 LOGGER_DEBUG("Added peer: %d", peer_id);
799} 799}
800 800
@@ -819,12 +819,12 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout )
819 819
820 for (; _call_idx < session->max_calls; _call_idx ++) { 820 for (; _call_idx < session->max_calls; _call_idx ++) {
821 if ( !session->calls[_call_idx] ) { 821 if ( !session->calls[_call_idx] ) {
822 822
823 if (!(session->calls[_call_idx] = calloc ( sizeof ( MSICall ), 1 ))) { 823 if (!(session->calls[_call_idx] = calloc ( sizeof ( MSICall ), 1 ))) {
824 LOGGER_WARNING("Allocation failed! Program might misbehave!"); 824 LOGGER_WARNING("Allocation failed! Program might misbehave!");
825 return NULL; 825 return NULL;
826 } 826 }
827 827
828 break; 828 break;
829 } 829 }
830 } 830 }
@@ -1384,13 +1384,13 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls )
1384 1384
1385 _retu->messenger_handle = messenger; 1385 _retu->messenger_handle = messenger;
1386 _retu->agent_handler = NULL; 1386 _retu->agent_handler = NULL;
1387 1387
1388 if (!(_retu->calls = calloc( sizeof (MSICall *), max_calls ))) { 1388 if (!(_retu->calls = calloc( sizeof (MSICall *), max_calls ))) {
1389 LOGGER_ERROR("Allocation failed! Program might misbehave!"); 1389 LOGGER_ERROR("Allocation failed! Program might misbehave!");
1390 free(_retu); 1390 free(_retu);
1391 return NULL; 1391 return NULL;
1392 } 1392 }
1393 1393
1394 _retu->max_calls = max_calls; 1394 _retu->max_calls = max_calls;
1395 1395
1396 _retu->frequ = 10000; /* default value? */ 1396 _retu->frequ = 10000; /* default value? */
diff --git a/toxav/rtp.c b/toxav/rtp.c
index ca37bf47..e3c1c148 100644
--- a/toxav/rtp.c
+++ b/toxav/rtp.c
@@ -105,16 +105,16 @@ RTPHeader *extract_header ( const uint8_t *payload, int length )
105 } 105 }
106 106
107 RTPHeader *_retu = calloc(1, sizeof (RTPHeader)); 107 RTPHeader *_retu = calloc(1, sizeof (RTPHeader));
108 108
109 if ( !_retu ) { 109 if ( !_retu ) {
110 LOGGER_WARNING("Alloc failed! Program might misbehave!"); 110 LOGGER_WARNING("Alloc failed! Program might misbehave!");
111 return NULL; 111 return NULL;
112 } 112 }
113 113
114 bytes_to_U16(&_retu->sequnum, payload); 114 bytes_to_U16(&_retu->sequnum, payload);
115 115
116 const uint8_t *_it = payload + 2; 116 const uint8_t *_it = payload + 2;
117 117
118 _retu->flags = *_it; 118 _retu->flags = *_it;
119 ++_it; 119 ++_it;
120 120
@@ -178,7 +178,7 @@ RTPExtHeader *extract_ext_header ( const uint8_t *payload, uint16_t length )
178 const uint8_t *_it = payload; 178 const uint8_t *_it = payload;
179 179
180 RTPExtHeader *_retu = calloc(1, sizeof (RTPExtHeader)); 180 RTPExtHeader *_retu = calloc(1, sizeof (RTPExtHeader));
181 181
182 if ( !_retu ) { 182 if ( !_retu ) {
183 LOGGER_WARNING("Alloc failed! Program might misbehave!"); 183 LOGGER_WARNING("Alloc failed! Program might misbehave!");
184 return NULL; 184 return NULL;
@@ -290,7 +290,7 @@ uint8_t *add_ext_header ( RTPExtHeader *header, uint8_t *payload )
290RTPHeader *build_header ( RTPSession *session ) 290RTPHeader *build_header ( RTPSession *session )
291{ 291{
292 RTPHeader *_retu = calloc ( 1, sizeof (RTPHeader) ); 292 RTPHeader *_retu = calloc ( 1, sizeof (RTPHeader) );
293 293
294 if ( !_retu ) { 294 if ( !_retu ) {
295 LOGGER_WARNING("Alloc failed! Program might misbehave!"); 295 LOGGER_WARNING("Alloc failed! Program might misbehave!");
296 return NULL; 296 return NULL;
@@ -451,7 +451,7 @@ RTPMessage *rtp_new_message ( RTPSession *session, const uint8_t *data, uint32_t
451 451
452 uint8_t *_from_pos; 452 uint8_t *_from_pos;
453 RTPMessage *_retu = calloc(1, sizeof (RTPMessage)); 453 RTPMessage *_retu = calloc(1, sizeof (RTPMessage));
454 454
455 if ( !_retu ) { 455 if ( !_retu ) {
456 LOGGER_WARNING("Alloc failed! Program might misbehave!"); 456 LOGGER_WARNING("Alloc failed! Program might misbehave!");
457 return NULL; 457 return NULL;
@@ -465,7 +465,7 @@ RTPMessage *rtp_new_message ( RTPSession *session, const uint8_t *data, uint32_t
465 uint32_t _total_length = length + _retu->header->length + 1; 465 uint32_t _total_length = length + _retu->header->length + 1;
466 466
467 _retu->data[0] = session->prefix; 467 _retu->data[0] = session->prefix;
468 468
469 if ( _retu->ext_header ) { 469 if ( _retu->ext_header ) {
470 _total_length += ( 4 /* Minimum ext header len */ + _retu->ext_header->length * size_32 ); 470 _total_length += ( 4 /* Minimum ext header len */ + _retu->ext_header->length * size_32 );
471 471
@@ -617,10 +617,10 @@ int rtp_send_msg ( RTPSession *session, Messenger *messenger, const uint8_t *dat
617 } 617 }
618 618
619 619
620 /* Set sequ number */ 620 /* Set sequ number */
621 session->sequnum = session->sequnum >= MAX_SEQU_NUM ? 0 : session->sequnum + 1; 621 session->sequnum = session->sequnum >= MAX_SEQU_NUM ? 0 : session->sequnum + 1;
622 rtp_free_msg ( session, msg ); 622 rtp_free_msg ( session, msg );
623 623
624 return 0; 624 return 0;
625} 625}
626 626
@@ -665,7 +665,7 @@ void rtp_free_msg ( RTPSession *session, RTPMessage *msg )
665RTPSession *rtp_init_session ( int payload_type, Messenger *messenger, int friend_num ) 665RTPSession *rtp_init_session ( int payload_type, Messenger *messenger, int friend_num )
666{ 666{
667 RTPSession *_retu = calloc(1, sizeof(RTPSession)); 667 RTPSession *_retu = calloc(1, sizeof(RTPSession));
668 668
669 if ( !_retu ) { 669 if ( !_retu ) {
670 LOGGER_WARNING("Alloc failed! Program might misbehave!"); 670 LOGGER_WARNING("Alloc failed! Program might misbehave!");
671 return NULL; 671 return NULL;