diff options
author | David Robillard <d@drobilla.net> | 2018-09-04 21:02:42 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-04 21:02:42 +0200 |
commit | bd57bc1edb6d8131a920bcc4f12d91457e2ca2ed (patch) | |
tree | 8cfdfb9c336aa991b21299e31c2106713add7f88 /test | |
parent | 4b298e4c7fa74836d023726185dfb2325d675c51 (diff) | |
download | lilv-bd57bc1edb6d8131a920bcc4f12d91457e2ca2ed.tar.gz lilv-bd57bc1edb6d8131a920bcc4f12d91457e2ca2ed.tar.bz2 lilv-bd57bc1edb6d8131a920bcc4f12d91457e2ca2ed.zip |
Fix GCC8 warnings
Diffstat (limited to 'test')
-rw-r--r-- | test/lilv_test.c | 19 | ||||
-rw-r--r-- | test/test.lv2/test.c | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c index 0c48588..6b81cb1 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -58,10 +58,10 @@ # define SHLIB_EXT ".so" #endif -static char bundle_dir_name[TEST_PATH_MAX]; -static char bundle_dir_uri[TEST_PATH_MAX]; -static char manifest_name[TEST_PATH_MAX]; -static char content_name[TEST_PATH_MAX]; +static char bundle_dir_name[TEST_PATH_MAX + sizeof("/.lv2/lilv-test.lv2")]; +static char bundle_dir_uri[sizeof(bundle_dir_name) + sizeof("file:///")]; +static char manifest_name[sizeof(bundle_dir_name) + sizeof("/manifest.ttl")]; +static char content_name[sizeof(bundle_dir_name) + sizeof("plugin.ttl")]; static LilvWorld* world; @@ -79,13 +79,16 @@ delete_bundle(void) static void init_tests(void) { - snprintf(bundle_dir_name, TEST_PATH_MAX, "%s/.lv2/lilv-test.lv2", + snprintf(bundle_dir_name, strlen(bundle_dir_name), "%s/.lv2/lilv-test.lv2", getenv("HOME")); lilv_mkdir_p(bundle_dir_name); - snprintf(bundle_dir_uri, TEST_PATH_MAX, "file://%s/", bundle_dir_name); - snprintf(manifest_name, TEST_PATH_MAX, "%s/manifest.ttl", bundle_dir_name); - snprintf(content_name, TEST_PATH_MAX, "%s/plugin.ttl", bundle_dir_name); + snprintf(bundle_dir_uri, sizeof(bundle_dir_uri), "file://%s/", + bundle_dir_name); + snprintf(manifest_name, sizeof(manifest_name), "%s/manifest.ttl", + bundle_dir_name); + snprintf(content_name, sizeof(content_name), "%s/plugin.ttl", + bundle_dir_name); delete_bundle(); } diff --git a/test/test.lv2/test.c b/test/test.lv2/test.c index 30677f1..d16e4a9 100644 --- a/test/test.lv2/test.c +++ b/test/test.lv2/test.c @@ -101,7 +101,7 @@ instantiate(const LV2_Descriptor* descriptor, return NULL; } - strncpy(test->tmp_file_path, TMP_TEMPLATE, sizeof(TMP_TEMPLATE)); + strncpy(test->tmp_file_path, TMP_TEMPLATE, strlen(TMP_TEMPLATE) + 1); mkstemp(test->tmp_file_path); LV2_State_Make_Path* make_path = NULL; |