diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-12 11:35:01 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-12 14:09:59 +0000 |
commit | d92c96e7832ae4c7f9c32eec0d2f7f661a65b73e (patch) | |
tree | f7577121b3463ad094493fbb0cf3601fbcb0f9dc /testing | |
parent | f0f456398da65fc36837c0ab66b983a69b6f9e3e (diff) |
Fix a few warnings from clang.
Also remove the use of a VLA in a context where there can be unbounded
memory allocations.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/DHT_test.c | 2 | ||||
-rw-r--r-- | testing/Messenger_test.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c index 78853746..c9372847 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c | |||
@@ -215,7 +215,7 @@ int main(int argc, char *argv[]) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | uint8_t *bin_id = hex_string_to_bin(temp_id); | 217 | uint8_t *bin_id = hex_string_to_bin(temp_id); |
218 | dht_addfriend(dht, bin_id, 0, 0, 0, 0); | 218 | dht_addfriend(dht, bin_id, nullptr, nullptr, 0, nullptr); |
219 | free(bin_id); | 219 | free(bin_id); |
220 | 220 | ||
221 | perror("Initialization"); | 221 | perror("Initialization"); |
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index a3380a09..4c140da9 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -53,7 +53,7 @@ static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type | |||
53 | void *userdata) | 53 | void *userdata) |
54 | { | 54 | { |
55 | printf("Message with length %u received from %u: %s \n", (unsigned)length, friendnumber, string); | 55 | printf("Message with length %u received from %u: %s \n", (unsigned)length, friendnumber, string); |
56 | m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, 0); | 56 | m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, nullptr); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* TODO(irungentoo): needed as print_request has to match the interface expected by | 59 | /* TODO(irungentoo): needed as print_request has to match the interface expected by |
@@ -108,7 +108,7 @@ int main(int argc, char *argv[]) | |||
108 | 108 | ||
109 | Messenger_Options options = {0}; | 109 | Messenger_Options options = {0}; |
110 | options.ipv6enabled = ipv6enabled; | 110 | options.ipv6enabled = ipv6enabled; |
111 | m = new_messenger(&options, 0); | 111 | m = new_messenger(&options, nullptr); |
112 | 112 | ||
113 | if (!m) { | 113 | if (!m) { |
114 | fputs("Failed to allocate messenger datastructure\n", stderr); | 114 | fputs("Failed to allocate messenger datastructure\n", stderr); |
@@ -181,7 +181,7 @@ int main(int argc, char *argv[]) | |||
181 | getname(m, num, name); | 181 | getname(m, num, name); |
182 | printf("%s\n", name); | 182 | printf("%s\n", name); |
183 | 183 | ||
184 | m_send_message_generic(m, num, MESSAGE_NORMAL, (const uint8_t *)"Test", 5, 0); | 184 | m_send_message_generic(m, num, MESSAGE_NORMAL, (const uint8_t *)"Test", 5, nullptr); |
185 | do_messenger(m, nullptr); | 185 | do_messenger(m, nullptr); |
186 | c_sleep(30); | 186 | c_sleep(30); |
187 | FILE *file = fopen("Save.bak", "wb"); | 187 | FILE *file = fopen("Save.bak", "wb"); |