diff options
author | David Robillard <d@drobilla.net> | 2008-10-04 20:24:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-10-04 20:24:44 +0000 |
commit | 812e8b14571cf6fbe4a14f295448d6fe90eae1ba (patch) | |
tree | 25a585b0952de02ca4af7fd70a8ff7ec4e5f382c | |
parent | b009334a06961360ebf5e7de0a07b303bff915d3 (diff) | |
download | lilv-812e8b14571cf6fbe4a14f295448d6fe90eae1ba.tar.gz lilv-812e8b14571cf6fbe4a14f295448d6fe90eae1ba.tar.bz2 lilv-812e8b14571cf6fbe4a14f295448d6fe90eae1ba.zip |
Fix slv2_plugin_get_supported_features.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1613 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/plugin.c | 16 |
2 files changed, 15 insertions, 2 deletions
@@ -3,6 +3,7 @@ slv2 (9999) unstable; urgency=low * NOT YET RELEASED * Add slv2_port_get_value (analogous to slv2_plugin_get_value). * Add slv2_instance_get_extension_data. + * Fix slv2_plugin_get_supported_features (previously non-functional). -- Dave Robillard <dave@drobilla.net> Sun, 01 Jan 9999 00:00:00 -0400 diff --git a/src/plugin.c b/src/plugin.c index cb98d69..25ddd5c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -663,14 +663,26 @@ slv2_plugin_has_feature(SLV2Plugin p, SLV2Values slv2_plugin_get_supported_features(SLV2Plugin p) { - const char* const query = + /* Work around broken UNION in Redland :( */ + /*const char* const query = "SELECT DISTINCT ?feature WHERE {\n" " { <> lv2:optionalFeature ?feature }\n" " UNION\n" " { <> lv2:requiredFeature ?feature }\n" "}\n"; + + SLV2Values result = slv2_plugin_query_variable(p, query, 0);*/ - SLV2Values result = slv2_plugin_query_variable(p, query, 0); + SLV2Values optional = slv2_plugin_get_optional_features(p); + SLV2Values required = slv2_plugin_get_required_features(p); + + SLV2Values result = slv2_values_new(); + unsigned n_optional = slv2_values_size(optional); + unsigned i = 0; + for ( ; i < n_optional; ++i) + slv2_values_set_at(result, i, slv2_values_get_at(optional, i)); + for ( ; i < n_optional + slv2_values_size(required); ++i) + slv2_values_set_at(result, i, slv2_values_get_at(required, i - n_optional)); return result; } |