summaryrefslogtreecommitdiff
path: root/toxcore/assoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/assoc.c')
-rw-r--r--toxcore/assoc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/toxcore/assoc.c b/toxcore/assoc.c
index 3653a8d4..74e4b0e0 100644
--- a/toxcore/assoc.c
+++ b/toxcore/assoc.c
@@ -123,8 +123,8 @@ static uint64_t id_distance(const Assoc *assoc, void *callback_data, const uint8
123/* qsort() callback for a sorting by id_distance() values */ 123/* qsort() callback for a sorting by id_distance() values */
124static int dist_index_comp(const void *a, const void *b) 124static int dist_index_comp(const void *a, const void *b)
125{ 125{
126 const uint64_t *_a = a; 126 const uint64_t *_a = (const uint64_t *)a;
127 const uint64_t *_b = b; 127 const uint64_t *_b = (const uint64_t *)b;
128 128
129 if (*_a < *_b) { 129 if (*_a < *_b) {
130 return -1; 130 return -1;
@@ -847,7 +847,7 @@ Assoc *new_Assoc(Logger *log, size_t bits, size_t entries, const uint8_t *public
847 return NULL; 847 return NULL;
848 } 848 }
849 849
850 Assoc *assoc = calloc(1, sizeof(*assoc)); 850 Assoc *assoc = (Assoc *)calloc(1, sizeof(*assoc));
851 851
852 if (!assoc) { 852 if (!assoc) {
853 return NULL; 853 return NULL;
@@ -900,14 +900,15 @@ Assoc *new_Assoc(Logger *log, size_t bits, size_t entries, const uint8_t *public
900 900
901 /* allocation: preferably few blobs */ 901 /* allocation: preferably few blobs */
902 size_t bckt, cix; 902 size_t bckt, cix;
903 Client_entry *clients = malloc(sizeof(*clients) * assoc->candidates_bucket_count * assoc->candidates_bucket_size); 903 Client_entry *clients = (Client_entry *)malloc(sizeof(*clients) * assoc->candidates_bucket_count *
904 assoc->candidates_bucket_size);
904 905
905 if (!clients) { 906 if (!clients) {
906 free(assoc); 907 free(assoc);
907 return NULL; 908 return NULL;
908 } 909 }
909 910
910 candidates_bucket *lists = malloc(sizeof(*lists) * assoc->candidates_bucket_count); 911 candidates_bucket *lists = (candidates_bucket *)malloc(sizeof(*lists) * assoc->candidates_bucket_count);
911 912
912 if (!lists) { 913 if (!lists) {
913 free(assoc); 914 free(assoc);