From 93479309fc791000018d657266549358357ff208 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 31 Jul 2016 17:10:51 -0400 Subject: Fix compilation with C++ compilers --- src/plugin.c | 17 +++++++---------- src/world.c | 15 ++++++++------- src/zix/common.h | 2 +- utils/uri_table.h | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 58cee88..e46fed8 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -281,21 +281,23 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) LilvNode* symbol = lilv_plugin_get_unique( p, port, p->world->uris.lv2_symbol); - bool error = false; if (!lilv_node_is_string(symbol) || !is_symbol((const char*)sord_node_get_string(symbol->node))) { LILV_ERRORF("Plugin <%s> port symbol `%s' is invalid\n", lilv_node_as_uri(p->plugin_uri), lilv_node_as_string(symbol)); - error = true; - goto done; + lilv_node_free(symbol); + lilv_plugin_free_ports(p); + break; } if (!lilv_node_is_int(index)) { LILV_ERRORF("Plugin <%s> port index is not an integer\n", lilv_node_as_uri(p->plugin_uri)); - error = true; - goto done; + lilv_node_free(symbol); + lilv_node_free(index); + lilv_plugin_free_ports(p); + break; } uint32_t this_index = lilv_node_as_int(index); @@ -334,13 +336,8 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) } sord_iter_free(types); - done: lilv_node_free(symbol); lilv_node_free(index); - if (error) { // Invalid plugin - lilv_plugin_free_ports(p); - break; - } } sord_iter_free(ports); diff --git a/src/world.c b/src/world.c index 7428354..1e51a2d 100644 --- a/src/world.c +++ b/src/world.c @@ -408,10 +408,11 @@ lilv_world_add_plugin(LilvWorld* world, lilv_node_free(plugin_uri); return; } - } else if ((z = lilv_collection_find_by_uri(world->zombies, plugin_uri))) { + } else if ((z = lilv_collection_find_by_uri((const ZixTree*)world->zombies, + plugin_uri))) { // Plugin bundle has been re-loaded, move from zombies to plugins - plugin = zix_tree_get(z); - zix_tree_remove(world->zombies, z); + plugin = (LilvPlugin*)zix_tree_get(z); + zix_tree_remove((ZixTree*)world->zombies, z); zix_tree_insert((ZixTree*)world->plugins, plugin, NULL); lilv_node_free(plugin_uri); lilv_plugin_clear(plugin, lilv_node_new_from_node(world, bundle)); @@ -868,14 +869,14 @@ lilv_world_unload_bundle(LilvWorld* world, const LilvNode* bundle_uri) will not be in the list returned by lilv_world_get_all_plugins() but can still be used. */ - ZixTreeIter* i = zix_tree_begin(world->plugins); - while (i != zix_tree_end(world->plugins)) { + ZixTreeIter* i = zix_tree_begin((ZixTree*)world->plugins); + while (i != zix_tree_end((ZixTree*)world->plugins)) { LilvPlugin* p = (LilvPlugin*)zix_tree_get(i); ZixTreeIter* next = zix_tree_iter_next(i); if (lilv_node_equals(lilv_plugin_get_bundle_uri(p), bundle_uri)) { - zix_tree_remove(world->plugins, i); - zix_tree_insert(world->zombies, p, NULL); + zix_tree_remove((ZixTree*)world->plugins, i); + zix_tree_insert((ZixTree*)world->zombies, p, NULL); } i = next; diff --git a/src/zix/common.h b/src/zix/common.h index f126cd1..e6b08e0 100644 --- a/src/zix/common.h +++ b/src/zix/common.h @@ -59,7 +59,7 @@ typedef enum { ZIX_STATUS_NOT_FOUND, ZIX_STATUS_EXISTS, ZIX_STATUS_BAD_ARG, - ZIX_STATUS_BAD_PERMS, + ZIX_STATUS_BAD_PERMS } ZixStatus; /** diff --git a/utils/uri_table.h b/utils/uri_table.h index 6a27c61..880d560 100644 --- a/utils/uri_table.h +++ b/utils/uri_table.h @@ -54,7 +54,7 @@ uri_table_map(LV2_URID_Map_Handle handle, const size_t len = strlen(uri); table->uris = (char**)realloc(table->uris, ++table->n_uris * sizeof(char*)); - table->uris[table->n_uris - 1] = malloc(len + 1); + table->uris[table->n_uris - 1] = (char*)malloc(len + 1); memcpy(table->uris[table->n_uris - 1], uri, len + 1); return table->n_uris; } -- cgit v1.2.1