summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.suppress.cppcheck2
-rw-r--r--NEWS3
-rw-r--r--include/lilv/lilv.h21
-rw-r--r--include/lilv/lilvmm.hpp34
-rw-r--r--src/collections.c54
-rw-r--r--src/node.c6
-rw-r--r--src/plugin.c8
-rw-r--r--src/port.c2
-rw-r--r--src/state.c42
-rw-r--r--src/world.c15
-rw-r--r--test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c2
-rw-r--r--test/missing_descriptor.lv2/test_missing_descriptor.c2
-rw-r--r--test/missing_plugin.lv2/test_missing_plugin.c2
-rw-r--r--test/test_bad_port_index.c4
-rw-r--r--test/test_bad_port_symbol.c4
-rw-r--r--test/test_discovery.c4
-rw-r--r--test/test_no_author.c10
-rw-r--r--test/test_no_verify.c4
-rw-r--r--test/test_plugin.c4
-rw-r--r--test/test_port.c4
-rw-r--r--test/test_project.c4
-rw-r--r--test/test_project_no_author.c10
-rw-r--r--test/test_prototype.c4
-rw-r--r--test/test_state.c10
-rw-r--r--test/test_value.c2
-rw-r--r--test/test_verify.c4
-rw-r--r--test/test_world.c2
-rw-r--r--tools/lv2bench.c4
-rw-r--r--tools/lv2info.c6
29 files changed, 137 insertions, 136 deletions
diff --git a/.suppress.cppcheck b/.suppress.cppcheck
index 773189d..48513d7 100644
--- a/.suppress.cppcheck
+++ b/.suppress.cppcheck
@@ -1,6 +1,4 @@
CastIntegerToAddressAtReturn
-constParameterPointer
-constVariablePointer
knownConditionTrueFalse
memleakOnRealloc
noExplicitConstructor
diff --git a/NEWS b/NEWS
index f9c1640..2a9424a 100644
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,9 @@ lilv (0.24.25) unstable; urgency=medium
* Fix C++ test build on MacOS
* Fix library current_version on MacOS
* Fix test suite when TMPDIR has no trailing slash
+ * Improve const correctness
- -- David Robillard <d@drobilla.net> Sun, 06 Oct 2024 18:20:31 +0000
+ -- David Robillard <d@drobilla.net> Sun, 06 Oct 2024 18:27:31 +0000
lilv (0.24.24) stable; urgency=medium
diff --git a/include/lilv/lilv.h b/include/lilv/lilv.h
index 9f52925..aed4b8a 100644
--- a/include/lilv/lilv.h
+++ b/include/lilv/lilv.h
@@ -407,7 +407,7 @@ lilv_plugin_classes_begin(const LilvPluginClasses* collection);
LILV_API
const LilvPluginClass*
-lilv_plugin_classes_get(const LilvPluginClasses* collection, LilvIter* i);
+lilv_plugin_classes_get(const LilvPluginClasses* collection, const LilvIter* i);
LILV_API
LilvIter*
@@ -415,7 +415,8 @@ lilv_plugin_classes_next(const LilvPluginClasses* collection, LilvIter* i);
LILV_API
bool
-lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i);
+lilv_plugin_classes_is_end(const LilvPluginClasses* collection,
+ const LilvIter* i);
/**
Get a plugin class from `classes` by URI.
@@ -446,7 +447,7 @@ lilv_scale_points_begin(const LilvScalePoints* collection);
LILV_API
const LilvScalePoint*
-lilv_scale_points_get(const LilvScalePoints* collection, LilvIter* i);
+lilv_scale_points_get(const LilvScalePoints* collection, const LilvIter* i);
LILV_API
LilvIter*
@@ -454,7 +455,7 @@ lilv_scale_points_next(const LilvScalePoints* collection, LilvIter* i);
LILV_API
bool
-lilv_scale_points_is_end(const LilvScalePoints* collection, LilvIter* i);
+lilv_scale_points_is_end(const LilvScalePoints* collection, const LilvIter* i);
/* UIs */
@@ -472,7 +473,7 @@ lilv_uis_begin(const LilvUIs* collection);
LILV_API
const LilvUI*
-lilv_uis_get(const LilvUIs* collection, LilvIter* i);
+lilv_uis_get(const LilvUIs* collection, const LilvIter* i);
LILV_API
LilvIter*
@@ -480,7 +481,7 @@ lilv_uis_next(const LilvUIs* collection, LilvIter* i);
LILV_API
bool
-lilv_uis_is_end(const LilvUIs* collection, LilvIter* i);
+lilv_uis_is_end(const LilvUIs* collection, const LilvIter* i);
/**
Get a UI from `uis` by URI.
@@ -510,7 +511,7 @@ lilv_nodes_begin(const LilvNodes* collection);
LILV_API
const LilvNode*
-lilv_nodes_get(const LilvNodes* collection, LilvIter* i);
+lilv_nodes_get(const LilvNodes* collection, const LilvIter* i);
LILV_API
LilvIter*
@@ -518,7 +519,7 @@ lilv_nodes_next(const LilvNodes* collection, LilvIter* i);
LILV_API
bool
-lilv_nodes_is_end(const LilvNodes* collection, LilvIter* i);
+lilv_nodes_is_end(const LilvNodes* collection, const LilvIter* i);
LILV_API
LilvNode*
@@ -550,7 +551,7 @@ lilv_plugins_begin(const LilvPlugins* collection);
LILV_API
const LilvPlugin*
-lilv_plugins_get(const LilvPlugins* collection, LilvIter* i);
+lilv_plugins_get(const LilvPlugins* collection, const LilvIter* i);
LILV_API
LilvIter*
@@ -558,7 +559,7 @@ lilv_plugins_next(const LilvPlugins* collection, LilvIter* i);
LILV_API
bool
-lilv_plugins_is_end(const LilvPlugins* collection, LilvIter* i);
+lilv_plugins_is_end(const LilvPlugins* collection, const LilvIter* i);
/**
Get a plugin from `plugins` by URI.
diff --git a/include/lilv/lilvmm.hpp b/include/lilv/lilvmm.hpp
index 810187f..a798fa5 100644
--- a/include/lilv/lilvmm.hpp
+++ b/include/lilv/lilvmm.hpp
@@ -189,16 +189,16 @@ struct PluginClass {
const LilvPluginClass* me;
};
-#define LILV_WRAP_COLL(CT, ET, prefix) \
- inline CT(const Lilv##CT* c_obj) \
- : me(c_obj) \
- {} \
- LILV_WRAP_CONVERSION(const Lilv##CT) \
- LILV_WRAP0(unsigned, prefix, size) \
- LILV_WRAP1(ET, prefix, get, LilvIter*, i) \
- LILV_WRAP0(LilvIter*, prefix, begin) \
- LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i) \
- LILV_WRAP1(bool, prefix, is_end, LilvIter*, i) \
+#define LILV_WRAP_COLL(CT, ET, prefix) \
+ inline CT(const Lilv##CT* c_obj) \
+ : me(c_obj) \
+ {} \
+ LILV_WRAP_CONVERSION(const Lilv##CT) \
+ LILV_WRAP0(unsigned, prefix, size) \
+ LILV_WRAP1(ET, prefix, get, const LilvIter*, i) \
+ LILV_WRAP0(LilvIter*, prefix, begin) \
+ LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i) \
+ LILV_WRAP1(bool, prefix, is_end, const LilvIter*, i) \
const Lilv##CT* me;
struct PluginClasses {
@@ -254,14 +254,14 @@ struct Port {
#define LILV_PORT_WRAP1(RT, name, T1, a1) \
inline RT name(T1 a1) { return lilv_port_##name(parent, me, a1); }
- LILV_PORT_WRAP1(LilvNodes*, get_value, LilvNode*, predicate)
+ LILV_PORT_WRAP1(LilvNodes*, get_value, const LilvNode*, predicate)
LILV_PORT_WRAP0(LilvNodes*, get_properties)
- LILV_PORT_WRAP1(bool, has_property, LilvNode*, property_uri)
- LILV_PORT_WRAP1(bool, supports_event, LilvNode*, event_uri)
+ LILV_PORT_WRAP1(bool, has_property, const LilvNode*, property_uri)
+ LILV_PORT_WRAP1(bool, supports_event, const LilvNode*, event_uri)
LILV_PORT_WRAP0(const LilvNode*, get_symbol)
LILV_PORT_WRAP0(LilvNode*, get_name)
LILV_PORT_WRAP0(const LilvNodes*, get_classes)
- LILV_PORT_WRAP1(bool, is_a, LilvNode*, port_class)
+ LILV_PORT_WRAP1(bool, is_a, const LilvNode*, port_class)
LILV_PORT_WRAP0(LilvScalePoints*, get_scale_points)
// TODO: get_range (output parameters)
@@ -305,7 +305,7 @@ struct Plugin {
return Port(me, lilv_plugin_get_port_by_index(me, index));
}
- Port get_port_by_symbol(LilvNode* symbol) const
+ Port get_port_by_symbol(const LilvNode* symbol) const
{
return Port(me, lilv_plugin_get_port_by_symbol(me, symbol));
}
@@ -422,9 +422,9 @@ struct World {
return lilv_world_find_nodes(me, subject, predicate, object);
}
- LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvNode*, value)
+ LILV_WRAP2_VOID(world, set_option, const char*, uri, const LilvNode*, value)
LILV_WRAP0_VOID(world, load_all)
- LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri)
+ LILV_WRAP1_VOID(world, load_bundle, const LilvNode*, bundle_uri)
LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class)
LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes)
LILV_WRAP0(Plugins, world, get_all_plugins)
diff --git a/src/collections.c b/src/collections.c
index a7b6923..508f69c 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -167,33 +167,33 @@ lilv_nodes_merge(const LilvNodes* a, const LilvNodes* b)
/* Iterator */
-#define LILV_COLLECTION_IMPL(prefix, CT, ET) \
- \
- unsigned prefix##_size(const CT* collection) \
- { \
- return lilv_collection_size(collection); \
- } \
- \
- LilvIter* prefix##_begin(const CT* collection) \
- { \
- return lilv_collection_begin(collection); \
- } \
- \
- const ET* prefix##_get(const CT* collection, LilvIter* i) \
- { \
- return (ET*)lilv_collection_get(collection, i); \
- } \
- \
- LilvIter* prefix##_next(const CT* collection, LilvIter* i) \
- { \
- (void)collection; \
- return zix_tree_iter_next((ZixTreeIter*)i); \
- } \
- \
- bool prefix##_is_end(const CT* collection, LilvIter* i) \
- { \
- (void)collection; \
- return zix_tree_iter_is_end((ZixTreeIter*)i); \
+#define LILV_COLLECTION_IMPL(prefix, CT, ET) \
+ \
+ unsigned prefix##_size(const CT* collection) \
+ { \
+ return lilv_collection_size(collection); \
+ } \
+ \
+ LilvIter* prefix##_begin(const CT* collection) \
+ { \
+ return lilv_collection_begin(collection); \
+ } \
+ \
+ const ET* prefix##_get(const CT* collection, const LilvIter* i) \
+ { \
+ return (ET*)lilv_collection_get(collection, i); \
+ } \
+ \
+ LilvIter* prefix##_next(const CT* collection, LilvIter* i) \
+ { \
+ (void)collection; \
+ return zix_tree_iter_next((ZixTreeIter*)i); \
+ } \
+ \
+ bool prefix##_is_end(const CT* collection, const LilvIter* i) \
+ { \
+ (void)collection; \
+ return zix_tree_iter_is_end((const ZixTreeIter*)i); \
}
LILV_COLLECTION_IMPL(lilv_plugin_classes, LilvPluginClasses, LilvPluginClass)
diff --git a/src/node.c b/src/node.c
index a10ac86..13c0e77 100644
--- a/src/node.c
+++ b/src/node.c
@@ -97,9 +97,9 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
return NULL;
}
- LilvNode* result = NULL;
- SordNode* datatype_uri = NULL;
- LilvNodeType type = LILV_VALUE_STRING;
+ LilvNode* result = NULL;
+ const SordNode* datatype_uri = NULL;
+ LilvNodeType type = LILV_VALUE_STRING;
switch (sord_node_get_type(node)) {
case SORD_URI:
diff --git a/src/plugin.c b/src/plugin.c
index 46a09e3..bd31920 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -489,7 +489,7 @@ lilv_plugin_get_name(const LilvPlugin* plugin)
LilvNode* ret = NULL;
if (results) {
- LilvNode* val = lilv_nodes_get_first(results);
+ const LilvNode* val = lilv_nodes_get_first(results);
if (lilv_node_is_string(val)) {
ret = lilv_node_duplicate(val);
}
@@ -588,7 +588,7 @@ lilv_plugin_get_num_ports_of_class_va(
// Check each port against every type
for (unsigned i = 0; i < plugin->num_ports; ++i) {
- LilvPort* port = plugin->ports[i];
+ const LilvPort* port = plugin->ports[i];
if (port && lilv_port_is_a(plugin, port, class_1)) {
bool matches = true;
for (size_t j = 0; j < n_classes; ++j) {
@@ -997,7 +997,7 @@ lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type)
LilvNodes* matches = lilv_nodes_new();
LILV_FOREACH (nodes, i, related) {
- LilvNode* node = (LilvNode*)lilv_collection_get((ZixTree*)related, i);
+ const LilvNode* node = (LilvNode*)lilv_collection_get((ZixTree*)related, i);
if (lilv_world_ask_internal(
world, node->node, world->uris.rdf_a, type->node)) {
zix_tree_insert(
@@ -1028,7 +1028,7 @@ new_lv2_env(const SerdNode* base)
}
static void
-maybe_write_prefixes(SerdWriter* writer, SerdEnv* env, FILE* file)
+maybe_write_prefixes(SerdWriter* writer, const SerdEnv* env, FILE* file)
{
fseek(file, 0, SEEK_END);
if (ftell(file) == 0) {
diff --git a/src/port.c b/src/port.c
index 55641e7..8b3a482 100644
--- a/src/port.c
+++ b/src/port.c
@@ -160,7 +160,7 @@ lilv_port_get_name(const LilvPlugin* plugin, const LilvPort* port)
LilvNode* ret = NULL;
if (results) {
- LilvNode* val = lilv_nodes_get_first(results);
+ const LilvNode* val = lilv_nodes_get_first(results);
if (lilv_node_is_string(val)) {
ret = lilv_node_duplicate(val);
}
diff --git a/src/state.c b/src/state.c
index 964691e..35cdb15 100644
--- a/src/state.c
+++ b/src/state.c
@@ -153,13 +153,13 @@ lilv_state_rel2abs(const LilvState* state, const char* path)
}
static void
-append_property(LilvState* state,
- PropertyArray* array,
- uint32_t key,
- const void* value,
- size_t size,
- uint32_t type,
- uint32_t flags)
+append_property(const LilvState* state,
+ PropertyArray* array,
+ uint32_t key,
+ const void* value,
+ size_t size,
+ uint32_t type,
+ uint32_t flags)
{
array->props =
(Property*)realloc(array->props, (++array->n) * sizeof(Property));
@@ -257,7 +257,7 @@ lilv_state_has_path(const char* path, const void* state)
static char*
make_path(LV2_State_Make_Path_Handle handle, const char* path)
{
- LilvState* state = (LilvState*)handle;
+ const LilvState* state = (const LilvState*)handle;
zix_create_directories(NULL, state->dir);
return zix_path_join(NULL, state->dir, path);
@@ -269,7 +269,7 @@ path_is_child(const char* path, const char* dir)
if (path && dir) {
const size_t path_len = strlen(path);
const size_t dir_len = strlen(dir);
- return dir && path_len >= dir_len && !strncmp(path, dir, dir_len);
+ return path_len >= dir_len && !strncmp(path, dir, dir_len);
}
return false;
}
@@ -293,7 +293,7 @@ abstract_path(LV2_State_Map_Path_Handle handle, const char* abs_path)
if (!zix_tree_find(state->abs2rel, &key, &iter)) {
// Already mapped path in a previous call
- PathMap* pm = (PathMap*)zix_tree_get(iter);
+ const PathMap* pm = (const PathMap*)zix_tree_get(iter);
zix_free(NULL, real_path);
return lilv_strdup(pm->rel);
}
@@ -353,8 +353,8 @@ abstract_path(LV2_State_Map_Path_Handle handle, const char* abs_path)
static char*
absolute_path(LV2_State_Map_Path_Handle handle, const char* state_path)
{
- LilvState* state = (LilvState*)handle;
- char* path = NULL;
+ const LilvState* state = (const LilvState*)handle;
+ char* path = NULL;
if (zix_path_is_absolute(state_path)) {
// Absolute path, return identical path
path = lilv_strdup(state_path);
@@ -777,7 +777,7 @@ lilv_state_new_from_file(LilvWorld* world,
serd_reader_read_file(reader, (const uint8_t*)node.buf);
- SordNode* subject_node =
+ const SordNode* subject_node =
(subject) ? subject->node
: sord_node_from_serd_node(world->world, env, &node, NULL, NULL);
@@ -1148,7 +1148,7 @@ lilv_state_write(LilvWorld* world,
serd_writer_write_statement(writer, 0, NULL, &subject, &p, &o, NULL, NULL);
}
- SerdEnv* env = serd_writer_get_env(writer);
+ const SerdEnv* env = serd_writer_get_env(writer);
const SerdNode* base = serd_env_get_base_uri(env, NULL);
Sratom* sratom = sratom_new(map);
@@ -1166,7 +1166,7 @@ lilv_state_write(LilvWorld* world,
// Write port values
sratom_set_pretty_numbers(sratom, true); // Use pretty numbers
for (uint32_t i = 0; i < state->n_values; ++i) {
- PortValue* const value = &state->values[i];
+ const PortValue* const value = &state->values[i];
const SerdNode port =
serd_node_from_string(SERD_BLANK, USTR(value->symbol));
@@ -1399,7 +1399,7 @@ lilv_state_delete(LilvWorld* world, const LilvState* state)
}
if (state->uri) {
- SordNode* file =
+ const SordNode* file =
sord_get(model, state->uri->node, world->uris.rdfs_seeAlso, NULL, NULL);
if (file) {
// Remove state file
@@ -1472,7 +1472,7 @@ lilv_state_delete(LilvWorld* world, const LilvState* state)
}
static void
-free_property_array(LilvState* state, PropertyArray* array)
+free_property_array(const LilvState* state, PropertyArray* array)
{
for (uint32_t i = 0; i < array->n; ++i) {
Property* prop = &array->props[i];
@@ -1518,8 +1518,8 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
}
for (uint32_t i = 0; i < a->n_values; ++i) {
- PortValue* const av = &a->values[i];
- PortValue* const bv = &b->values[i];
+ const PortValue* const av = &a->values[i];
+ const PortValue* const bv = &b->values[i];
if (av->atom->size != bv->atom->size || av->atom->type != bv->atom->type ||
!!strcmp(av->symbol, bv->symbol) ||
!!memcmp(av->atom + 1, bv->atom + 1, av->atom->size)) {
@@ -1528,8 +1528,8 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
}
for (uint32_t i = 0; i < a->props.n; ++i) {
- Property* const ap = &a->props.props[i];
- Property* const bp = &b->props.props[i];
+ const Property* const ap = &a->props.props[i];
+ const Property* const bp = &b->props.props[i];
if (ap->key != bp->key || ap->type != bp->type || ap->flags != bp->flags) {
return false;
}
diff --git a/src/world.c b/src/world.c
index b6bdf85..d4d7f8b 100644
--- a/src/world.c
+++ b/src/world.c
@@ -391,7 +391,7 @@ lilv_collection_find_by_uri(const ZixTree* seq, const LilvNode* uri)
struct LilvHeader*
lilv_collection_get_by_uri(const ZixTree* seq, const LilvNode* uri)
{
- ZixTreeIter* const i = lilv_collection_find_by_uri(seq, uri);
+ const ZixTreeIter* const i = lilv_collection_find_by_uri(seq, uri);
return i ? (struct LilvHeader*)zix_tree_get(i) : NULL;
}
@@ -688,10 +688,10 @@ load_plugin_model(LilvWorld* world,
const LilvNode* plugin_uri)
{
// Create model and reader for loading into it
- SordNode* bundle_node = bundle_uri->node;
- SordModel* model = sord_new(world->world, SORD_SPO | SORD_OPS, false);
- SerdEnv* env = serd_env_new(sord_node_to_serd_node(bundle_node));
- SerdReader* reader = sord_new_reader(model, env, SERD_TURTLE, NULL);
+ const SordNode* bundle_node = bundle_uri->node;
+ SordModel* model = sord_new(world->world, SORD_SPO | SORD_OPS, false);
+ SerdEnv* env = serd_env_new(sord_node_to_serd_node(bundle_node));
+ SerdReader* reader = sord_new_reader(model, env, SERD_TURTLE, NULL);
// Load manifest
LilvNode* manifest_uri = lilv_world_get_manifest_uri(world, bundle_uri);
@@ -723,7 +723,7 @@ load_plugin_model(LilvWorld* world,
}
static LilvVersion
-get_version(LilvWorld* world, SordModel* model, const LilvNode* subject)
+get_version(const LilvWorld* world, SordModel* model, const LilvNode* subject)
{
const SordNode* minor_node =
sord_get(model, subject->node, world->uris.lv2_minorVersion, NULL, NULL);
@@ -1014,7 +1014,8 @@ lilv_world_load_specifications(LilvWorld* world)
{
for (LilvSpec* spec = world->specs; spec; spec = spec->next) {
LILV_FOREACH (nodes, f, spec->data_uris) {
- LilvNode* file = (LilvNode*)lilv_collection_get(spec->data_uris, f);
+ const LilvNode* file =
+ (const LilvNode*)lilv_collection_get(spec->data_uris, f);
lilv_world_load_graph(world, NULL, file);
}
}
diff --git a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
index 9a9641b..f4fb879 100644
--- a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
+++ b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
@@ -31,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c
index b737048..c76779d 100644
--- a/test/missing_descriptor.lv2/test_missing_descriptor.c
+++ b/test/missing_descriptor.lv2/test_missing_descriptor.c
@@ -31,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c
index 6eb1705..dfa9158 100644
--- a/test/missing_plugin.lv2/test_missing_plugin.c
+++ b/test/missing_plugin.lv2/test_missing_plugin.c
@@ -31,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/test_bad_port_index.c b/test/test_bad_port_index.c
index 99bdfc6..c8eeb21 100644
--- a/test/test_bad_port_index.c
+++ b/test/test_bad_port_index.c
@@ -25,8 +25,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "bad_port_index.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
diff --git a/test/test_bad_port_symbol.c b/test/test_bad_port_symbol.c
index 2422e15..31fe1c6 100644
--- a/test/test_bad_port_symbol.c
+++ b/test/test_bad_port_symbol.c
@@ -25,8 +25,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "bad_port_symbol.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
diff --git a/test/test_discovery.c b/test/test_discovery.c
index 7d38207..35cdef6 100644
--- a/test/test_discovery.c
+++ b/test/test_discovery.c
@@ -43,8 +43,8 @@ discovery_verify_plugin(const LilvTestEnv* env, const LilvPlugin* plugin)
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "discovery.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_no_author.c b/test/test_no_author.c
index 396ae9e..1a2b8dd 100644
--- a/test/test_no_author.c
+++ b/test/test_no_author.c
@@ -47,8 +47,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "no_author.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
@@ -61,13 +61,13 @@ main(void)
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri);
assert(plug);
- LilvNode* author_name = lilv_plugin_get_author_name(plug);
+ const LilvNode* author_name = lilv_plugin_get_author_name(plug);
assert(!author_name);
- LilvNode* author_email = lilv_plugin_get_author_email(plug);
+ const LilvNode* author_email = lilv_plugin_get_author_email(plug);
assert(!author_email);
- LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
+ const LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
assert(!author_homepage);
delete_bundle(env);
diff --git a/test/test_no_verify.c b/test/test_no_verify.c
index 66f81e9..7d28314 100644
--- a/test/test_no_verify.c
+++ b/test/test_no_verify.c
@@ -14,8 +14,8 @@ static const char* const plugin_ttl = ":plug a lv2:Plugin .\n";
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "no_verify.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_plugin.c b/test/test_plugin.c
index e2b9b53..32e356b 100644
--- a/test/test_plugin.c
+++ b/test/test_plugin.c
@@ -101,7 +101,7 @@ main(void)
const LilvNodes* data_uris = lilv_plugin_get_data_uris(plug);
assert(lilv_nodes_size(data_uris) == 2);
- LilvNode* project = lilv_plugin_get_project(plug);
+ const LilvNode* project = lilv_plugin_get_project(plug);
assert(!project);
char* manifest_uri =
@@ -218,7 +218,7 @@ main(void)
LilvNode* blank_p = lilv_new_uri(world, "http://example.org/blank");
LilvNodes* blanks = lilv_plugin_get_value(plug, blank_p);
assert(lilv_nodes_size(blanks) == 1);
- LilvNode* blank = lilv_nodes_get_first(blanks);
+ const LilvNode* blank = lilv_nodes_get_first(blanks);
assert(lilv_node_is_blank(blank));
const char* blank_str = lilv_node_as_blank(blank);
char* blank_tok = lilv_node_get_turtle_token(blank);
diff --git a/test/test_port.c b/test/test_port.c
index e05dcde..5991189 100644
--- a/test/test_port.c
+++ b/test/test_port.c
@@ -92,8 +92,8 @@ main(void)
lilv_node_free(nopsym);
// Try getting an invalid property
- LilvNode* num = lilv_new_int(world, 1);
- LilvNodes* nothing = lilv_port_get_value(plug, p, num);
+ LilvNode* num = lilv_new_int(world, 1);
+ const LilvNodes* nothing = lilv_port_get_value(plug, p, num);
assert(!nothing);
lilv_node_free(num);
diff --git a/test/test_project.c b/test/test_project.c
index cfce35a..d37d9a1 100644
--- a/test/test_project.c
+++ b/test/test_project.c
@@ -53,8 +53,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "project.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_project_no_author.c b/test/test_project_no_author.c
index 5b0e57d..3426e72 100644
--- a/test/test_project_no_author.c
+++ b/test/test_project_no_author.c
@@ -47,8 +47,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "project_no_author.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
@@ -62,13 +62,13 @@ main(void)
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri);
assert(plug);
- LilvNode* author_name = lilv_plugin_get_author_name(plug);
+ const LilvNode* author_name = lilv_plugin_get_author_name(plug);
assert(!author_name);
- LilvNode* author_email = lilv_plugin_get_author_email(plug);
+ const LilvNode* author_email = lilv_plugin_get_author_email(plug);
assert(!author_email);
- LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
+ const LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
assert(!author_homepage);
delete_bundle(env);
diff --git a/test/test_prototype.c b/test/test_prototype.c
index 4e17a63..8ffd6e4 100644
--- a/test/test_prototype.c
+++ b/test/test_prototype.c
@@ -60,8 +60,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "prototype.lv2", manifest_ttl, plugin_ttl)) {
return 1;
diff --git a/test/test_state.c b/test/test_state.c
index 67325d2..bc310eb 100644
--- a/test/test_state.c
+++ b/test/test_state.c
@@ -235,7 +235,7 @@ set_port_value(const char* port_symbol,
static char*
make_scratch_path(LV2_State_Make_Path_Handle handle, const char* path)
{
- TestDirectories* dirs = (TestDirectories*)handle;
+ const TestDirectories* dirs = (TestDirectories*)handle;
return zix_path_join(NULL, dirs->scratch, path);
}
@@ -1010,12 +1010,12 @@ test_bad_subject(void)
TestContext* const ctx = test_context_new();
LilvNode* const string = lilv_new_string(ctx->env->world, "Not a URI");
- LilvState* const file_state = lilv_state_new_from_file(
+ const LilvState* const file_state = lilv_state_new_from_file(
ctx->env->world, &ctx->map, string, "/I/do/not/matter");
assert(!file_state);
- LilvState* const world_state =
+ const LilvState* const world_state =
lilv_state_new_from_world(ctx->env->world, &ctx->map, string);
assert(!world_state);
@@ -1027,8 +1027,8 @@ test_bad_subject(void)
static void
test_missing_path(void)
{
- TestContext* const ctx = test_context_new();
- LilvState* const state = lilv_state_new_from_file(
+ TestContext* const ctx = test_context_new();
+ const LilvState* const state = lilv_state_new_from_file(
ctx->env->world, &ctx->map, NULL, "/does/not/exist");
assert(!state);
diff --git a/test/test_value.c b/test/test_value.c
index a37c886..3314701 100644
--- a/test/test_value.c
+++ b/test/test_value.c
@@ -133,7 +133,7 @@ main(void)
assert(!lilv_node_equals(ival, ifval));
lilv_node_free(ifval);
- LilvNode* nil = NULL;
+ const LilvNode* nil = NULL;
assert(!lilv_node_equals(uval, nil));
assert(!lilv_node_equals(nil, uval));
assert(lilv_node_equals(nil, nil));
diff --git a/test/test_verify.c b/test/test_verify.c
index e066751..3a2031b 100644
--- a/test/test_verify.c
+++ b/test/test_verify.c
@@ -23,8 +23,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "verify.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_world.c b/test/test_world.c
index fda8595..269e95f 100644
--- a/test/test_world.c
+++ b/test/test_world.c
@@ -19,7 +19,7 @@ main(void)
LilvNode* num = lilv_new_int(env->world, 4);
LilvNode* uri = lilv_new_uri(env->world, "http://example.org/object");
- LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL);
+ const LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL);
assert(!matches);
matches = lilv_world_find_nodes(world, NULL, num, NULL);
diff --git a/tools/lv2bench.c b/tools/lv2bench.c
index aeb86a0..461d088 100644
--- a/tools/lv2bench.c
+++ b/tools/lv2bench.c
@@ -82,8 +82,8 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
LV2_Atom_Sequence* seq_out =
(LV2_Atom_Sequence*)malloc(sizeof(LV2_Atom_Sequence) + atom_capacity);
- const char* uri = lilv_node_as_string(lilv_plugin_get_uri(p));
- LilvNodes* required = lilv_plugin_get_required_features(p);
+ const char* uri = lilv_node_as_string(lilv_plugin_get_uri(p));
+ const LilvNodes* required = lilv_plugin_get_required_features(p);
LILV_FOREACH (nodes, i, required) {
const LilvNode* feature = lilv_nodes_get(required, i);
if (!lilv_node_equals(feature, urid_map)) {
diff --git a/tools/lv2info.c b/tools/lv2info.c
index 55acd09..e40edee 100644
--- a/tools/lv2info.c
+++ b/tools/lv2info.c
@@ -28,9 +28,9 @@ static LilvNode* supports_event_pred = NULL;
static void
print_port(const LilvPlugin* p,
uint32_t index,
- float* mins,
- float* maxes,
- float* defaults)
+ const float* mins,
+ const float* maxes,
+ const float* defaults)
{
const LilvPort* port = lilv_plugin_get_port_by_index(p, index);