diff options
author | David Robillard <d@drobilla.net> | 2013-12-25 03:24:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-25 03:24:33 +0000 |
commit | d8f7e5c92f7e03bfd28cb137ce40536f9f36818f (patch) | |
tree | d938636c7cf27ff5b14d8b7121461f3e59c3ba06 /src | |
parent | 280527ada49e4763707ab861590ec30b5e57c854 (diff) | |
download | jalv-d8f7e5c92f7e03bfd28cb137ce40536f9f36818f.tar.gz jalv-d8f7e5c92f7e03bfd28cb137ce40536f9f36818f.tar.bz2 jalv-d8f7e5c92f7e03bfd28cb137ce40536f9f36818f.zip |
Fix more const-correctness violations.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5196 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv.c | 8 | ||||
-rw-r--r-- | src/jalv_gtk.c | 16 | ||||
-rw-r--r-- | src/worker.c | 4 | ||||
-rw-r--r-- | src/worker.h | 6 |
4 files changed, 18 insertions, 16 deletions
@@ -527,8 +527,8 @@ jack_process_cb(jack_nframes_t nframes, void* data) } else if (ev.protocol == jalv->urids.atom_eventTransfer) { LV2_Evbuf_Iterator e = lv2_evbuf_end(port->evbuf); const LV2_Atom* const atom = (const LV2_Atom*)body; - lv2_evbuf_write(&e, nframes, 0, - atom->type, atom->size, LV2_ATOM_BODY(atom)); + lv2_evbuf_write(&e, nframes, 0, atom->type, atom->size, + LV2_ATOM_BODY_CONST(atom)); } else { fprintf(stderr, "error: Unknown control change protocol %d\n", ev.protocol); @@ -733,7 +733,7 @@ jalv_ui_write(SuilController controller, const LV2_Atom* atom = (const LV2_Atom*)buffer; char* str = sratom_to_turtle( jalv->sratom, &jalv->unmap, "jalv:", NULL, NULL, - atom->type, atom->size, LV2_ATOM_BODY(atom)); + atom->type, atom->size, LV2_ATOM_BODY_CONST(atom)); printf("\n## UI => Plugin (%u bytes) ##\n%s\n", atom->size, str); free(str); } @@ -1111,7 +1111,7 @@ main(int argc, char** argv) && lilv_plugin_has_extension_data(jalv.plugin, jalv.nodes.work_interface)) { jalv_worker_init( &jalv, &jalv.worker, - (LV2_Worker_Interface*)lilv_instance_get_extension_data( + (const LV2_Worker_Interface*)lilv_instance_get_extension_data( jalv.instance, LV2_WORKER__interface)); } diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index e35a9a2..ed7c78b 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -278,7 +278,7 @@ jalv_ui_port_event(Jalv* jalv, if (controller->spin) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(controller->spin), - *(float*)buffer); + *(const float*)buffer); } GtkWidget* widget = controller->control; @@ -291,7 +291,7 @@ jalv_ui_port_event(Jalv* jalv, gtk_tree_model_get_value(model, &i, 0, &value); const double v = g_value_get_double(&value); g_value_unset(&value); - if (fabs(v - *(float*)buffer) < FLT_EPSILON) { + if (fabs(v - *(const float*)buffer) < FLT_EPSILON) { gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget), &i); return; } @@ -299,9 +299,9 @@ jalv_ui_port_event(Jalv* jalv, } } else if (GTK_IS_TOGGLE_BUTTON(widget)) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), - *(float*)buffer > 0.0f); + *(const float*)buffer > 0.0f); } else if (GTK_IS_RANGE(widget)) { - gtk_range_set_value(GTK_RANGE(widget), *(float*)buffer); + gtk_range_set_value(GTK_RANGE(widget), *(const float*)buffer); } else { fprintf(stderr, "Unknown widget type for port %d\n", port_index); } @@ -404,16 +404,16 @@ file_changed(GtkFileChooserButton* widget, static gint dcmp(gconstpointer a, gconstpointer b) { - double y = *(double*)a; - double z = *(double*)b; + double y = *(const double*)a; + double z = *(const double*)b; return y < z ? -1 : z < y ? 1 : 0; } static gint drcmp(gconstpointer a, gconstpointer b) { - double y = *(double*)a; - double z = *(double*)b; + double y = *(const double*)a; + double z = *(const double*)b; return y < z ? 1 : z < y ? -1 : 0; } diff --git a/src/worker.c b/src/worker.c index d958605..cba1e64 100644 --- a/src/worker.c +++ b/src/worker.c @@ -59,7 +59,9 @@ worker_func(void* data) } void -jalv_worker_init(Jalv* jalv, JalvWorker* worker, LV2_Worker_Interface* iface) +jalv_worker_init(Jalv* jalv, + JalvWorker* worker, + const LV2_Worker_Interface* iface) { worker->iface = iface; zix_thread_create(&worker->thread, 4096, worker_func, jalv); diff --git a/src/worker.h b/src/worker.h index f454ce7..3aebdc2 100644 --- a/src/worker.h +++ b/src/worker.h @@ -19,9 +19,9 @@ #include "jalv_internal.h" void -jalv_worker_init(Jalv* jalv, - JalvWorker* worker, - LV2_Worker_Interface* iface); +jalv_worker_init(Jalv* jalv, + JalvWorker* worker, + const LV2_Worker_Interface* iface); void jalv_worker_finish(JalvWorker* worker); |