Commit e83e7afe authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fix compiler warnings.

parent 9681988e
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
void gather_redundancy_packets(const PrrtBlock *block_ptr, gf *const *fec, int *idx_p) void gather_redundancy_packets(const PrrtBlock *block_ptr, gf *const *fec, int *idx_p)
{ {
int i; uint32_t i;
uint32_t m = List_count(block_ptr->dataPackets); uint32_t m = List_count(block_ptr->dataPackets);
PrrtPacket *packet = NULL; PrrtPacket *packet = NULL;
...@@ -25,7 +25,7 @@ void gather_redundancy_packets(const PrrtBlock *block_ptr, gf *const *fec, int * ...@@ -25,7 +25,7 @@ void gather_redundancy_packets(const PrrtBlock *block_ptr, gf *const *fec, int *
void gather_data_packets(PrrtBlock *block_ptr, gf *const *fec, int *idx_p) void gather_data_packets(PrrtBlock *block_ptr, gf *const *fec, int *idx_p)
{ {
int m = 0; uint32_t m = 0;
uint32_t dataBlocks = List_count(block_ptr->dataPackets); uint32_t dataBlocks = List_count(block_ptr->dataPackets);
for(m = 0; m < dataBlocks; m++) { for(m = 0; m < dataBlocks; m++) {
PrrtPacket *packet = List_shift(block_ptr->dataPackets); PrrtPacket *packet = List_shift(block_ptr->dataPackets);
......
...@@ -104,6 +104,7 @@ PrrtPacket *PrrtPacket_copy(PrrtPacket *original) ...@@ -104,6 +104,7 @@ PrrtPacket *PrrtPacket_copy(PrrtPacket *original)
return newPacket; return newPacket;
error: error:
PERROR("Not enough memory for packet copies.%s", ""); PERROR("Not enough memory for packet copies.%s", "");
return NULL;
} }
PrrtPacket *create_header(uint8_t priority, uint16_t seqno, uint32_t size, uint8_t type, uint8_t index) PrrtPacket *create_header(uint8_t priority, uint16_t seqno, uint32_t size, uint8_t type, uint8_t index)
...@@ -121,6 +122,7 @@ PrrtPacket *create_header(uint8_t priority, uint16_t seqno, uint32_t size, uint8 ...@@ -121,6 +122,7 @@ PrrtPacket *create_header(uint8_t priority, uint16_t seqno, uint32_t size, uint8
error: error:
PERROR("Could not create packet.%s", ""); PERROR("Could not create packet.%s", "");
return NULL;
} }
int PrrtPacket_encode(void *buf_ptr, uint16_t buf_size, PrrtPacket *packet_ptr) int PrrtPacket_encode(void *buf_ptr, uint16_t buf_size, PrrtPacket *packet_ptr)
...@@ -422,6 +424,7 @@ PrrtPacket *PrrtPacket_create_data_packet(uint8_t priority, const void *payloadP ...@@ -422,6 +424,7 @@ PrrtPacket *PrrtPacket_create_data_packet(uint8_t priority, const void *payloadP
error: error:
PERROR("Could not create packet.%s",""); PERROR("Could not create packet.%s","");
return NULL;
} }
PrrtPacket *PrrtPacket_create_redundancy_packet(uint8_t priority, void *payloadPointer, uint32_t payloadLength, PrrtPacket *PrrtPacket_create_redundancy_packet(uint8_t priority, void *payloadPointer, uint32_t payloadLength,
......
...@@ -82,7 +82,7 @@ void * send_data_loop(void *ptr) { ...@@ -82,7 +82,7 @@ void * send_data_loop(void *ptr) {
PrrtBlock_insert_data_packet(block, packet); PrrtBlock_insert_data_packet(block, packet);
if (PrrtBlock_encode_ready(block)) { if (PrrtBlock_encode_ready(block)) {
int j = 0; uint32_t j = 0;
PrrtBlock_encode(block, &sock_ptr->sequenceNumberRedundancy); PrrtBlock_encode(block, &sock_ptr->sequenceNumberRedundancy);
uint32_t redundancyBlocks = List_count(block->redundancyPackets); uint32_t redundancyBlocks = List_count(block->redundancyPackets);
......
...@@ -134,7 +134,7 @@ int32_t PrrtSocket_recv(PrrtSocket *sock_ptr, void *buf_ptr) { ...@@ -134,7 +134,7 @@ int32_t PrrtSocket_recv(PrrtSocket *sock_ptr, void *buf_ptr) {
return len; return len;
} }
error: error:
PERROR("Wrong socket type.", ""); PERROR("Wrong socket type.%s", "");
return -1; return -1;
} }
...@@ -171,6 +171,7 @@ int PrrtSocket_interrupt(PrrtSocket *sock_ptr) { ...@@ -171,6 +171,7 @@ int PrrtSocket_interrupt(PrrtSocket *sock_ptr) {
sock_ptr->receiveFeedbackThread = 0; sock_ptr->receiveFeedbackThread = 0;
} }
debug("Interrupted all threads."); debug("Interrupted all threads.");
return EXIT_SUCCESS;
} }
int PrrtSocket_close(PrrtSocket *sock_ptr) { int PrrtSocket_close(PrrtSocket *sock_ptr) {
......
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
#include "common.h" #include "common.h"
// Taken from: http://c.learncodethehardway.org/book/ex32.html // Taken from: http://c.learncodethehardway.org/book/ex32.html
List *List_create() List *List_create(void)
{ {
void *p = calloc(1, sizeof(List)); void *p = calloc(1, sizeof(List));
check_mem(p); check_mem(p);
return p; return p;
error: error:
PERROR("Could not create necessary list%s.", ""); PERROR("Could not create necessary list%s.", "");
return NULL;
} }
void List_destroy(const List *list) void List_destroy(const List *list)
...@@ -60,7 +61,8 @@ void List_push(List *list, const void *value) ...@@ -60,7 +61,8 @@ void List_push(List *list, const void *value)
return; return;
error: error:
PERROR("Cannot add necessary list item: %p.", value); PERROR("Cannot add necessary list item: %p.", value);
return;
} }
void *List_pop(const List *list) void *List_pop(const List *list)
...@@ -89,7 +91,8 @@ void List_unshift(List *list, const void *value) ...@@ -89,7 +91,8 @@ void List_unshift(List *list, const void *value)
return; return;
error: error:
PERROR("Cannot add necessary list item: %p.", value); PERROR("Cannot add necessary list item: %p.", value);
return;
} }
void *List_shift(const List *list) void *List_shift(const List *list)
...@@ -112,7 +115,7 @@ void *List_remove(List *list, const ListNode *node) ...@@ -112,7 +115,7 @@ void *List_remove(List *list, const ListNode *node)
list->first = node->next; list->first = node->next;
list->first->prev = NULL; list->first->prev = NULL;
check(list->first != NULL, "Invalid list, somehow got a first that is NULL."); check(list->first != NULL, "Invalid list, somehow got a first that is NULL.");
} else if (node == list->last) { } else if(node == list->last) {
list->last = node->prev; list->last = node->prev;
list->last->next = NULL; list->last->next = NULL;
check(list->last != NULL, "Invalid list, somehow got a next that is NULL."); check(list->last != NULL, "Invalid list, somehow got a next that is NULL.");
...@@ -129,5 +132,6 @@ void *List_remove(List *list, const ListNode *node) ...@@ -129,5 +132,6 @@ void *List_remove(List *list, const ListNode *node)
return result; return result;
error: error:
PERROR("Cannot remove list item: %p.", node); PERROR("Cannot remove list item: %p.", node);
return NULL;
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ typedef struct list { ...@@ -20,7 +20,7 @@ typedef struct list {
ListNode *last; ListNode *last;
} List; } List;
List *List_create(); List *List_create(void);
void List_destroy(const List *list); void List_destroy(const List *list);
void List_clear(const List *list); void List_clear(const List *list);
void List_clear_destroy(const List *list); void List_clear_destroy(const List *list);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment