summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-22 19:19:05 +0000
committerDavid Robillard <d@drobilla.net>2006-07-22 19:19:05 +0000
commitdeca2cc89850dffc051d0a0aafc9d681af838934 (patch)
treecfca762a3b03289385bb40c17673b4483142c420 /src
parentc7153b1a3d607108bab6cd8d6719977ffb213092 (diff)
downloadlilv-deca2cc89850dffc051d0a0aafc9d681af838934.tar.gz
lilv-deca2cc89850dffc051d0a0aafc9d681af838934.tar.bz2
lilv-deca2cc89850dffc051d0a0aafc9d681af838934.zip
Removed data type enumeration in favour of using the URI directly
git-svn-id: http://svn.drobilla.net/lad/libslv2@100 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c8
-rw-r--r--src/pluginlist.c2
-rw-r--r--src/port.c30
-rw-r--r--src/query.c12
4 files changed, 34 insertions, 18 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 29083e8..b44eb56 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -90,23 +90,23 @@ bool
slv2_plugin_verify(const SLV2Plugin* plugin)
{
// FIXME: finish this (properly)
- /*
+
size_t num_values = 0;
- struct SLV2Property* prop = slv2_plugin_get_property(plugin, "doap:name");
+ struct _Property* prop = slv2_plugin_get_property(plugin, "doap:name");
if (prop) {
num_values = prop->num_values;
free(prop);
}
if (num_values < 1)
return false;
-
+/*
prop = slv2_plugin_get_property(plugin, "doap:license");
num_values = prop->num_values;
free(prop);
if (num_values < 1)
return false;
-*/
+*/
return true;
}
diff --git a/src/pluginlist.c b/src/pluginlist.c
index 20e9dea..6a1a8c1 100644
--- a/src/pluginlist.c
+++ b/src/pluginlist.c
@@ -141,7 +141,7 @@ slv2_list_load_bundle(SLV2List list,
// FIXME: leaks? rasqal really doesn't handle missing files well..
if (results) {
rasqal_free_query_results(results);
- rasqal_free_query(rq);
+ //rasqal_free_query(rq); // FIXME: crashes? leak?
raptor_free_uri(base_uri); // FIXME: leak?
}
rasqal_finish();
diff --git a/src/port.c b/src/port.c
index f37f82a..f80d33b 100644
--- a/src/port.c
+++ b/src/port.c
@@ -34,6 +34,8 @@ slv2_port_get_class(SLV2Plugin* p,
assert(class->num_values == 1);
assert(class->values);
+ // FIXME FIXME FIXME: leak
+
if (!strcmp((char*)class->values[0], "http://lv2plug.in/ontology#ControlRateInputPort"))
return SLV2_CONTROL_RATE_INPUT;
else if (!strcmp((char*)class->values[0], "http://lv2plug.in/ontology#ControlRateOutputPort"))
@@ -49,8 +51,8 @@ slv2_port_get_class(SLV2Plugin* p,
}
-enum SLV2DataType
-slv2_port_get_data_type(SLV2Plugin* p,
+uchar*
+slv2_port_get_data_type(SLV2Plugin* p,
unsigned long index)
{
SLV2Property type = slv2_port_get_property(p, index, U("lv2:datatype"));
@@ -58,15 +60,14 @@ slv2_port_get_data_type(SLV2Plugin* p,
assert(type->num_values == 1);
assert(type->values);
- if (!strcmp((char*)type->values[0], "http://lv2plug.in/ontology#float"))
- return SLV2_DATA_TYPE_FLOAT;
- else
- return SLV2_UNKNOWN_DATA_TYPE;
+ uchar* ret = type->values[0];
+ slv2_property_free(type);
+ return ret;
}
SLV2Property
-slv2_port_get_property(SLV2Plugin* p,
+slv2_port_get_property(SLV2Plugin* p,
unsigned long index,
const uchar* property)
{
@@ -94,7 +95,8 @@ slv2_port_get_property(SLV2Plugin* p,
uchar*
-slv2_port_get_symbol(SLV2Plugin* p, unsigned long index)
+slv2_port_get_symbol(SLV2Plugin* p,
+ unsigned long index)
{
// FIXME: leaks
uchar* result = NULL;
@@ -104,7 +106,7 @@ slv2_port_get_symbol(SLV2Plugin* p, unsigned long index)
if (prop && prop->num_values == 1)
result = (uchar*)strdup((char*)prop->values[0]);
- free(prop);
+ slv2_property_free(prop);
return result;
}
@@ -124,12 +126,14 @@ slv2_port_get_default_value(SLV2Plugin* p,
if (prop && prop->num_values == 1)
result = atof((char*)prop->values[0]);
+ slv2_property_free(prop);
+
return result;
}
float
-slv2_port_get_minimum_value(SLV2Plugin* p,
+slv2_port_get_minimum_value(SLV2Plugin* p,
unsigned long index)
{
// FIXME: do casting properly in the SPARQL query
@@ -142,12 +146,14 @@ slv2_port_get_minimum_value(SLV2Plugin* p,
if (prop && prop->num_values == 1)
result = atof((char*)prop->values[0]);
+ slv2_property_free(prop);
+
return result;
}
float
-slv2_port_get_maximum_value(SLV2Plugin* p,
+slv2_port_get_maximum_value(SLV2Plugin* p,
unsigned long index)
{
// FIXME: do casting properly in the SPARQL query
@@ -160,6 +166,8 @@ slv2_port_get_maximum_value(SLV2Plugin* p,
if (prop && prop->num_values == 1)
result = atof((char*)prop->values[0]);
+ slv2_property_free(prop);
+
return result;
}
diff --git a/src/query.c b/src/query.c
index ddaf648..da9239d 100644
--- a/src/query.c
+++ b/src/query.c
@@ -50,8 +50,8 @@ slv2_query_lang_filter(const uchar* variable)
// FILTER( LANG(?value) = "en" || LANG(?value) = "" )
result = ustrjoin(
//U("FILTER (lang(?value) = \""), lang, U("\")\n"), 0);
- U("FILTER( lang(?value) = \""), lang,
- U("\" || lang(?value) = \"\" )\n"), NULL);
+ U("FILTER( lang(?"), variable, U(") = \""), lang,
+ U("\" || lang(?"), variable, U(") = \"\" )\n"), NULL);
}
return result;
@@ -122,3 +122,11 @@ slv2_query_get_results(rasqal_query_results* results)
return result;
}
+void
+slv2_property_free(struct _Property* prop)
+{
+ //struct _Property* prop = (struct _Property*)property;
+ free(prop->values);
+ free(prop);
+}
+