diff options
-rw-r--r-- | examples/hosts/.jack_host.c.swp | bin | 28672 -> 0 bytes | |||
-rw-r--r-- | examples/plugins/Amp-swh.lv2/Makefile | 2 | ||||
-rwxr-xr-x | examples/plugins/Amp-swh.lv2/amp.so | bin | 2629 -> 0 bytes | |||
-rw-r--r-- | src/plugin.c | 8 | ||||
-rw-r--r-- | src/pluginlist.c | 15 | ||||
-rw-r--r-- | src/port.c | 4 | ||||
-rw-r--r-- | src/query.c | 17 | ||||
-rw-r--r-- | src/util.c | 35 |
8 files changed, 33 insertions, 48 deletions
diff --git a/examples/hosts/.jack_host.c.swp b/examples/hosts/.jack_host.c.swp Binary files differdeleted file mode 100644 index eb9bb86..0000000 --- a/examples/hosts/.jack_host.c.swp +++ /dev/null diff --git a/examples/plugins/Amp-swh.lv2/Makefile b/examples/plugins/Amp-swh.lv2/Makefile index 4fb858a..55180c2 100644 --- a/examples/plugins/Amp-swh.lv2/Makefile +++ b/examples/plugins/Amp-swh.lv2/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -Wall -I../../../include +CFLAGS = -Wall -I../../../include -fPIC all: amp.so diff --git a/examples/plugins/Amp-swh.lv2/amp.so b/examples/plugins/Amp-swh.lv2/amp.so Binary files differdeleted file mode 100755 index 281b709..0000000 --- a/examples/plugins/Amp-swh.lv2/amp.so +++ /dev/null diff --git a/src/plugin.c b/src/plugin.c index 27fb481..8c7a4cc 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -60,7 +60,7 @@ const unsigned char* slv2_plugin_get_data_path(const SLV2Plugin* p) { assert(p); - if (!strncmp((char*)p->data_url, "file://", 7)) + if (!strncmp((char*)p->data_url, "file://", (size_t)7)) return (p->data_url) + 7; else return NULL; @@ -79,7 +79,7 @@ const unsigned char* slv2_plugin_get_library_path(const SLV2Plugin* p) { assert(p); - if (!strncmp((char*)p->lib_url, "file://", 7)) + if (!strncmp((char*)p->lib_url, "file://", (size_t)7)) return (p->lib_url) + 7; else return NULL; @@ -152,7 +152,7 @@ slv2_plugin_get_property(const SLV2Plugin* p, rasqal_query_results* results = slv2_plugin_run_query(p, U("SELECT DISTINCT ?value FROM data: WHERE { \n" "plugin: "), property, U(" ?value . \n" - "} \n"), 0); + "} \n"), NULL); struct _Property* result = slv2_query_get_results(results); @@ -175,7 +175,7 @@ slv2_plugin_get_num_ports(const SLV2Plugin* p) rasqal_query_results* results = slv2_plugin_run_query(p, U("SELECT DISTINCT ?value FROM data: WHERE { \n" "plugin: lv2:port ?value . \n" - "} \n"), 0); + "} \n"), NULL); while (!rasqal_query_results_finished(results)) { ++result; diff --git a/src/pluginlist.c b/src/pluginlist.c index 61e4c4b..20e9dea 100644 --- a/src/pluginlist.c +++ b/src/pluginlist.c @@ -138,9 +138,12 @@ slv2_list_load_bundle(SLV2List list, rasqal_query_results_next(results); } - rasqal_free_query_results(results); - rasqal_free_query(rq); - raptor_free_uri(base_uri); + // FIXME: leaks? rasqal really doesn't handle missing files well.. + if (results) { + rasqal_free_query_results(results); + rasqal_free_query(rq); + raptor_free_uri(base_uri); // FIXME: leak? + } rasqal_finish(); free(manifest_uri); @@ -162,8 +165,8 @@ add_plugins_from_dir(SLV2List list, const char* dir) if (!strcmp(pfile->d_name, ".") || !strcmp(pfile->d_name, "..")) continue; - char* bundle_path = (char*)ustrjoin(U(dir), U("/"), U(pfile->d_name), 0); - char* bundle_url = (char*)ustrjoin(U("file://"), U(dir), U("/"), U(pfile->d_name), 0); + char* bundle_path = (char*)ustrjoin(U(dir), U("/"), U(pfile->d_name), NULL); + char* bundle_url = (char*)ustrjoin(U("file://"), U(dir), U("/"), U(pfile->d_name), NULL); DIR* bundle_dir = opendir(bundle_path); if (bundle_dir != NULL) { @@ -185,7 +188,7 @@ slv2_list_load_path(SLV2List list, const char* slv2_path) { - char* path = (char*)ustrjoin(U(slv2_path), U(":"), 0); + char* path = (char*)ustrjoin(U(slv2_path), U(":"), NULL); char* dir = path; // Pointer into path @@ -72,7 +72,7 @@ slv2_port_get_property(SLV2Plugin* p, assert(property); char index_str[4]; - snprintf(index_str, 4, "%ld", index); + snprintf(index_str, (size_t)4, "%lu", index); rasqal_init(); @@ -80,7 +80,7 @@ slv2_port_get_property(SLV2Plugin* p, U("SELECT DISTINCT ?value FROM data: WHERE { \n" "plugin: lv2:port ?port \n" "?port lv2:index "), index_str, U(" \n" - "?port "), property, U(" ?value . \n}\n"), 0); + "?port "), property, U(" ?value . \n}\n"), NULL); SLV2Property result = slv2_query_get_results(results); diff --git a/src/query.c b/src/query.c index 2030735..ddaf648 100644 --- a/src/query.c +++ b/src/query.c @@ -35,7 +35,7 @@ slv2_query_header(const SLV2Plugin* p) "PREFIX doap: <http://usefulinc.com/ns/doap#> \n" "PREFIX lv2: <http://lv2plug.in/ontology#> \n" "PREFIX plugin: <"), plugin_uri, U("> \n"), - U("PREFIX data: <"), data_file_url, U("> \n\n"), 0); + U("PREFIX data: <"), data_file_url, U("> \n\n"), NULL); return query_string; } @@ -51,7 +51,7 @@ slv2_query_lang_filter(const uchar* variable) result = ustrjoin( //U("FILTER (lang(?value) = \""), lang, U("\")\n"), 0); U("FILTER( lang(?value) = \""), lang, - U("\" || lang(?value) = \"\" )\n"), 0); + U("\" || lang(?value) = \"\" )\n"), NULL); } return result; @@ -62,16 +62,17 @@ rasqal_query_results* slv2_plugin_run_query(const SLV2Plugin* p, const uchar* first, ...) { - va_list args_list; - va_start(args_list, first); - va_list args_copy; - va_copy(args_copy, args_list); /* FIXME: Too much unecessary allocation */ uchar* header = slv2_query_header(p); - uchar* args_str = vstrjoin(first, args_copy); - uchar* query_str = ustrjoin(header, args_str, 0); + va_list args_list; + va_start(args_list, first); + + uchar* args_str = vstrjoin(first, args_list); + uchar* query_str = ustrjoin(header, args_str, NULL); + va_end(args_list); + assert(p); assert(query_str); @@ -50,49 +50,30 @@ ustrdup(const uchar* src) uchar* ustrjoin(const uchar* first, ...) { - // FIXME: this is horribly, awfully, disgracefully slow - va_list args_list; va_start(args_list, first); - va_list args_copy; - va_copy(args_copy, args_list); - - uchar* result = vstrjoin(first, args_copy); - - //va_end(args_copy); + uchar* result = vstrjoin(first, args_list); + va_end(args_list); return result; - - /* - va_list args_list; - uchar* arg = NULL; - uchar* result = ustrdup(first); - - va_start(args_list, first); - - while ((arg = va_arg(args_list, uchar*)) != (uchar*)0) - ustrappend(&result, arg); - - va_end(args_list); - - return result;*/ } uchar* vstrjoin(const uchar* first, va_list args_list) { - // FIXME: this is horribly, awfully, disgracefully slow + // FIXME: this is horribly, awfully, disgracefully slow. + // so I'm lazy. uchar* arg = NULL; uchar* result = ustrdup(first); - - while ((arg = va_arg(args_list, uchar*)) != NULL) + + while ((arg = va_arg(args_list, const uchar*)) != NULL) ustrappend(&result, arg); - va_end(args_list); + //va_end(args_list); return result; } @@ -112,7 +93,7 @@ url2path(const uchar* const url) char* result = calloc(strlen((char*)url)-7+1, sizeof(char)); strcpy(result, (char*)url+7); return result;*/ - if (!strncmp((char*)url, "file://", 7)) + if (!strncmp((char*)url, "file://", (size_t)7)) return (char*)url + 7; else return NULL; |