summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-19 16:38:10 +0000
committerDavid Robillard <d@drobilla.net>2011-02-19 16:38:10 +0000
commit51ef7905c4d8dd143c498bb0c088035d930742bc (patch)
tree381bcc7cc429300173598a168534ca634c7ba36f /src
parentc56d5d6fd1ff0a5c0c4d3fc8bc1f20eab8bb1e3c (diff)
downloadlilv-51ef7905c4d8dd143c498bb0c088035d930742bc.tar.gz
lilv-51ef7905c4d8dd143c498bb0c088035d930742bc.tar.bz2
lilv-51ef7905c4d8dd143c498bb0c088035d930742bc.zip
Fix return of undefined values when port range value (min, max, or default) is unspecified.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugin.c b/src/plugin.c
index cf6d6d4..2987371 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -498,19 +498,18 @@ slv2_plugin_get_port_ranges_float(SLV2Plugin p,
float* def_values)
{
slv2_plugin_load_ports_if_necessary(p);
- for (unsigned i = 0; i < p->num_ports; ++i) {
- SLV2Port port = p->ports[i];
+ for (uint32_t i = 0; i < p->num_ports; ++i) {
SLV2Value def, min, max;
- slv2_port_get_range(p, port, &def, &min, &max);
-
- if (min && min_values)
- min_values[i] = slv2_value_as_float(min);
+ slv2_port_get_range(p, p->ports[i], &def, &min, &max);
+
+ if (min_values)
+ min_values[i] = min ? slv2_value_as_float(min) : NAN;
- if (max && max_values)
- max_values[i] = slv2_value_as_float(max);
+ if (max_values)
+ max_values[i] = max ? slv2_value_as_float(max) : NAN;
- if (def && def_values)
- def_values[i] = slv2_value_as_float(def);
+ if (def_values)
+ def_values[i] = def ? slv2_value_as_float(def) : NAN;
slv2_value_free(def);
slv2_value_free(min);