summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-09 01:50:07 +0000
committerDavid Robillard <d@drobilla.net>2012-08-09 01:50:07 +0000
commit1ac0d686b1a540f3ffe5a948f07f53b9a9cdbe5b (patch)
tree3cc280aae8daa7bf8d64868d1a41976eb845418c
parent2fdda7eb1b6b5f5582e05c94591a1db44947af18 (diff)
downloadlilv-1ac0d686b1a540f3ffe5a948f07f53b9a9cdbe5b.tar.gz
lilv-1ac0d686b1a540f3ffe5a948f07f53b9a9cdbe5b.tar.bz2
lilv-1ac0d686b1a540f3ffe5a948f07f53b9a9cdbe5b.zip
Fix warnings: -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4631 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/collections.c13
-rw-r--r--src/instance.c2
-rw-r--r--src/plugin.c8
-rw-r--r--src/query.c2
-rw-r--r--src/state.c20
-rw-r--r--src/util.c4
-rw-r--r--src/world.c6
-rw-r--r--src/zix/tree.c2
-rw-r--r--src/zix/tree.h2
-rw-r--r--test/lilv_test.c71
-rw-r--r--test/test_plugin.c2
-rw-r--r--utils/lilv-bench.c17
-rw-r--r--utils/lv2info.c18
-rw-r--r--utils/lv2ls.c6
14 files changed, 78 insertions, 95 deletions
diff --git a/src/collections.c b/src/collections.c
index ebb5633..dd676e6 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -25,8 +25,8 @@ lilv_ptr_cmp(const void* a, const void* b, void* user_data)
int
lilv_resource_node_cmp(const void* a, const void* b, void* user_data)
{
- const SordNode* an = ((LilvNode*)a)->val.uri_val;
- const SordNode* bn = ((LilvNode*)b)->val.uri_val;
+ const SordNode* an = ((const LilvNode*)a)->val.uri_val;
+ const SordNode* bn = ((const LilvNode*)b)->val.uri_val;
return (intptr_t)an - (intptr_t)bn;
}
@@ -48,7 +48,7 @@ lilv_collection_free(LilvCollection* coll)
unsigned
lilv_collection_size(const LilvCollection* coll)
{
- return (coll ? zix_tree_size((ZixTree*)coll) : 0);
+ return (coll ? zix_tree_size((const ZixTree*)coll) : 0);
}
LilvIter*
@@ -104,14 +104,15 @@ const LilvPluginClass*
lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
const LilvNode* uri)
{
- return (LilvPluginClass*)lilv_collection_get_by_uri((ZixTree*)coll, uri);
+ return (LilvPluginClass*)lilv_collection_get_by_uri(
+ (const ZixTree*)coll, uri);
}
LILV_API
const LilvUI*
lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri)
{
- return (LilvUI*)lilv_collection_get_by_uri((ZixTree*)coll, uri);
+ return (LilvUI*)lilv_collection_get_by_uri((const ZixTree*)coll, uri);
}
/* Plugins */
@@ -126,7 +127,7 @@ LILV_API
const LilvPlugin*
lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
{
- return (LilvPlugin*)lilv_collection_get_by_uri((ZixTree*)list, uri);
+ return (LilvPlugin*)lilv_collection_get_by_uri((const ZixTree*)list, uri);
}
/* Nodes */
diff --git a/src/instance.c b/src/instance.c
index 0d4457d..5fa47fa 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -83,7 +83,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
result = (LilvInstance*)malloc(sizeof(LilvInstance));
result->lv2_descriptor = ld;
result->lv2_handle = ld->instantiate(
- ld, sample_rate, (char*)bundle_path,
+ ld, sample_rate, bundle_path,
(features) ? features : local_features);
result->pimpl = lib;
serd_node_free(&abs_uri_node);
diff --git a/src/plugin.c b/src/plugin.c
index e085abb..c32c2fe 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1016,16 +1016,16 @@ lilv_plugin_write_description(LilvWorld* world,
maybe_write_prefixes(writer, env, plugin_file);
// Write plugin description
- SordIter* iter = lilv_world_query_internal(
+ SordIter* plug_iter = lilv_world_query_internal(
world, subject->val.uri_val, NULL, NULL);
- sord_write_iter(iter, writer);
+ sord_write_iter(plug_iter, writer);
// Write port descriptions
for (uint32_t i = 0; i < num_ports; ++i) {
const LilvPort* port = plugin->ports[i];
- SordIter* iter = lilv_world_query_internal(
+ SordIter* port_iter = lilv_world_query_internal(
world, port->node, NULL, NULL);
- sord_write_iter(iter, writer);
+ sord_write_iter(port_iter, writer);
}
serd_writer_free(writer);
diff --git a/src/query.c b/src/query.c
index 7f2a7de..09fa6f2 100644
--- a/src/query.c
+++ b/src/query.c
@@ -46,7 +46,7 @@ lilv_lang_matches(const char* a, const char* b)
return LILV_LANG_MATCH_NONE;
}
-LilvNodes*
+static LilvNodes*
lilv_nodes_from_stream_objects_i18n(LilvWorld* world,
SordIter* stream,
SordQuadIndex field)
diff --git a/src/state.c b/src/state.c
index c058f8d..6a6d339 100644
--- a/src/state.c
+++ b/src/state.c
@@ -200,16 +200,16 @@ make_path(LV2_State_Make_Path_Handle handle, const char* path)
static char*
abstract_path(LV2_State_Map_Path_Handle handle,
- const char* absolute_path)
+ const char* abs_path)
{
LilvState* state = (LilvState*)handle;
char* path = NULL;
- char* real_path = lilv_realpath(absolute_path);
+ char* real_path = lilv_realpath(abs_path);
const PathMap key = { (char*)real_path, NULL };
ZixTreeIter* iter = NULL;
- if (absolute_path[0] == '\0') {
- return lilv_strdup(absolute_path);
+ if (abs_path[0] == '\0') {
+ return lilv_strdup(abs_path);
} else if (!zix_tree_find(state->abs2rel, &key, &iter)) {
// Already mapped path in a previous call
PathMap* pm = (PathMap*)zix_tree_get(iter);
@@ -259,26 +259,26 @@ abstract_path(LV2_State_Map_Path_Handle handle,
static char*
absolute_path(LV2_State_Map_Path_Handle handle,
- const char* abstract_path)
+ const char* state_path)
{
LilvState* state = (LilvState*)handle;
char* path = NULL;
- if (lilv_path_is_absolute(abstract_path)) {
+ if (lilv_path_is_absolute(state_path)) {
// Absolute path, return identical path
- path = lilv_strdup(abstract_path);
+ path = lilv_strdup(state_path);
} else if (state->dir) {
// Relative path inside state directory
- path = lilv_path_join(state->dir, abstract_path);
+ path = lilv_path_join(state->dir, state_path);
} else {
// State has not been saved, unmap
- path = lilv_strdup(lilv_state_rel2abs(state, abstract_path));
+ path = lilv_strdup(lilv_state_rel2abs(state, state_path));
}
return path;
}
/** Return a new features array which is @c feature added to @c features. */
-const LV2_Feature**
+static const LV2_Feature**
add_features(const LV2_Feature *const * features,
const LV2_Feature* map, const LV2_Feature* make)
{
diff --git a/src/util.c b/src/util.c
index b534ffd..e9c0411 100644
--- a/src/util.c
+++ b/src/util.c
@@ -138,7 +138,7 @@ lilv_get_lang(void)
}
/** Append suffix to dst, update dst_len, and return the realloc'd result. */
-char*
+static char*
strappend(char* dst, size_t* dst_len, const char* suffix, size_t suffix_len)
{
dst = (char*)realloc(dst, *dst_len + suffix_len + 1);
@@ -148,7 +148,7 @@ strappend(char* dst, size_t* dst_len, const char* suffix, size_t suffix_len)
}
/** Append the value of the environment variable var to dst. */
-char*
+static char*
append_var(char* dst, size_t* dst_len, const char* var)
{
// Get value from environment
diff --git a/src/world.c b/src/world.c
index 9ebdaac..96cb247 100644
--- a/src/world.c
+++ b/src/world.c
@@ -702,12 +702,10 @@ lilv_world_load_plugin_classes(LilvWorld* world)
const uint8_t* label = sord_node_get_string(label_node);
sord_iter_free(labels);
- LilvPluginClasses* classes = world->plugin_classes;
- LilvPluginClass* pclass = lilv_plugin_class_new(
+ LilvPluginClass* pclass = lilv_plugin_class_new(
world, parent_node, class_node, (const char*)label);
-
if (pclass) {
- zix_tree_insert((ZixTree*)classes, pclass, NULL);
+ zix_tree_insert(world->plugin_classes, pclass, NULL);
}
}
sord_iter_free(classes);
diff --git a/src/zix/tree.c b/src/zix/tree.c
index c8a5bb4..dd6be5d 100644
--- a/src/zix/tree.c
+++ b/src/zix/tree.c
@@ -107,7 +107,7 @@ zix_tree_free(ZixTree* t)
}
size_t
-zix_tree_size(ZixTree* t)
+zix_tree_size(const ZixTree* t)
{
return t->size;
}
diff --git a/src/zix/tree.h b/src/zix/tree.h
index 5a74fd7..cb8c60d 100644
--- a/src/zix/tree.h
+++ b/src/zix/tree.h
@@ -61,7 +61,7 @@ zix_tree_free(ZixTree* t);
Return the number of elements in @a t.
*/
size_t
-zix_tree_size(ZixTree* t);
+zix_tree_size(const ZixTree* t);
/**
Insert the element @a e into @a t and point @a ti at the new element.
diff --git a/test/lilv_test.c b/test/lilv_test.c
index ea22771..610af9d 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -64,7 +64,7 @@ static LilvWorld* world;
int test_count = 0;
int error_count = 0;
-void
+static void
delete_bundle(void)
{
unlink(content_name);
@@ -72,7 +72,7 @@ delete_bundle(void)
remove(bundle_dir_name);
}
-void
+static void
init_tests(void)
{
strncpy(bundle_dir_name, getenv("HOME"), 900);
@@ -86,7 +86,7 @@ init_tests(void)
delete_bundle();
}
-void
+static void
fatal_error(const char *err, const char *arg)
{
/* TODO: possibly change to vfprintf later */
@@ -96,7 +96,7 @@ fatal_error(const char *err, const char *arg)
exit(1);
}
-void
+static void
write_file(const char *name, const char *content)
{
FILE* f = fopen(name, "w");
@@ -106,14 +106,14 @@ write_file(const char *name, const char *content)
fclose(f);
}
-int
+static int
init_world(void)
{
world = lilv_world_new();
return world != NULL;
}
-int
+static int
load_all_bundles(void)
{
if (!init_world())
@@ -122,7 +122,7 @@ load_all_bundles(void)
return 1;
}
-void
+static void
create_bundle(char *manifest, char *content)
{
if (mkdir(bundle_dir_name, 0700) && errno != EEXIST)
@@ -131,14 +131,14 @@ create_bundle(char *manifest, char *content)
write_file(content_name, content);
}
-int
+static int
start_bundle(char *manifest, char *content)
{
create_bundle(manifest, content);
return load_all_bundles();
}
-void
+static void
unload_bundle(void)
{
if (world)
@@ -146,7 +146,7 @@ unload_bundle(void)
world = NULL;
}
-void
+static void
cleanup(void)
{
delete_bundle();
@@ -190,7 +190,7 @@ static LilvNode* plugin2_uri_value;
/*****************************************************************************/
-void
+static void
init_uris(void)
{
plugin_uri_value = lilv_new_uri(world, uris_plugin);
@@ -199,7 +199,7 @@ init_uris(void)
TEST_ASSERT(plugin2_uri_value);
}
-void
+static void
cleanup_uris(void)
{
lilv_node_free(plugin2_uri_value);
@@ -210,7 +210,7 @@ cleanup_uris(void)
/*****************************************************************************/
-int
+static int
test_utils(void)
{
TEST_ASSERT(!strcmp(lilv_uri_to_path("file:///tmp/blah"), "/tmp/blah"));
@@ -221,7 +221,7 @@ test_utils(void)
/*****************************************************************************/
-int
+static int
test_value(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -349,7 +349,7 @@ discovery_verify_plugin(const LilvPlugin* plugin)
}
}
-int
+static int
test_discovery(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -392,7 +392,7 @@ test_discovery(void)
/*****************************************************************************/
-int
+static int
test_lv2_path(void)
{
#ifndef _WIN32
@@ -400,7 +400,7 @@ test_lv2_path(void)
setenv("LV2_PATH", "~/.lv2:/usr/local/lib/lv2:/usr/lib/lv2", 1);
- LilvWorld* world = lilv_world_new();
+ world = lilv_world_new();
lilv_world_load_all(world);
const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
@@ -414,6 +414,7 @@ test_lv2_path(void)
plugins = lilv_world_get_all_plugins(world);
TEST_ASSERT(lilv_plugins_size(plugins) == n_plugins);
lilv_world_free(world);
+ world = NULL;
if (orig_lv2_path) {
setenv("LV2_PATH", orig_lv2_path, 1);
@@ -427,7 +428,7 @@ test_lv2_path(void)
/*****************************************************************************/
-int
+static int
test_verify(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -451,7 +452,7 @@ test_verify(void)
/*****************************************************************************/
-int
+static int
test_no_verify(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -471,7 +472,7 @@ test_no_verify(void)
/*****************************************************************************/
-int
+static int
test_classes(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -515,7 +516,7 @@ test_classes(void)
/*****************************************************************************/
-int
+static int
test_plugin(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -730,7 +731,7 @@ test_plugin(void)
/*****************************************************************************/
-int
+static int
test_port(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -965,7 +966,7 @@ ui_supported(const char* container_type_uri,
return !strcmp(container_type_uri, ui_type_uri);
}
-int
+static int
test_ui(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -1075,7 +1076,7 @@ uint32_t atom_Float = 0;
float in = 1.0;
float out = 42.0;
-const void*
+static const void*
get_port_value(const char* port_symbol,
void* user_data,
uint32_t* size,
@@ -1097,7 +1098,7 @@ get_port_value(const char* port_symbol,
}
}
-void
+static void
set_port_value(const char* port_symbol,
void* user_data,
const void* value,
@@ -1117,7 +1118,7 @@ set_port_value(const char* port_symbol,
char** uris = NULL;
size_t n_uris = 0;
-LV2_URID
+static LV2_URID
map_uri(LV2_URID_Map_Handle handle,
const char* uri)
{
@@ -1133,7 +1134,7 @@ map_uri(LV2_URID_Map_Handle handle,
return n_uris;
}
-const char*
+static const char*
unmap_uri(LV2_URID_Map_Handle handle,
LV2_URID urid)
{
@@ -1145,19 +1146,20 @@ unmap_uri(LV2_URID_Map_Handle handle,
static char* temp_dir = NULL;
-char*
+static char*
lilv_make_path(LV2_State_Make_Path_Handle handle,
const char* path)
{
return lilv_path_join(temp_dir, path);
}
-int
+static int
test_state(void)
{
+ init_world();
+
uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(LILV_TEST_BUNDLE);
SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
- LilvWorld* world = lilv_world_new();
LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
LilvNode* plugin_uri = lilv_new_uri(world,
"http://example.org/lilv-test-plugin");
@@ -1414,7 +1416,6 @@ test_state(void)
lilv_node_free(plugin_uri);
lilv_node_free(bundle_uri);
- lilv_world_free(world);
free(link_dir);
free(copy_dir);
free(temp_dir);
@@ -1425,7 +1426,7 @@ test_state(void)
/*****************************************************************************/
-int
+static int
test_bad_port_symbol(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -1456,7 +1457,7 @@ test_bad_port_symbol(void)
/*****************************************************************************/
-int
+static int
test_bad_port_index(void)
{
if (!start_bundle(MANIFEST_PREFIXES
@@ -1487,7 +1488,7 @@ test_bad_port_index(void)
/*****************************************************************************/
-int
+static int
test_string(void)
{
char* s = NULL;
@@ -1547,7 +1548,7 @@ static struct TestCase tests[] = {
{ NULL, NULL }
};
-void
+static void
run_tests(void)
{
int i;
diff --git a/test/test_plugin.c b/test/test_plugin.c
index cddb0c4..9f78f4e 100644
--- a/test/test_plugin.c
+++ b/test/test_plugin.c
@@ -351,7 +351,7 @@ restore(LV2_Handle instance,
return LV2_STATE_SUCCESS;
}
-const void*
+static const void*
extension_data(const char* uri)
{
static const LV2_State_Interface state = { save, restore };
diff --git a/utils/lilv-bench.c b/utils/lilv-bench.c
index 44c0a79..432e5fd 100644
--- a/utils/lilv-bench.c
+++ b/utils/lilv-bench.c
@@ -20,23 +20,6 @@
#include "lilv_config.h"
-void
-print_version(void)
-{
- printf("lilv_bench (lilv) " LILV_VERSION "\n");
- printf("Copyright 2011-2011 David Robillard <http://drobilla.net>\n");
- printf("License: <http://www.opensource.org/licenses/isc-license>\n");
- printf("This is free software: you are free to change and redistribute it.\n");
- printf("There is NO WARRANTY, to the extent permitted by law.\n");
-}
-
-void
-print_usage(void)
-{
- printf("Usage: lilv_bench\n");
- printf("Load all discovered LV2 plugins.\n");
-}
-
int
main(int argc, char** argv)
{
diff --git a/utils/lv2info.c b/utils/lv2info.c
index 53ad3d9..3dc7a09 100644
--- a/utils/lv2info.c
+++ b/utils/lv2info.c
@@ -41,7 +41,7 @@ LilvNode* preset_class = NULL;
LilvNode* designation_pred = NULL;
LilvNode* supports_event_pred = NULL;
-void
+static void
print_port(const LilvPlugin* p,
uint32_t index,
float* mins,
@@ -87,10 +87,10 @@ print_port(const LilvPlugin* p,
if (points)
printf("\n\t\tScale Points:\n");
LILV_FOREACH(scale_points, i, points) {
- const LilvScalePoint* p = lilv_scale_points_get(points, i);
+ const LilvScalePoint* point = lilv_scale_points_get(points, i);
printf("\t\t\t%s = \"%s\"\n",
- lilv_node_as_string(lilv_scale_point_get_value(p)),
- lilv_node_as_string(lilv_scale_point_get_label(p)));
+ lilv_node_as_string(lilv_scale_point_get_value(point)),
+ lilv_node_as_string(lilv_scale_point_get_label(point)));
}
lilv_scale_points_free(points);
@@ -140,7 +140,7 @@ print_port(const LilvPlugin* p,
lilv_nodes_free(properties);
}
-void
+static void
print_plugin(LilvWorld* world,
const LilvPlugin* p)
{
@@ -204,9 +204,9 @@ print_plugin(LilvWorld* world,
const char* binary = lilv_node_as_uri(lilv_ui_get_binary_uri(ui));
const LilvNodes* types = lilv_ui_get_classes(ui);
- LILV_FOREACH(nodes, i, types) {
+ LILV_FOREACH(nodes, t, types) {
printf("\t\t\tClass: %s\n",
- lilv_node_as_uri(lilv_nodes_get(types, i)));
+ lilv_node_as_uri(lilv_nodes_get(types, t)));
}
if (binary)
@@ -318,7 +318,7 @@ print_plugin(LilvWorld* world,
free(defaults);
}
-void
+static void
print_version(void)
{
printf(
@@ -329,7 +329,7 @@ print_version(void)
"There is NO WARRANTY, to the extent permitted by law.\n");
}
-void
+static void
print_usage(void)
{
printf(
diff --git a/utils/lv2ls.c b/utils/lv2ls.c
index f77cc28..6f898d5 100644
--- a/utils/lv2ls.c
+++ b/utils/lv2ls.c
@@ -21,7 +21,7 @@
#include "lilv_config.h"
-void
+static void
list_plugins(const LilvPlugins* list, bool show_names)
{
LILV_FOREACH(plugins, i, list) {
@@ -36,7 +36,7 @@ list_plugins(const LilvPlugins* list, bool show_names)
}
}
-void
+static void
print_version(void)
{
printf(
@@ -47,7 +47,7 @@ print_version(void)
"There is NO WARRANTY, to the extent permitted by law.\n");
}
-void
+static void
print_usage(void)
{
printf("Usage: lv2ls [OPTION]...\n");