summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-04 05:48:37 +0000
committerDavid Robillard <d@drobilla.net>2011-02-04 05:48:37 +0000
commit77a78c6535a62bdadbf780a069aa47a4bfd01805 (patch)
tree1ef344a592e67a503b83ab92b82d34106283380d /src/plugin.c
parentea4087e0029c4f6c6f80716b50ddf60120598b1b (diff)
downloadlilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.tar.gz
lilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.tar.bz2
lilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.zip
Fix "ISO C forbids initialization between function pointer and ‘void *’" warnings.
Fix crash when plugins have no required or optional features. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2908 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 1533ac6..4b29a00 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -257,7 +257,7 @@ slv2_plugin_load(SLV2Plugin p)
}
typedef int (*OpenFunc)(LV2_Dyn_Manifest_Handle*, const LV2_Feature *const *);
- OpenFunc open_func = (OpenFunc)dlsym(lib, "lv2_dyn_manifest_open");
+ OpenFunc open_func = (OpenFunc)slv2_dlfunc(lib, "lv2_dyn_manifest_open");
LV2_Dyn_Manifest_Handle handle = NULL;
if (open_func)
open_func(&handle, &dman_features);
@@ -265,7 +265,7 @@ slv2_plugin_load(SLV2Plugin p)
typedef int (*GetDataFunc)(LV2_Dyn_Manifest_Handle handle,
FILE* fp,
const char* uri);
- GetDataFunc get_data_func = (GetDataFunc)dlsym(lib, "lv2_dyn_manifest_get_data");
+ GetDataFunc get_data_func = (GetDataFunc)slv2_dlfunc(lib, "lv2_dyn_manifest_get_data");
if (get_data_func) {
FILE* fd = tmpfile();
get_data_func(handle, fd, slv2_value_as_string(p->plugin_uri));
@@ -275,7 +275,7 @@ slv2_plugin_load(SLV2Plugin p)
}
typedef int (*CloseFunc)(LV2_Dyn_Manifest_Handle);
- CloseFunc close_func = (CloseFunc)dlsym(lib, "lv2_dyn_manifest_close");
+ CloseFunc close_func = (CloseFunc)slv2_dlfunc(lib, "lv2_dyn_manifest_close");
if (close_func)
close_func(handle);
}
@@ -656,8 +656,12 @@ slv2_plugin_get_supported_features(SLV2Plugin p)
for (unsigned i = 0 ; i < n_required; ++i)
g_ptr_array_add(result, slv2_values_get_at(required, i));
- free(((GPtrArray*)optional)->pdata);
- free(((GPtrArray*)required)->pdata);
+ if (optional) {
+ free(((GPtrArray*)optional)->pdata);
+ }
+ if (required) {
+ free(((GPtrArray*)required)->pdata);
+ }
return result;
}