summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/collections.c9
-rw-r--r--src/instance.c3
-rw-r--r--src/node.c25
-rw-r--r--src/plugin.c20
-rw-r--r--src/pluginclass.c3
-rw-r--r--src/port.c15
-rw-r--r--src/util.c3
-rw-r--r--src/world.c12
8 files changed, 57 insertions, 33 deletions
diff --git a/src/collections.c b/src/collections.c
index 95d8fe6..f519b71 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -41,8 +41,9 @@ lilv_collection_new(ZixComparator cmp, ZixDestroyFunc destructor)
void
lilv_collection_free(LilvCollection* coll)
{
- if (coll)
+ if (coll) {
zix_tree_free((ZixTree*)coll);
+ }
}
unsigned
@@ -129,9 +130,11 @@ lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
LILV_API bool
lilv_nodes_contains(const LilvNodes* list, const LilvNode* value)
{
- LILV_FOREACH(nodes, i, list)
- if (lilv_node_equals(lilv_nodes_get(list, i), value))
+ LILV_FOREACH(nodes, i, list) {
+ if (lilv_node_equals(lilv_nodes_get(list, i), value)) {
return true;
+ }
+ }
return false;
}
diff --git a/src/instance.c b/src/instance.c
index 93f0754..030c6ff 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -98,8 +98,9 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
LILV_API void
lilv_instance_free(LilvInstance* instance)
{
- if (!instance)
+ if (!instance) {
return;
+ }
instance->lv2_descriptor->cleanup(instance->lv2_handle);
instance->lv2_descriptor = NULL;
diff --git a/src/node.c b/src/node.c
index 5686cc1..2b160f3 100644
--- a/src/node.c
+++ b/src/node.c
@@ -121,19 +121,20 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
case SORD_LITERAL:
datatype_uri = sord_node_get_datatype(node);
if (datatype_uri) {
- if (sord_node_equals(datatype_uri, world->uris.xsd_boolean))
+ if (sord_node_equals(datatype_uri, world->uris.xsd_boolean)) {
type = LILV_VALUE_BOOL;
- else if (sord_node_equals(datatype_uri, world->uris.xsd_decimal)
- || sord_node_equals(datatype_uri, world->uris.xsd_double))
+ } else if (sord_node_equals(datatype_uri, world->uris.xsd_decimal) ||
+ sord_node_equals(datatype_uri, world->uris.xsd_double)) {
type = LILV_VALUE_FLOAT;
- else if (sord_node_equals(datatype_uri, world->uris.xsd_integer))
+ } else if (sord_node_equals(datatype_uri, world->uris.xsd_integer)) {
type = LILV_VALUE_INT;
- else if (sord_node_equals(datatype_uri,
- world->uris.xsd_base64Binary))
+ } else if (sord_node_equals(datatype_uri,
+ world->uris.xsd_base64Binary)) {
type = LILV_VALUE_BLOB;
- else
+ } else {
LILV_ERRORF("Unknown datatype `%s'\n",
sord_node_get_string(datatype_uri));
+ }
}
result = lilv_node_new(
world, type, (const char*)sord_node_get_string(node));
@@ -225,12 +226,13 @@ lilv_node_free(LilvNode* val)
LILV_API bool
lilv_node_equals(const LilvNode* value, const LilvNode* other)
{
- if (value == NULL && other == NULL)
+ if (value == NULL && other == NULL) {
return true;
- else if (value == NULL || other == NULL)
+ } else if (value == NULL || other == NULL) {
return false;
- else if (value->type != other->type)
+ } else if (value->type != other->type) {
return false;
+ }
switch (value->type) {
case LILV_VALUE_URI:
@@ -317,8 +319,9 @@ lilv_node_as_blank(const LilvNode* value)
LILV_API bool
lilv_node_is_literal(const LilvNode* value)
{
- if (!value)
+ if (!value) {
return false;
+ }
switch (value->type) {
case LILV_VALUE_STRING:
diff --git a/src/plugin.c b/src/plugin.c
index 5e10d7c..e8956fb 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -359,8 +359,9 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p)
void
lilv_plugin_load_if_necessary(const LilvPlugin* p)
{
- if (!p->loaded)
+ if (!p->loaded) {
lilv_plugin_load((LilvPlugin*)p);
+ }
}
LILV_API const LilvNode*
@@ -441,8 +442,9 @@ lilv_plugin_get_class(const LilvPlugin* const_p)
}
sord_iter_free(c);
- if (p->plugin_class == NULL)
+ if (p->plugin_class == NULL) {
p->plugin_class = p->world->lv2_plugin_class;
+ }
}
return p->plugin_class;
}
@@ -499,14 +501,16 @@ lilv_plugin_get_name(const LilvPlugin* plugin)
LilvNode* ret = NULL;
if (results) {
LilvNode* val = lilv_nodes_get_first(results);
- if (lilv_node_is_string(val))
+ if (lilv_node_is_string(val)) {
ret = lilv_node_duplicate(val);
+ }
lilv_nodes_free(results);
}
- if (!ret)
+ if (!ret) {
LILV_WARNF("Plugin <%s> has no (mandatory) doap:name\n",
lilv_node_as_string(lilv_plugin_get_uri(plugin)));
+ }
return ret;
}
@@ -807,10 +811,11 @@ lilv_plugin_get_port_by_index(const LilvPlugin* p,
uint32_t index)
{
lilv_plugin_load_ports_if_necessary(p);
- if (index < p->num_ports)
+ if (index < p->num_ports) {
return p->ports[index];
- else
+ } else {
return NULL;
+ }
}
LILV_API const LilvPort*
@@ -820,8 +825,9 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
lilv_plugin_load_ports_if_necessary(p);
for (uint32_t i = 0; i < p->num_ports; ++i) {
LilvPort* port = p->ports[i];
- if (lilv_node_equals(port->symbol, symbol))
+ if (lilv_node_equals(port->symbol, symbol)) {
return port;
+ }
}
return NULL;
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 0afb39a..622ff8f 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -79,8 +79,9 @@ lilv_plugin_class_get_children(const LilvPluginClass* plugin_class)
const LilvPluginClass* c = (LilvPluginClass*)zix_tree_get(i);
const LilvNode* parent = lilv_plugin_class_get_parent_uri(c);
if (parent && lilv_node_equals(lilv_plugin_class_get_uri(plugin_class),
- parent))
+ parent)) {
zix_tree_insert((ZixTree*)result, (LilvPluginClass*)c, NULL);
+ }
}
return result;
diff --git a/src/port.c b/src/port.c
index 6bf8fc7..3ddc9b7 100644
--- a/src/port.c
+++ b/src/port.c
@@ -55,9 +55,11 @@ lilv_port_is_a(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* port_class)
{
- LILV_FOREACH(nodes, i, port->classes)
- if (lilv_node_equals(lilv_nodes_get(port->classes, i), port_class))
+ LILV_FOREACH(nodes, i, port->classes) {
+ if (lilv_node_equals(lilv_nodes_get(port->classes, i), port_class)) {
return true;
+ }
+ }
return false;
}
@@ -163,14 +165,16 @@ lilv_port_get_name(const LilvPlugin* p,
LilvNode* ret = NULL;
if (results) {
LilvNode* val = lilv_nodes_get_first(results);
- if (lilv_node_is_string(val))
+ if (lilv_node_is_string(val)) {
ret = lilv_node_duplicate(val);
+ }
lilv_nodes_free(results);
}
- if (!ret)
+ if (!ret) {
LILV_WARNF("Plugin <%s> port has no (mandatory) doap:name\n",
lilv_node_as_string(lilv_plugin_get_uri(p)));
+ }
return ret;
}
@@ -226,8 +230,9 @@ lilv_port_get_scale_points(const LilvPlugin* p,
NULL);
LilvScalePoints* ret = NULL;
- if (!sord_iter_end(points))
+ if (!sord_iter_end(points)) {
ret = lilv_scale_points_new();
+ }
FOREACH_MATCH(points) {
const SordNode* point = sord_iter_get_node(points, SORD_OBJECT);
diff --git a/src/util.c b/src/util.c
index 7d590c5..e552fc8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -86,8 +86,9 @@ lilv_strjoin(const char* first, ...)
va_start(args, first);
while (1) {
const char* const s = va_arg(args, const char *);
- if (s == NULL)
+ if (s == NULL) {
break;
+ }
const size_t this_len = strlen(s);
char* new_result = (char*)realloc(result, len + this_len + 1);
diff --git a/src/world.c b/src/world.c
index a053b0d..80aad28 100644
--- a/src/world.c
+++ b/src/world.c
@@ -32,12 +32,14 @@ lilv_world_new(void)
LilvWorld* world = (LilvWorld*)malloc(sizeof(LilvWorld));
world->world = sord_world_new();
- if (!world->world)
+ if (!world->world) {
goto fail;
+ }
world->model = sord_new(world->world, SORD_SPO|SORD_OPS, true);
- if (!world->model)
+ if (!world->model) {
goto fail;
+ }
world->specs = NULL;
world->plugin_classes = lilv_plugin_classes_new();
@@ -893,8 +895,9 @@ static void
load_dir_entry(const char* dir, const char* name, void* data)
{
LilvWorld* world = (LilvWorld*)data;
- if (!strcmp(name, ".") || !strcmp(name, ".."))
+ if (!strcmp(name, ".") || !strcmp(name, "..")) {
return;
+ }
char* path = lilv_strjoin(dir, "/", name, "/", NULL);
SerdNode suri = serd_node_new_file_uri((const uint8_t*)path, 0, 0, true);
@@ -1012,8 +1015,9 @@ LILV_API void
lilv_world_load_all(LilvWorld* world)
{
const char* lv2_path = getenv("LV2_PATH");
- if (!lv2_path)
+ if (!lv2_path) {
lv2_path = LILV_DEFAULT_LV2_PATH;
+ }
// Discover bundles and read all manifest files into model
lilv_world_load_path(world, lv2_path);