From fc11a2cabbb7b910e5483239629eca2576a4a072 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 17 Dec 2013 03:14:34 +0000 Subject: Fix more const issues. Require latest LV2 svn for Ingen (fix #945). git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5174 a436a847-0d15-0410-975c-d299462d15a1 --- src/state.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index b2953a4..79b55ec 100644 --- a/src/state.c +++ b/src/state.c @@ -374,7 +374,7 @@ lilv_state_new_from_instance(const LilvPlugin* plugin, // Store properties const LV2_Descriptor* desc = instance->lv2_descriptor; const LV2_State_Interface* iface = (desc->extension_data) - ? (LV2_State_Interface*)desc->extension_data(LV2_STATE__interface) + ? (const LV2_State_Interface*)desc->extension_data(LV2_STATE__interface) : NULL; if (iface) { @@ -413,7 +413,7 @@ lilv_state_restore(const LilvState* state, const LV2_Descriptor* desc = instance ? instance->lv2_descriptor : NULL; const LV2_State_Interface* iface = (desc && desc->extension_data) - ? (LV2_State_Interface*)desc->extension_data(LV2_STATE__interface) + ? (const LV2_State_Interface*)desc->extension_data(LV2_STATE__interface) : NULL; if (iface) { @@ -501,11 +501,12 @@ new_state_from_model(LilvWorld* world, } else if (value) { chunk.len = 0; sratom_read(sratom, &forge, world->world, model, value); - LV2_Atom* atom = (LV2_Atom*)chunk.buf; + const LV2_Atom* atom = (const LV2_Atom*)chunk.buf; append_port_value(state, (const char*)sord_node_get_string(symbol), - LV2_ATOM_BODY(atom), atom->size, atom->type); + LV2_ATOM_BODY_CONST(atom), + atom->size, atom->type); if (label) { lilv_state_set_label(state, @@ -532,15 +533,15 @@ new_state_from_model(LilvWorld* world, &forge, sratom_forge_sink, sratom_forge_deref, &chunk); sratom_read(sratom, &forge, world->world, model, o); - LV2_Atom* atom = (LV2_Atom*)chunk.buf; - uint32_t flags = LV2_STATE_IS_POD|LV2_STATE_IS_PORTABLE; - Property prop = { NULL, 0, 0, 0, flags }; + const LV2_Atom* atom = (const LV2_Atom*)chunk.buf; + uint32_t flags = LV2_STATE_IS_POD|LV2_STATE_IS_PORTABLE; + Property prop = { NULL, 0, 0, 0, flags }; prop.key = map->map(map->handle, (const char*)sord_node_get_string(p)); prop.type = atom->type; prop.size = atom->size; prop.value = malloc(atom->size); - memcpy(prop.value, LV2_ATOM_BODY(atom), atom->size); + memcpy(prop.value, LV2_ATOM_BODY_CONST(atom), atom->size); if (atom->type == forge.Path) { prop.flags = LV2_STATE_IS_PORTABLE; } @@ -713,7 +714,7 @@ add_state_to_manifest(const LilvNode* plugin_uri, const char* state_uri, const char* state_path) { - FILE* fd = fopen((char*)manifest_path, "a"); + FILE* fd = fopen(manifest_path, "a"); if (!fd) { LILV_ERRORF("Failed to open %s (%s)\n", manifest_path, strerror(errno)); -- cgit v1.2.1