summaryrefslogtreecommitdiff
path: root/testing/tox_sync.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2017-01-20 21:16:55 +0000
committeriphydf <iphydf@users.noreply.github.com>2017-01-28 20:49:12 +0000
commit6ae33c16cf9e37fda85d70c78b3c2779eb8ca21a (patch)
tree99c3a8c26e02039b515bb6f57d2797d1cdf77c1d /testing/tox_sync.c
parent895de7ef26e7617769f2271345e414545c2581f8 (diff)
Add VLA compatibility macro for C89-ish compilers.
Diffstat (limited to 'testing/tox_sync.c')
-rw-r--r--testing/tox_sync.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/testing/tox_sync.c b/testing/tox_sync.c
index c719b3ec..d2fc41ca 100644
--- a/testing/tox_sync.c
+++ b/testing/tox_sync.c
@@ -34,6 +34,7 @@
34#include "config.h" 34#include "config.h"
35#endif 35#endif
36 36
37#include "../toxcore/ccompat.h"
37#include "../toxcore/tox.h" 38#include "../toxcore/tox.h"
38#include "misc_tools.c" 39#include "misc_tools.c"
39 40
@@ -73,7 +74,7 @@ static void tox_file_chunk_request(Tox *tox, uint32_t friend_number, uint32_t fi
73 } 74 }
74 75
75 fseek(file_senders[i].file, position, SEEK_SET); 76 fseek(file_senders[i].file, position, SEEK_SET);
76 uint8_t data[length]; 77 VLA(uint8_t, data, length);
77 int len = fread(data, 1, length, file_senders[i].file); 78 int len = fread(data, 1, length, file_senders[i].file);
78 tox_file_send_chunk(tox, friend_number, file_number, position, data, len, 0); 79 tox_file_send_chunk(tox, friend_number, file_number, position, data, len, 0);
79 break; 80 break;
@@ -314,7 +315,7 @@ int main(int argc, char *argv[])
314 315
315 if (d) { 316 if (d) {
316 while ((dir = readdir(d)) != NULL) { 317 while ((dir = readdir(d)) != NULL) {
317 char filepath[strlen(path) + strlen(dir->d_name) + 1]; 318 VLA(char, filepath, strlen(path) + strlen(dir->d_name) + 1);
318 memcpy(filepath, path, strlen(path)); 319 memcpy(filepath, path, strlen(path));
319 memcpy(filepath + strlen(path), dir->d_name, strlen(dir->d_name) + 1); 320 memcpy(filepath + strlen(path), dir->d_name, strlen(dir->d_name) + 1);
320 stat(filepath, &statbuf); 321 stat(filepath, &statbuf);