diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 2 | ||||
-rw-r--r-- | src/pluginlist.c | 6 | ||||
-rw-r--r-- | src/port.c | 2 | ||||
-rw-r--r-- | src/query.c | 3 | ||||
-rw-r--r-- | src/stringlist.c | 12 |
5 files changed, 15 insertions, 10 deletions
diff --git a/src/plugin.c b/src/plugin.c index 703b2a3..d3710a4 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -40,7 +40,7 @@ slv2_plugin_duplicate(const SLV2Plugin* p) result->lib_uri = p->lib_uri; result->data_uris = slv2_strings_new(); - for (int i=0; i < slv2_strings_size(p->data_uris); ++i) + for (unsigned i=0; i < slv2_strings_size(p->data_uris); ++i) raptor_sequence_push(result->data_uris, strdup(slv2_strings_get_at(p->data_uris, i))); return result; } diff --git a/src/pluginlist.c b/src/pluginlist.c index 1c28f01..f030713 100644 --- a/src/pluginlist.c +++ b/src/pluginlist.c @@ -261,7 +261,7 @@ slv2_plugins_load_path(SLV2Plugins list, } -size_t +unsigned slv2_plugins_size(const SLV2Plugins list) { assert(list != NULL); @@ -275,7 +275,7 @@ slv2_plugins_get_by_uri(const SLV2Plugins list, const char* uri) if (list->num_plugins > 0) { assert(list->plugins != NULL); - for (size_t i=0; i < list->num_plugins; ++i) + for (unsigned i=0; i < list->num_plugins; ++i) if (!strcmp((char*)list->plugins[i]->plugin_uri, (char*)uri)) return list->plugins[i]; } @@ -285,7 +285,7 @@ slv2_plugins_get_by_uri(const SLV2Plugins list, const char* uri) SLV2Plugin* -slv2_plugins_get_at(const SLV2Plugins list, size_t index) +slv2_plugins_get_at(const SLV2Plugins list, unsigned index) { if (list->num_plugins == 0) return NULL; @@ -60,7 +60,7 @@ slv2_port_get_class(SLV2Plugin* p, int io = -1; // 0 = in, 1 = out enum { UNKNOWN, AUDIO, CONTROL, MIDI } type = UNKNOWN; - for (int i=0; i < slv2_strings_size(class); ++i) { + for (unsigned i=0; i < slv2_strings_size(class); ++i) { char* value = slv2_strings_get_at(class, i); if (!strcmp(value, "http://lv2plug.in/ontology#InputPort")) io = 0; diff --git a/src/query.c b/src/query.c index 311ef50..fa3b22b 100644 --- a/src/query.c +++ b/src/query.c @@ -24,6 +24,7 @@ #include <slv2/library.h> #include <slv2/util.h> #include <slv2/stringlist.h> +#include <slv2/private_types.h> char* @@ -127,7 +128,7 @@ slv2_plugin_query(SLV2Plugin* plugin, NULL, RASQAL_DATA_GRAPH_BACKGROUND); // Add all plugin data files to query sources - for (int i=0; i < slv2_strings_size(plugin->data_uris); ++i) { + for (unsigned i=0; i < slv2_strings_size(plugin->data_uris); ++i) { const char* file_uri_str = slv2_strings_get_at(plugin->data_uris, i); raptor_uri* file_uri = raptor_new_uri((const unsigned char*)file_uri_str); rasqal_query_add_data_graph(rq, file_uri, diff --git a/src/stringlist.c b/src/stringlist.c index 04f2de7..bdb173e 100644 --- a/src/stringlist.c +++ b/src/stringlist.c @@ -18,6 +18,7 @@ #include <string.h> #include <stdlib.h> +#include <limits.h> #include <raptor.h> #include <slv2/stringlist.h> @@ -29,7 +30,7 @@ slv2_strings_new() } -int +unsigned slv2_strings_size(const SLV2Strings list) { return raptor_sequence_size(list); @@ -37,16 +38,19 @@ slv2_strings_size(const SLV2Strings list) char* -slv2_strings_get_at(const SLV2Strings list, int index) +slv2_strings_get_at(const SLV2Strings list, unsigned index) { - return (char*)raptor_sequence_get_at(list, index); + if (index > INT_MAX) + return NULL; + else + return (char*)raptor_sequence_get_at(list, (int)index); } bool slv2_strings_contains(const SLV2Strings list, const char* uri) { - for (int i=0; i < slv2_strings_size(list); ++i) + for (unsigned i=0; i < slv2_strings_size(list); ++i) if (!strcmp(slv2_strings_get_at(list, i), uri)) return true; |