summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-18 21:12:59 +0000
committerDavid Robillard <d@drobilla.net>2007-02-18 21:12:59 +0000
commitec3e2125f960aa3de9da474d175bab353745748b (patch)
tree64d5f7e53cc47cca38bf41b6d1f69bc62dafac7f
parentf340d22e82760166d24a037d8466501217b06a3e (diff)
downloadlilv-ec3e2125f960aa3de9da474d175bab353745748b.tar.gz
lilv-ec3e2125f960aa3de9da474d175bab353745748b.tar.bz2
lilv-ec3e2125f960aa3de9da474d175bab353745748b.zip
Fixed index types of Strings and Plugins for consistency.
git-svn-id: http://svn.drobilla.net/lad/slv2@315 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--hosts/lv2_jack_host.c2
-rw-r--r--hosts/lv2_simple_jack_host.c2
-rw-r--r--slv2/plugin.h3
-rw-r--r--slv2/pluginlist.h12
-rw-r--r--slv2/private_types.h6
-rw-r--r--slv2/stringlist.h16
-rw-r--r--slv2/types.h2
-rw-r--r--src/plugin.c2
-rw-r--r--src/pluginlist.c6
-rw-r--r--src/port.c2
-rw-r--r--src/query.c3
-rw-r--r--src/stringlist.c12
-rw-r--r--utils/lv2_inspect.c6
-rw-r--r--utils/lv2_list.c2
14 files changed, 45 insertions, 31 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index 30ce919..6eb682b 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -309,7 +309,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
void
list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ for (unsigned i=0; i < slv2_plugins_size(list); ++i) {
const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}
diff --git a/hosts/lv2_simple_jack_host.c b/hosts/lv2_simple_jack_host.c
index e6eeaad..6221d2f 100644
--- a/hosts/lv2_simple_jack_host.c
+++ b/hosts/lv2_simple_jack_host.c
@@ -214,7 +214,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
void
list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ for (unsigned i=0; i < slv2_plugins_size(list); ++i) {
const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 05bba75..27fa982 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -26,7 +26,8 @@ extern "C" {
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
-#include "types.h"
+#include <slv2/types.h>
+#include <slv2/stringlist.h>
typedef const struct _Plugin SLV2Plugin;
diff --git a/slv2/pluginlist.h b/slv2/pluginlist.h
index 5410bc3..1032a84 100644
--- a/slv2/pluginlist.h
+++ b/slv2/pluginlist.h
@@ -91,7 +91,7 @@ slv2_plugins_load_all(SLV2Plugins list);
* Use of this function is \b not recommended. Use \ref slv2_plugins_load_all.
*/
void
-slv2_plugins_load_path(SLV2Plugins list,
+slv2_plugins_load_path(SLV2Plugins list,
const char* search_path);
@@ -108,13 +108,13 @@ slv2_plugins_load_path(SLV2Plugins list,
* installed plugins. Use \ref slv2_plugins_load_all for that.
*/
void
-slv2_plugins_load_bundle(SLV2Plugins list,
- const char* bundle_base_url);
+slv2_plugins_load_bundle(SLV2Plugins list,
+ const char* bundle_base_uri);
/** Get the number of plugins in the list.
*/
-size_t
+unsigned
slv2_plugins_size(const SLV2Plugins list);
@@ -129,7 +129,7 @@ slv2_plugins_size(const SLV2Plugins list);
*/
const SLV2Plugin*
slv2_plugins_get_by_uri(const SLV2Plugins list,
- const char* uri);
+ const char* uri);
/** Get a plugin from the list by index.
@@ -146,7 +146,7 @@ slv2_plugins_get_by_uri(const SLV2Plugins list,
*/
const SLV2Plugin*
slv2_plugins_get_at(const SLV2Plugins list,
- size_t index);
+ unsigned index);
/** @} */
diff --git a/slv2/private_types.h b/slv2/private_types.h
index abda0a1..906d89c 100644
--- a/slv2/private_types.h
+++ b/slv2/private_types.h
@@ -47,7 +47,7 @@ extern "C" {
struct _Plugin {
char* plugin_uri;
char* bundle_url; // Bundle directory plugin was loaded from
- raptor_sequence* data_uris; // rdfs::seeAlso
+ raptor_sequence* data_uris; // rdfs::seeAlso
char* lib_uri; // lv2:binary
};
@@ -70,9 +70,7 @@ struct _PluginList {
/** An ordered, indexable collection of strings. */
-typedef raptor_sequence* SLV2Strings;
-
-SLV2Strings slv2_strings_new();
+//typedef raptor_sequence* SLV2Strings;
#ifdef __cplusplus
diff --git a/slv2/stringlist.h b/slv2/stringlist.h
index 5ed711b..4abb383 100644
--- a/slv2/stringlist.h
+++ b/slv2/stringlist.h
@@ -19,7 +19,10 @@
#ifndef __SLV2_STRINGLIST_H__
#define __SLV2_STRINGLIST_H__
-#include <slv2/private_types.h>
+#include <stdbool.h>
+
+typedef void* SLV2Strings;
+
#ifdef __cplusplus
extern "C" {
@@ -34,9 +37,16 @@ extern "C" {
* @{
*/
+
+/** Allocate a new, empty SLV2Strings
+ */
+SLV2Strings
+slv2_strings_new();
+
+
/** Get the number of elements in a string list.
*/
-int
+unsigned
slv2_strings_size(const SLV2Strings list);
@@ -45,7 +55,7 @@ slv2_strings_size(const SLV2Strings list);
* @return the element at @a index, or NULL if index is out of range.
*/
char*
-slv2_strings_get_at(const SLV2Strings list, int index);
+slv2_strings_get_at(const SLV2Strings list, unsigned index);
/** Return whether @a list contains @a uri.
diff --git a/slv2/types.h b/slv2/types.h
index 018c8e2..b1b115c 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -22,7 +22,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
-#include <slv2/private_types.h>
+//#include <slv2/private_types.h>
#ifdef __cplusplus
extern "C" {
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;
diff --git a/src/port.c b/src/port.c
index 478a070..c6d0c10 100644
--- a/src/port.c
+++ b/src/port.c
@@ -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;
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index 32c07dd..077aefe 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -84,7 +84,7 @@ print_plugin(SLV2Plugin* p)
printf("\tData URIs:\n");
SLV2Strings data_uris = slv2_plugin_get_data_uris(p);
- for (int i=0; i < slv2_strings_size(data_uris); ++i)
+ for (unsigned i=0; i < slv2_strings_size(data_uris); ++i)
printf("\t\t%s\n", slv2_strings_get_at(data_uris, i));
printf("\n\tLibrary URI: %s\n\n", slv2_plugin_get_library_uri(p));
@@ -100,13 +100,13 @@ print_plugin(SLV2Plugin* p)
printf("\tProperties:\n");
SLV2Strings v = slv2_plugin_get_properties(p);
- for (int i=0; i < slv2_strings_size(v); ++i)
+ for (unsigned i=0; i < slv2_strings_size(v); ++i)
printf("\t\t%s\n", slv2_strings_get_at(v, i));
slv2_strings_free(v);
printf("\tHints:\n");
v = slv2_plugin_get_hints(p);
- for (int i=0; i < slv2_strings_size(v); ++i)
+ for (unsigned i=0; i < slv2_strings_size(v); ++i)
printf("\t\t%s\n", slv2_strings_get_at(v, i));
slv2_strings_free(v);
diff --git a/utils/lv2_list.c b/utils/lv2_list.c
index 71cf34c..a1966fd 100644
--- a/utils/lv2_list.c
+++ b/utils/lv2_list.c
@@ -23,7 +23,7 @@
void
list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ for (unsigned i=0; i < slv2_plugins_size(list); ++i) {
const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}