summaryrefslogtreecommitdiff
path: root/auto_tests/save_friend_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/save_friend_test.c')
-rw-r--r--auto_tests/save_friend_test.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c
index 448160c0..6d0640c3 100644
--- a/auto_tests/save_friend_test.c
+++ b/auto_tests/save_friend_test.c
@@ -4,6 +4,7 @@
4#define _XOPEN_SOURCE 600 4#define _XOPEN_SOURCE 600
5 5
6#include "helpers.h" 6#include "helpers.h"
7#include "../toxcore/ccompat.h"
7#include "../toxcore/tox.h" 8#include "../toxcore/tox.h"
8 9
9#include <assert.h> 10#include <assert.h>
@@ -28,14 +29,14 @@ struct test_data {
28 29
29static void set_random(Tox *m, bool (*setter)(Tox *, const uint8_t *, size_t, TOX_ERR_SET_INFO *), size_t length) 30static void set_random(Tox *m, bool (*setter)(Tox *, const uint8_t *, size_t, TOX_ERR_SET_INFO *), size_t length)
30{ 31{
31 uint8_t text[length]; 32 VLA(uint8_t, text, length);
32 uint32_t i; 33 uint32_t i;
33 34
34 for (i = 0; i < length; ++i) { 35 for (i = 0; i < length; ++i) {
35 text[i] = rand(); 36 text[i] = rand();
36 } 37 }
37 38
38 setter(m, text, sizeof(text), 0); 39 setter(m, text, SIZEOF_VLA(text), 0);
39} 40}
40 41
41void namechange_callback(Tox *tox, uint32_t friend_number, const uint8_t *name, size_t length, void *user_data) 42void namechange_callback(Tox *tox, uint32_t friend_number, const uint8_t *name, size_t length, void *user_data)
@@ -106,7 +107,7 @@ int main(int argc, char *argv[])
106 } 107 }
107 108
108 size_t save_size = tox_get_savedata_size(tox1); 109 size_t save_size = tox_get_savedata_size(tox1);
109 uint8_t savedata[save_size]; 110 VLA(uint8_t, savedata, save_size);
110 tox_get_savedata(tox1, savedata); 111 tox_get_savedata(tox1, savedata);
111 112
112 struct Tox_Options *options = tox_options_new(NULL); 113 struct Tox_Options *options = tox_options_new(NULL);