diff options
author | David Robillard <d@drobilla.net> | 2011-04-30 02:07:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-30 02:07:42 +0000 |
commit | 6c72abfc6d6649f07d85f70b25ce4393dc775a39 (patch) | |
tree | d87d8cc347a43b3b02d97caa6666848448c7e92c | |
parent | 054c39b12cb610d79006f0b51153cb2c4aa5a0b7 (diff) | |
download | lilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.tar.gz lilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.tar.bz2 lilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.zip |
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3241 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | lilv/lilv.h | 9 | ||||
-rw-r--r-- | lilv/lilvmm.hpp | 20 | ||||
-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 | ||||
-rw-r--r-- | wscript | 4 |
11 files changed, 60 insertions, 43 deletions
diff --git a/lilv/lilv.h b/lilv/lilv.h index a9c2992..fbb7207 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -49,6 +49,7 @@ extern "C" { #endif #define LILV_NS_DOAP "http://usefulinc.com/ns/doap#" +#define LILV_NS_FOAF "http://xmlns.com/foaf/0.1/" #define LILV_NS_LILV "http://drobilla.net/ns/lilv#" #define LILV_NS_LV2 "http://lv2plug.in/ns/lv2core#" #define LILV_NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" @@ -66,9 +67,9 @@ extern "C" { typedef struct LilvPluginImpl LilvPlugin; /**< LV2 Plugin. */ typedef struct LilvPluginClassImpl LilvPluginClass; /**< Plugin Class. */ typedef struct LilvPortImpl LilvPort; /**< Port. */ -typedef struct LilvScalePointImpl LilvScalePoint; /**< Scale Point (Notch). */ +typedef struct LilvScalePointImpl LilvScalePoint; /**< Scale Point. */ typedef struct LilvUIImpl LilvUI; /**< Plugin UI. */ -typedef struct LilvNodeImpl LilvNode; /**< Typed Value. */ +typedef struct LilvNodeImpl LilvNode; /**< Typed Value. */ typedef struct LilvWorldImpl LilvWorld; /**< Lilv World. */ typedef struct LilvInstanceImpl LilvInstance; /**< Plugin instance. */ @@ -354,7 +355,7 @@ lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i); LILV_API const LilvPluginClass* lilv_plugin_classes_get_by_uri(const LilvPluginClasses* classes, - const LilvNode* uri); + const LilvNode* uri); /* ScalePoints */ @@ -416,7 +417,7 @@ lilv_uis_is_end(const LilvUIs* collection, LilvIter* i); */ LILV_API const LilvUI* -lilv_uis_get_by_uri(const LilvUIs* uis, +lilv_uis_get_by_uri(const LilvUIs* uis, const LilvNode* uri); /* Values */ diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp index 9a256b0..d0bd1cd 100644 --- a/lilv/lilvmm.hpp +++ b/lilv/lilvmm.hpp @@ -24,22 +24,24 @@ namespace Lilv { const char* uri_to_path(const char* uri) { return lilv_uri_to_path(uri); } #define LILV_WRAP0(RT, prefix, name) \ - inline RT name () { return lilv_ ## prefix ## _ ## name (me); } + inline RT name() { return lilv_ ## prefix ## _ ## name (me); } #define LILV_WRAP0_VOID(prefix, name) \ - inline void name () { lilv_ ## prefix ## _ ## name (me); } + inline void name() { lilv_ ## prefix ## _ ## name(me); } #define LILV_WRAP1(RT, prefix, name, T1, a1) \ - inline RT name (T1 a1) { return lilv_ ## prefix ## _ ## name (me, a1); } + inline RT name(T1 a1) { return lilv_ ## prefix ## _ ## name (me, a1); } #define LILV_WRAP1_VOID(prefix, name, T1, a1) \ - inline void name (T1 a1) { lilv_ ## prefix ## _ ## name (me, a1); } + inline void name(T1 a1) { lilv_ ## prefix ## _ ## name(me, a1); } #define LILV_WRAP2(RT, prefix, name, T1, a1, T2, a2) \ - inline RT name (T1 a1, T2 a2) { return lilv_ ## prefix ## _ ## name (me, a1, a2); } + inline RT name(T1 a1, T2 a2) { \ + return lilv_ ## prefix ## _ ## name(me, a1, a2); \ + } #define LILV_WRAP2_VOID(prefix, name, T1, a1, T2, a2) \ - inline void name (T1 a1, T2 a2) { lilv_ ## prefix ## _ ## name (me, a1, a2); } + inline void name(T1 a1, T2 a2) { lilv_ ## prefix ## _ ## name(me, a1, a2); } #ifndef SWIG #define LILV_WRAP_CONVERSION(CT) \ @@ -152,13 +154,15 @@ struct World { LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class); LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes); LILV_WRAP0(Plugins, world, get_all_plugins); - //LILV_WRAP1(Plugin, world, get_plugin_by_uri_string, const char*, uri); LilvWorld* me; }; struct Port { - inline Port(const LilvPlugin* p, const LilvPort* c_obj) : parent(p), me(c_obj) {} + inline Port(const LilvPlugin* p, const LilvPort* c_obj) + : parent(p), me(c_obj) + {} + LILV_WRAP_CONVERSION(const LilvPort); #define LILV_PORT_WRAP0(RT, name) \ 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 @@ -1,6 +1,7 @@ #!/usr/bin/env python import os import sys +import subprocess from waflib.extras import autowaf as autowaf import waflib.Options as Options @@ -295,3 +296,6 @@ def test(ctx): autowaf.pre_test(ctx, APPNAME) autowaf.run_tests(ctx, APPNAME, ['test/lilv_test'], dirs=['./src','./test']) autowaf.post_test(ctx, APPNAME) + +def lint(ctx): + subprocess.call('cpplint.py --filter=+whitespace/comments,-whitespace/tab,-whitespace/braces,-whitespace/labels,-build/header_guard,-readability/casting,-readability/todo,-build/include src/* lilv/*', shell=True) |