diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/collections.c | 8 | ||||
-rw-r--r-- | src/instance.c | 7 | ||||
-rw-r--r-- | src/lilv_internal.h | 10 | ||||
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/plugin.c | 11 | ||||
-rw-r--r-- | src/port.c | 2 | ||||
-rw-r--r-- | src/query.c | 12 | ||||
-rw-r--r-- | src/world.c | 16 |
8 files changed, 39 insertions, 31 deletions
diff --git a/src/collections.c b/src/collections.c index 0049d1f..74d10df 100644 --- a/src/collections.c +++ b/src/collections.c @@ -42,7 +42,10 @@ lilv_collection_size(const LilvCollection* coll) LilvIter* lilv_collection_begin(const LilvCollection* collection) { - return collection ? g_sequence_get_begin_iter((LilvCollection*)collection) : NULL; + if (collection) { + return g_sequence_get_begin_iter((LilvCollection*)collection); + } + return NULL; } void* @@ -82,7 +85,8 @@ lilv_plugin_classes_new(void) LILV_API const LilvPluginClass* -lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, const LilvNode* uri) +lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, + const LilvNode* uri) { return (LilvPluginClass*)lilv_sequence_get_by_uri(coll, uri); } diff --git a/src/instance.c b/src/instance.c index 717bdb6..c9a5d83 100644 --- a/src/instance.c +++ b/src/instance.c @@ -37,8 +37,9 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, local_features[0] = NULL; } - const char* const lib_uri = lilv_node_as_uri(lilv_plugin_get_library_uri(plugin)); - const char* const lib_path = lilv_uri_to_path(lib_uri); + const LilvNode* const lib_uri_node = lilv_plugin_get_library_uri(plugin); + const char* const lib_uri = lilv_node_as_uri(lib_uri_node); + const char* const lib_path = lilv_uri_to_path(lib_uri); if (!lib_path) return NULL; @@ -70,7 +71,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, LILV_ERRORF("Did not find plugin %s in %s\n", lilv_node_as_uri(lilv_plugin_get_uri(plugin)), lib_path); dlclose(lib); - break; // return NULL + break; // return NULL } else { // Parse bundle URI to use as base URI const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin); diff --git a/src/lilv_internal.h b/src/lilv_internal.h index c405a0d..c016eaf 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -159,7 +159,7 @@ typedef enum { struct LilvNodeImpl { LilvWorld* world; - char* str_val; ///< always present + char* str_val; ///< always present union { int int_val; float float_val; @@ -194,7 +194,9 @@ LilvPort* lilv_port_new(LilvWorld* world, const char* symbol); void lilv_port_free(const LilvPlugin* plugin, LilvPort* port); -LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri); +LilvPlugin* lilv_plugin_new(LilvWorld* world, + LilvNode* uri, + LilvNode* bundle_uri); void lilv_plugin_load_if_necessary(const LilvPlugin* p); void lilv_plugin_free(LilvPlugin* plugin); LilvNode* lilv_plugin_get_unique(const LilvPlugin* p, @@ -233,7 +235,9 @@ LilvUI* lilv_ui_new(LilvWorld* world, void lilv_ui_free(LilvUI* ui); -LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val); +LilvNode* lilv_node_new(LilvWorld* world, + LilvNodeType type, + const char* val); LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node); const SordNode* lilv_node_as_node(const LilvNode* value); @@ -284,7 +284,7 @@ lilv_node_get_turtle_token(const LilvNode* value) case LILV_VALUE_FLOAT: // FIXME: locale kludge, need a locale independent snprintf locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); - len = 20; // FIXME: proper maximum value? + len = 20; // FIXME: proper maximum value? result = calloc(len, 1); setlocale(LC_NUMERIC, "POSIX"); snprintf(result, len, "%f", value->val.float_val); @@ -395,7 +395,7 @@ lilv_node_as_float(const LilvNode* value) assert(lilv_node_is_float(value) || lilv_node_is_int(value)); if (lilv_node_is_float(value)) return value->val.float_val; - else // lilv_node_is_int(value) + else // lilv_node_is_int(value) return (float)value->val.int_val; } diff --git a/src/plugin.c b/src/plugin.c index 25ae481..6bd2e78 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -249,7 +249,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) free(p->ports); p->ports = NULL; } - break; // Invalid plugin + break; // Invalid plugin } } lilv_match_end(ports); @@ -337,8 +337,7 @@ lilv_plugin_get_class(const LilvPlugin* const_p) } LilvNode* class = lilv_node_new_from_node(p->world, class_node); - if ( ! lilv_node_equals(class, p->world->lv2_plugin_class->uri)) { - + if (!lilv_node_equals(class, p->world->lv2_plugin_class->uri)) { const LilvPluginClass* plugin_class = lilv_plugin_classes_get_by_uri( p->world->plugin_classes, class); @@ -425,11 +424,11 @@ lilv_plugin_get_value_for_subject(const LilvPlugin* p, const LilvNode* predicate) { lilv_plugin_load_ports_if_necessary(p); - if ( ! lilv_node_is_uri(subject) && ! lilv_node_is_blank(subject)) { + if (!lilv_node_is_uri(subject) && !lilv_node_is_blank(subject)) { LILV_ERROR("Subject is not a resource\n"); return NULL; } - if ( ! lilv_node_is_uri(predicate)) { + if (!lilv_node_is_uri(predicate)) { LILV_ERROR("Predicate is not a URI\n"); return NULL; } @@ -501,7 +500,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, va_start(args, class_1); bool matches = true; - for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)) != NULL ; ) { + for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)); ) { if (!lilv_port_is_a(p, port, class_i)) { va_end(args); matches = false; @@ -120,7 +120,7 @@ lilv_port_get_value(const LilvPlugin* p, const LilvPort* port, const LilvNode* predicate) { - if ( ! lilv_node_is_uri(predicate)) { + if (!lilv_node_is_uri(predicate)) { LILV_ERROR("Predicate is not a URI\n"); return NULL; } diff --git a/src/query.c b/src/query.c index 1155e44..5f6cc57 100644 --- a/src/query.c +++ b/src/query.c @@ -24,9 +24,9 @@ #include "lilv_internal.h" typedef enum { - LILV_LANG_MATCH_NONE, ///< Language does not match at all - LILV_LANG_MATCH_PARTIAL, ///< Partial (language, but not country) match - LILV_LANG_MATCH_EXACT ///< Exact (language and country) match + LILV_LANG_MATCH_NONE, ///< Language does not match at all + LILV_LANG_MATCH_PARTIAL, ///< Partial (language, but not country) match + LILV_LANG_MATCH_EXACT ///< Exact (language and country) match } LilvLangMatch; static LilvLangMatch @@ -57,9 +57,9 @@ LilvNodes* lilv_nodes_from_stream_objects_i18n(LilvWorld* world, SordIter* stream) { - LilvNodes* values = lilv_nodes_new(); - const SordNode* nolang = NULL; // Untranslated value - const SordNode* partial = NULL; // Partial language match + LilvNodes* values = lilv_nodes_new(); + const SordNode* nolang = NULL; // Untranslated value + const SordNode* partial = NULL; // Partial language match char* syslang = lilv_get_lang(); FOREACH_MATCH(stream) { const SordNode* value = lilv_match_object(stream); diff --git a/src/world.c b/src/world.c index 336970f..edd9bd1 100644 --- a/src/world.c +++ b/src/world.c @@ -56,8 +56,8 @@ lilv_world_new(void) world->plugin_classes = lilv_plugin_classes_new(); world->plugins = lilv_plugins_new(); -#define NS_DYNMAN (const uint8_t*)"http://lv2plug.in/ns/ext/dynmanifest#" -#define NS_DC (const uint8_t*)"http://dublincore.org/documents/dcmi-namespace/" +#define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#" +#define NS_DC "http://dublincore.org/documents/dcmi-namespace/" #define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri) #define NEW_URI_VAL(uri) lilv_new_uri(world, (const char*)(uri)); @@ -96,11 +96,11 @@ lilv_world_new(void) assert(world->lv2_plugin_class); world->namespaces = serd_env_new(); - lilv_world_set_prefix(world, "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - lilv_world_set_prefix(world, "rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - lilv_world_set_prefix(world, "doap", "http://usefulinc.com/ns/doap#"); - lilv_world_set_prefix(world, "foaf", "http://xmlns.com/foaf/0.1/"); - lilv_world_set_prefix(world, "lv2", "http://lv2plug.in/ns/lv2core#"); + lilv_world_set_prefix(world, "rdf", LILV_NS_RDF); + lilv_world_set_prefix(world, "rdfs", LILV_NS_RDFS); + lilv_world_set_prefix(world, "doap", LILV_NS_DOAP); + lilv_world_set_prefix(world, "foaf", LILV_NS_FOAF); + lilv_world_set_prefix(world, "lv2", LILV_NS_LV2); lilv_world_set_prefix(world, "lv2ev", "http://lv2plug.in/ns/ext/event#"); world->n_read_files = 0; @@ -474,7 +474,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world, dlclose(lib); } lilv_match_end(dmanifests); -#endif // LILV_DYN_MANIFEST +#endif // LILV_DYN_MANIFEST } LILV_API |